initNotifyService method

void initNotifyService(
  1. AtClientPreference atClientPreference,
  2. String currentAtSignFromApp,
  3. String rootDomainFromApp,
  4. int rootPortFromApp,
)

Initialise function to set the client preference, atsign and root domain

Implementation

void initNotifyService(
    AtClientPreference atClientPreference,
    String currentAtSignFromApp,
    String rootDomainFromApp,
    int rootPortFromApp) async {
  currentAtSign = currentAtSignFromApp;
  rootDomain = rootDomainFromApp;
  rootPort = rootPortFromApp;
  atClientManager = AtClientManager.getInstance();
  AtClientManager.getInstance().setCurrentAtSign(
      currentAtSignFromApp, atClientPreference.namespace, atClientPreference);
  atClient = AtClientManager.getInstance().atClient;
  _notificationsPlugin = FlutterLocalNotificationsPlugin();

  atClientManager.atClient.notificationService
      .subscribe(
          regex: '.${atClientPreference.namespace}', shouldDecrypt: true)
      .listen((AtNotification notification) {
    _notificationCallback(notification);
  });

  if (Platform.isIOS) {
    _requestIOSPermission();
  }
  await initializePlatformSpecifics();
}