zego-zim-react-native
Version:
Zego ZIM SDK for React Native
90 lines (89 loc) • 5.36 kB
JavaScript
export class ZIM {
/**
* Gets the SDK's version number.
*
* Available since: 1.1.0.
* Description: Get the SDK version.
* Use cases:
* 1. When the SDK is running, the developer finds that it does not match the expected situation and submits the problem and related logs to the ZEGO technical staff for locating. The ZEGO technical staff may need the information of the engine version to assist in locating the problem.
* 2. Developers can also collect this information as the version information of the engine used by the app, so that the SDK corresponding to each version of the app on the line.
* When to call: It can be called at any time.
*/
static getVersion() {
return Promise.resolve('');
}
/**
* Create a ZIM instance.
*
* Available since: 2.3.0 and above.
* Description: Create a ZIM instance for subsequent calls to other member functions.
* When to call: Before calling other member functions, you must call this API to create a ZIM example.
* Restrictions: Currently only one instance is supported, repeated calls will return [null].
* Caution:
* 1. Currently, the [create] function can only create one instance at most. If it is called multiple times, only the first one will return a valid instance, and the rest will be [null]. The developer should save the ZIM instance by himself, and ensure that the life cycle of the instance is available in the process of using the ZIM business function; or after calling [create], he can use [getInstance] to obtain its singleton object and call other member functions.
* 2. If you use this function to create an instance, you must pass in both AppID and AppSign (exclude Web platform).
* Scope of impact: Failure to call this function will prevent other member functions from being called.
* Platform differences: When calling this function on the Android platform, in addition to the appID, the Application class object must also be passed in.
*
* @param appConfig ZIMAppConfig
*/
static create(appConfig) {
return null;
}
/**
* Get the ZIM singleton object.
*
* Available since: 2.3.0 and above.
* Description: Get the ZIM singleton object for subsequent calls to other member functions.
* When to call: You must call [create] to create an instance before calling this function to obtain a singleton object, otherwise it will return [null].
* Related APIs: [create].
*/
static getInstance() {
return null;
}
/**
* Set ZIM advanced configuration.
*
* When you need to customize the set advanced configurations, you need to call this function.
* It must be set before calling [create] to take effect. If it is set after [create], it will take effect at the next [create].
*
* @param key Configuration Key
* @param value Configuration value
*/
static setAdvancedConfig(key, value) { }
/**
* Set geofence-related configurations.
*
* Available since: 2.12.0 and above.
* Description: Geofencing means that instant messaging data transmission is limited to a certain area to meet regional data privacy and security regulations, that is, to restrict access to communication services in a specific area.
* When to call: The [setGeofencingConfig] interface needs to be called before the [create] interface.
* Restrictions: If you need to use this function, please contact ZEGO technical support.
* Caution: If you need to update geo fencing information, please call the [destroy] interface to destroy the current ZIM instance, and then call this interface.
*
* @param areaList Geofencing area list
* @param type Geofencing type
*/
static setGeofencingConfig(areaList, type) {
return Promise.resolve(false);
}
/**
* Set log related configuration.
*
* Available since: 1.1.0 and above.
* Description: Set log related configuration, including log path and log size. Since there is a default log path inside the SDK, unless the developer has a strong need to customize the log path, it is generally not recommended that customers set it by themselves.
* Default value:
* Android: /storage/Android/data/[packageName]/files/ZIMLogs
* iOS: ~/Library/Caches/ZIMLogs
* macOS: (sandbox) ~/Library/Containers/[Bundle ID]/Data/Library/Caches/ZIMLogs /; (non-sandbox) ~/Library/Caches/ZIMLogs
* Windows: C:/Users/[Your UserName]/AppData/[App Name]ZEGO.SDK/ZIMLogs
* When to call: It must be called before [create].
* Caution: If the developer calls after [create], the SDK will save this configuration until the next time [create] takes effect.
* Life cycle: Set before calling [create], and take effect when calling [create]. If the developer does not set a new log configuration in the next [create], the previous configuration will still take effect.
* Platform differences: The default path of different platforms is different, please refer to the default value.
* Related APIs: For details, please refer to https://doc-zh.zego.im/faq/IM_sdkLog?product=IM&platform=all.
*
* @param config Custom log configuration
*/
static setLogConfig(config) { }
static setCacheConfig(config) { }
}