registerSubscriber static method

Future<void> registerSubscriber(
  1. String? registration
)

Implementation

static Future<void> registerSubscriber(String? registration) async {
  final registerSubscriberRequest = RegisterSubscriberRequest(
    appInstalledIn: DateTime.now(),
    appToken: InngageProperties.appToken,
    appUpdatedIn: DateTime.now(),
    customField: InngageProperties.customFields,
    appVersion: await InngageUtils.getVersionApp(),
    deviceModel: await InngageUtils.getDeviceModel(),
    sdk: '2.0.9',
    phoneNumber: InngageProperties.phoneNumber,
    email: InngageProperties.email,
    deviceManufacturer: await InngageUtils.getDeviceManufacturer(),
    identifier: InngageProperties.identifier,
    osLanguage: (await Devicelocale.preferredLanguages)!.isNotEmpty
        ? (await Devicelocale.preferredLanguages)![0]
        : "",
    osLocale: await Devicelocale.currentLocale,
    osVersion: await InngageUtils.getDeviceOS(),
    registration: registration,
    uuid: await InngageUtils.getUniqueId(),
    platform: Platform.isAndroid ? 'Android' : 'iOS',
    advertiserId: await InngageUtils.getAdvertisingId(),
    idfa: await InngageUtils.getAdvertisingId(),
    lat: InngageProperties.latitude,
    long: InngageProperties.longitude,
  );

  //make request subscription to inngage backend
  await InngageProperties.inngageNetwork.subscription(
    subscription: SubscriptionRequest(
      registerSubscriberRequest: registerSubscriberRequest,
    ),
  );
}