registerWhenReceiveNotif static method

Future<void> registerWhenReceiveNotif()

Implementation

static Future<void> registerWhenReceiveNotif() async {
  final SharedPreferences prefs = await SharedPreferences.getInstance();
  final String? sipInfoData = prefs.getString("SIP_INFO_DATA");
  final String? pnPushParams = prefs.getString("PN_PUSH_PARAMS");

  final SipInfoData? sipInfoDataDecode = sipInfoData != null
      ? SipInfoData.fromJson(jsonDecode(sipInfoData))
      : null;
  final PnPushParams? pnPushParamsDecode = pnPushParams != null
      ? PnPushParams.fromJson(jsonDecode(pnPushParams))
      : null;

  if (sipInfoDataDecode != null && pnPushParamsDecode != null) {
    final pitelClient = PitelClient.getInstance();
    pitelClient.setExtensionInfo(sipInfoDataDecode.toGetExtensionResponse());
    pitelClient.registerSipWithoutFCM(pnPushParamsDecode);
  }
}