setAppInfoForChannel static method

Future<void> setAppInfoForChannel(
  1. MethodChannel _channel,
  2. PushAppInfo appInfo
)

Set appinfo for each channel manualy

Implementation

static Future<void> setAppInfoForChannel(MethodChannel _channel, PushAppInfo appInfo) async {
  if(await _channel.invokeMethod("isOppoRom") && appInfo.oppo_app_key != null && appInfo.oppo_app_secret != null){
    await _channel.invokeMethod("setOppoPushAppId", {
      "appId": appInfo.oppo_app_key!,
    });
    await _channel.invokeMethod("setOppoPushAppKey", {
      "appKey": appInfo.oppo_app_secret!,
    });
    return;
  }else if(await _channel.invokeMethod("isMiuiRom") && appInfo.mi_app_id != null && appInfo.mi_app_key != null){
    print("TUIKitPush | init | setMiPushAppId");
    await _channel.invokeMethod("setMiPushAppId", {
      "appId": appInfo.mi_app_id!,
    });
    print("TUIKitPush | init | setMiPushAppKey");
    await _channel.invokeMethod("setMiPushAppKey", {
      "appKey": appInfo.mi_app_key!,
    });
    return;
  }else if(await _channel.invokeMethod("isMeizuRom") && appInfo.mz_app_id != null && appInfo.mz_app_key != null){
    await _channel.invokeMethod("setMzPushAppId", {
      "appId": appInfo.mz_app_id!,
    });
    await _channel.invokeMethod("setMzPushAppKey", {
      "appKey": appInfo.mz_app_key!,
    });
    return;
  }
}