From 66d0311f8e24ac7e0243b57f8f358b3914695958 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 19 Oct 2022 16:34:49 -0400 Subject: [PATCH 001/196] [User Model] notification_types and model event rework * Update `ISingletonModelStore.get()` function to be `ISingletonModelStore.model` property * Rework the model store change event system to always fire, using tags to differentiate why changes occurred. * Add `SubscriptionModel.status` to capture the subscription status, for when retrieving push token fails for some reason. * Drive event callback when app killed during request notification permission activity. --- .../onesignal/core/internal/OneSignalImp.kt | 19 +++--- .../backend/ISubscriptionBackendService.kt | 6 +- .../impl/SubscriptionBackendService.kt | 4 +- .../backend/impl/UserBackendService.kt | 3 +- .../core/internal/common/AndroidUtils.kt | 30 +++++++++ .../core/internal/device/IDeviceService.kt | 7 ++ .../internal/device/impl/DeviceService.kt | 27 ++++++++ .../core/internal/http/impl/HttpClient.kt | 2 +- .../influence/impl/InfluenceDataRepository.kt | 14 ++-- .../internal/language/impl/LanguageContext.kt | 4 +- .../listeners/ConfigModelStoreListener.kt | 26 +++++--- .../listeners/IdentityModelStoreListener.kt | 4 +- .../internal/listeners/ModelStoreListener.kt | 22 +++++-- .../listeners/PropertiesModelStoreListener.kt | 6 +- .../internal/listeners/SessionListener.kt | 4 +- .../listeners/SingletonModelStoreListener.kt | 16 ++++- .../SubscriptionModelStoreListener.kt | 6 +- .../internal/modeling/IModelChangedHandler.kt | 3 +- .../core/internal/modeling/IModelStore.kt | 39 ++++++++--- .../modeling/IModelStoreChangeHandler.kt | 15 ++--- .../internal/modeling/ISingletonModelStore.kt | 10 ++- .../ISingletonModelStoreChangeHandler.kt | 12 ++-- .../core/internal/modeling/MapModel.kt | 4 +- .../onesignal/core/internal/modeling/Model.kt | 26 ++++---- .../core/internal/modeling/ModelStore.kt | 46 +++++++------ .../internal/modeling/SingletonModelStore.kt | 46 ++++++------- .../core/internal/models/SubscriptionModel.kt | 31 +++++++++ .../operations/CreateSubscriptionOperation.kt | 10 ++- .../operations/UpdateSubscriptionOperation.kt | 10 ++- .../impl/SubscriptionOperationExecutor.kt | 14 ++-- .../operations/impl/UserOperationExecutor.kt | 18 +++--- .../outcomes/impl/OutcomeEventsController.kt | 4 +- .../preferences/PreferencesService.kt | 18 ++++-- .../internal/purchases/TrackAmazonPurchase.kt | 2 +- .../internal/purchases/TrackGooglePurchase.kt | 2 +- .../internal/session/impl/SessionService.kt | 4 +- .../core/internal/user/SubscriptionManager.kt | 39 +++++------ .../core/internal/user/UserManager.kt | 4 +- .../com/onesignal/iam/internal/IAMManager.kt | 40 ++++++------ .../internal/display/impl/InAppDisplayer.kt | 4 +- .../triggers/impl/TriggerController.kt | 8 ++- .../location/internal/LocationManager.kt | 23 ++++--- .../internal/capture/impl/LocationCapturer.kt | 2 +- .../LocationPermissionController.kt | 20 +++++- .../internal/NotificationsManager.kt | 51 ++++++--------- .../data/impl/NotificationQueryHelper.kt | 2 +- .../impl/NotificationGenerationProcessor.kt | 2 +- .../listeners/ConfigModelStoreListener.kt | 12 +++- .../listeners/NotificationListener.kt | 2 +- .../internal/listeners/PushTokenListener.kt | 9 +-- .../open/impl/NotificationOpenedProcessor.kt | 2 +- .../INotificationPermissionController.kt | 8 ++- .../impl/NotificationPermissionController.kt | 18 +++++- .../internal/pushtoken/IPushTokenManager.kt | 5 +- .../internal/pushtoken/PushTokenManager.kt | 64 ++++++++++++------- .../impl/ReceiveReceiptWorkManager.kt | 4 +- .../impl/GooglePlayServicesUpgradePrompt.kt | 2 +- .../impl/PushRegistratorAbstractGoogle.kt | 9 ++- .../registration/impl/PushRegistratorFCM.kt | 2 +- .../impl/NotificationSummaryManager.kt | 2 +- 60 files changed, 532 insertions(+), 316 deletions(-) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt index 3b4e0332a3..ecabdca169 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt @@ -11,6 +11,7 @@ import com.onesignal.core.internal.common.IDManager import com.onesignal.core.internal.common.OneSignalUtils import com.onesignal.core.internal.debug.DebugManager import com.onesignal.core.internal.logging.Logging +import com.onesignal.core.internal.modeling.ModelChangeTags import com.onesignal.core.internal.models.ConfigModel import com.onesignal.core.internal.models.ConfigModelStore import com.onesignal.core.internal.models.IdentityModel @@ -69,7 +70,7 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { // check again now that we are synchronized. if (!_hasCreatedBackendUser) { // Create the new user in the backend as an operation - _operationRepo!!.enqueue(CreateUserOperation(_configModel!!.appId, _identityModelStore!!.get().onesignalId, _identityModelStore!!.get().externalId)) + _operationRepo!!.enqueue(CreateUserOperation(_configModel!!.appId, _identityModelStore!!.model.onesignalId, _identityModelStore!!.model.externalId)) _hasCreatedBackendUser = true } } @@ -122,8 +123,8 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { (_services.getService() as ApplicationService).start(context) // get the current config model, if there is one - _configModel = _services.getService().get() - _sessionModel = _services.getService().get() + _configModel = _services.getService().model + _sessionModel = _services.getService().model // if the app id was specified as input, update the config model with it if (appId != null) { @@ -154,8 +155,8 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { _startupService = _services.getService() _startupService!!.bootstrap() - if (_identityModelStore!!.get().hasProperty(IdentityConstants.ONESIGNAL_ID)) { - Logging.debug("initWithContext: using cached user ${_identityModelStore!!.get().onesignalId}") + if (_identityModelStore!!.model.hasProperty(IdentityConstants.ONESIGNAL_ID)) { + Logging.debug("initWithContext: using cached user ${_identityModelStore!!.model.onesignalId}") _hasCreatedBackendUser = true } else { createAndSwitchToNewUser() @@ -185,7 +186,7 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { // TODO: Set JWT Token for all future requests. // Create the new user in the backend as an operation - _operationRepo!!.execute(CreateUserOperation(_configModel!!.appId, _identityModelStore!!.get().onesignalId, _identityModelStore!!.get().externalId)) + _operationRepo!!.execute(CreateUserOperation(_configModel!!.appId, _identityModelStore!!.model.onesignalId, _identityModelStore!!.model.externalId)) } override fun logout() { @@ -238,10 +239,10 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { subscriptions.add(newPushSubscription) // The next 4 lines makes this user the effective user locally. We clear the subscriptions - // first without firing the event because we don't want to drive deleting the cleared subscriptions + // first as an internal change because we don't want to drive deleting the cleared subscriptions // on the backend. Once cleared we can then setup the new identity/properties model, and add - // the new user's subscriptions. - _subscriptionModelStore!!.clear(fireEvent = false) + // the new user's subscriptions as a "normal" change, which will drive changes to the backend. + _subscriptionModelStore!!.clear(ModelChangeTags.NO_PROPOGATE) _identityModelStore!!.replace(identityModel) _propertiesModelStore!!.replace(propertiesModel) _subscriptionModelStore!!.replaceAll(subscriptions) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/ISubscriptionBackendService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/ISubscriptionBackendService.kt index d8de59a90f..8fed5fac49 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/ISubscriptionBackendService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/ISubscriptionBackendService.kt @@ -13,10 +13,11 @@ internal interface ISubscriptionBackendService { * @param type The type of subscription to create. * @param enabled Whether this subscription is enabled. * @param address The subscription address. + * @param status The subscription status. * * @return The ID of the subscription created. */ - suspend fun createSubscription(appId: String, aliasLabel: String, aliasValue: String, type: SubscriptionObjectType, enabled: Boolean, address: String): String + suspend fun createSubscription(appId: String, aliasLabel: String, aliasValue: String, type: SubscriptionObjectType, enabled: Boolean, address: String, status: Int): String /** * Update an existing subscription with the properties provided. @@ -25,8 +26,9 @@ internal interface ISubscriptionBackendService { * @param subscriptionId The ID of the subscription to update. * @param enabled Whether this subscription is enabled. * @param address The subscription address. + * @param status The subscription status. */ - suspend fun updateSubscription(appId: String, subscriptionId: String, enabled: Boolean, address: String) + suspend fun updateSubscription(appId: String, subscriptionId: String, enabled: Boolean, address: String, status: Int) /** * Delete an existing subscription. diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/impl/SubscriptionBackendService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/impl/SubscriptionBackendService.kt index f14db4bd38..192ec2281f 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/impl/SubscriptionBackendService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/impl/SubscriptionBackendService.kt @@ -23,7 +23,7 @@ internal class SubscriptionBackendService( private val _http: IHttpClient ) : ISubscriptionBackendService { - override suspend fun createSubscription(appId: String, aliasLabel: String, aliasValue: String, type: SubscriptionObjectType, enabled: Boolean, address: String): String { + override suspend fun createSubscription(appId: String, aliasLabel: String, aliasValue: String, type: SubscriptionObjectType, enabled: Boolean, address: String, status: Int): String { // TODO: To Implement, temporarily using players endpoint when PUSH if (type == SubscriptionObjectType.SMS || type == SubscriptionObjectType.EMAIL) { return UUID.randomUUID().toString() @@ -70,7 +70,7 @@ internal class SubscriptionBackendService( return responseJSON.getString("id") } - override suspend fun updateSubscription(appId: String, subscriptionId: String, enabled: Boolean, address: String) { + override suspend fun updateSubscription(appId: String, subscriptionId: String, enabled: Boolean, address: String, status: Int) { // TODO: To Implement } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/impl/UserBackendService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/impl/UserBackendService.kt index 8ab7042dc4..ab605b5582 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/impl/UserBackendService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/impl/UserBackendService.kt @@ -7,6 +7,7 @@ import com.onesignal.core.internal.backend.IdentityConstants import com.onesignal.core.internal.backend.PropertiesDeltasObject import com.onesignal.core.internal.backend.PropertiesObject import com.onesignal.core.internal.backend.SubscriptionObject +import com.onesignal.core.internal.models.SubscriptionModel import org.json.JSONArray import org.json.JSONObject import java.util.* @@ -34,7 +35,7 @@ internal class UserBackendService( // TODO: Temporarily using players endpoint via subscription backend to register the subscription, so we can drive push/IAMs. val subscriptionIDs = mutableListOf() for (subscription in subscriptions) { - val subscriptionId = _subscriptionBackend.createSubscription(appId, "", "", subscription.type, subscription.enabled ?: true, subscription.token ?: "") + val subscriptionId = _subscriptionBackend.createSubscription(appId, "", "", subscription.type, subscription.enabled ?: true, subscription.token ?: "", subscription.notificationTypes ?: SubscriptionModel.STATUS_SUBSCRIBED) subscriptionIDs.add(subscriptionId) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidUtils.kt index e0917bb1d1..091b3c6a10 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidUtils.kt @@ -12,6 +12,9 @@ import android.os.Bundle import android.os.Looper import android.text.TextUtils import androidx.annotation.Keep +import androidx.core.app.JobIntentService +import androidx.core.app.NotificationManagerCompat +import androidx.legacy.content.WakefulBroadcastReceiver import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.logging.Logging import java.util.Random @@ -119,6 +122,33 @@ internal object AndroidUtils { return Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 } + fun hasJobIntentService(): Boolean { + return try { + // noinspection ConstantConditions + JobIntentService::class.java != null + } catch (e: Throwable) { + false + } + } + + fun hasWakefulBroadcastReceiver(): Boolean { + return try { + // noinspection ConstantConditions + WakefulBroadcastReceiver::class.java != null + } catch (e: Throwable) { + false + } + } + + fun hasNotificationManagerCompat(): Boolean { + return try { + // noinspection ConstantConditions + NotificationManagerCompat::class.java != null + } catch (e: Throwable) { + false + } + } + fun openURLInBrowser(appContext: Context, url: String) { openURLInBrowser(appContext, Uri.parse(url.trim { it <= ' ' })) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/device/IDeviceService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/device/IDeviceService.kt index 23afa1b04d..be59adf636 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/device/IDeviceService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/device/IDeviceService.kt @@ -13,4 +13,11 @@ internal interface IDeviceService { val isGMSInstalledAndEnabled: Boolean val hasAllHMSLibrariesForPushKit: Boolean val hasFCMLibrary: Boolean + val androidSupportLibraryStatus: AndroidSupportLibraryStatus + + enum class AndroidSupportLibraryStatus { + MISSING, + OUTDATED, + OK + } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/device/impl/DeviceService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/device/impl/DeviceService.kt index c90022c212..9827a477a4 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/device/impl/DeviceService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/device/impl/DeviceService.kt @@ -1,6 +1,7 @@ package com.onesignal.core.internal.device.impl import android.content.pm.PackageManager +import android.os.Build import com.google.android.gms.common.GoogleApiAvailability import com.google.android.gms.location.LocationListener import com.google.firebase.messaging.FirebaseMessaging @@ -82,6 +83,32 @@ internal class DeviceService(private val _applicationService: IApplicationServic return false } + override val androidSupportLibraryStatus: IDeviceService.AndroidSupportLibraryStatus + get() { + val hasWakefulBroadcastReceiver: Boolean = AndroidUtils.hasWakefulBroadcastReceiver() + val hasNotificationManagerCompat: Boolean = AndroidUtils.hasNotificationManagerCompat() + if (!hasWakefulBroadcastReceiver && !hasNotificationManagerCompat) { + return IDeviceService.AndroidSupportLibraryStatus.MISSING + } + + if (!hasWakefulBroadcastReceiver || !hasNotificationManagerCompat) { + return IDeviceService.AndroidSupportLibraryStatus.OUTDATED + } + + // If running on Android O and targeting O we need version 26.0.0 for + // the new compat NotificationCompat.Builder constructor. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && + AndroidUtils.getTargetSdkVersion(_applicationService.appContext) >= Build.VERSION_CODES.O + ) { + // Class was added in 26.0.0-beta2 + if (!AndroidUtils.hasJobIntentService()) { + return IDeviceService.AndroidSupportLibraryStatus.OUTDATED + } + } + + return IDeviceService.AndroidSupportLibraryStatus.OK + } + private fun supportsGooglePush(): Boolean { // 1. If app does not have the FCM library it won't support Google push return if (!hasFCMLibrary) false else isGMSInstalledAndEnabled diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/http/impl/HttpClient.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/http/impl/HttpClient.kt index f2886d7f39..8da54c3945 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/http/impl/HttpClient.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/http/impl/HttpClient.kt @@ -56,7 +56,7 @@ internal class HttpClient( cacheKey: String? ): HttpResponse { // If privacy consent is required but not yet given, any non-GET request should be blocked. - if (method != null && _configModelStore.get().requiresPrivacyConsent == true && _configModelStore.get().givenPrivacyConsent != true) { + if (method != null && _configModelStore.model.requiresPrivacyConsent == true && _configModelStore.model.givenPrivacyConsent != true) { Logging.warn("$method `$url` was called before the user provided privacy consent. Your application is set to require the user's privacy consent before the OneSignal SDK can be initialized. Please ensure the user has provided consent before calling this method. You can check the latest OneSignal consent status by calling OneSignal.privacyConsent") return HttpResponse(0, null, null) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InfluenceDataRepository.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InfluenceDataRepository.kt index 7b29b38d85..d794b84d95 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InfluenceDataRepository.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InfluenceDataRepository.kt @@ -124,23 +124,23 @@ internal class InfluenceDataRepository( } override val notificationLimit: Int - get() = _configModelStore.get().influenceParams.notificationLimit + get() = _configModelStore.model.influenceParams.notificationLimit override val iamLimit: Int - get() = _configModelStore.get().influenceParams.iamLimit + get() = _configModelStore.model.influenceParams.iamLimit override val notificationIndirectAttributionWindow: Int - get() = _configModelStore.get().influenceParams.indirectNotificationAttributionWindow + get() = _configModelStore.model.influenceParams.indirectNotificationAttributionWindow override val iamIndirectAttributionWindow: Int - get() = _configModelStore.get().influenceParams.indirectIAMAttributionWindow + get() = _configModelStore.model.influenceParams.indirectIAMAttributionWindow override val isDirectInfluenceEnabled: Boolean - get() = _configModelStore.get().influenceParams.isDirectEnabled + get() = _configModelStore.model.influenceParams.isDirectEnabled override val isIndirectInfluenceEnabled: Boolean - get() = _configModelStore.get().influenceParams.isIndirectEnabled + get() = _configModelStore.model.influenceParams.isIndirectEnabled override val isUnattributedInfluenceEnabled: Boolean - get() = _configModelStore.get().influenceParams.isUnattributedEnabled + get() = _configModelStore.model.influenceParams.isUnattributedEnabled } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/language/impl/LanguageContext.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/language/impl/LanguageContext.kt index 14e5d57537..4e8bc2f39e 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/language/impl/LanguageContext.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/language/impl/LanguageContext.kt @@ -10,6 +10,6 @@ internal class LanguageContext( private var _deviceLanguageProvider = LanguageProviderDevice() override var language: String - get() = _propertiesModelStore.get().language ?: _deviceLanguageProvider.language - set(value) { _propertiesModelStore.get().language = value } + get() = _propertiesModelStore.model.language ?: _deviceLanguageProvider.language + set(value) { _propertiesModelStore.model.language = value } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/ConfigModelStoreListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/ConfigModelStoreListener.kt index 9eac2f52d8..1174e1e4f3 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/ConfigModelStoreListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/ConfigModelStoreListener.kt @@ -5,6 +5,8 @@ import com.onesignal.core.internal.backend.IParamsBackendService import com.onesignal.core.internal.common.suspendifyOnThread import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.modeling.ISingletonModelStoreChangeHandler +import com.onesignal.core.internal.modeling.ModelChangeTags +import com.onesignal.core.internal.modeling.ModelChangedArgs import com.onesignal.core.internal.models.ConfigModel import com.onesignal.core.internal.models.ConfigModelStore import com.onesignal.core.internal.models.InfluenceConfigModel @@ -31,19 +33,24 @@ internal class ConfigModelStoreListener( fetchParams() } - override fun onModelUpdated(model: ConfigModel, path: String, property: String, oldValue: Any?, newValue: Any?) { - if (property != ConfigModel::appId.name) { + override fun onModelUpdated(args: ModelChangedArgs, tag: String) { + if (args.property != ConfigModel::appId.name) { return } fetchParams() } - override fun onModelReplaced(model: ConfigModel) { + override fun onModelReplaced(model: ConfigModel, tag: String) { + if (tag != ModelChangeTags.NORMAL) { + return + } + + fetchParams() } private fun fetchParams() { - val appId = _configModelStore.get().appId + val appId = _configModelStore.model.appId if (appId.isEmpty()) { return @@ -68,10 +75,11 @@ internal class ConfigModelStoreListener( config.googleProjectNumber = params.googleProjectNumber config.clearGroupOnSummaryClick = params.clearGroupOnSummaryClick ?: true config.receiveReceiptEnabled = params.receiveReceiptEnabled ?: false - config.disableGMSMissingPrompt = params.disableGMSMissingPrompt ?: _configModelStore.get().disableGMSMissingPrompt - config.unsubscribeWhenNotificationsDisabled = params.unsubscribeWhenNotificationsDisabled ?: _configModelStore.get().unsubscribeWhenNotificationsDisabled - config.locationShared = params.locationShared ?: _configModelStore.get().locationShared - config.requiresPrivacyConsent = params.requiresUserPrivacyConsent ?: _configModelStore.get().requiresPrivacyConsent + config.disableGMSMissingPrompt = params.disableGMSMissingPrompt ?: _configModelStore.model.disableGMSMissingPrompt + config.unsubscribeWhenNotificationsDisabled = params.unsubscribeWhenNotificationsDisabled ?: _configModelStore.model.unsubscribeWhenNotificationsDisabled + config.locationShared = params.locationShared ?: _configModelStore.model.locationShared + config.requiresPrivacyConsent = params.requiresUserPrivacyConsent ?: _configModelStore.model.requiresPrivacyConsent + config.givenPrivacyConsent = _configModelStore.model.givenPrivacyConsent config.influenceParams.notificationLimit = params.influenceParams.notificationLimit ?: InfluenceConfigModel.DEFAULT_NOTIFICATION_LIMIT config.influenceParams.indirectNotificationAttributionWindow = params.influenceParams.indirectNotificationAttributionWindow ?: InfluenceConfigModel.DEFAULT_INDIRECT_ATTRIBUTION_WINDOW @@ -86,7 +94,7 @@ internal class ConfigModelStoreListener( config.fcmParams.appId = params.fcmParams.appId config.fcmParams.apiKey = params.fcmParams.apiKey - _configModelStore.replace(config) + _configModelStore.replace(config, ModelChangeTags.HYDRATE) success = true } catch (ex: BackendException) { if (ex.statusCode == HttpURLConnection.HTTP_FORBIDDEN) { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/IdentityModelStoreListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/IdentityModelStoreListener.kt index 53264000af..ecdeeb2f1a 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/IdentityModelStoreListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/IdentityModelStoreListener.kt @@ -21,9 +21,9 @@ internal class IdentityModelStoreListener( override fun getUpdateOperation(model: IdentityModel, path: String, property: String, oldValue: Any?, newValue: Any?): Operation { return if (newValue != null && newValue is String) { - SetAliasOperation(_configModelStore.get().appId, model.onesignalId, property, newValue) + SetAliasOperation(_configModelStore.model.appId, model.onesignalId, property, newValue) } else { - DeleteAliasOperation(_configModelStore.get().appId, model.onesignalId, property) + DeleteAliasOperation(_configModelStore.model.appId, model.onesignalId, property) } } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/ModelStoreListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/ModelStoreListener.kt index 9620b6529e..7175352dbe 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/ModelStoreListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/ModelStoreListener.kt @@ -3,6 +3,8 @@ package com.onesignal.core.internal.listeners import com.onesignal.core.internal.modeling.IModelStore import com.onesignal.core.internal.modeling.IModelStoreChangeHandler import com.onesignal.core.internal.modeling.Model +import com.onesignal.core.internal.modeling.ModelChangeTags +import com.onesignal.core.internal.modeling.ModelChangedArgs import com.onesignal.core.internal.operations.IOperationRepo import com.onesignal.core.internal.operations.Operation import com.onesignal.core.internal.startup.IBootstrapService @@ -21,21 +23,33 @@ internal abstract class ModelStoreListener( store.unsubscribe(this) } - override fun onAdded(model: TModel) { + override fun onModelAdded(model: TModel, tag: String) { + if (tag != ModelChangeTags.NORMAL) { + return + } + val operation = getAddOperation(model) if (operation != null) { opRepo.enqueue(operation) } } - override fun onUpdated(model: TModel, path: String, property: String, oldValue: Any?, newValue: Any?) { - val operation = getUpdateOperation(model, path, property, oldValue, newValue) + override fun onModelUpdated(args: ModelChangedArgs, tag: String) { + if (tag != ModelChangeTags.NORMAL) { + return + } + + val operation = getUpdateOperation(args.model as TModel, args.path, args.property, args.oldValue, args.newValue) if (operation != null) { opRepo.enqueue(operation) } } - override fun onRemoved(model: TModel) { + override fun onModelRemoved(model: TModel, tag: String) { + if (tag != ModelChangeTags.NORMAL) { + return + } + val operation = getRemoveOperation(model) if (operation != null) { opRepo.enqueue(operation) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/PropertiesModelStoreListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/PropertiesModelStoreListener.kt index b5b93e1812..b1d35d8a99 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/PropertiesModelStoreListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/PropertiesModelStoreListener.kt @@ -23,12 +23,12 @@ internal class PropertiesModelStoreListener( override fun getUpdateOperation(model: PropertiesModel, path: String, property: String, oldValue: Any?, newValue: Any?): Operation? { if (path.startsWith(PropertiesModel::tags.name)) { return if (newValue != null && newValue is String) { - SetTagOperation(_configModelStore.get().appId, model.onesignalId, property, newValue) + SetTagOperation(_configModelStore.model.appId, model.onesignalId, property, newValue) } else { - DeleteTagOperation(_configModelStore.get().appId, model.onesignalId, property) + DeleteTagOperation(_configModelStore.model.appId, model.onesignalId, property) } } - return SetPropertyOperation(_configModelStore.get().appId, model.onesignalId, property, newValue) + return SetPropertyOperation(_configModelStore.model.appId, model.onesignalId, property, newValue) } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SessionListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SessionListener.kt index 8ed9bac8bf..c7b9032d8d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SessionListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SessionListener.kt @@ -39,10 +39,10 @@ internal class SessionListener( } override fun onSessionEnded(duration: Long) { - _operationRepo.enqueue(TrackSessionOperation(_configModelStore.get().appId, _identityModelStore.get().onesignalId, duration)) + _operationRepo.enqueue(TrackSessionOperation(_configModelStore.model.appId, _identityModelStore.model.onesignalId, duration)) suspendifyOnThread { - _outcomeEventsController.sendOutcomeEvent("__os_session_end") + _outcomeEventsController.sendOutcomeEvent("os__session_duration") } } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SingletonModelStoreListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SingletonModelStoreListener.kt index aef46d64b7..729fa4d57a 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SingletonModelStoreListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SingletonModelStoreListener.kt @@ -3,6 +3,8 @@ package com.onesignal.core.internal.listeners import com.onesignal.core.internal.modeling.ISingletonModelStore import com.onesignal.core.internal.modeling.ISingletonModelStoreChangeHandler import com.onesignal.core.internal.modeling.Model +import com.onesignal.core.internal.modeling.ModelChangeTags +import com.onesignal.core.internal.modeling.ModelChangedArgs import com.onesignal.core.internal.operations.IOperationRepo import com.onesignal.core.internal.operations.Operation import com.onesignal.core.internal.startup.IBootstrapService @@ -21,15 +23,23 @@ internal abstract class SingletonModelStoreListener( store.unsubscribe(this) } - override fun onModelReplaced(model: TModel) { + override fun onModelReplaced(model: TModel, tag: String) { + if (tag != ModelChangeTags.NORMAL) { + return + } + val operation = getReplaceOperation(model) if (operation != null) { opRepo.enqueue(operation) } } - override fun onModelUpdated(model: TModel, path: String, property: String, oldValue: Any?, newValue: Any?) { - val operation = getUpdateOperation(model, path, property, oldValue, newValue) + override fun onModelUpdated(args: ModelChangedArgs, tag: String) { + if (tag != ModelChangeTags.NORMAL) { + return + } + + val operation = getUpdateOperation(args.model as TModel, args.path, args.property, args.oldValue, args.newValue) if (operation != null) { opRepo.enqueue(operation) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SubscriptionModelStoreListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SubscriptionModelStoreListener.kt index 2b4bd02c77..c88c0894bf 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SubscriptionModelStoreListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/listeners/SubscriptionModelStoreListener.kt @@ -18,14 +18,14 @@ internal class SubscriptionModelStoreListener( ) : ModelStoreListener(store, opRepo) { override fun getAddOperation(model: SubscriptionModel): Operation { - return CreateSubscriptionOperation(_configModelStore.get().appId, _identityModelStore.get().onesignalId, model.id, model.type, model.enabled, model.address) + return CreateSubscriptionOperation(_configModelStore.model.appId, _identityModelStore.model.onesignalId, model.id, model.type, model.enabled, model.address, model.status) } override fun getRemoveOperation(model: SubscriptionModel): Operation { - return DeleteSubscriptionOperation(_configModelStore.get().appId, _identityModelStore.get().onesignalId, model.id) + return DeleteSubscriptionOperation(_configModelStore.model.appId, _identityModelStore.model.onesignalId, model.id) } override fun getUpdateOperation(model: SubscriptionModel, path: String, property: String, oldValue: Any?, newValue: Any?): Operation { - return UpdateSubscriptionOperation(_configModelStore.get().appId, _identityModelStore.get().onesignalId, model.id, model.enabled, model.address) + return UpdateSubscriptionOperation(_configModelStore.model.appId, _identityModelStore.model.onesignalId, model.id, model.enabled, model.address, model.status) } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelChangedHandler.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelChangedHandler.kt index f48a2c1254..d135d77bc7 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelChangedHandler.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelChangedHandler.kt @@ -10,8 +10,9 @@ internal interface IModelChangedHandler { * Called when the subscribed model has been changed. * * @param args Information related to what has changed. + * @param tag The tag which identifies how/why the model was changed. */ - fun onChanged(args: ModelChangedArgs) + fun onChanged(args: ModelChangedArgs, tag: String) } /** diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStore.kt index 9e6fa19ffa..cdfca9e68c 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStore.kt @@ -18,9 +18,9 @@ internal interface IModelStore : IEventNotifier @@ -28,12 +28,12 @@ internal interface IModelStore : IEventNotifier : IEventNotifier, tag: String = ModelChangeTags.NORMAL) +} + +internal object ModelChangeTags { + /** + * A change was performed through normal means. + */ + const val NORMAL = "NORMAL" + + /** + * A change was performed that should *not* be propogated to the backend. + */ + const val NO_PROPOGATE = "NO_PROPOGATE" + + /** + * A change was performed through the backend hydrating the model. */ - fun replaceAll(models: List, fireEvent: Boolean = true) + const val HYDRATE = "HYDRATE" } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStoreChangeHandler.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStoreChangeHandler.kt index 0b5f53fba8..bed4567449 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStoreChangeHandler.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStoreChangeHandler.kt @@ -9,26 +9,25 @@ internal interface IModelStoreChangeHandler where TModel : Model { * Called when a model has been added to the model store. * * @param model The model that has been added. + * @param tag The tag which identifies how/why the model was added. */ - fun onAdded(model: TModel) + fun onModelAdded(model: TModel, tag: String) /** * Called when a model has been updated. This callback wraps [IModelChangedHandler.onChanged] * so users of the model store does not need to manage subscriptions to each individual [Model] * within the store. * - * @param model The model that has been updated (includes the updates). - * @param path The path to the property of the model that has been updated. - * @param property The property of the model that has been updated. - * @param oldValue The old value of the property that has changed. - * @param newValue The new value of the property that has changed. + * @param args The model changed arguments. + * @param tag The tag which identifies how/why the model was updated. */ - fun onUpdated(model: TModel, path: String, property: String, oldValue: Any?, newValue: Any?) + fun onModelUpdated(args: ModelChangedArgs, tag: String) /** * Called when a model has been removed from the model store. * * @param model The model that has been removed. + * @param tag The tag which identifies how/why the model was removed. */ - fun onRemoved(model: TModel) + fun onModelRemoved(model: TModel, tag: String) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStore.kt index 8aa2fd6d7b..fd8e9e51ba 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStore.kt @@ -10,17 +10,15 @@ import com.onesignal.core.internal.common.events.IEventNotifier internal interface ISingletonModelStore : IEventNotifier> where TModel : Model { /** - * Retrieve the model managed by this singleton model store. - * - * @return The single model managed by this store. + * The model managed by this singleton model store. */ - fun get(): TModel + val model: TModel /** * Replace the existing model with the new model provided. * * @param model A model that contains all the data for the new effective model. - * @param fireEvent Whether an event should be fired for this update action. + * @param tag The tag which identifies how/why the model is being replaced. */ - fun replace(model: TModel, fireEvent: Boolean = true) + fun replace(model: TModel, tag: String = ModelChangeTags.NORMAL) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStoreChangeHandler.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStoreChangeHandler.kt index 918ff5c764..00c67ea521 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStoreChangeHandler.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStoreChangeHandler.kt @@ -10,19 +10,17 @@ internal interface ISingletonModelStoreChangeHandler where TModel : Mode * Called when the model has been replaced. * * @param model The model + * @param tag The tag which identifies how/why the model was replaced. */ - fun onModelReplaced(model: TModel) + fun onModelReplaced(model: TModel, tag: String) /** * Called when a property within the model has been updated. This callback wraps [IModelChangedHandler.onChanged] * so users of the model store does not need to manage subscriptions to the individual [Model] * within the store. * - * @param model The model that has been updated (includes the updates). - * @param path The path to the property of the model that has been updated. - * @param property The property of the model that has been updated. - * @param oldValue The old value of the property that has changed. - * @param newValue The new value of the property that has changed. + * @param args The model changed arguments. + * @param tag The tag which identifies how/why the model was updated. */ - fun onModelUpdated(model: TModel, path: String, property: String, oldValue: Any?, newValue: Any?) + fun onModelUpdated(args: ModelChangedArgs, tag: String) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/MapModel.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/MapModel.kt index c7c17c44d0..fc272ee9c7 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/MapModel.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/MapModel.kt @@ -2,8 +2,8 @@ package com.onesignal.core.internal.modeling /** * A Map Model is a [MutableMap] that has a key of type string and a generically-specified - * value. It is a [Model] which hooks the map into the model framework and allows for change - * notification propagation for any adds, removes, or updates to the map. + * value. It is a [Model] which hooks the [MutableMap] into the model framework and allows for change + * notification propagation for any adds, removes, or updates to the [MutableMap]. */ internal open class MapModel( parentModel: Model? = null, diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/Model.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/Model.kt index c8c12867ab..303f0fff70 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/Model.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/Model.kt @@ -33,7 +33,7 @@ import org.json.JSONObject * [MutableMap] and [Model]. * * Deserialization - * ----------------------------- + * --------------- * When deserializing a flat [Model] nothing specific is required. However if the [Model] * is nested the [createModelForProperty] and/or [createListForProperty] needs to be implemented * to aide in the deserialization process. @@ -85,15 +85,15 @@ internal open class Model( if (jsonValue is JSONObject) { val childModel = createModelForProperty(property, jsonValue) if (childModel != null) { - setProperty(property, childModel, notify = false) + data[property] = childModel } } else if (jsonValue is JSONArray) { val listOfItems = createListForProperty(property, jsonValue) if (listOfItems != null) { - setProperty(property, listOfItems, notify = false) + data[property] = listOfItems } } else { - setProperty(property, jsonObject.get(property), notify = false) + data[property] = jsonObject.get(property) } } } @@ -102,11 +102,13 @@ internal open class Model( * Initialize this model from a [Model]. The model provided will be replicated * within this model. * + * @param id The id of the model to initialze to. * @param model The model to initialize this model from. */ - fun initializeFromModel(model: Model) { + fun initializeFromModel(id: String, model: Model) { data.clear() data.putAll(model.data) + data[::id.name] = id } /** @@ -143,9 +145,9 @@ internal open class Model( * * @param name: The name of the property that is to be set. * @param value: The value of the property to set it to. - * @param notify: Whether to notify subscribers of the change. + * @param tag The tag which identifies how/why the property is being set. */ - fun setProperty(name: String, value: T, notify: Boolean = true) { + fun setProperty(name: String, value: T, tag: String = ModelChangeTags.NORMAL) { val oldValue = data[name] val newValue = value as Any? @@ -159,9 +161,7 @@ internal open class Model( data.remove(name) } - if (notify) { - notifyChanged(name, name, oldValue, newValue) - } + notifyChanged(name, name, tag, oldValue, newValue) } /** @@ -194,15 +194,15 @@ internal open class Model( } } - private fun notifyChanged(path: String, property: String, oldValue: Any?, newValue: Any?) { + private fun notifyChanged(path: String, property: String, tag: String, oldValue: Any?, newValue: Any?) { // if there are any changed listeners for this specific model, notify them. val changeArgs = ModelChangedArgs(this, path, property, oldValue, newValue) - _changeNotifier.fire { it.onChanged(changeArgs) } + _changeNotifier.fire { it.onChanged(changeArgs, tag) } // if there is a parent model, propagate the change up to the parent for it's own processing. if (_parentModel != null) { val parentPath = "$_parentProperty.$path" - _parentModel.notifyChanged(parentPath, property, oldValue, newValue) + _parentModel.notifyChanged(parentPath, property, tag, oldValue, newValue) } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ModelStore.kt index 9bcb519ce8..9381910de4 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ModelStore.kt @@ -35,13 +35,13 @@ internal abstract class ModelStore( private val _changeSubscription: EventProducer> = EventProducer() private val _models: MutableList = mutableListOf() - override fun add(model: TModel, fireEvent: Boolean) { + override fun add(model: TModel, tag: String) { val oldModel = _models.firstOrNull { it.id == model.id } if (oldModel != null) { - removeItem(oldModel, fireEvent) + removeItem(oldModel, tag) } - addItem(model, fireEvent) + addItem(model, tag) } override fun list(): Collection { @@ -52,34 +52,39 @@ internal abstract class ModelStore( return _models.firstOrNull { it.id == id } } - override fun remove(id: String, fireEvent: Boolean) { + override fun remove(id: String, tag: String) { val model = _models.firstOrNull { it.id == id } ?: return - removeItem(model, fireEvent) + removeItem(model, tag) } - override fun onChanged(args: ModelChangedArgs) { + override fun onChanged(args: ModelChangedArgs, tag: String) { persist() - _changeSubscription.fire { it.onUpdated(args.model as TModel, args.path, args.property, args.oldValue, args.newValue) } + + _changeSubscription.fire { it.onModelUpdated(args, tag) } } - override fun replaceAll(models: List, fireEvent: Boolean) { - clear(fireEvent) + override fun replaceAll(models: List, tag: String) { + clear(tag) for (model in models) { - add(model, fireEvent) + add(model, tag) } } - override fun clear(fireEvent: Boolean) { + override fun clear(tag: String) { val localList = _models.toList() _models.clear() + persist() + for (item in localList) { - removeItem(item, fireEvent) + // no longer listen for changes to this model + item.unsubscribe(this) + _changeSubscription.fire { it.onModelRemoved(item, tag) } } } - private fun addItem(model: TModel, fireEvent: Boolean) { + private fun addItem(model: TModel, tag: String) { _models.add(model) // listen for changes to this model @@ -87,12 +92,10 @@ internal abstract class ModelStore( persist() - if (fireEvent) { - _changeSubscription.fire { it.onAdded(model) } - } + _changeSubscription.fire { it.onModelAdded(model, tag) } } - private fun removeItem(model: TModel, fireEvent: Boolean) { + private fun removeItem(model: TModel, tag: String) { _models.remove(model) // no longer listen for changes to this model @@ -100,9 +103,7 @@ internal abstract class ModelStore( persist() - if (fireEvent) { - _changeSubscription.fire { it.onRemoved(model) } - } + _changeSubscription.fire { it.onModelRemoved(model, tag) } } protected fun load() { @@ -118,10 +119,7 @@ internal abstract class ModelStore( } } - /** - * Persist this model store. - */ - fun persist() { + private fun persist() { if (name != null && _prefs != null) { val jsonArray = JSONArray() for (model in _models) { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SingletonModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SingletonModelStore.kt index c108904edb..e35b71a15b 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SingletonModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SingletonModelStore.kt @@ -17,45 +17,37 @@ internal open class SingletonModelStore( store.subscribe(this) } - override fun get(): TModel { - val model = store.get(_singletonId) - if (model != null) { - return model + override val model: TModel + get() { + val model = store.get(_singletonId) + if (model != null) { + return model + } + + val createdModel = store.create() + createdModel.id = _singletonId + store.add(createdModel) + return createdModel } - val createdModel = store.create() - createdModel.id = _singletonId - store.add(createdModel) - return createdModel - } - - override fun replace(model: TModel, fireEvent: Boolean) { - val existingModel = get() - existingModel.initializeFromModel(model) - existingModel.setProperty(Model::id.name, _singletonId, notify = false) - - _changeSubscription.fire { it.onModelReplaced(existingModel) } - } - - /** - * Persist the singleton model store. - */ - fun persist() { - store.persist() + override fun replace(model: TModel, tag: String) { + val existingModel = this.model + existingModel.initializeFromModel(_singletonId, model) + _changeSubscription.fire { it.onModelReplaced(existingModel, tag) } } override fun subscribe(handler: ISingletonModelStoreChangeHandler) = _changeSubscription.subscribe(handler) override fun unsubscribe(handler: ISingletonModelStoreChangeHandler) = _changeSubscription.unsubscribe(handler) - override fun onAdded(model: TModel) { + override fun onModelAdded(model: TModel, tag: String) { // singleton is assumed to always exist. It gets added transparently therefore no event. } - override fun onUpdated(model: TModel, path: String, property: String, oldValue: Any?, newValue: Any?) { - _changeSubscription.fire { it.onModelUpdated(model, path, property, oldValue, newValue) } + override fun onModelUpdated(args: ModelChangedArgs, tag: String) { + _changeSubscription.fire { it.onModelUpdated(args, tag) } } - override fun onRemoved(model: TModel) { + override fun onModelRemoved(model: TModel, tag: String) { // singleton is assumed to always exist. It never gets removed therefore no event. } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/SubscriptionModel.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/SubscriptionModel.kt index df52fb0737..00d4c2a237 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/SubscriptionModel.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/SubscriptionModel.kt @@ -20,4 +20,35 @@ internal class SubscriptionModel : Model() { var address: String get() = getProperty(::address.name) set(value) { setProperty(::address.name, value) } + + var status: Int + get() = getProperty(::status.name) { STATUS_SUBSCRIBED } + set(value) { setProperty(::status.name, value) } + + companion object { + const val STATUS_SUBSCRIBED = 1 + const val STATUS_NO_PERMISSION = 0 + const val STATUS_UNSUBSCRIBE = -2 + const val STATUS_MISSING_ANDROID_SUPPORT_LIBRARY = -3 + const val STATUS_MISSING_FIREBASE_FCM_LIBRARY = -4 + const val STATUS_OUTDATED_ANDROID_SUPPORT_LIBRARY = -5 + const val STATUS_INVALID_FCM_SENDER_ID = -6 + const val STATUS_OUTDATED_GOOGLE_PLAY_SERVICES_APP = -7 + const val STATUS_FIREBASE_FCM_INIT_ERROR = -8 + const val STATUS_FIREBASE_FCM_ERROR_IOEXCEPTION_SERVICE_NOT_AVAILABLE = -9 + + // -10 is a server side detection only from FCM that the app is no longer installed + const val STATUS_FIREBASE_FCM_ERROR_IOEXCEPTION_OTHER = -11 + const val STATUS_FIREBASE_FCM_ERROR_MISC_EXCEPTION = -12 + + // -13 to -24 reserved for other platforms + const val STATUS_HMS_TOKEN_TIMEOUT = -25 + + // Most likely missing "client/app_id". + // Check that there is "apply plugin: 'com.huawei.agconnect'" in your app/build.gradle + const val STATUS_HMS_ARGUMENTS_INVALID = -26 + const val STATUS_HMS_API_EXCEPTION_OTHER = -27 + const val STATUS_MISSING_HMS_PUSHKIT_LIBRARY = -28 + const val STATUS_FIREBASE_FCM_ERROR_IOEXCEPTION_AUTHENTICATION_FAILED = -29 + } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/CreateSubscriptionOperation.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/CreateSubscriptionOperation.kt index 995c8e2fdd..c963084672 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/CreateSubscriptionOperation.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/CreateSubscriptionOperation.kt @@ -58,17 +58,25 @@ internal class CreateSubscriptionOperation() : Operation(SubscriptionOperationEx get() = getProperty(::address.name) private set(value) { setProperty(::address.name, value) } + /** + * The status of this subscription. + */ + var status: Int + get() = getProperty(::status.name) + private set(value) { setProperty(::status.name, value) } + override val createComparisonKey: String get() = "$appId.User.$onesignalId" override val modifyComparisonKey: String get() = "$appId.User.$onesignalId.Subscription.$subscriptionId" override val groupComparisonType: GroupComparisonType = GroupComparisonType.ALTER override val canStartExecute: Boolean get() = !IDManager.isIdLocalOnly(onesignalId) - constructor(appId: String, onesignalId: String, subscriptionId: String, type: SubscriptionType, enabled: Boolean, address: String) : this() { + constructor(appId: String, onesignalId: String, subscriptionId: String, type: SubscriptionType, enabled: Boolean, address: String, status: Int) : this() { this.appId = appId this.onesignalId = onesignalId this.subscriptionId = subscriptionId this.type = type this.enabled = enabled this.address = address + this.status = status } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/UpdateSubscriptionOperation.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/UpdateSubscriptionOperation.kt index f2e50d86d8..8783196224 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/UpdateSubscriptionOperation.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/UpdateSubscriptionOperation.kt @@ -50,16 +50,24 @@ internal class UpdateSubscriptionOperation() : Operation(SubscriptionOperationEx get() = getProperty(::address.name) private set(value) { setProperty(::address.name, value) } + /** + * The status of this subscription. + */ + var status: Int + get() = getProperty(::status.name) + private set(value) { setProperty(::status.name, value) } + override val createComparisonKey: String get() = "$appId.User.$onesignalId" override val modifyComparisonKey: String get() = "$appId.User.$onesignalId.Subscription.$subscriptionId" override val groupComparisonType: GroupComparisonType = GroupComparisonType.ALTER override val canStartExecute: Boolean get() = !IDManager.isIdLocalOnly(onesignalId) && !IDManager.isIdLocalOnly(onesignalId) - constructor(appId: String, onesignalId: String, subscriptionId: String, enabled: Boolean, address: String) : this() { + constructor(appId: String, onesignalId: String, subscriptionId: String, enabled: Boolean, address: String, status: Int) : this() { this.appId = appId this.onesignalId = onesignalId this.subscriptionId = subscriptionId this.enabled = enabled this.address = address + this.status = status } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/impl/SubscriptionOperationExecutor.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/impl/SubscriptionOperationExecutor.kt index 2eed279a2c..63bc3c6a1f 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/impl/SubscriptionOperationExecutor.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/impl/SubscriptionOperationExecutor.kt @@ -8,6 +8,7 @@ import com.onesignal.core.internal.backend.SubscriptionObjectType import com.onesignal.core.internal.common.IDManager import com.onesignal.core.internal.device.IDeviceService import com.onesignal.core.internal.logging.Logging +import com.onesignal.core.internal.modeling.ModelChangeTags import com.onesignal.core.internal.models.SubscriptionModel import com.onesignal.core.internal.models.SubscriptionModelStore import com.onesignal.core.internal.models.SubscriptionType @@ -49,8 +50,9 @@ internal class SubscriptionOperationExecutor( // the effective enabled/address for this subscription is the last update performed, if there is one. If there // isn't one we fall back to whatever is in the create operation. val lastUpdateOperation = operations.lastOrNull { it is UpdateSubscriptionOperation } as UpdateSubscriptionOperation? - var enabled = lastUpdateOperation?.enabled ?: createOperation.enabled - var address = lastUpdateOperation?.address ?: createOperation.address + val enabled = lastUpdateOperation?.enabled ?: createOperation.enabled + val address = lastUpdateOperation?.address ?: createOperation.address + val status = lastUpdateOperation?.status ?: createOperation.status // translate the subscription type to the subscription object type. val subscriptionType: SubscriptionObjectType = when (createOperation.type) { @@ -72,7 +74,8 @@ internal class SubscriptionOperationExecutor( IDManager.retrieveId(createOperation.onesignalId), subscriptionType, enabled, - address + address, + status ) // Add the "local-to-backend" ID translation to the IdentifierTranslator for any operations that were @@ -81,7 +84,7 @@ internal class SubscriptionOperationExecutor( IDManager.setLocalToBackendIdTranslation(createOperation.subscriptionId, backendSubscriptionId) val subscriptionModel = _subscriptionModelStore.get(createOperation.subscriptionId) - subscriptionModel?.setProperty(SubscriptionModel::id.name, backendSubscriptionId, false) + subscriptionModel?.setProperty(SubscriptionModel::id.name, backendSubscriptionId, ModelChangeTags.HYDRATE) } catch (ex: BackendException) { // TODO: Error handling } @@ -95,7 +98,8 @@ internal class SubscriptionOperationExecutor( lastOperation.appId, IDManager.retrieveId(lastOperation.subscriptionId), lastOperation.enabled, - lastOperation.address + lastOperation.address, + lastOperation.status ) } catch (ex: BackendException) { // TODO: Need a concept of retrying on network error, and other error handling diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/impl/UserOperationExecutor.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/impl/UserOperationExecutor.kt index 3004d8069e..3a8f8bcbc0 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/impl/UserOperationExecutor.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/operations/impl/UserOperationExecutor.kt @@ -17,6 +17,7 @@ import com.onesignal.core.internal.common.OneSignalUtils import com.onesignal.core.internal.common.RootToolsInternalMethods import com.onesignal.core.internal.device.IDeviceService import com.onesignal.core.internal.logging.Logging +import com.onesignal.core.internal.modeling.ModelChangeTags import com.onesignal.core.internal.models.IdentityModelStore import com.onesignal.core.internal.models.PropertiesModel import com.onesignal.core.internal.models.PropertiesModelStore @@ -98,25 +99,23 @@ internal class UserOperationExecutor( IDManager.setLocalToBackendIdTranslation(createUserOperation.onesignalId, backendOneSignalId) - val identityModel = _identityModelStore.get() - val propertiesModel = _propertiesModelStore.get() + val identityModel = _identityModelStore.model + val propertiesModel = _propertiesModelStore.model if (identityModel.onesignalId == createUserOperation.onesignalId) { - identityModel.setProperty(IdentityConstants.ONESIGNAL_ID, backendOneSignalId, false) + identityModel.setProperty(IdentityConstants.ONESIGNAL_ID, backendOneSignalId, ModelChangeTags.HYDRATE) // TODO: hydrate any additional aliases from the backend... - _identityModelStore.persist() } if (propertiesModel.onesignalId == createUserOperation.onesignalId) { - propertiesModel.setProperty(PropertiesModel::onesignalId.name, backendOneSignalId, notify = false) + propertiesModel.setProperty(PropertiesModel::onesignalId.name, backendOneSignalId, ModelChangeTags.HYDRATE) // TODO: hydrate the models from the backend create response. Temporarily inject dummy stuff to // show that it's working. // propertiesModel.setProperty(PropertiesModel::language.name, "en", notify = false) - propertiesModel.setProperty(PropertiesModel::country.name, "US", notify = false) - propertiesModel.tags.setProperty("foo", UUID.randomUUID().toString(), notify = false) - _propertiesModelStore.persist() + propertiesModel.setProperty(PropertiesModel::country.name, "US", ModelChangeTags.HYDRATE) + propertiesModel.tags.setProperty("foo", UUID.randomUUID().toString(), ModelChangeTags.HYDRATE) } // TODO: assumption that the response.subscriptionIDs will associate to the input subscriptionList...to confirm @@ -130,9 +129,8 @@ internal class UserOperationExecutor( IDManager.setLocalToBackendIdTranslation(subscriptionList[index].id, backendSubscriptionId) val subscriptionModel = _subscriptionsModelStore.get(subscriptionList[index].id) - subscriptionModel?.setProperty(SubscriptionModel::id.name, backendSubscriptionId, false) + subscriptionModel?.setProperty(SubscriptionModel::id.name, backendSubscriptionId, ModelChangeTags.HYDRATE) } - _subscriptionsModelStore.persist() } catch (ex: BackendException) { } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/outcomes/impl/OutcomeEventsController.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/outcomes/impl/OutcomeEventsController.kt index dd3b43a5a2..19660ebe55 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/outcomes/impl/OutcomeEventsController.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/outcomes/impl/OutcomeEventsController.kt @@ -65,7 +65,7 @@ internal class OutcomeEventsController( private suspend fun sendSavedOutcomeEvent(event: OutcomeEventParams) { val deviceType: Int = _deviceService.deviceType - val appId: String = _configModelStore.get().appId + val appId: String = _configModelStore.model.appId try { requestMeasureOutcomeEvent(appId, deviceType, event) @@ -159,7 +159,7 @@ Outcome event was cached and will be reattempted on app cold start""" ): OutcomeEvent? { val timestampSeconds: Long = _time.currentTimeMillis / 1000 val deviceType: Int = _deviceService.deviceType - val appId: String = _configModelStore.get().appId + val appId: String = _configModelStore.model.appId var directSourceBody: OutcomeSourceBody? = null var indirectSourceBody: OutcomeSourceBody? = null var unattributed = false diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/PreferencesService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/PreferencesService.kt index 904a2d63ea..59a3ee0d27 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/PreferencesService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/PreferencesService.kt @@ -60,13 +60,17 @@ internal class PreferencesService( val prefs = getSharedPrefsByName(store) if (prefs != null) { - return when (type) { - String::class.java -> prefs.getString(key, defValue as String?) - Boolean::class.java -> prefs.getBoolean(key, (defValue as Boolean?) ?: false) - Int::class.java -> prefs.getInt(key, (defValue as Int?) ?: 0) - Long::class.java -> prefs.getLong(key, (defValue as Long?) ?: 0) - Set::class.java -> prefs.getStringSet(key, defValue as Set?) - else -> null + try { + return when (type) { + String::class.java -> prefs.getString(key, defValue as String?) + Boolean::class.java -> prefs.getBoolean(key, (defValue as Boolean?) ?: false) + Int::class.java -> prefs.getInt(key, (defValue as Int?) ?: 0) + Long::class.java -> prefs.getLong(key, (defValue as Long?) ?: 0) + Set::class.java -> prefs.getStringSet(key, defValue as Set?) + else -> null + } + } catch (ex: Exception) { + // any issues retrieving the preference, return the default value. } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackAmazonPurchase.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackAmazonPurchase.kt index d2c9d13a7f..39d1f548a8 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackAmazonPurchase.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackAmazonPurchase.kt @@ -181,7 +181,7 @@ internal class TrackAmazonPurchase( } // TODO: amount spent? - _operationRepo.enqueue(TrackPurchaseOperation(_configModelStore.get().appId, _identityModelStore.get().onesignalId, false, BigDecimal(0), purchasesToReport)) + _operationRepo.enqueue(TrackPurchaseOperation(_configModelStore.model.appId, _identityModelStore.model.onesignalId, false, BigDecimal(0), purchasesToReport)) } } } else if (orgPurchasingListener != null) { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackGooglePurchase.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackGooglePurchase.kt index 066e593e7e..23a53ce0bd 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackGooglePurchase.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackGooglePurchase.kt @@ -221,7 +221,7 @@ internal class TrackGooglePurchase( // New purchases to report. If successful then mark them as tracked. if (purchasesToReport.isNotEmpty()) { - _operationRepo.enqueue(TrackPurchaseOperation(_configModelStore.get().appId, _identityModelStore.get().onesignalId, newAsExisting, BigDecimal(0), purchasesToReport)) + _operationRepo.enqueue(TrackPurchaseOperation(_configModelStore.model.appId, _identityModelStore.model.onesignalId, newAsExisting, BigDecimal(0), purchasesToReport)) purchaseTokens.addAll(newPurchaseTokens) _prefs.saveString(PreferenceStores.PLAYER_PURCHASES, PreferencePlayerPurchasesKeys.PREFS_PURCHASE_TOKENS, purchaseTokens.toString()) _prefs.saveBool(PreferenceStores.PLAYER_PURCHASES, PreferencePlayerPurchasesKeys.PREFS_EXISTING_PURCHASES, true) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/session/impl/SessionService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/session/impl/SessionService.kt index 958ada3988..5d3929e1ea 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/session/impl/SessionService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/session/impl/SessionService.kt @@ -48,8 +48,8 @@ internal class SessionService( private var _config: ConfigModel? = null override fun start() { - _session = _sessionModelStore.get() - _config = _configModelStore.get() + _session = _sessionModelStore.model + _config = _configModelStore.model _applicationService.addApplicationLifecycleHandler(this) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/SubscriptionManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/SubscriptionManager.kt index d7b85852ff..28dc3ce188 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/SubscriptionManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/SubscriptionManager.kt @@ -6,6 +6,7 @@ import com.onesignal.core.internal.common.events.EventProducer import com.onesignal.core.internal.common.events.IEventNotifier import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.modeling.IModelStoreChangeHandler +import com.onesignal.core.internal.modeling.ModelChangedArgs import com.onesignal.core.internal.models.SubscriptionModel import com.onesignal.core.internal.models.SubscriptionModelStore import com.onesignal.core.internal.models.SubscriptionType @@ -19,16 +20,14 @@ internal interface ISubscriptionManager : IEventNotifier Unit) { @@ -125,7 +126,7 @@ internal class SubscriptionManager( * Called when the model store has added a new subscription. The subscription list must be updated * to reflect the added subscription. */ - override fun onAdded(model: SubscriptionModel) { + override fun onModelAdded(model: SubscriptionModel, tag: String) { createSubscriptionAndAddToSubscriptionList(model) } @@ -133,16 +134,16 @@ internal class SubscriptionManager( * Called when a subscription model has been updated. The subscription list must be updated * to reflect the update subscription. */ - override fun onUpdated(model: SubscriptionModel, path: String, property: String, oldValue: Any?, newValue: Any?) { - val subscription = subscriptions.collection.firstOrNull { it.id == model.id } + override fun onModelUpdated(args: ModelChangedArgs, tag: String) { + val subscription = subscriptions.collection.firstOrNull { it.id == args.model.id } if (subscription == null) { // this shouldn't happen, but create a new subscription if a model was updated and we // don't yet have a representation for it in the subscription list. - createSubscriptionAndAddToSubscriptionList(model) + createSubscriptionAndAddToSubscriptionList(args.model as SubscriptionModel) } else { // the model has already been updated, so fire the update event - _events.fire { it.onSubscriptionUpdated(subscription) } + _events.fire { it.onSubscriptionsChanged() } } } @@ -150,8 +151,8 @@ internal class SubscriptionManager( * Called when a subscription model has been removed. The subscription list must be updated * to reflect the subscription removed. */ - override fun onRemoved(model: SubscriptionModel) { - val subscription = subscriptions.collection.firstOrNull { it.id.toString() == model.id } + override fun onModelRemoved(model: SubscriptionModel, tag: String) { + val subscription = subscriptions.collection.firstOrNull { it.id == model.id } if (subscription != null) { removeSubscriptionFromSubscriptionList(subscription) @@ -165,7 +166,7 @@ internal class SubscriptionManager( subscriptions.add(subscription) this.subscriptions = SubscriptionList(subscriptions) - _events.fire { it.onSubscriptionAdded(subscription) } + _events.fire { it.onSubscriptionsChanged() } } private fun removeSubscriptionFromSubscriptionList(subscription: ISubscription) { @@ -173,7 +174,7 @@ internal class SubscriptionManager( subscriptions.remove(subscription) this.subscriptions = SubscriptionList(subscriptions) - _events.fire { it.onSubscriptionRemoved(subscription) } + _events.fire { it.onSubscriptionsChanged() } } private fun createSubscriptionFromModel(subscriptionModel: SubscriptionModel): ISubscription { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/UserManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/UserManager.kt index e19b7ff99d..ba0f3153a6 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/UserManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/UserManager.kt @@ -41,10 +41,10 @@ internal open class UserManager( get() = _subscriptionManager.subscriptions private val _identityModel: IdentityModel - get() = _identityModelStore.get() + get() = _identityModelStore.model private val _propertiesModel: PropertiesModel - get() = _propertiesModelStore.get() + get() = _propertiesModelStore.model override fun addAlias(label: String, id: String): com.onesignal.core.user.IUserManager { Logging.log(LogLevel.DEBUG, "setAlias(label: $label, id: $id)") diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt index 1b7b5ba205..766d4e3d83 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt @@ -6,6 +6,7 @@ import com.onesignal.core.debug.LogLevel import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.backend.BackendException import com.onesignal.core.internal.common.AndroidUtils +import com.onesignal.core.internal.common.IDManager import com.onesignal.core.internal.common.JSONUtils import com.onesignal.core.internal.common.events.CallbackProducer import com.onesignal.core.internal.common.events.ICallbackProducer @@ -14,6 +15,7 @@ import com.onesignal.core.internal.influence.IInfluenceManager import com.onesignal.core.internal.language.ILanguageContext import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.modeling.ISingletonModelStoreChangeHandler +import com.onesignal.core.internal.modeling.ModelChangedArgs import com.onesignal.core.internal.models.ConfigModel import com.onesignal.core.internal.models.ConfigModelStore import com.onesignal.core.internal.outcomes.IOutcomeEventsController @@ -23,9 +25,7 @@ import com.onesignal.core.internal.startup.IStartableService import com.onesignal.core.internal.time.ITime import com.onesignal.core.internal.user.ISubscriptionChangedHandler import com.onesignal.core.internal.user.ISubscriptionManager -import com.onesignal.core.internal.user.subscriptions.PushSubscription import com.onesignal.core.user.IUserManager -import com.onesignal.core.user.subscriptions.ISubscription import com.onesignal.iam.IIAMManager import com.onesignal.iam.IInAppMessageClickHandler import com.onesignal.iam.IInAppMessageLifecycleHandler @@ -147,8 +147,8 @@ internal class IAMManager( _messageClickCallback.set(handler) } - override fun onModelUpdated(model: ConfigModel, path: String, property: String, oldValue: Any?, newValue: Any?) { - if (property != ConfigModel::appId.name) { + override fun onModelUpdated(args: ModelChangedArgs, tag: String) { + if (args.property != ConfigModel::appId.name) { return } @@ -157,8 +157,14 @@ internal class IAMManager( } } - override fun onSubscriptionAdded(subscription: ISubscription) { - if (subscription !is PushSubscription) { + override fun onModelReplaced(model: ConfigModel, tag: String) { + suspendifyOnThread { + fetchMessages() + } + } + + override fun onSubscriptionsChanged() { + if (_subscriptionManager.subscriptions.push == null) { return } @@ -167,12 +173,6 @@ internal class IAMManager( } } - override fun onSubscriptionUpdated(subscription: ISubscription) { - // nothing to do when a subscription is updated. - } - - override fun onSubscriptionRemoved(subscription: ISubscription) { } - override fun onSessionStarted() { for (redisplayInAppMessage in _redisplayedInAppMessages) { redisplayInAppMessage.isDisplayedInSession = false @@ -188,16 +188,16 @@ internal class IAMManager( // called when a new push subscription is added, or the app id is updated, or a new session starts private suspend fun fetchMessages() { - val appId = _configModelStore.get().appId + val appId = _configModelStore.model.appId val subscriptionId = _subscriptionManager.subscriptions.push?.id - if (subscriptionId == null || appId.isEmpty()) { + if (subscriptionId == null || IDManager.isIdLocalOnly(subscriptionId) || appId.isEmpty()) { return } _fetchIAMMutex.withLock { val now = _time.currentTimeMillis - if (_lastTimeFetchedIAMs != null && (now - _lastTimeFetchedIAMs!!) < _configModelStore.get().fetchIAMMinInterval) { + if (_lastTimeFetchedIAMs != null && (now - _lastTimeFetchedIAMs!!) < _configModelStore.model.fetchIAMMinInterval) { return } @@ -462,7 +462,7 @@ internal class IAMManager( suspendifyOnThread { try { _backend.sendIAMImpression( - _configModelStore.get().appId, + _configModelStore.model.appId, _subscriptionManager.subscriptions.push?.id.toString(), variantId, message.messageId @@ -689,7 +689,7 @@ internal class IAMManager( try { _backend.sendIAMPageImpression( - _configModelStore.get().appId, + _configModelStore.model.appId, _subscriptionManager.subscriptions.push?.id.toString(), variantId, message.messageId, @@ -723,7 +723,7 @@ internal class IAMManager( try { _backend.sendIAMClick( - _configModelStore.get().appId, + _configModelStore.model.appId, _subscriptionManager.subscriptions.push?.id.toString(), variantId, message.messageId, @@ -751,8 +751,4 @@ internal class IAMManager( .setPositiveButton(android.R.string.ok) { _, _ -> suspendifyOnThread { showMultiplePrompts(inAppMessage, prompts) } } .show() } - - override fun onModelReplaced(model: ConfigModel) { - // TODO("Not yet implemented") - } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt index fa0628f695..24f5215827 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt @@ -45,7 +45,7 @@ internal class InAppDisplayer( private var lastInstance: WebViewManager? = null override suspend fun displayMessage(message: InAppMessage): Boolean? { - var response = _backend.getIAMData(_configModelStore.get().appId, message.messageId, InAppHelper.variantIdForMessage(message, _languageContext)) + var response = _backend.getIAMData(_configModelStore.model.appId, message.messageId, InAppHelper.variantIdForMessage(message, _languageContext)) if (response.content != null) { message.displayDuration = response.content!!.displayDuration!! @@ -66,7 +66,7 @@ internal class InAppDisplayer( override suspend fun displayPreviewMessage(previewUUID: String): Boolean { val message = InAppMessage(true, _time) - val content = _backend.getIAMPreviewData(_configModelStore.get().appId, previewUUID) + val content = _backend.getIAMPreviewData(_configModelStore.model.appId, previewUUID) return if (content == null) { false diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt index 0b8c72fbac..932e65dbce 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt @@ -2,6 +2,7 @@ package com.onesignal.iam.internal.triggers.impl import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.modeling.IModelStoreChangeHandler +import com.onesignal.core.internal.modeling.ModelChangedArgs import com.onesignal.core.internal.models.TriggerModel import com.onesignal.core.internal.models.TriggerModelStore import com.onesignal.iam.internal.InAppMessage @@ -206,17 +207,18 @@ internal class TriggerController( return true } - override fun onAdded(model: TriggerModel) { + override fun onModelAdded(model: TriggerModel, tag: String) { addTriggers(model.key, model.value) _dynamicTriggerController.events.fire { it.onTriggerChanged(model.key) } } - override fun onUpdated(model: TriggerModel, path: String, property: String, oldValue: Any?, newValue: Any?) { + override fun onModelUpdated(args: ModelChangedArgs, tag: String) { + val model = args.model as TriggerModel addTriggers(model.key, model.value) _dynamicTriggerController.events.fire { it.onTriggerChanged(model.key) } } - override fun onRemoved(model: TriggerModel) { + override fun onModelRemoved(model: TriggerModel, tag: String) { removeTriggersForKeys(model.key) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationManager.kt index c2ea615a9a..01c5cb7872 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationManager.kt @@ -12,6 +12,7 @@ import com.onesignal.location.internal.capture.ILocationCapturer import com.onesignal.location.internal.common.LocationConstants import com.onesignal.location.internal.common.LocationUtils import com.onesignal.location.internal.controller.ILocationController +import com.onesignal.location.internal.permissions.ILocationPermissionChangedHandler import com.onesignal.location.internal.permissions.LocationPermissionController internal class LocationManager( @@ -19,11 +20,12 @@ internal class LocationManager( private val _capturer: ILocationCapturer, private val _locationController: ILocationController, private val _locationPermissionController: LocationPermissionController -) : ILocationManager, IStartableService { +) : ILocationManager, IStartableService, ILocationPermissionChangedHandler { override var isLocationShared: Boolean = false override fun start() { + _locationPermissionController.subscribe(this) if (LocationUtils.hasLocationPermission(_applicationService.appContext)) { suspendifyOnThread { startGetLocation() @@ -31,6 +33,14 @@ internal class LocationManager( } } + override fun onLocationPermissionChanged(enabled: Boolean) { + if (enabled) { + suspendifyOnThread { + startGetLocation() + } + } + } + /** * This method handle location and permission location flows and border cases. * For each flow we need to trigger location prompts listener, @@ -123,17 +133,10 @@ internal class LocationManager( result = backgroundLocationPermissionLogic() } else { result = true + startGetLocation() } } - if (result) { - startGetLocation() - } - - // if result is null that means the user has gone to app settings and may or may not do - // something there. However when they come back the application will be brought into - // focus and our application lifecycle handler will pick up any change that could have - // occurred. return result } @@ -157,7 +160,7 @@ internal class LocationManager( private suspend fun startGetLocation() { Logging.debug("LocationManager.startGetLocation()") // with lastLocation: " + lastLocation) try { - if (!_locationController!!.start()) { + if (!_locationController.start()) { Logging.warn("LocationManager.startGetLocation: not possible, no location dependency found") } } catch (t: Throwable) { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt index c7311f8d28..ac6e813101 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt @@ -60,7 +60,7 @@ internal class LocationCapturer( point.log = location.longitude } - var userProperties = _propertiesModelStore.get() + var userProperties = _propertiesModelStore.model userProperties.locationLongitude = point.log userProperties.locationLatitude = point.lat userProperties.locationAccuracy = point.accuracy diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt index 06286f0771..4a45c9e617 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt @@ -31,22 +31,30 @@ import com.onesignal.R import com.onesignal.core.internal.application.ApplicationLifecycleHandlerBase import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.common.AndroidUtils +import com.onesignal.core.internal.common.events.EventProducer +import com.onesignal.core.internal.common.events.IEventNotifier import com.onesignal.core.internal.permissions.IRequestPermissionService import com.onesignal.core.internal.permissions.impl.AlertDialogPrepromptForAndroidSettings import com.onesignal.core.internal.startup.IStartableService import com.onesignal.onesignal.core.internal.common.suspend.WaiterWithValue +internal interface ILocationPermissionChangedHandler { + fun onLocationPermissionChanged(enabled: Boolean) +} + internal class LocationPermissionController( private val _application: IApplicationService, private val _requestPermission: IRequestPermissionService, private val _applicationService: IApplicationService ) : IRequestPermissionService.PermissionCallback, - IStartableService { + IStartableService, + IEventNotifier { companion object { private const val PERMISSION_TYPE = "LOCATION" } private val _waiter = WaiterWithValue() + private val _events = EventProducer() private var _currPermission: String = "" override fun start() { @@ -69,6 +77,7 @@ internal class LocationPermissionController( override fun onAccept() { _waiter.wake(true) + _events.fire { it.onLocationPermissionChanged(true) } } override fun onReject(fallbackToSettings: Boolean) { @@ -81,6 +90,7 @@ internal class LocationPermissionController( if (!fallbackShown) { _waiter.wake(false) + _events.fire { it.onLocationPermissionChanged(false) } } } @@ -97,16 +107,22 @@ internal class LocationPermissionController( override fun onFocus() { super.onFocus() _applicationService.removeApplicationLifecycleHandler(this) - _waiter.wake(AndroidUtils.hasPermission(_currPermission, true, _applicationService)) + val hasPermission = AndroidUtils.hasPermission(_currPermission, true, _applicationService) + _waiter.wake(hasPermission) + _events.fire { it.onLocationPermissionChanged(hasPermission) } } }) NavigateToAndroidSettingsForLocation.show(activity) } override fun onDecline() { _waiter.wake(false) + _events.fire { it.onLocationPermissionChanged(false) } } } ) return true } + + override fun subscribe(handler: ILocationPermissionChangedHandler) = _events.subscribe(handler) + override fun unsubscribe(handler: ILocationPermissionChangedHandler) = _events.subscribe(handler) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt index d959717666..006a6bace5 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt @@ -4,6 +4,7 @@ import android.app.Activity import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.backend.BackendException import com.onesignal.core.internal.common.events.EventProducer +import com.onesignal.core.internal.common.suspendifyOnMain import com.onesignal.core.internal.common.suspendifyOnThread import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.models.ConfigModelStore @@ -18,12 +19,10 @@ import com.onesignal.notification.internal.common.GenerateNotificationOpenIntent import com.onesignal.notification.internal.common.NotificationHelper import com.onesignal.notification.internal.data.INotificationRepository import com.onesignal.notification.internal.lifecycle.INotificationLifecycleService +import com.onesignal.notification.internal.permissions.INotificationPermissionChangedHandler import com.onesignal.notification.internal.permissions.INotificationPermissionController import com.onesignal.notification.internal.restoration.INotificationRestoreWorkManager import com.onesignal.notification.internal.summary.INotificationSummaryManager -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext -import kotlinx.coroutines.yield import org.json.JSONArray import org.json.JSONException import org.json.JSONObject @@ -51,7 +50,8 @@ internal class NotificationsManager( private val _summaryManager: INotificationSummaryManager ) : INotificationsManager, INotificationActivityOpener, - INotificationStateRefresher { + INotificationStateRefresher, + INotificationPermissionChangedHandler { override var permissionStatus: IPermissionState = PermissionState(false) override var unsubscribeWhenNotificationsAreDisabled: Boolean = false @@ -59,52 +59,42 @@ internal class NotificationsManager( private val _permissionChangedNotifier = EventProducer() init { + _notificationPermissionController.subscribe(this) suspendifyOnThread { _notificationDataController.deleteExpiredNotifications() } } + /** + * Called when app calls [requestPermission] and the user accepts/denies permission. + */ + override fun onNotificationPermissionChanged(enabled: Boolean) { + setPermissionStatusAndFire(enabled) + } + + /** + * Called when app has gained focus and the notification state should be refreshed. + */ override fun refreshNotificationState() { // ensure all notifications for this app have been restored to the notification panel _notificationRestoreWorkManager.beginEnqueueingWork(_applicationService.appContext, false) val isEnabled = NotificationHelper.areNotificationsEnabled(_applicationService.appContext) - - suspendifyOnThread { - setPermissionStatusAndFire(isEnabled) - } + setPermissionStatusAndFire(isEnabled) } override suspend fun requestPermission(): Boolean { Logging.debug("NotificationsManager.requestPermission()") - - // TODO: We do not yet handle the case where the activity is shown to the user, the application - // is killed, the app is re-opened (showing the permission activity), and the - // user makes a decision. Because the app is killed this flow is dead. - // NotificationPermissionController does still get the callback, the way it is structured, - // so we just need to figure out how to get it to tell us outside of us calling (weird). - val result = _notificationPermissionController.prompt(true) - - // if result is null that means the user has gone to app settings and may or may not do - // something there. However when they come back the application will be brought into - // focus and our application lifecycle handler will pick up any change that could have - // occurred. - setPermissionStatusAndFire(result) - - // yield to force a suspension. When there is no suspension and invoked via Java the - // continuation is never called (TODO: True?) - yield() - - return result + return _notificationPermissionController.prompt(true) } - private suspend fun setPermissionStatusAndFire(isEnabled: Boolean) { + private fun setPermissionStatusAndFire(isEnabled: Boolean) { val oldPermissionStatus = permissionStatus permissionStatus = PermissionState(isEnabled) if (oldPermissionStatus.notificationsEnabled != isEnabled) { // switch over to the main thread for the firing of the event - withContext(Dispatchers.Main) { + suspendifyOnMain { val changes = PermissionStateChanges(oldPermissionStatus, permissionStatus) _permissionChangedNotifier.fire { it.onPermissionChanged(changes) } } @@ -131,8 +121,7 @@ internal class NotificationsManager( val appId = if (json.has("app_id")) { json.getString("app_id") } else { - val config = _configModelStore.get() - config.appId ?: return JSONObject().put("error", "Missing app_id") + _configModelStore.model.appId } try { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt index df889ce5ea..9641d34eb0 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt @@ -19,7 +19,7 @@ internal class NotificationQueryHelper( OneSignalDbContract.NotificationTable.COLUMN_NAME_OPENED + " = 0 AND " + OneSignalDbContract.NotificationTable.COLUMN_NAME_IS_SUMMARY + " = 0" ) - val useTtl = _configModelStore.get().restoreTTLFilter + val useTtl = _configModelStore.model.restoreTTLFilter if (useTtl) { val expireTimeWhere = " AND " + OneSignalDbContract.NotificationTable.COLUMN_NAME_EXPIRE_TIME + " > " + currentTimeSec diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt index ee8f4269bb..685892b942 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt @@ -163,7 +163,7 @@ internal class NotificationGenerationProcessor( // If available TTL times comes in seconds, by default is 3 days in seconds private fun isNotificationWithinTTL(notification: Notification): Boolean { - val useTtl = _configModelStore.get().restoreTTLFilter + val useTtl = _configModelStore.model.restoreTTLFilter if (!useTtl) return true val currentTimeInSeconds = _time.currentTimeMillis / 1000 val sentTime = notification.sentTime diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt index a141aaba9e..afb70675d5 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt @@ -2,6 +2,8 @@ package com.onesignal.notification.internal.listeners import com.onesignal.core.internal.common.suspendifyOnThread import com.onesignal.core.internal.modeling.ISingletonModelStoreChangeHandler +import com.onesignal.core.internal.modeling.ModelChangeTags +import com.onesignal.core.internal.modeling.ModelChangedArgs import com.onesignal.core.internal.models.ConfigModel import com.onesignal.core.internal.models.ConfigModelStore import com.onesignal.core.internal.startup.IStartableService @@ -18,7 +20,13 @@ internal class ConfigModelStoreListener( _configModelStore.subscribe(this) } - override fun onModelReplaced(model: ConfigModel) { + override fun onModelReplaced(model: ConfigModel, tag: String) { + // we only need to do things when the config model was replaced + // via a hydration from the backend. + if (tag != ModelChangeTags.HYDRATE) { + return + } + // Refresh the notification permissions whenever we come back into focus _channelManager.processChannelList(model.notificationChannels) @@ -27,6 +35,6 @@ internal class ConfigModelStoreListener( } } - override fun onModelUpdated(model: ConfigModel, path: String, property: String, oldValue: Any?, newValue: Any?) { + override fun onModelUpdated(args: ModelChangedArgs, tag: String) { } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt index fa6354419b..ac610452c0 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt @@ -67,7 +67,7 @@ internal class NotificationListener( data: JSONArray, notificationId: String ) { - val config = _configModelStore.get() + val config = _configModelStore.model val appId: String = config.appId ?: "" val subscriptionId: String = _subscriptionManager.subscriptions.push?.id.toString() val deviceType = _deviceService.deviceType diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt index 9ee2768983..4a04225240 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt @@ -5,6 +5,7 @@ import com.onesignal.core.internal.user.ISubscriptionManager import com.onesignal.notification.internal.INotificationStateRefresher import com.onesignal.notification.internal.pushtoken.IPushTokenChangedHandler import com.onesignal.notification.internal.pushtoken.IPushTokenManager +import com.onesignal.notification.internal.registration.IPushRegistrator internal class PushTokenListener( private val _pushTokenManager: IPushTokenManager, @@ -16,12 +17,8 @@ internal class PushTokenListener( _pushTokenManager.subscribe(this) } - override fun onPushTokenChanged(pushToken: String?) { - if (pushToken == null || pushToken.isEmpty()) { - return - } - - _subscriptionManager.addOrUpdatePushSubscription(_pushTokenManager.pushToken) + override fun onPushTokenChanged(pushToken: String?, pushTokenStatus: IPushRegistrator.RegisterStatus) { + _subscriptionManager.addOrUpdatePushSubscription(pushToken, pushTokenStatus.value) _notificationStateRefresher.refreshNotificationState() } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt index 323cba85f4..be63db8d8e 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt @@ -178,7 +178,7 @@ internal class NotificationOpenedProcessor( intent.getIntExtra(NotificationConstants.BUNDLE_KEY_ANDROID_NOTIFICATION_ID, 0), dismissed, summaryGroup, - _configModelStore.get().clearGroupOnSummaryClick + _configModelStore.model.clearGroupOnSummaryClick ) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt index 975dacc7bd..ad489f98b2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt @@ -27,7 +27,9 @@ package com.onesignal.notification.internal.permissions -internal interface INotificationPermissionController { +import com.onesignal.core.internal.common.events.IEventNotifier + +internal interface INotificationPermissionController : IEventNotifier { /** * Prompt the user for notification permission. Note it is possible the application * will be killed while the permission prompt is being displayed to the user. When the @@ -42,3 +44,7 @@ internal interface INotificationPermissionController { */ suspend fun prompt(fallbackToSettings: Boolean): Boolean } + +internal interface INotificationPermissionChangedHandler { + fun onNotificationPermissionChanged(enabled: Boolean) +} diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt index 3b128c9d31..f44ede3c59 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt @@ -33,11 +33,14 @@ import com.onesignal.R import com.onesignal.core.internal.application.ApplicationLifecycleHandlerBase import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.common.AndroidUtils +import com.onesignal.core.internal.common.events.EventProducer import com.onesignal.core.internal.permissions.IRequestPermissionService import com.onesignal.core.internal.permissions.impl.AlertDialogPrepromptForAndroidSettings import com.onesignal.notification.internal.common.NotificationHelper +import com.onesignal.notification.internal.permissions.INotificationPermissionChangedHandler import com.onesignal.notification.internal.permissions.INotificationPermissionController import com.onesignal.onesignal.core.internal.common.suspend.WaiterWithValue +import kotlinx.coroutines.yield internal class NotificationPermissionController( private val _application: IApplicationService, @@ -47,6 +50,7 @@ internal class NotificationPermissionController( INotificationPermissionController { private val _waiter = WaiterWithValue() + private val _events = EventProducer() init { _requestPermission.registerAsCallback(PERMISSION_TYPE, this) @@ -70,6 +74,10 @@ internal class NotificationPermissionController( * to notify of the status. */ override suspend fun prompt(fallbackToSettings: Boolean): Boolean { + // yield to force a suspension. When there is no suspension the continuation will + // never be called + yield() + if (notificationsEnabled()) { return true } @@ -92,8 +100,12 @@ internal class NotificationPermissionController( return _waiter.waitForWake() } + override fun subscribe(handler: INotificationPermissionChangedHandler) = _events.subscribe(handler) + override fun unsubscribe(handler: INotificationPermissionChangedHandler) = _events.subscribe(handler) + override fun onAccept() { _waiter.wake(true) + _events.fire { it.onNotificationPermissionChanged(true) } } override fun onReject(fallbackToSettings: Boolean) { @@ -106,6 +118,7 @@ internal class NotificationPermissionController( if (!fallbackShown) { _waiter.wake(false) + _events.fire { it.onNotificationPermissionChanged(false) } } } @@ -124,13 +137,16 @@ internal class NotificationPermissionController( override fun onFocus() { super.onFocus() _applicationService.removeApplicationLifecycleHandler(this) - _waiter.wake(AndroidUtils.hasPermission(ANDROID_PERMISSION_STRING, true, _applicationService)) + val hasPermission = AndroidUtils.hasPermission(ANDROID_PERMISSION_STRING, true, _applicationService) + _waiter.wake(hasPermission) + _events.fire { it.onNotificationPermissionChanged(hasPermission) } } }) NavigateToAndroidSettingsForNotifications.show(activity) } override fun onDecline() { _waiter.wake(false) + _events.fire { it.onNotificationPermissionChanged(false) } } } ) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt index 45a8f8cf38..b993b1eb4d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt @@ -1,14 +1,15 @@ package com.onesignal.notification.internal.pushtoken import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.notification.internal.registration.IPushRegistrator internal interface IPushTokenManager : IEventNotifier { /** The push token for this device **/ val pushToken: String? - + val pushTokenStatus: IPushRegistrator.RegisterStatus suspend fun retrievePushToken() } internal interface IPushTokenChangedHandler { - fun onPushTokenChanged(pushToken: String?) + fun onPushTokenChanged(pushToken: String?, pushTokenStatus: IPushRegistrator.RegisterStatus) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt index b63884aec4..d4ffb9ec17 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt @@ -1,6 +1,8 @@ package com.onesignal.notification.internal.pushtoken import com.onesignal.core.internal.common.events.EventProducer +import com.onesignal.core.internal.device.IDeviceService +import com.onesignal.core.internal.logging.Logging import com.onesignal.notification.internal.registration.IPushRegistrator /** @@ -8,38 +10,54 @@ import com.onesignal.notification.internal.registration.IPushRegistrator * on the current device (not the user). */ internal class PushTokenManager( - private val _pushRegistrator: IPushRegistrator + private val _pushRegistrator: IPushRegistrator, + private val _deviceService: IDeviceService ) : IPushTokenManager { private val _pushTokenChangedNotifier = EventProducer() + + override var pushTokenStatus: IPushRegistrator.RegisterStatus = IPushRegistrator.RegisterStatus.PUSH_STATUS_SUBSCRIBED override var pushToken: String? = null override suspend fun retrievePushToken() { - // if there's already a push token, nothing to do. - if (pushToken != null) { - return - } + when (_deviceService.androidSupportLibraryStatus) { + IDeviceService.AndroidSupportLibraryStatus.MISSING -> { + Logging.fatal("Could not find the Android Support Library. Please make sure it has been correctly added to your project.") + pushTokenStatus = IPushRegistrator.RegisterStatus.PUSH_STATUS_MISSING_ANDROID_SUPPORT_LIBRARY + } + IDeviceService.AndroidSupportLibraryStatus.OUTDATED -> { + Logging.fatal("The included Android Support Library is to old or incomplete. Please update to the 26.0.0 revision or newer.") + pushTokenStatus = IPushRegistrator.RegisterStatus.PUSH_STATUS_OUTDATED_ANDROID_SUPPORT_LIBRARY + } + else -> { + val registerResult = _pushRegistrator.registerForPush() - val registerResult = _pushRegistrator.registerForPush() - - if (registerResult.status < IPushRegistrator.RegisterStatus.PUSH_STATUS_SUBSCRIBED) { - // Only allow errored subscribableStatuses if we have never gotten a token. - // This ensures the device will not later be marked unsubscribed due to a - // any inconsistencies returned by Google Play services. - // Also do not override a config error status if we got a runtime error -// TODO if (OneSignalStateSynchronizer.getRegistrationId() == null && -// (OneSignal.subscribableStatus == UserState.PUSH_STATUS_SUBSCRIBED || -// OneSignal.pushStatusRuntimeError(OneSignal.subscribableStatus)) -// ) OneSignal.subscribableStatus = status - } -// TODO else if (OneSignal.pushStatusRuntimeError(OneSignal.subscribableStatus)) -// OneSignal.subscribableStatus = status + if (registerResult.status.value < IPushRegistrator.RegisterStatus.PUSH_STATUS_SUBSCRIBED.value) { + // Only allow errored statuses if we have never gotten a token. This ensures the + // device will not later be marked unsubscribed due to any inconsistencies returned + // by Google Play services. Also do not override a config error status if we got a + // runtime error + if (pushToken == null && + ( + pushTokenStatus == IPushRegistrator.RegisterStatus.PUSH_STATUS_SUBSCRIBED || + pushStatusRuntimeError(pushTokenStatus) + ) + ) { + pushTokenStatus = registerResult.status + } + } else if (pushStatusRuntimeError(pushTokenStatus)) { + pushTokenStatus = registerResult.status + } - // TODO: What if no result or the push registration fails? - if (registerResult.status == IPushRegistrator.RegisterStatus.PUSH_STATUS_SUBSCRIBED) { - pushToken = registerResult.id!! - _pushTokenChangedNotifier.fire { it.onPushTokenChanged(pushToken) } + pushToken = registerResult.id + } } + + _pushTokenChangedNotifier.fire { it.onPushTokenChanged(pushToken, pushTokenStatus) } + } + + private fun pushStatusRuntimeError(status: IPushRegistrator.RegisterStatus): Boolean { + return status.value < -6 } override fun subscribe(handler: IPushTokenChangedHandler) = _pushTokenChangedNotifier.subscribe(handler) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt index 122b93b6b4..7697d14000 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt @@ -29,12 +29,12 @@ internal class ReceiveReceiptWorkManager( private val maxDelay = 25 override fun enqueueReceiveReceipt(notificationId: String) { - if (!_configModelStore.get().receiveReceiptEnabled) { + if (!_configModelStore.model.receiveReceiptEnabled) { Logging.debug("sendReceiveReceipt disabled") return } - val appId: String = _configModelStore.get().appId + val appId: String = _configModelStore.model.appId val subscriptionId: String? = _subscriptionManager.subscriptions.push?.id if (subscriptionId == null || appId.isEmpty()) { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt index 3a6c5b171f..bcd0a1bd8d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt @@ -43,7 +43,7 @@ internal class GooglePlayServicesUpgradePrompt( return } - if (!isGooglePlayStoreInstalled || _configModelStore.get().disableGMSMissingPrompt) { + if (!isGooglePlayStoreInstalled || _configModelStore.model.disableGMSMissingPrompt) { return } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt index eb22f0934f..6ade3fae39 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt @@ -50,14 +50,19 @@ internal abstract class PushRegistratorAbstractGoogle( abstract suspend fun getToken(senderId: String): String override suspend fun registerForPush(): IPushRegistrator.RegisterResult { - return if (!isValidProjectNumber(_configModelStore.get().googleProjectNumber)) { + if (!_deviceService.hasFCMLibrary) { + Logging.fatal("The Firebase FCM library is missing! Please make sure to include it in your project.") + return IPushRegistrator.RegisterResult(null, IPushRegistrator.RegisterStatus.PUSH_STATUS_MISSING_FIREBASE_FCM_LIBRARY) + } + + return if (!isValidProjectNumber(_configModelStore.model.googleProjectNumber)) { Logging.error("Missing Google Project number!\nPlease enter a Google Project number / Sender ID on under App Settings > Android > Configuration on the OneSignal dashboard.") IPushRegistrator.RegisterResult( null, IPushRegistrator.RegisterStatus.PUSH_STATUS_INVALID_FCM_SENDER_ID ) } else { - internalRegisterForPush(_configModelStore.get().googleProjectNumber!!) + internalRegisterForPush(_configModelStore.model.googleProjectNumber!!) } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt index 59f8cc3dfa..5103c9fd27 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt @@ -48,7 +48,7 @@ internal class PushRegistratorFCM( get() = "FCM" init { - val fcpParams = _configModelStore.get().fcmParams + val fcpParams = _configModelStore.model.fcmParams this.projectId = fcpParams.projectId ?: FCM_DEFAULT_PROJECT_ID this.appId = fcpParams.appId ?: FCM_DEFAULT_APP_ID diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt index 72438a4b8e..f40f236c87 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt @@ -91,7 +91,7 @@ internal class NotificationSummaryManager( // Obtain the most recent notification id val mostRecentId = _dataController.getAndroidIdForGroup(group, false) if (mostRecentId != null) { - val shouldDismissAll = _configModelStore.get().clearGroupOnSummaryClick + val shouldDismissAll = _configModelStore.model.clearGroupOnSummaryClick if (shouldDismissAll) { val groupId = if (group == NotificationHelper.grouplessSummaryKey) { // If the group is groupless, obtain the hardcoded groupless summary id From 4bdaa8b4bb74777619df7a3a6c937ff84c45c7c7 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 20 Oct 2022 10:43:41 -0400 Subject: [PATCH 002/196] [User Model] Visual logging and other TODOs * Implement visual logging * Remove IInfluenceManager.addSessionData which is no longer required, as session influence is captured via outcome. * Ensure IAM repository is cleaned on startup. * Create dummy IAMManager when <4.4 --- .../onesignal/core/internal/OneSignalImp.kt | 8 ++- .../internal/influence/IInfluenceManager.kt | 5 -- .../internal/influence/impl/ChannelTracker.kt | 1 - .../influence/impl/InAppMessageTracker.kt | 6 -- .../influence/impl/InfluenceManager.kt | 12 ---- .../influence/impl/NotificationTracker.kt | 11 ---- .../core/internal/logging/Logging.kt | 58 ++++++++++-------- .../internal/purchases/TrackAmazonPurchase.kt | 5 +- .../onesignal/iam/internal/DummyIAMManager.kt | 15 +++++ .../com/onesignal/iam/internal/IAMManager.kt | 2 + .../com/onesignal/iam/internal/IAMModule.kt | 59 +++++++++++-------- .../internal/repositories/IInAppRepository.kt | 1 - 12 files changed, 94 insertions(+), 89 deletions(-) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt index ecabdca169..b29ae29b72 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt @@ -99,7 +99,7 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { private var _givenPrivacyConsent: Boolean? = null init { - var serviceBuilder = ServiceBuilder() + val serviceBuilder = ServiceBuilder() CoreModule.register(serviceBuilder) NotificationModule.register(serviceBuilder) @@ -120,7 +120,11 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { // start the application service. This is called explicitly first because we want // to make sure it has the context provided on input, for all other startable services // to depend on if needed. - (_services.getService() as ApplicationService).start(context) + val applicationService = _services.getService() + (applicationService as ApplicationService).start(context) + + // Give the logging singleton access to the application service to support visual logging. + Logging.applicationService = applicationService // get the current config model, if there is one _configModel = _services.getService().model diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/IInfluenceManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/IInfluenceManager.kt index 06f749225b..1cb59b6be9 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/IInfluenceManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/IInfluenceManager.kt @@ -1,7 +1,5 @@ package com.onesignal.core.internal.influence -import org.json.JSONObject - internal interface IInfluenceManager { /** @@ -9,9 +7,6 @@ internal interface IInfluenceManager { */ val influences: List - // TODO: This needs to be called by FocusTimeController. - fun addSessionData(jsonObject: JSONObject, influences: List) - /** * Indicate a notification has been received by the SDK. * diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/ChannelTracker.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/ChannelTracker.kt index f4f69101d4..942e0a1de5 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/ChannelTracker.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/ChannelTracker.kt @@ -21,7 +21,6 @@ internal abstract class ChannelTracker internal constructor(protected var dataRe abstract fun getLastChannelObjectsReceivedByNewId(id: String?): JSONArray abstract fun saveChannelObjects(channelObjects: JSONArray) abstract fun initInfluencedTypeFromCache() - abstract fun addSessionData(jsonObject: JSONObject, influence: Influence) private val isDirectSessionEnabled: Boolean get() = dataRepository.isDirectInfluenceEnabled diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InAppMessageTracker.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InAppMessageTracker.kt index 9b30fe567c..7b815094ac 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InAppMessageTracker.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InAppMessageTracker.kt @@ -1,13 +1,11 @@ package com.onesignal.core.internal.influence.impl -import com.onesignal.core.internal.influence.Influence import com.onesignal.core.internal.influence.InfluenceChannel import com.onesignal.core.internal.influence.InfluenceType import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.time.ITime import org.json.JSONArray import org.json.JSONException -import org.json.JSONObject internal class InAppMessageTracker(dataRepository: InfluenceDataRepository, timeProvider: ITime) : ChannelTracker(dataRepository, timeProvider) { override val idTag: String @@ -62,10 +60,6 @@ internal class InAppMessageTracker(dataRepository: InfluenceDataRepository, time Logging.debug("InAppMessageTracker.initInfluencedTypeFromCache: $this") } - override fun addSessionData(jsonObject: JSONObject, influence: Influence) { - // In app message don't influence the session - } - override fun cacheState() { // We only need to cache INDIRECT and UNATTRIBUTED influence types // DIRECT is downgrade to INDIRECT to avoid inconsistency state diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InfluenceManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InfluenceManager.kt index 5535dd3bf3..f26b77f73e 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InfluenceManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/InfluenceManager.kt @@ -66,17 +66,6 @@ internal class InfluenceManager( override fun onSessionEnded(duration: Long) { } - override fun addSessionData(jsonObject: JSONObject, influences: List) { - influences.forEach { - when (it.influenceChannel) { - InfluenceChannel.NOTIFICATION -> trackers[InfluenceConstants.NOTIFICATION_TAG]!!.addSessionData(jsonObject, it) - InfluenceChannel.IAM -> { - // IAM doesn't influence session - } - } - } - } - private fun getChannelByEntryAction(entryAction: AppEntryAction): IChannelTracker? { return if (entryAction.isNotificationClick) notificationChannelTracker else null } @@ -248,6 +237,5 @@ internal class InfluenceManager( } Logging.debug("InfluenceManager.attemptSessionUpgrade: Trackers after update attempt: $channels") - // TODO: FocusTimeController needs the influencesToEnd data. } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/NotificationTracker.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/NotificationTracker.kt index a308b130f3..20851fc0cb 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/NotificationTracker.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/influence/impl/NotificationTracker.kt @@ -49,17 +49,6 @@ internal class NotificationTracker(dataRepository: InfluenceDataRepository, time Logging.debug("NotificationTracker.initInfluencedTypeFromCache: $this") } - override fun addSessionData(jsonObject: JSONObject, influence: Influence) { - if (influence.influenceType.isAttributed()) { - try { - jsonObject.put(InfluenceConstants.DIRECT_TAG, influence.influenceType.isDirect()) - jsonObject.put(InfluenceConstants.NOTIFICATIONS_IDS, influence.ids) - } catch (exception: JSONException) { - Logging.error("Generating notification tracker addSessionData JSONObject ", exception) - } - } - } - override fun cacheState() { dataRepository.cacheNotificationInfluenceType(influenceType ?: InfluenceType.UNATTRIBUTED) dataRepository.cacheNotificationOpenId(directId) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/logging/Logging.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/logging/Logging.kt index 53cde88efe..0225148dae 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/logging/Logging.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/logging/Logging.kt @@ -1,15 +1,22 @@ package com.onesignal.core.internal.logging +import android.app.AlertDialog import com.onesignal.core.debug.LogLevel +import com.onesignal.core.internal.application.IApplicationService +import com.onesignal.core.internal.common.suspendifyOnMain +import java.io.PrintWriter +import java.io.StringWriter internal object Logging { private const val TAG = "OneSignal" + var applicationService: IApplicationService? = null + @JvmStatic var logLevel = LogLevel.WARN @JvmStatic - var visualLogLevel = LogLevel.WARN + var visualLogLevel = LogLevel.NONE @JvmStatic fun atLogLevel(level: LogLevel): Boolean { @@ -63,27 +70,32 @@ internal object Logging { LogLevel.ERROR, LogLevel.FATAL -> android.util.Log.e(TAG, message, throwable) } } -// TODO: Implement -// if (level.compareTo(logLevel) < 1 && OneSignal.getCurrentActivity() != null) { -// try { -// var fullMessage: String? = "$message\n".trimIndent() -// if (throwable != null) { -// fullMessage += throwable.message -// val sw = StringWriter() -// val pw = PrintWriter(sw) -// throwable.printStackTrace(pw) -// fullMessage += sw.toString() -// } -// val finalFullMessage = fullMessage -// OSUtils.runOnMainUIThread(Runnable { -// if (OneSignal.getCurrentActivity() != null) AlertDialog.Builder(OneSignal.getCurrentActivity()) -// .setTitle(level.toString()) -// .setMessage(finalFullMessage) -// .show() -// }) -// } catch (t: Throwable) { -// android.util.Log.e(TAG, "Error showing logging message.", t) -// } -// } + + if (level.compareTo(visualLogLevel) < 1 && applicationService?.current != null) { + try { + var fullMessage: String? = "$message\n".trimIndent() + if (throwable != null) { + fullMessage += throwable.message + val sw = StringWriter() + val pw = PrintWriter(sw) + throwable.printStackTrace(pw) + fullMessage += sw.toString() + } + val finalFullMessage = fullMessage + + suspendifyOnMain { + val currentActivity = applicationService?.current + if (currentActivity != null) { + AlertDialog.Builder(currentActivity) + .setTitle(level.toString()) + .setMessage(finalFullMessage) + .show() + } + } + + } catch (t: Throwable) { + android.util.Log.e(TAG, "Error showing logging message.", t) + } + } } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackAmazonPurchase.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackAmazonPurchase.kt index 39d1f548a8..49f850d9e6 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackAmazonPurchase.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/TrackAmazonPurchase.kt @@ -165,6 +165,7 @@ internal class TrackAmazonPurchase( ProductDataResponse.RequestStatus.SUCCESSFUL -> { val purchasesToReport = mutableListOf() val products = response.productData + var amountSpent = BigDecimal(0) for (key in products.keys) { val product = products[key] val sku = product!!.sku @@ -177,11 +178,11 @@ internal class TrackAmazonPurchase( val price = BigDecimal(priceStr) + amountSpent += price purchasesToReport.add(PurchaseInfo(sku, iso, price)) } - // TODO: amount spent? - _operationRepo.enqueue(TrackPurchaseOperation(_configModelStore.model.appId, _identityModelStore.model.onesignalId, false, BigDecimal(0), purchasesToReport)) + _operationRepo.enqueue(TrackPurchaseOperation(_configModelStore.model.appId, _identityModelStore.model.onesignalId, false, amountSpent, purchasesToReport)) } } } else if (orgPurchasingListener != null) { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt new file mode 100644 index 0000000000..75eab461c8 --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt @@ -0,0 +1,15 @@ +package com.onesignal.iam.internal + +import com.onesignal.iam.IIAMManager +import com.onesignal.iam.IInAppMessageClickHandler +import com.onesignal.iam.IInAppMessageLifecycleHandler + +internal class DummyIAMManager : IIAMManager { + override var paused: Boolean = true + + override fun setInAppMessageLifecycleHandler(handler: IInAppMessageLifecycleHandler?) { + } + + override fun setInAppMessageClickHandler(handler: IInAppMessageClickHandler?) { + } +} diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt index 766d4e3d83..cb8651935b 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt @@ -124,6 +124,8 @@ internal class IAMManager( _sessionService.subscribe(this) suspendifyOnThread { + _repository.cleanCachedInAppMessages() + // get saved IAMs from database _redisplayedInAppMessages.addAll(_repository.listInAppMessages()) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMModule.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMModule.kt index e3bcbb4d1b..63c72dbde5 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMModule.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMModule.kt @@ -1,5 +1,6 @@ package com.onesignal.iam.internal +import android.os.Build import com.onesignal.core.internal.service.ServiceBuilder import com.onesignal.core.internal.startup.IStartableService import com.onesignal.iam.IIAMManager @@ -24,31 +25,37 @@ import com.onesignal.iam.internal.triggers.impl.TriggerController internal object IAMModule { fun register(builder: ServiceBuilder) { - // Low level services - builder.register().provides() - builder.register().provides() - builder.register().provides() - builder.register().provides() - builder.register().provides() - builder.register().provides() - - // Triggers - builder.register().provides() - builder.register().provides() // observer - - // Display - builder.register().provides() - - // Previews - builder.register().provides() - - // Prompts - builder.register().provides() - - builder.register() - .provides() - .provides() - - // TODO: Only Android 4.4 can use IAMS (see OSInAppMessageDummyController) + // Make sure only Android 4.4 devices and higher can use IAMs + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) { + builder.register() + .provides() + } + else { + // Low level services + builder.register().provides() + builder.register().provides() + builder.register().provides() + builder.register().provides() + builder.register().provides() + builder.register().provides() + + // Triggers + builder.register().provides() + builder.register() + .provides() // observer + + // Display + builder.register().provides() + + // Previews + builder.register().provides() + + // Prompts + builder.register().provides() + + builder.register() + .provides() + .provides() + } } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt index c994f2eeb9..11c6e60d66 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt @@ -24,6 +24,5 @@ internal interface IInAppRepository { /** * Clean up (delete) all stale in app messages. */ - // TODO: This needs to be driven suspend fun cleanCachedInAppMessages() } From 96fb6c45628d80a60ade5f80c2038a6688d94467 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 20 Oct 2022 13:04:19 -0400 Subject: [PATCH 003/196] [User Model] Session Manager * Move outcome calls over to new ISessionManager (OneSignal.session) * Add OneSignal.disableGMSMissingPrompt --- .../sdktest/model/MainActivityViewModel.java | 6 +-- .../main/java/com/onesignal/core/Continue.kt | 3 ++ .../java/com/onesignal/core/IOneSignal.kt | 11 +++++ .../main/java/com/onesignal/core/OneSignal.kt | 41 ++++++++++++++++-- .../com/onesignal/core/internal/CoreModule.kt | 3 ++ .../onesignal/core/internal/OneSignalImp.kt | 16 +++++++ .../core/internal/session/SessionManager.kt | 42 +++++++++++++++++++ .../core/internal/user/UserManager.kt | 35 +--------------- .../onesignal/core/session/ISessionManager.kt | 37 ++++++++++++++++ .../com/onesignal/core/user/IUserManager.kt | 37 ++-------------- 10 files changed, 157 insertions(+), 74 deletions(-) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/session/SessionManager.kt create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/session/ISessionManager.kt diff --git a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java index 6374068ffa..a1133f8a62 100644 --- a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java +++ b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java @@ -650,10 +650,10 @@ private void setupOutcomeLayout() { public boolean onSuccess(OutcomeEvent outcomeEvent, String name, String value) { switch (outcomeEvent) { case OUTCOME: - OneSignal.getUser().sendOutcome(name); + OneSignal.getSession().sendOutcome(name); break; case UNIQUE_OUTCOME: - OneSignal.getUser().sendUniqueOutcome(name); + OneSignal.getSession().sendUniqueOutcome(name); break; case OUTCOME_WITH_VALUE: if (value.isEmpty()) { @@ -661,7 +661,7 @@ public boolean onSuccess(OutcomeEvent outcomeEvent, String name, String value) { return false; } - OneSignal.getUser().sendOutcomeWithValue(name, Float.parseFloat(value)); + OneSignal.getSession().sendOutcomeWithValue(name, Float.parseFloat(value)); break; } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/Continue.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/Continue.kt index c5ae7fdf93..9e969422d6 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/Continue.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/Continue.kt @@ -1,5 +1,7 @@ package com.onesignal.core +import android.os.Build +import androidx.annotation.RequiresApi import kotlinx.coroutines.Dispatchers import java.util.function.Consumer import kotlin.coroutines.Continuation @@ -57,6 +59,7 @@ object Continue { * @return The [Continuation] which should be provided to the Kotlin coroutine, and will be executed * once that coroutine has completed. */ + @RequiresApi(Build.VERSION_CODES.N) @JvmOverloads @JvmStatic fun with(onFinished: Consumer>, context: CoroutineContext = Dispatchers.Main): Continuation { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/IOneSignal.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/IOneSignal.kt index 223975bdc2..b8de03d29e 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/IOneSignal.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/IOneSignal.kt @@ -4,6 +4,7 @@ import android.content.Context import com.onesignal.core.OneSignal.login import com.onesignal.core.OneSignal.user import com.onesignal.core.debug.IDebugManager +import com.onesignal.core.session.ISessionManager import com.onesignal.core.user.IUserManager import com.onesignal.iam.IIAMManager import com.onesignal.location.ILocationManager @@ -26,6 +27,11 @@ interface IOneSignal { */ val user: IUserManager + /** + * The session manager for accessing session-scoped management. + */ + val session: ISessionManager + /** * The notification manager for accessing device-scoped * notification management. @@ -66,6 +72,11 @@ interface IOneSignal { */ var privacyConsent: Boolean + /** + * Whether to disable the "GMS is missing" prompt to the user. + */ + var disableGMSMissingPrompt: Boolean + /** * Initialize the OneSignal SDK. This should be called during startup of the application. * diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/OneSignal.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/OneSignal.kt index 7a25001945..35a87c66be 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/OneSignal.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/OneSignal.kt @@ -4,6 +4,7 @@ import android.content.Context import com.onesignal.core.debug.IDebugManager import com.onesignal.core.internal.OneSignalImp import com.onesignal.core.internal.service.IServiceProvider +import com.onesignal.core.session.ISessionManager import com.onesignal.core.user.IUserManager import com.onesignal.iam.IIAMManager import com.onesignal.location.ILocationManager @@ -44,6 +45,14 @@ object OneSignal { val user: IUserManager get() = oneSignal.user + /** + * The session manager for accessing session-scoped management. Initialized only after [initWithContext] + * has been called. + */ + @JvmStatic + val session: ISessionManager + get() = oneSignal.session + /** * The notification manager for accessing device-scoped notification management. Initialized * only after [initWithContext] has been called. @@ -98,6 +107,14 @@ object OneSignal { get() = oneSignal.privacyConsent set(value) { oneSignal.privacyConsent = value } + /** + * Whether to disable the "GMS is missing" prompt to the user. + */ + @JvmStatic + var disableGMSMissingPrompt: Boolean + get() = oneSignal.disableGMSMissingPrompt + set(value) { oneSignal.disableGMSMissingPrompt = value } + /** * Initialize the OneSignal SDK. This should be called during startup of the application. * @@ -126,13 +143,31 @@ object OneSignal { * because both Push and IAM are owned by the device. * * @param externalId The external ID of the user that is to be logged in. - * @param jwtBearerToken The optional JWT bearer token generated by your backend to establish - * trust for the login operation. Required when identity verification has been enabled. See - * [Identity Verification | OneSignal](https://documentation.onesignal.com/docs/identity-verification) */ @JvmStatic suspend fun login(externalId: String) = oneSignal.login(externalId) + /** + * Login to OneSignal under the user identified by the [externalId] provided. The act of + * logging a user into the OneSignal SDK will switch the [user] context to that specific user. + * + * * If the [externalId] exists the user will be retrieved and the context set from that + * user information. If operations have already been performed under a guest user, they + * *will not* be applied to the now logged in user (they will be lost). + * * If the [externalId] does not exist the user will be created and the context set from + * the current local state. If operations have already been performed under a guest user + * those operations *will* be applied to the newly created user. + * + * *Push Notifications and In App Messaging* + * Logging in a new user will automatically transfer push notification and in app messaging + * subscriptions from the current user (if there is one) to the newly logged in user. This is + * because both Push and IAM are owned by the device. + * + * @param externalId The external ID of the user that is to be logged in. + * @param jwtBearerToken The optional JWT bearer token generated by your backend to establish + * trust for the login operation. Required when identity verification has been enabled. See + * [Identity Verification | OneSignal](https://documentation.onesignal.com/docs/identity-verification) + */ @JvmStatic suspend fun login(externalId: String, jwtBearerToken: String? = null) = oneSignal.login(externalId, jwtBearerToken) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt index 9f9de2f839..db0f6bca18 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt @@ -59,6 +59,7 @@ import com.onesignal.core.internal.purchases.TrackAmazonPurchase import com.onesignal.core.internal.purchases.TrackGooglePurchase import com.onesignal.core.internal.service.ServiceBuilder import com.onesignal.core.internal.session.ISessionService +import com.onesignal.core.internal.session.SessionManager import com.onesignal.core.internal.session.impl.SessionService import com.onesignal.core.internal.startup.IBootstrapService import com.onesignal.core.internal.startup.IStartableService @@ -68,6 +69,7 @@ import com.onesignal.core.internal.time.Time import com.onesignal.core.internal.user.ISubscriptionManager import com.onesignal.core.internal.user.SubscriptionManager import com.onesignal.core.internal.user.UserManager +import com.onesignal.core.session.ISessionManager import com.onesignal.core.user.IUserManager internal object CoreModule { @@ -121,6 +123,7 @@ internal object CoreModule { .provides() .provides() builder.register().provides() + builder.register().provides() // Background builder.register() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt index ecabdca169..82c1fcd7df 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/OneSignalImp.kt @@ -29,6 +29,7 @@ import com.onesignal.core.internal.service.IServiceProvider import com.onesignal.core.internal.service.ServiceBuilder import com.onesignal.core.internal.service.ServiceProvider import com.onesignal.core.internal.startup.StartupService +import com.onesignal.core.session.ISessionManager import com.onesignal.core.user.IUserManager import com.onesignal.iam.IIAMManager import com.onesignal.iam.internal.IAMModule @@ -55,7 +56,15 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { _configModel?.givenPrivacyConsent = value } + override var disableGMSMissingPrompt: Boolean + get() = _configModel?.disableGMSMissingPrompt ?: (_disableGMSMissingPrompt == true) + set(value) { + _disableGMSMissingPrompt = value + _configModel?.disableGMSMissingPrompt = value + } + override val debug: IDebugManager = DebugManager() + override val session: ISessionManager get() = if (isInitialized) _session!! else throw Exception("Must call 'initWithContext' before use") override val notifications: INotificationsManager get() = if (isInitialized) _notifications!! else throw Exception("Must call 'initWithContext' before use") override val location: ILocationManager get() = if (isInitialized) _location!! else throw Exception("Must call 'initWithContext' before use") override val iam: IIAMManager get() = if (isInitialized) _iam!! else throw Exception("Must call 'initWithContext' before use") @@ -82,6 +91,7 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { // Services required by this class private var _user: IUserManager? = null private var _hasCreatedBackendUser: Boolean = false + private var _session: ISessionManager? = null private var _iam: IIAMManager? = null private var _location: ILocationManager? = null private var _notifications: INotificationsManager? = null @@ -97,6 +107,7 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { private var _sessionModel: SessionModel? = null private var _requiresPrivacyConsent: Boolean? = null private var _givenPrivacyConsent: Boolean? = null + private var _disableGMSMissingPrompt: Boolean? = null init { var serviceBuilder = ServiceBuilder() @@ -141,9 +152,14 @@ internal class OneSignalImp : IOneSignal, IServiceProvider { _configModel!!.givenPrivacyConsent = _givenPrivacyConsent!! } + if (_disableGMSMissingPrompt != null) { + _configModel!!.disableGMSMissingPrompt = _disableGMSMissingPrompt!! + } + // "Inject" the services required by this main class _location = _services.getService() _user = _services.getService() + _session = _services.getService() _iam = _services.getService() _notifications = _services.getService() _operationRepo = _services.getService() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/session/SessionManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/session/SessionManager.kt new file mode 100644 index 0000000000..91aba36952 --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/session/SessionManager.kt @@ -0,0 +1,42 @@ +package com.onesignal.core.internal.session + +import com.onesignal.core.debug.LogLevel +import com.onesignal.core.internal.common.suspendifyOnThread +import com.onesignal.core.internal.logging.Logging +import com.onesignal.core.internal.outcomes.IOutcomeEventsController +import com.onesignal.core.session.ISessionManager + +internal open class SessionManager( + private val _outcomeController: IOutcomeEventsController +) : ISessionManager { + + override fun sendOutcome(name: String): ISessionManager { + Logging.log(LogLevel.DEBUG, "sendOutcome(name: $name)") + + suspendifyOnThread { + _outcomeController.sendOutcomeEvent(name) + } + + return this + } + + override fun sendUniqueOutcome(name: String): ISessionManager { + Logging.log(LogLevel.DEBUG, "sendUniqueOutcome(name: $name)") + + suspendifyOnThread { + _outcomeController.sendUniqueOutcomeEvent(name) + } + + return this + } + + override fun sendOutcomeWithValue(name: String, value: Float): ISessionManager { + Logging.log(LogLevel.DEBUG, "sendOutcomeWithValue(name: $name, value: $value)") + + suspendifyOnThread { + _outcomeController.sendOutcomeEventWithValue(name, value) + } + + return this + } +} diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/UserManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/UserManager.kt index ba0f3153a6..5caae70aa8 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/UserManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/UserManager.kt @@ -2,7 +2,6 @@ package com.onesignal.core.internal.user import com.onesignal.core.debug.LogLevel import com.onesignal.core.internal.backend.IdentityConstants -import com.onesignal.core.internal.common.suspendifyOnThread import com.onesignal.core.internal.language.ILanguageContext import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.models.IdentityModel @@ -11,7 +10,6 @@ import com.onesignal.core.internal.models.PropertiesModel import com.onesignal.core.internal.models.PropertiesModelStore import com.onesignal.core.internal.models.TriggerModel import com.onesignal.core.internal.models.TriggerModelStore -import com.onesignal.core.internal.outcomes.IOutcomeEventsController import com.onesignal.core.user.IUserManager import com.onesignal.core.user.subscriptions.SubscriptionList @@ -20,8 +18,7 @@ internal open class UserManager( private val _identityModelStore: IdentityModelStore, private val _propertiesModelStore: PropertiesModelStore, private val _triggerModelStore: TriggerModelStore, - private val _languageContext: ILanguageContext, - private val _outcomeController: IOutcomeEventsController + private val _languageContext: ILanguageContext ) : IUserManager { override val externalId: String? @@ -184,34 +181,4 @@ internal open class UserManager( _triggerModelStore.clear() return this } - - override fun sendOutcome(name: String): IUserManager { - Logging.log(LogLevel.DEBUG, "sendOutcome(name: $name)") - - suspendifyOnThread { - _outcomeController.sendOutcomeEvent(name) - } - - return this - } - - override fun sendUniqueOutcome(name: String): IUserManager { - Logging.log(LogLevel.DEBUG, "sendUniqueOutcome(name: $name)") - - suspendifyOnThread { - _outcomeController.sendUniqueOutcomeEvent(name) - } - - return this - } - - override fun sendOutcomeWithValue(name: String, value: Float): IUserManager { - Logging.log(LogLevel.DEBUG, "sendOutcomeWithValue(name: $name, value: $value)") - - suspendifyOnThread { - _outcomeController.sendOutcomeEventWithValue(name, value) - } - - return this - } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/session/ISessionManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/session/ISessionManager.kt new file mode 100644 index 0000000000..a8ad387a5a --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/session/ISessionManager.kt @@ -0,0 +1,37 @@ +package com.onesignal.core.session + +/** + * The OneSignal session manager is responsible for managing the current session state. + */ +interface ISessionManager { + /** + * Send an outcome with the provided name, captured against the current session. + * See [Outcomes | OneSignal] (https://documentation.onesignal.com/docs/outcomes) + * + * @param name The name of the outcome that has occurred. + * + * @return this user manager to allow for chaining of calls. + */ + fun sendOutcome(name: String): ISessionManager + + /** + * Send a unique outcome with the provided name, captured against the current session. + * See [Outcomes | OneSignal] (https://documentation.onesignal.com/docs/outcomes) + * + * @param name The name of the unique outcome that has occurred. + * + * @return this user manager to allow for chaining of calls. + */ + fun sendUniqueOutcome(name: String): ISessionManager + + /** + * Send an outcome with the provided name and value, captured against the current session. + * See [Outcomes | OneSignal] (https://documentation.onesignal.com/docs/outcomes) + * + * @param name The name of the outcome that has occurred. + * @param value The value tied to the outcome. + * + * @return this user manager to allow for chaining of calls. + */ + fun sendOutcomeWithValue(name: String, value: Float): ISessionManager +} diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/user/IUserManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/user/IUserManager.kt index 57e3183bd5..99a9a66e07 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/user/IUserManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/user/IUserManager.kt @@ -5,9 +5,9 @@ import com.onesignal.core.user.subscriptions.SubscriptionList /** * The OneSignal user manager is responsible for managing the current user state. When - * an app starts up for the first time, it is defaulted to having a user with an [identity] - * of [Identity.Anonymous]. Once the application knows the identity of the user using their - * app they should call [OneSignal.login] providing that identity to OneSignal, at which + * an app starts up for the first time, it is defaulted to having a guest user that is only + * accessible by the current device. Once the application knows the identity of the user using their + * app, they should call [OneSignal.login] providing that identity to OneSignal, at which * point all state in here will reflect the state of that known user. * * The current user is persisted across the application lifecycle, even when the application @@ -213,35 +213,4 @@ interface IUserManager { * @return this user manager to allow for chaining of calls. */ fun clearTriggers(): IUserManager - - /** - * Send an outcome with the provided name, captured against the current user (ish). - * See [Outcomes | OneSignal] (https://documentation.onesignal.com/docs/outcomes) - * - * @param name The name of the outcome that has occurred. - * - * @return this user manager to allow for chaining of calls. - */ - fun sendOutcome(name: String): IUserManager - - /** - * Send a unique outcome with the provided name, captured against the current user (ish). - * See [Outcomes | OneSignal] (https://documentation.onesignal.com/docs/outcomes) - * - * @param name The name of the unique outcome that has occurred. - * - * @return this user manager to allow for chaining of calls. - */ - fun sendUniqueOutcome(name: String): IUserManager - - /** - * Send an outcome with the provided name and value, captured against the current user (ish). - * See [Outcomes | OneSignal] (https://documentation.onesignal.com/docs/outcomes) - * - * @param name The name of the outcome that has occurred. - * @param value The value tied to the outcome. - * - * @return this user manager to allow for chaining of calls. - */ - fun sendOutcomeWithValue(name: String, value: Float): IUserManager } From 60dbb5aec93cf2dea391e05ea11d8400548b2c2b Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Fri, 21 Oct 2022 10:31:40 -0400 Subject: [PATCH 004/196] * Align preferences with config model store, removing preferences now moved to config model. * Document IPreferencesService * Document ITime --- .../com/onesignal/core/internal/CoreModule.kt | 4 +- .../core/internal/models/ConfigModel.kt | 7 + .../preferences/IPreferencesService.kt | 216 +++++++++++++----- .../{ => impl}/PreferencesService.kt | 7 +- .../com/onesignal/core/internal/time/ITime.kt | 9 +- .../com/onesignal/core/internal/time/Time.kt | 10 - .../onesignal/core/internal/time/impl/Time.kt | 8 + .../internal/NotificationModule.kt | 3 +- .../impl/FirebaseAnalyticsTracker.kt | 21 +- .../impl/GooglePlayServicesUpgradePrompt.kt | 16 +- 10 files changed, 196 insertions(+), 105 deletions(-) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/{ => impl}/PreferencesService.kt (96%) delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/Time.kt create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/impl/Time.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt index db0f6bca18..f7899ae08d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt @@ -54,7 +54,7 @@ import com.onesignal.core.internal.outcomes.impl.OutcomeEventsRepository import com.onesignal.core.internal.permissions.IRequestPermissionService import com.onesignal.core.internal.permissions.impl.RequestPermissionService import com.onesignal.core.internal.preferences.IPreferencesService -import com.onesignal.core.internal.preferences.PreferencesService +import com.onesignal.core.internal.preferences.impl.PreferencesService import com.onesignal.core.internal.purchases.TrackAmazonPurchase import com.onesignal.core.internal.purchases.TrackGooglePurchase import com.onesignal.core.internal.service.ServiceBuilder @@ -65,7 +65,7 @@ import com.onesignal.core.internal.startup.IBootstrapService import com.onesignal.core.internal.startup.IStartableService import com.onesignal.core.internal.startup.StartupService import com.onesignal.core.internal.time.ITime -import com.onesignal.core.internal.time.Time +import com.onesignal.core.internal.time.impl.Time import com.onesignal.core.internal.user.ISubscriptionManager import com.onesignal.core.internal.user.SubscriptionManager import com.onesignal.core.internal.user.UserManager diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/ConfigModel.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/ConfigModel.kt index 7a3b6f71fe..3dd7e2cb62 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/ConfigModel.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/ConfigModel.kt @@ -40,6 +40,13 @@ internal class ConfigModel : Model() { get() = getProperty(::disableGMSMissingPrompt.name) { false } set(value) { setProperty(::disableGMSMissingPrompt.name, value) } + /** + * Whether to disable the "GMS is missing" prompt to the user. + */ + var userRejectedGMSUpdate: Boolean + get() = getProperty(::userRejectedGMSUpdate.name) { false } + set(value) { setProperty(::userRejectedGMSUpdate.name, value) } + /** * Whether to automatically unsubscribe from OneSignal when notifications have been disabled. */ diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/IPreferencesService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/IPreferencesService.kt index c231230bec..920926a018 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/IPreferencesService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/IPreferencesService.kt @@ -1,109 +1,199 @@ package com.onesignal.core.internal.preferences +/** + * Provides access to the low level preferences. There are one or more preference + * stores, identified by [PreferenceStores], each store contains a key for each + * preference. Each key has a known data type, it's value can be fetched/stored as + * needed. Stored preferences will persist across the lifetime of the app installation. + */ internal interface IPreferencesService { + /** + * Retrieve a [String] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param defValue The optional default value to return, if the [key] was not previously saved. + * + * @return the value in the preference store, or [defValue] if not previously saved. + */ fun getString(store: String, key: String, defValue: String? = null): String? + + /** + * Retrieve a [Boolean] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param defValue The optional default value to return, if the [key] was not previously saved. + * + * @return the value in the preference store, or [defValue] if not previously saved. + */ fun getBool(store: String, key: String, defValue: Boolean? = null): Boolean? + + /** + * Retrieve a [Int] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param defValue The optional default value to return, if the [key] was not previously saved. + * + * @return the value in the preference store, or [defValue] if not previously saved. + */ fun getInt(store: String, key: String, defValue: Int? = null): Int? + + /** + * Retrieve a [Long] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param defValue The optional default value to return, if the [key] was not previously saved. + * + * @return the value in the preference store, or [defValue] if not previously saved. + */ fun getLong(store: String, key: String, defValue: Long? = null): Long? + + /** + * Retrieve a [Set] of [String] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param defValue The optional default value to return, if the [key] was not previously saved. + * + * @return the value in the preference store, or [defValue] if not previously saved. + */ fun getStringSet(store: String, key: String, defValue: Set? = null): Set? + /** + * Save a [String] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param value The value to save. + */ fun saveString(store: String, key: String, value: String?) + + /** + * Save a [Boolean] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param value The value to save. + */ fun saveBool(store: String, key: String, value: Boolean?) + + /** + * Save a [Int] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param value The value to save. + */ fun saveInt(store: String, key: String, value: Int?) + + /** + * Save a [Long] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param value The value to save. + */ fun saveLong(store: String, key: String, value: Long?) + + /** + * Save a [Set] of [String] value identified by the [store] and [key] provided. + * + * @param store The name of the preference store. + * @param key The key to retrieve. + * @param value The value to save. + */ fun saveStringSet(store: String, key: String, value: Set?) } internal object PreferenceStores { + /** + * The default OneSignal store, keys defined in [PreferenceOneSignalKeys]. + */ const val ONESIGNAL = "OneSignal" + + /** + * The player purchase store, keys defined in [PreferencePlayerPurchasesKeys]. + */ const val PLAYER_PURCHASES = "GTPlayerPurchases" - const val TRIGGERS = "OneSignalTriggers" } internal object PreferencePlayerPurchasesKeys { // Player Purchase Keys + /** + * (String) The purchase tokens that have been tracked. + */ const val PREFS_PURCHASE_TOKENS = "purchaseTokens" + + /** + * (Boolean) Whether new purchases should be treated as existing. + */ const val PREFS_EXISTING_PURCHASES = "ExistingPurchases" } -internal object PreferenceTriggerKeys - internal object PreferenceOneSignalKeys { - // TODO: Remove this once the tasks below have been finished... - // 1. Fix all of the SharedPreference Keys so they are organized by usage with comments - // ex. - // // In-App Messaging - // public static final String PREFS_OS_CACHED_IAMS = "PREFS_OS_CACHED_IAMS"; - // public static final String PREFS_OS_DISMISSED_IAMS = "PREFS_OS_DISPLAYED_IAMS"; - // public static final String PREFS_OS_IMPRESSIONED_IAMS = "PREFS_OS_IMPRESSIONED_IAMS"; - // public static final String PREFS_OS_CLICKED_CLICK_IDS_IAMS = "PREFS_OS_CLICKED_CLICK_IDS_IAMS"; - // 2. Match keys with value names - // ex. - // public static final String PREFS_OS_LAST_LOCATION_TIME = "OS_LAST_LOCATION_TIME"; - // 3. Follow syntax and make new names relevant (specific and as short as possible) - // ex. - // Start with prefix "PREFS_OS_" + "LAST_LOCATION_TIME" - // Unorganized Keys + // Location + /** + * (Long) The last time the device location was captured, in Unix time milliseconds. + */ const val PREFS_OS_LAST_LOCATION_TIME = "OS_LAST_LOCATION_TIME" - const val PREFS_GT_SOUND_ENABLED = "GT_SOUND_ENABLED" - const val PREFS_OS_LAST_SESSION_TIME = "OS_LAST_SESSION_TIME" - const val PREFS_GT_VIBRATE_ENABLED = "GT_VIBRATE_ENABLED" - const val PREFS_OS_FILTER_OTHER_GCM_RECEIVERS = "OS_FILTER_OTHER_GCM_RECEIVERS" - const val PREFS_GT_APP_ID = "GT_APP_ID" - const val PREFS_GT_PLAYER_ID = "GT_PLAYER_ID" - const val PREFS_GT_UNSENT_ACTIVE_TIME = "GT_UNSENT_ACTIVE_TIME" - const val PREFS_OS_UNSENT_ATTRIBUTED_ACTIVE_TIME = "OS_UNSENT_ATTRIBUTED_ACTIVE_TIME" - const val PREFS_ONESIGNAL_USERSTATE_DEPENDVALYES_ = "ONESIGNAL_USERSTATE_DEPENDVALYES_" - const val PREFS_ONESIGNAL_USERSTATE_SYNCVALYES_ = "ONESIGNAL_USERSTATE_SYNCVALYES_" - const val PREFS_ONESIGNAL_ACCEPTED_NOTIFICATION_LAST = "ONESIGNAL_ACCEPTED_NOTIFICATION_LAST" - const val PREFS_ONESIGNAL_SUBSCRIPTION_LAST = "ONESIGNAL_SUBSCRIPTION_LAST" - const val PREFS_ONESIGNAL_PLAYER_ID_LAST = "ONESIGNAL_PLAYER_ID_LAST" - const val PREFS_ONESIGNAL_PUSH_TOKEN_LAST = "ONESIGNAL_PUSH_TOKEN_LAST" - const val PREFS_ONESIGNAL_PERMISSION_ACCEPTED_LAST = "ONESIGNAL_PERMISSION_ACCEPTED_LAST" - const val PREFS_GT_DO_NOT_SHOW_MISSING_GPS = "GT_DO_NOT_SHOW_MISSING_GPS" - const val PREFS_ONESIGNAL_SUBSCRIPTION = "ONESIGNAL_SUBSCRIPTION" - const val PREFS_ONESIGNAL_SYNCED_SUBSCRIPTION = "ONESIGNAL_SYNCED_SUBSCRIPTION" - const val PREFS_GT_REGISTRATION_ID = "GT_REGISTRATION_ID" - const val PREFS_ONESIGNAL_USER_PROVIDED_CONSENT = "ONESIGNAL_USER_PROVIDED_CONSENT" - const val PREFS_OS_ETAG_PREFIX = "PREFS_OS_ETAG_PREFIX_" - const val PREFS_OS_HTTP_CACHE_PREFIX = "PREFS_OS_HTTP_CACHE_PREFIX_" - - // Remote params - const val PREFS_GT_FIREBASE_TRACKING_ENABLED = "GT_FIREBASE_TRACKING_ENABLED" - const val PREFS_OS_RESTORE_TTL_FILTER = "OS_RESTORE_TTL_FILTER" - const val PREFS_OS_CLEAR_GROUP_SUMMARY_CLICK = "OS_CLEAR_GROUP_SUMMARY_CLICK" - const val PREFS_OS_UNSUBSCRIBE_WHEN_NOTIFICATIONS_DISABLED = "PREFS_OS_UNSUBSCRIBE_WHEN_NOTIFICATIONS_DISABLED" - const val PREFS_OS_DISABLE_GMS_MISSING_PROMPT = "PREFS_OS_DISABLE_GMS_MISSING_PROMPT" - const val PREFS_OS_REQUIRES_USER_PRIVACY_CONSENT = "PREFS_OS_REQUIRES_USER_PRIVACY_CONSENT" - const val PREFS_OS_LOCATION_SHARED = "PREFS_OS_LOCATION_SHARED" - // Remote params - Receive Receipts (aka Confirmed Deliveries) - const val PREFS_OS_RECEIVE_RECEIPTS_ENABLED = "PREFS_OS_RECEIVE_RECEIPTS_ENABLED" + // HTTP + /** + * (String) A prefix key for retrieving the ETAG for a given HTTP GET cache key. The cache + * key should be appended to this prefix. + */ + const val PREFS_OS_ETAG_PREFIX = "PREFS_OS_ETAG_PREFIX_" - // On Focus Influence - const val PREFS_OS_ATTRIBUTED_INFLUENCES = "PREFS_OS_ATTRIBUTED_INFLUENCES" + /** + * (String) A prefix key for retrieving the response for a given HTTP GET cache key. The cache + * key should be appended to this prefix. + */ + const val PREFS_OS_HTTP_CACHE_PREFIX = "PREFS_OS_HTTP_CACHE_PREFIX_" // Outcomes + /** + * (String Set) The set of unattributed outcome events that have occurred to ensure uniqueness when requested. + */ const val PREFS_OS_UNATTRIBUTED_UNIQUE_OUTCOME_EVENTS_SENT = "PREFS_OS_UNATTRIBUTED_UNIQUE_OUTCOME_EVENTS_SENT" - // Email - const val PREFS_OS_EMAIL_ID = "OS_EMAIL_ID" - const val PREFS_ONESIGNAL_EMAIL_ID_LAST = "PREFS_ONESIGNAL_EMAIL_ID_LAST" - const val PREFS_ONESIGNAL_EMAIL_ADDRESS_LAST = "PREFS_ONESIGNAL_EMAIL_ADDRESS_LAST" - - // SMS - const val PREFS_OS_SMS_ID = "PREFS_OS_SMS_ID" - const val PREFS_OS_SMS_ID_LAST = "PREFS_OS_SMS_ID_LAST" - const val PREFS_OS_SMS_NUMBER_LAST = "PREFS_OS_SMS_NUMBER_LAST" - // In-App Messaging + /** + * (String) The serialized IAMs TODO: This isn't currently used, determine if actually needed for cold start IAM fetch delay + */ const val PREFS_OS_CACHED_IAMS = "PREFS_OS_CACHED_IAMS" + + /** + * (String Set) The set of IAM IDs that have been dismissed on this device. + */ const val PREFS_OS_DISMISSED_IAMS = "PREFS_OS_DISPLAYED_IAMS" + + /** + * (String Set) The set of IAM IDs that have impressed (displayed) on the device. + */ const val PREFS_OS_IMPRESSIONED_IAMS = "PREFS_OS_IMPRESSIONED_IAMS" + + /** + * (String Set) The set of click IDs that the device has clicked on. + */ const val PREFS_OS_CLICKED_CLICK_IDS_IAMS = "PREFS_OS_CLICKED_CLICK_IDS_IAMS" + + /** + * (String Set) The set of page IDs that have impressed (displayed) on the device. + */ const val PREFS_OS_PAGE_IMPRESSIONED_IAMS = "PREFS_OS_PAGE_IMPRESSIONED_IAMS" + + /** + * (Long) The last time an IAM was dismissed, in unix time milliseconds. + */ const val PREFS_OS_LAST_TIME_IAM_DISMISSED = "PREFS_OS_LAST_TIME_IAM_DISMISSED" // Models + /** + * (String) A prefix key for retrieving a specific model store contents. The name of the model + * store should be appended to this prefix. + */ const val MODEL_STORE_PREFIX = "MODEL_STORE_" } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/PreferencesService.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/impl/PreferencesService.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/PreferencesService.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/impl/PreferencesService.kt index 59a3ee0d27..4c9caf4ef7 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/PreferencesService.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/preferences/impl/PreferencesService.kt @@ -1,10 +1,12 @@ -package com.onesignal.core.internal.preferences +package com.onesignal.core.internal.preferences.impl import android.content.Context import android.content.SharedPreferences import com.onesignal.core.debug.LogLevel import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.logging.Logging +import com.onesignal.core.internal.preferences.IPreferencesService +import com.onesignal.core.internal.preferences.PreferenceStores import com.onesignal.core.internal.startup.IStartableService import com.onesignal.core.internal.time.ITime import com.onesignal.onesignal.core.internal.common.suspend.Waiter @@ -20,8 +22,7 @@ internal class PreferencesService( ) : IPreferencesService, IStartableService { private val _prefsToApply: Map> = mapOf( PreferenceStores.ONESIGNAL to mutableMapOf(), - PreferenceStores.PLAYER_PURCHASES to mutableMapOf(), - PreferenceStores.TRIGGERS to mutableMapOf() + PreferenceStores.PLAYER_PURCHASES to mutableMapOf() ) private var _queueJob: Deferred? = null diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/ITime.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/ITime.kt index d997598436..cfbc995700 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/ITime.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/ITime.kt @@ -1,6 +1,13 @@ package com.onesignal.core.internal.time +/** + * Provides an abstraction to retrieving the current time. This should be used rather + * than standard library services, to allow for more flexible testing scenarios. + */ internal interface ITime { + /** + * Returns the current time in unix time milliseconds (the number of milliseconds between the + * current time and midnight, January 1, 1970 UTC). + */ val currentTimeMillis: Long - val elapsedRealtime: Long } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/Time.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/Time.kt deleted file mode 100644 index 5dd8f0e8b6..0000000000 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/Time.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.onesignal.core.internal.time - -import android.os.SystemClock - -internal class Time : ITime { - override val currentTimeMillis: Long - get() = System.currentTimeMillis() - override val elapsedRealtime: Long - get() = SystemClock.elapsedRealtime() -} diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/impl/Time.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/impl/Time.kt new file mode 100644 index 0000000000..231f37edf3 --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/time/impl/Time.kt @@ -0,0 +1,8 @@ +package com.onesignal.core.internal.time.impl + +import com.onesignal.core.internal.time.ITime + +internal class Time : ITime { + override val currentTimeMillis: Long + get() = System.currentTimeMillis() +} diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationModule.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationModule.kt index ccbd7e5bac..b4434f5517 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationModule.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationModule.kt @@ -3,7 +3,6 @@ package com.onesignal.notification.internal import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.device.IDeviceService import com.onesignal.core.internal.models.ConfigModelStore -import com.onesignal.core.internal.preferences.IPreferencesService import com.onesignal.core.internal.service.ServiceBuilder import com.onesignal.core.internal.startup.IStartableService import com.onesignal.core.internal.time.ITime @@ -100,7 +99,7 @@ internal object NotificationModule { if (FirebaseAnalyticsTracker.canTrack()) { return@register FirebaseAnalyticsTracker( it.getService(IApplicationService::class.java), - it.getService(IPreferencesService::class.java), + it.getService(ConfigModelStore::class.java), it.getService(ITime::class.java) ) } else { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt index e0fc17e21b..5c1c2f5705 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt @@ -29,9 +29,7 @@ package com.onesignal.notification.internal.analytics.impl import android.content.Context import android.os.Bundle import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.preferences.IPreferencesService -import com.onesignal.core.internal.preferences.PreferenceOneSignalKeys -import com.onesignal.core.internal.preferences.PreferenceStores +import com.onesignal.core.internal.models.ConfigModelStore import com.onesignal.core.internal.time.ITime import com.onesignal.notification.internal.analytics.IAnalyticsTracker import java.lang.reflect.Method @@ -39,10 +37,15 @@ import java.util.concurrent.atomic.AtomicLong internal class FirebaseAnalyticsTracker( private val _applicationService: IApplicationService, - private val _preferences: IPreferencesService, + private val _configModelStore: ConfigModelStore, private val _time: ITime ) : IAnalyticsTracker { + private val isEnabled: Boolean + get() { + return _configModelStore.model.firebaseAnalytics + } + private var lastReceivedTime: AtomicLong? = null private var lastOpenedTime: AtomicLong? = null private var lastReceivedNotificationId: String? = null @@ -50,7 +53,7 @@ internal class FirebaseAnalyticsTracker( private var mFirebaseAnalyticsInstance: Any? = null override fun trackInfluenceOpenEvent() { - if (!isEnabled() || lastReceivedTime == null || lastReceivedNotificationId == null) { + if (!isEnabled || lastReceivedTime == null || lastReceivedNotificationId == null) { return } @@ -79,7 +82,7 @@ internal class FirebaseAnalyticsTracker( } override fun trackOpenedEvent(notificationId: String, campaign: String) { - if (!isEnabled()) { + if (!isEnabled) { return } @@ -106,7 +109,7 @@ internal class FirebaseAnalyticsTracker( } override fun trackReceivedEvent(notificationId: String, campaign: String) { - if (!isEnabled()) { + if (!isEnabled) { return } @@ -143,10 +146,6 @@ internal class FirebaseAnalyticsTracker( return mFirebaseAnalyticsInstance } - private fun isEnabled(): Boolean { - return _preferences.getBool(PreferenceStores.ONESIGNAL, PreferenceOneSignalKeys.PREFS_GT_FIREBASE_TRACKING_ENABLED, false)!! - } - companion object { private var FirebaseAnalyticsClass: Class<*>? = null private const val EVENT_NOTIFICATION_OPENED = "os_notification_opened" diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt index bcd0a1bd8d..6715b03c36 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt @@ -9,17 +9,13 @@ import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.common.AndroidUtils import com.onesignal.core.internal.device.IDeviceService import com.onesignal.core.internal.models.ConfigModelStore -import com.onesignal.core.internal.preferences.IPreferencesService -import com.onesignal.core.internal.preferences.PreferenceOneSignalKeys -import com.onesignal.core.internal.preferences.PreferenceStores import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext internal class GooglePlayServicesUpgradePrompt( private val _applicationService: IApplicationService, private val _deviceService: IDeviceService, - private val _configModelStore: ConfigModelStore, - private val _prefs: IPreferencesService + private val _configModelStore: ConfigModelStore ) { // Google Play Store might not be installed, ignore exception if so private val isGooglePlayStoreInstalled: Boolean @@ -43,13 +39,7 @@ internal class GooglePlayServicesUpgradePrompt( return } - if (!isGooglePlayStoreInstalled || _configModelStore.model.disableGMSMissingPrompt) { - return - } - - val userSelectedSkip = _prefs.getBool(PreferenceStores.ONESIGNAL, PreferenceOneSignalKeys.PREFS_GT_DO_NOT_SHOW_MISSING_GPS, false)!! - - if (userSelectedSkip) { + if (!isGooglePlayStoreInstalled || _configModelStore.model.disableGMSMissingPrompt || _configModelStore.model.userRejectedGMSUpdate) { return } @@ -82,7 +72,7 @@ internal class GooglePlayServicesUpgradePrompt( builder.setMessage(alertBodyText) .setPositiveButton(alertButtonUpdate) { dialog, which -> openPlayStoreToApp(activity) } .setNegativeButton(alertButtonSkip) { dialog, which -> - _prefs.saveBool(PreferenceStores.ONESIGNAL, PreferenceOneSignalKeys.PREFS_GT_DO_NOT_SHOW_MISSING_GPS, true) + _configModelStore.model.userRejectedGMSUpdate = true }.setNeutralButton(alertButtonClose, null).create().show() } } From 5e9019eb90efce573e1f2b4360e6b847a22143b7 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Mon, 24 Oct 2022 12:27:32 -0400 Subject: [PATCH 005/196] [User Model] Modularize IAM/Notification/Location * Move IAM/Notification/Location to their own gradle modules. AndroidManifest/proguard has now been split across the 4 modules. * Load modules dynamically using reflection within OneSignalImpl, falling back to "Misconfigured" versions if the modules weren't specified in the application. * Make internal classes required by a OS module no longer defined as `internal` (but keep in internal namespace). --- Examples/OneSignalDemo/app/build.gradle | 24 ++- .../sdktest/activity/MainActivity.java | 2 +- .../sdktest/application/MainApplication.java | 4 +- .../sdktest/model/MainActivityViewModel.java | 10 +- .../model/SplashActivityViewModel.java | 2 +- .../NotificationServiceExtension.java | 4 +- .../OneSignalNotificationSender.java | 6 +- OneSignalSDK/build.gradle | 9 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- OneSignalSDK/onesignal/build.gradle | 83 ++------ .../onesignal/consumer-proguard-rules.pro | 89 --------- OneSignalSDK/onesignal/consumer-rules.pro | 3 + OneSignalSDK/onesignal/iam/.gitignore | 1 + OneSignalSDK/onesignal/iam/build.gradle | 86 +++++++++ OneSignalSDK/onesignal/iam/consumer-rules.pro | 1 + OneSignalSDK/onesignal/iam/proguard-rules.pro | 21 ++ .../iam/src/main/AndroidManifest.xml | 4 + .../main/java/com/onesignal/iam}/IAMModule.kt | 18 +- .../onesignal/iam/internal/DummyIAMManager.kt | 0 .../com/onesignal/iam/internal/IAMManager.kt | 42 ++-- .../onesignal/iam/internal/InAppMessage.kt | 2 +- .../iam/internal/InAppMessageAction.kt | 0 .../iam/internal/InAppMessageContent.kt | 0 .../iam/internal/InAppMessageOutcome.kt | 0 .../iam/internal/InAppMessagePage.kt | 0 .../internal/InAppMessageRedisplayStats.kt | 2 +- .../onesignal/iam/internal/InAppMessageTag.kt | 0 .../com/onesignal/iam/internal/Trigger.kt | 0 .../internal/backend/IInAppBackendService.kt | 2 +- .../backend/impl/InAppBackendService.kt | 6 +- .../iam/internal/common/InAppHelper.kt | 0 .../iam/internal/common/OneSignalChromeTab.kt | 0 .../iam/internal/display/IInAppDisplayer.kt | 0 .../display/impl/DraggableRelativeLayout.kt | 2 +- .../internal/display/impl/InAppDisplayer.kt | 7 +- .../internal/display/impl/InAppMessageView.kt | 10 +- .../iam/internal/display/impl/OSWebView.kt | 0 .../internal/display/impl/OneSignalAnimate.kt | 0 .../impl/OneSignalBounceInterpolator.kt | 0 .../internal/display/impl/WebViewManager.kt | 11 +- .../iam/internal/hydrators/InAppHydrator.kt | 5 +- .../lifecycle/IInAppLifecycleEventHandler.kt | 0 .../lifecycle/IInAppLifecycleService.kt | 2 +- .../lifecycle/impl/IAMLifecycleService.kt | 2 +- .../IInAppPreferencesController.kt | 0 .../impl/InAppPreferencesController.kt | 0 .../preview/InAppMessagePreviewHandler.kt | 0 .../prompt/IInAppMessagePromptFactory.kt | 0 .../prompt/impl/InAppMessageLocationPrompt.kt | 0 .../prompt/impl/InAppMessagePrompt.kt | 0 .../prompt/impl/InAppMessagePromptFactory.kt | 0 .../prompt/impl/InAppMessagePushPrompt.kt | 0 .../internal/repositories/IInAppRepository.kt | 0 .../repositories/impl/InAppRepository.kt | 4 +- .../iam/internal/state/InAppStateService.kt | 0 .../internal/triggers/ITriggerController.kt | 2 +- .../iam/internal/triggers/ITriggerHandler.kt | 2 +- .../triggers/impl/DynamicTriggerController.kt | 9 +- .../triggers/impl/DynamicTriggerTimer.kt | 2 +- .../triggers/impl/TriggerController.kt | 11 +- .../iam/src/main/res/values/strings.xml | 5 + .../java/com/onesignal/iam/ExampleUnitTest.kt | 16 ++ OneSignalSDK/onesignal/location/.gitignore | 1 + OneSignalSDK/onesignal/location/build.gradle | 85 +++++++++ .../onesignal/location/consumer-rules.pro | 1 + .../onesignal/location/proguard-rules.pro | 21 ++ .../location/src/main/AndroidManifest.xml | 7 + .../com/onesignal/location}/LocationModule.kt | 16 +- .../location/internal/LocationManager.kt | 8 +- .../background/LocationBackgroundService.kt | 2 +- .../internal/capture/ILocationCapturer.kt | 0 .../internal/capture/impl/LocationCapturer.kt | 4 +- .../internal/common/LocationConstants.kt | 0 .../location/internal/common/LocationPoint.kt | 0 .../location/internal/common/LocationUtils.kt | 2 +- .../controller/ILocationController.kt | 2 +- .../controller/impl/GmsLocationController.kt | 8 +- .../impl/GoogleApiClientCompatProxy.kt | 0 .../controller/impl/HmsLocationController.kt | 12 +- .../controller/impl/NullLocationController.kt | 0 .../LocationPermissionController.kt | 12 +- .../NavigateToAndroidSettingsForLocation.kt | 0 .../ILocationPreferencesService.kt | 0 .../impl/LocationPreferencesService.kt | 0 .../location/src/main/res/values/strings.xml | 5 + .../com/onesignal/location/ExampleUnitTest.kt | 16 ++ .../onesignal/notification/.gitignore | 1 + .../onesignal/notification/build.gradle | 107 +++++++++++ .../onesignal/notification/consumer-rules.pro | 39 ++++ .../libs/amazon-device-messaging-1.1.0.jar | Bin .../onesignal/notification/proguard-rules.pro | 21 ++ .../src/debug}/AndroidManifest.xml | 5 +- .../notification/src/main/AndroidManifest.xml | 113 +++++++++++ .../notification}/NotificationModule.kt | 24 ++- .../activities/NotificationOpenedActivity.kt | 0 ...ficationOpenedActivityAndroid22AndOlder.kt | 0 .../NotificationOpenedActivityBase.kt | 4 +- .../NotificationOpenedActivityHMS.kt | 4 +- .../bridges/OneSignalHmsEventBridge.kt | 8 +- .../internal/MutableNotification.kt | 0 .../notification/internal/Notification.kt | 4 +- .../internal/NotificationAction.kt | 0 .../internal/NotificationOpenedResult.kt | 2 +- .../internal/NotificationReceivedEvent.kt | 0 .../internal/NotificationsManager.kt | 16 +- .../notification/internal/PermissionState.kt | 0 .../internal/PermissionStateChanges.kt | 0 .../internal/analytics/IAnalyticsTracker.kt | 0 .../impl/FirebaseAnalyticsTracker.kt | 2 +- .../analytics/impl/NoAnalyticsTracker.kt | 0 .../backend/INotificationBackendService.kt | 2 +- .../impl/NotificationBackendService.kt | 2 +- .../internal/badges/IBadgeCountUpdater.kt | 0 .../internal/badges/impl/BadgeCountUpdater.kt | 2 +- .../badges/impl/shortcutbadger/Badger.java | 0 .../ShortcutBadgeException.java | 0 .../impl/shortcutbadger/ShortcutBadger.java | 0 .../shortcutbadger/impl/AdwHomeBadger.java | 0 .../shortcutbadger/impl/ApexHomeBadger.java | 0 .../shortcutbadger/impl/AsusHomeBadger.java | 0 .../shortcutbadger/impl/DefaultBadger.java | 0 .../impl/EverythingMeHomeBadger.java | 0 .../shortcutbadger/impl/HuaweiHomeBadger.java | 0 .../shortcutbadger/impl/LGHomeBadger.java | 0 .../shortcutbadger/impl/NewHtcHomeBadger.java | 0 .../shortcutbadger/impl/NovaHomeBadger.java | 0 .../shortcutbadger/impl/OPPOHomeBader.java | 0 .../impl/SamsungHomeBadger.java | 0 .../shortcutbadger/impl/SonyHomeBadger.java | 0 .../shortcutbadger/impl/VivoHomeBadger.java | 0 .../shortcutbadger/impl/XiaomiHomeBadger.java | 0 .../shortcutbadger/impl/ZukHomeBadger.java | 0 .../shortcutbadger/util/BroadcastHelper.java | 0 .../impl/shortcutbadger/util/CloseHelper.java | 0 .../bundle/INotificationBundleProcessor.kt | 0 .../impl/NotificationBundleProcessor.kt | 2 +- .../channels/INotificationChannelManager.kt | 0 .../impl/NotificationChannelManager.kt | 8 +- .../common/GenerateNotificationOpenIntent.kt | 0 ...teNotificationOpenIntentFromPushPayload.kt | 2 +- .../internal/common/NotificationConstants.kt | 2 +- .../common/NotificationFormatHelper.kt | 2 +- .../common/NotificationGenerationJob.kt | 4 +- .../internal/common/NotificationHelper.kt | 7 +- .../common/OSNotificationOpenAppSettings.kt | 2 +- ...NotificationOpenBehaviorFromPushPayload.kt | 0 .../internal/data/INotificationQueryHelper.kt | 0 .../internal/data/INotificationRepository.kt | 0 .../data/impl/NotificationQueryHelper.kt | 2 +- .../data/impl/NotificationRepository.kt | 2 +- .../display/INotificationDisplayBuilder.kt | 0 .../display/INotificationDisplayer.kt | 2 +- .../display/ISummaryNotificationDisplayer.kt | 0 ...entGeneratorForAttachingToNotifications.kt | 0 .../impl/NotificationDisplayBuilder.kt | 4 +- .../display/impl/NotificationDisplayer.kt | 10 +- .../impl/SummaryNotificationDisplayer.kt | 0 .../INotificationGenerationProcessor.kt | 0 .../INotificationGenerationWorkManager.kt | 0 .../impl/NotificationGenerationProcessor.kt | 8 +- .../impl/NotificationGenerationWorkManager.kt | 6 +- .../INotificationLifecycleCallback.kt | 2 +- .../INotificationLifecycleEventHandler.kt | 2 +- .../INotificationLifecycleService.kt | 2 +- .../impl/NotificationLifecycleService.kt | 8 +- .../limiting/INotificationLimitManager.kt | 0 .../limiting/impl/NotificationLimitManager.kt | 0 .../internal/listeners/ApplicationListener.kt | 0 .../listeners/ConfigModelStoreListener.kt | 12 +- .../listeners/NotificationListener.kt | 12 +- .../internal/listeners/PushTokenListener.kt | 2 +- .../open/INotificationOpenedProcessor.kt | 0 .../open/INotificationOpenedProcessorHMS.kt | 0 .../open/impl/NotificationIntentExtras.kt | 0 .../open/impl/NotificationOpenedProcessor.kt | 6 +- .../impl/NotificationOpenedProcessorHMS.kt | 2 +- .../INotificationPermissionController.kt | 5 +- ...vigateToAndroidSettingsForNotifications.kt | 0 .../impl/NotificationPermissionController.kt | 10 +- .../internal/pushtoken/IPushTokenManager.kt | 2 +- .../internal/pushtoken/PushTokenManager.kt | 4 +- .../IReceiveReceiptProcessor.kt | 0 .../IReceiveReceiptWorkManager.kt | 0 .../impl/ReceiveReceiptProcessor.kt | 4 +- .../impl/ReceiveReceiptWorkManager.kt | 10 +- .../internal/registration/IPushRegistrator.kt | 0 .../impl/GooglePlayServicesUpgradePrompt.kt | 4 +- .../impl/IPushRegistratorCallback.kt | 0 .../registration/impl/PushRegistratorADM.kt | 4 +- .../impl/PushRegistratorAbstractGoogle.kt | 6 +- .../registration/impl/PushRegistratorFCM.kt | 6 +- .../registration/impl/PushRegistratorHMS.kt | 4 +- .../registration/impl/PushRegistratorNone.kt | 0 .../INotificationRestoreProcessor.kt | 0 .../INotificationRestoreWorkManager.kt | 0 .../impl/NotificationRestoreProcessor.kt | 2 +- .../impl/NotificationRestoreWorkManager.kt | 2 +- .../summary/INotificationSummaryManager.kt | 0 .../impl/NotificationSummaryManager.kt | 2 +- .../receivers/ADMMessageReceiver.kt | 2 +- .../notification/receivers/BootUpReceiver.kt | 2 +- .../receivers/FCMBroadcastReceiver.kt | 2 +- .../receivers/NotificationDismissReceiver.kt | 4 +- .../notification/receivers/UpgradeReceiver.kt | 2 +- .../services/ADMMessageHandler.kt | 6 +- .../services/ADMMessageHandlerJob.kt | 6 +- .../services/HmsMessageServiceOneSignal.kt | 2 +- ...ic_os_notification_fallback_white_24dp.png | Bin ...ic_os_notification_fallback_white_24dp.png | Bin ...ic_os_notification_fallback_white_24dp.png | Bin ...ic_os_notification_fallback_white_24dp.png | Bin ...ic_os_notification_fallback_white_24dp.png | Bin .../layout/onesignal_bgimage_notif_layout.xml | 0 .../main/res/raw/consumer_onesignal_keep.xml | 14 ++ .../src/main/res/values/strings.xml | 5 + .../src/release}/AndroidManifest.xml | 3 +- .../onesignal/notification/ExampleUnitTest.kt | 16 ++ .../onesignal/src/main/AndroidManifest.xml | 117 +----------- .../java/com/onesignal/{core => }/Continue.kt | 2 +- .../com/onesignal/{core => }/IOneSignal.kt | 10 +- .../com/onesignal/{core => }/OneSignal.kt | 20 +- .../common/AndroidSupportV4Compat.kt | 6 +- .../internal => }/common/AndroidUtils.kt | 6 +- .../{core/internal => }/common/DateUtils.kt | 4 +- .../{core/internal => }/common/DeviceUtils.kt | 4 +- .../{core/internal => }/common/IDManager.kt | 6 +- .../common/JSONObjectExtensions.kt | 2 +- .../{core/internal => }/common/JSONUtils.kt | 6 +- .../internal => }/common/NetworkUtils.kt | 4 +- .../com/onesignal/common/OneSignalUtils.kt | 6 + .../common/RootToolsInternalMethods.kt | 4 +- .../{core/internal => }/common/TimeUtils.kt | 4 +- .../{core/internal => }/common/ViewUtils.kt | 4 +- .../common/events/CallbackProducer.kt | 4 +- .../common/events/EventProducer.kt | 4 +- .../common/events/ICallbackNotifier.kt | 16 +- .../common/events/IEventNotifier.kt | 16 +- .../common/exceptions/BackendException.kt | 16 ++ .../common/exceptions/MainThreadException.kt | 6 + .../modeling/IModelChangedHandler.kt | 6 +- .../modeling/IModelStore.kt | 9 +- .../modeling/IModelStoreChangeHandler.kt | 4 +- .../modeling/ISingletonModelStore.kt | 6 +- .../ISingletonModelStoreChangeHandler.kt | 4 +- .../internal => common}/modeling/MapModel.kt | 4 +- .../internal => common}/modeling/Model.kt | 10 +- .../modeling/ModelStore.kt | 12 +- .../modeling/SimpleModelStore.kt | 4 +- .../modeling/SingletonModelStore.kt | 6 +- .../com/onesignal/common/modules/IModule.kt | 19 ++ .../services}/IServiceBuilder.kt | 2 +- .../services}/IServiceProvider.kt | 4 +- .../services}/ServiceBuilder.kt | 10 +- .../services}/ServiceProvider.kt | 6 +- .../services}/ServiceRegistration.kt | 42 +++- .../common/threading/ThreadUtils.kt | 12 +- .../internal => }/common/threading/Waiter.kt | 2 +- .../java/com/onesignal/core/CoreModule.kt | 91 +++++++++ .../core/activities/PermissionsActivity.kt | 4 +- .../com/onesignal/core/internal/CoreModule.kt | 162 ---------------- .../internal/application/AppEntryAction.kt | 2 +- .../application/IActivityLifecycleHandler.kt | 4 +- .../IApplicationLifecycleHandler.kt | 4 +- .../application/IApplicationService.kt | 2 +- .../application/impl/ApplicationService.kt | 12 +- .../core/internal/backend/BackendException.kt | 6 - .../internal/backend/IParamsBackendService.kt | 8 +- .../backend/impl/ParamsBackendService.kt | 14 +- .../internal/background/IBackgroundManager.kt | 2 +- .../internal/background/IBackgroundService.kt | 2 +- .../background/impl/BackgroundManager.kt | 5 +- .../core/internal/common/BundleCompat.kt | 179 ------------------ .../core/internal/common/OneSignalUtils.kt | 6 - .../common/exceptions/MainThreadException.kt | 3 - .../{models => config}/ConfigModel.kt | 10 +- .../core/internal/config/ConfigModelStore.kt | 9 + .../impl}/ConfigModelStoreListener.kt | 22 +-- .../core/internal/database/ICursor.kt | 2 +- .../core/internal/database/IDatabase.kt | 2 +- .../internal/database/IDatabaseProvider.kt | 2 +- .../database/impl/DatabaseProvider.kt | 2 +- .../core/internal/database/impl/OSDatabase.kt | 19 +- .../database/impl/OneSignalDbContract.kt | 6 +- .../core/internal/device/IDeviceService.kt | 4 +- .../internal/device/impl/DeviceService.kt | 74 +++----- .../core/internal/http/HttpResponse.kt | 2 +- .../core/internal/http/IHttpClient.kt | 2 +- .../core/internal/http/impl/HttpClient.kt | 8 +- .../internal/language/impl/LanguageContext.kt | 2 +- .../core/internal/models/ModelStoreDefs.kt | 12 -- .../internal/operations/IOperationExecutor.kt | 2 +- .../internal/operations/IOperationRepo.kt | 2 +- .../core/internal/operations/Operation.kt | 6 +- .../operations/impl/OperationModelStore.kt | 27 +-- .../internal/operations/impl/OperationRepo.kt | 4 +- .../listeners/ModelStoreListener.kt | 34 +++- .../listeners/SingletonModelStoreListener.kt | 30 ++- .../AlertDialogPrepromptForAndroidSettings.kt | 7 +- .../permissions/IRequestPermissionService.kt | 2 +- .../impl/RequestPermissionService.kt | 5 +- .../preferences/IPreferencesService.kt | 8 +- .../preferences/impl/PreferencesService.kt | 6 +- .../{ => impl}/TrackAmazonPurchase.kt | 19 +- .../{ => impl}/TrackGooglePurchase.kt | 13 +- .../internal/startup/IStartableService.kt | 8 +- .../com/onesignal/core/internal/time/ITime.kt | 2 +- .../core/internal/user/aliases/Alias.kt | 12 -- .../user/subscriptions/EmailSubscription.kt | 11 -- .../user/subscriptions/SmsSubscription.kt | 11 -- .../onesignal/core/internal/user/tags/Tag.kt | 9 - .../core/internal/user/triggers/Trigger.kt | 9 - .../onesignal/core/services/SyncJobService.kt | 6 +- .../onesignal/core/services/SyncService.kt | 6 +- .../{core => }/debug/IDebugManager.kt | 2 +- .../onesignal/{core => }/debug/LogLevel.kt | 2 +- .../debug => debug/internal}/DebugManager.kt | 8 +- .../internal/logging/Logging.kt | 10 +- .../iam/internal/MisconfiguredIAMManager.kt | 21 ++ .../{core => }/internal/OneSignalImp.kt | 91 +++++---- .../internal/MisconfiguredLocationManager.kt | 19 ++ .../MisconfiguredNotificationsManager.kt | 36 ++++ .../{core => }/session/ISessionManager.kt | 2 +- .../com/onesignal/session/SessionModule.kt | 45 +++++ .../internal}/SessionManager.kt | 12 +- .../internal/influence/IInfluenceManager.kt | 4 +- .../internal/influence/Influence.kt | 4 +- .../internal/influence/InfluenceChannel.kt | 4 +- .../internal/influence/InfluenceType.kt | 4 +- .../internal/influence/impl/ChannelTracker.kt | 8 +- .../influence/impl/IChannelTracker.kt | 8 +- .../impl/IInfluenceDataRepository.kt | 4 +- .../influence/impl/InAppMessageTracker.kt | 8 +- .../influence/impl/InfluenceConstants.kt | 2 +- .../influence/impl/InfluenceDataRepository.kt | 6 +- .../influence/impl/InfluenceManager.kt | 20 +- .../influence/impl/NotificationTracker.kt | 10 +- .../internal/outcomes/IOutcomeEvent.kt | 6 +- .../outcomes/IOutcomeEventsController.kt | 4 +- .../outcomes/impl/CachedUniqueOutcome.kt | 4 +- .../impl/IOutcomeEventsBackendService.kt | 4 +- .../impl/IOutcomeEventsPreferences.kt | 2 +- .../outcomes/impl/IOutcomeEventsRepository.kt | 4 +- .../outcomes/impl/OutcomeConstants.kt | 2 +- .../internal/outcomes/impl/OutcomeEvent.kt | 6 +- .../outcomes/impl/OutcomeEventParams.kt | 2 +- .../impl/OutcomeEventsBackendService.kt | 7 +- .../outcomes/impl/OutcomeEventsController.kt | 24 +-- .../outcomes/impl/OutcomeEventsPreferences.kt | 2 +- .../outcomes/impl/OutcomeEventsRepository.kt | 12 +- .../internal/outcomes/impl/OutcomeSource.kt | 2 +- .../outcomes/impl/OutcomeSourceBody.kt | 2 +- .../outcomes/impl/OutcomeTableProvider.kt | 10 +- .../outcomes/impl/OutcomesDbContract.kt | 8 +- .../session/ISessionLifecycleHandler.kt | 4 +- .../internal/session/ISessionService.kt | 6 +- .../internal/session}/SessionModel.kt | 6 +- .../internal/session/SessionModelStore.kt | 9 + .../internal/session/impl}/SessionListener.kt | 16 +- .../internal/session/impl/SessionService.kt | 20 +- .../onesignal/{core => }/user/IUserManager.kt | 6 +- .../java/com/onesignal/user/UserModule.kt | 54 ++++++ .../user/internal/EmailSubscription.kt | 11 ++ .../internal}/PushSubscription.kt | 6 +- .../user/internal/SmsSubscription.kt | 11 ++ .../internal}/Subscription.kt | 6 +- .../user => user/internal}/UserManager.kt | 27 +-- .../backend/IIdentityBackendService.kt | 4 +- .../backend/ISubscriptionBackendService.kt | 4 +- .../internal/backend/IUserBackendService.kt | 6 +- .../backend/PropertiesDeltasObject.kt | 6 +- .../internal/backend/PropertiesObject.kt | 4 +- .../internal/backend/SubscriptionObject.kt | 4 +- .../backend/SubscriptionObjectType.kt | 4 +- .../backend/impl/IdentityBackendService.kt | 4 +- .../impl/SubscriptionBackendService.kt | 21 +- .../backend/impl/UserBackendService.kt | 22 +-- .../internal/identity}/IdentityModel.kt | 8 +- .../internal/identity/IdentityModelStore.kt | 9 + .../operations/CreateSubscriptionOperation.kt | 12 +- .../operations/CreateUserOperation.kt | 8 +- .../operations/DeleteAliasOperation.kt | 10 +- .../operations/DeleteSubscriptionOperation.kt | 10 +- .../internal/operations/DeleteTagOperation.kt | 10 +- .../internal/operations/SetAliasOperation.kt | 10 +- .../operations/SetPropertyOperation.kt | 10 +- .../internal/operations/SetTagOperation.kt | 10 +- .../operations/TrackPurchaseOperation.kt | 14 +- .../operations/TrackSessionOperation.kt | 10 +- .../operations/UpdateSubscriptionOperation.kt | 12 +- .../executors}/IdentityOperationExecutor.kt | 16 +- .../SubscriptionOperationExecutor.kt | 30 +-- .../impl/executors}/UserOperationExecutor.kt | 66 +++---- .../listeners/IdentityModelStoreListener.kt | 13 +- .../listeners/PropertiesModelStoreListener.kt | 15 +- .../SubscriptionModelStoreListener.kt | 17 +- .../internal/properties}/PropertiesModel.kt | 8 +- .../properties/PropertiesModelStore.kt | 9 + .../subscriptions/ISubscriptionManager.kt | 18 ++ .../subscriptions}/SubscriptionModel.kt | 8 +- .../subscriptions/SubscriptionModelStore.kt | 6 + .../impl}/SubscriptionManager.kt | 49 ++--- .../internal/triggers}/TriggerModel.kt | 6 +- .../internal/triggers/TriggerModelStore.kt | 5 + .../user/subscriptions/IEmailSubscription.kt | 2 +- .../user/subscriptions/IPushSubscription.kt | 2 +- .../user/subscriptions/ISmsSubscription.kt | 2 +- .../user/subscriptions/ISubscription.kt | 2 +- .../user/subscriptions/SubscriptionList.kt | 2 +- .../main/res/raw/consumer_onesignal_keep.xml | 6 +- .../onesignal/src/main/res/values/strings.xml | 9 - .../internal/database/InitialOSDatabase.kt | 2 +- .../internal/database/OSDatabaseTests.kt | 10 +- .../core}/internal/http/HttpClientTests.kt | 12 +- .../http/MockHttpConnectionFactory.kt | 2 +- .../tests => tests/core}/mocks/MockHelper.kt | 14 +- .../core}/mocks/MockPreferencesService.kt | 2 +- .../extensions/ContainedRobolectricRunner.kt | 2 +- .../tests/extensions/RobolectricExtension.kt | 2 +- .../influence/InfluenceManagerTests.kt | 12 +- .../OutcomeEventsBackendServiceTests.kt | 14 +- .../outcomes/OutcomeEventsControllerTests.kt | 30 +-- .../internal/session/SessionServiceTests.kt | 8 +- OneSignalSDK/settings.gradle | 17 +- OneSignalSDK/unittest/build.gradle | 1 + .../unittest/src/main/AndroidManifest.xml | 3 +- 425 files changed, 2166 insertions(+), 1744 deletions(-) delete mode 100644 OneSignalSDK/onesignal/consumer-proguard-rules.pro create mode 100644 OneSignalSDK/onesignal/consumer-rules.pro create mode 100644 OneSignalSDK/onesignal/iam/.gitignore create mode 100644 OneSignalSDK/onesignal/iam/build.gradle create mode 100644 OneSignalSDK/onesignal/iam/consumer-rules.pro create mode 100644 OneSignalSDK/onesignal/iam/proguard-rules.pro create mode 100644 OneSignalSDK/onesignal/iam/src/main/AndroidManifest.xml rename OneSignalSDK/onesignal/{src/main/java/com/onesignal/iam/internal => iam/src/main/java/com/onesignal/iam}/IAMModule.kt (87%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/IAMManager.kt (96%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/InAppMessage.kt (99%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/InAppMessageAction.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/InAppMessageContent.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/InAppMessageOutcome.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/InAppMessagePage.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/InAppMessageRedisplayStats.kt (98%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/InAppMessageTag.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/Trigger.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/backend/IInAppBackendService.kt (98%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/backend/impl/InAppBackendService.kt (97%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/common/InAppHelper.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/common/OneSignalChromeTab.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/display/IInAppDisplayer.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/display/impl/DraggableRelativeLayout.kt (99%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt (97%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/display/impl/InAppMessageView.kt (98%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/display/impl/OSWebView.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalAnimate.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalBounceInterpolator.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/display/impl/WebViewManager.kt (98%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/hydrators/InAppHydrator.kt (94%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleEventHandler.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleService.kt (92%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/lifecycle/impl/IAMLifecycleService.kt (95%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/preferences/IInAppPreferencesController.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/preferences/impl/InAppPreferencesController.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/preview/InAppMessagePreviewHandler.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/prompt/IInAppMessagePromptFactory.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessageLocationPrompt.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePrompt.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePromptFactory.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePushPrompt.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/repositories/impl/InAppRepository.kt (98%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/state/InAppStateService.kt (100%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/triggers/ITriggerController.kt (96%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/triggers/ITriggerHandler.kt (94%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerController.kt (95%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerTimer.kt (91%) rename OneSignalSDK/onesignal/{ => iam}/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt (96%) create mode 100644 OneSignalSDK/onesignal/iam/src/main/res/values/strings.xml create mode 100644 OneSignalSDK/onesignal/iam/src/test/java/com/onesignal/iam/ExampleUnitTest.kt create mode 100644 OneSignalSDK/onesignal/location/.gitignore create mode 100644 OneSignalSDK/onesignal/location/build.gradle create mode 100644 OneSignalSDK/onesignal/location/consumer-rules.pro create mode 100644 OneSignalSDK/onesignal/location/proguard-rules.pro create mode 100644 OneSignalSDK/onesignal/location/src/main/AndroidManifest.xml rename OneSignalSDK/onesignal/{src/main/java/com/onesignal/location/internal => location/src/main/java/com/onesignal/location}/LocationModule.kt (78%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/LocationManager.kt (97%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/background/LocationBackgroundService.kt (97%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/capture/ILocationCapturer.kt (100%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt (95%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/common/LocationConstants.kt (100%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/common/LocationPoint.kt (100%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/common/LocationUtils.kt (95%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/controller/ILocationController.kt (84%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/controller/impl/GmsLocationController.kt (98%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/controller/impl/GoogleApiClientCompatProxy.kt (100%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/controller/impl/HmsLocationController.kt (95%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/controller/impl/NullLocationController.kt (100%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt (93%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/permissions/NavigateToAndroidSettingsForLocation.kt (100%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/preferences/ILocationPreferencesService.kt (100%) rename OneSignalSDK/onesignal/{ => location}/src/main/java/com/onesignal/location/internal/preferences/impl/LocationPreferencesService.kt (100%) create mode 100644 OneSignalSDK/onesignal/location/src/main/res/values/strings.xml create mode 100644 OneSignalSDK/onesignal/location/src/test/java/com/onesignal/location/ExampleUnitTest.kt create mode 100644 OneSignalSDK/onesignal/notification/.gitignore create mode 100644 OneSignalSDK/onesignal/notification/build.gradle create mode 100644 OneSignalSDK/onesignal/notification/consumer-rules.pro rename OneSignalSDK/onesignal/{ => notification}/libs/amazon-device-messaging-1.1.0.jar (100%) create mode 100644 OneSignalSDK/onesignal/notification/proguard-rules.pro rename OneSignalSDK/onesignal/{src/release => notification/src/debug}/AndroidManifest.xml (95%) create mode 100644 OneSignalSDK/onesignal/notification/src/main/AndroidManifest.xml rename OneSignalSDK/onesignal/{src/main/java/com/onesignal/notification/internal => notification/src/main/java/com/onesignal/notification}/NotificationModule.kt (91%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivity.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityAndroid22AndOlder.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityBase.kt (95%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityHMS.kt (97%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/bridges/OneSignalHmsEventBridge.kt (94%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/MutableNotification.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/Notification.kt (99%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/NotificationAction.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/NotificationOpenedResult.kt (93%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/NotificationReceivedEvent.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt (95%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/PermissionState.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/PermissionStateChanges.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/analytics/IAnalyticsTracker.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt (99%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/analytics/impl/NoAnalyticsTracker.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/backend/INotificationBackendService.kt (97%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/backend/impl/NotificationBackendService.kt (96%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/IBadgeCountUpdater.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/BadgeCountUpdater.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/Badger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadgeException.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AdwHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ApexHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AsusHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/DefaultBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/EverythingMeHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/HuaweiHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/LGHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NewHtcHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NovaHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/OPPOHomeBader.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SamsungHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SonyHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/VivoHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/XiaomiHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ZukHomeBadger.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/BroadcastHelper.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/CloseHelper.java (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/bundle/INotificationBundleProcessor.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/bundle/impl/NotificationBundleProcessor.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/channels/INotificationChannelManager.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/channels/impl/NotificationChannelManager.kt (97%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntent.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntentFromPushPayload.kt (94%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/common/NotificationConstants.kt (96%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/common/NotificationFormatHelper.kt (97%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/common/NotificationGenerationJob.kt (96%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/common/NotificationHelper.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenAppSettings.kt (94%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenBehaviorFromPushPayload.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/data/INotificationQueryHelper.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/data/INotificationRepository.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt (95%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/data/impl/NotificationRepository.kt (99%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayBuilder.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayer.kt (83%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/display/ISummaryNotificationDisplayer.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/display/impl/IntentGeneratorForAttachingToNotifications.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayBuilder.kt (99%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayer.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/display/impl/SummaryNotificationDisplayer.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationProcessor.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationWorkManager.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationWorkManager.kt (97%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleCallback.kt (93%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleEventHandler.kt (89%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleService.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/lifecycle/impl/NotificationLifecycleService.kt (96%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/limiting/INotificationLimitManager.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/limiting/impl/NotificationLimitManager.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/listeners/ApplicationListener.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt (76%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt (93%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt (93%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessor.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessorHMS.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/open/impl/NotificationIntentExtras.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessorHMS.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt (92%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/permissions/impl/NavigateToAndroidSettingsForNotifications.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt (95%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt (89%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt (96%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptProcessor.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptWorkManager.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptProcessor.kt (89%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt (93%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/registration/IPushRegistrator.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt (97%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/registration/impl/IPushRegistratorCallback.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorADM.kt (95%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt (97%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorHMS.kt (97%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorNone.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreProcessor.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreWorkManager.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreProcessor.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreWorkManager.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/summary/INotificationSummaryManager.kt (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/receivers/ADMMessageReceiver.kt (94%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/receivers/BootUpReceiver.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/receivers/FCMBroadcastReceiver.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/receivers/NotificationDismissReceiver.kt (95%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/receivers/UpgradeReceiver.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/services/ADMMessageHandler.kt (92%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/services/ADMMessageHandlerJob.kt (91%) rename OneSignalSDK/onesignal/{ => notification}/src/main/java/com/onesignal/notification/services/HmsMessageServiceOneSignal.kt (98%) rename OneSignalSDK/onesignal/{ => notification}/src/main/res/drawable-hdpi/ic_os_notification_fallback_white_24dp.png (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/res/drawable-mdpi/ic_os_notification_fallback_white_24dp.png (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/res/drawable-xhdpi/ic_os_notification_fallback_white_24dp.png (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/res/drawable-xxhdpi/ic_os_notification_fallback_white_24dp.png (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/res/drawable-xxxhdpi/ic_os_notification_fallback_white_24dp.png (100%) rename OneSignalSDK/onesignal/{ => notification}/src/main/res/layout/onesignal_bgimage_notif_layout.xml (100%) create mode 100644 OneSignalSDK/onesignal/notification/src/main/res/raw/consumer_onesignal_keep.xml create mode 100644 OneSignalSDK/onesignal/notification/src/main/res/values/strings.xml rename OneSignalSDK/onesignal/{src/debug => notification/src/release}/AndroidManifest.xml (96%) create mode 100644 OneSignalSDK/onesignal/notification/src/test/java/com/onesignal/notification/ExampleUnitTest.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/Continue.kt (99%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/IOneSignal.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/OneSignal.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/AndroidSupportV4Compat.kt (97%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/AndroidUtils.kt (98%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/DateUtils.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/DeviceUtils.kt (96%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/IDManager.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/JSONObjectExtensions.kt (97%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/JSONUtils.kt (97%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/NetworkUtils.kt (81%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/common/OneSignalUtils.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/RootToolsInternalMethods.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/TimeUtils.kt (89%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/ViewUtils.kt (98%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/events/CallbackProducer.kt (88%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/events/EventProducer.kt (90%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/events/ICallbackNotifier.kt (53%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/events/IEventNotifier.kt (66%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/common/exceptions/BackendException.kt create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/common/exceptions/MainThreadException.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/IModelChangedHandler.kt (92%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/IModelStore.kt (91%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/IModelStoreChangeHandler.kt (90%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/ISingletonModelStore.kt (82%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/ISingletonModelStoreChangeHandler.kt (86%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/MapModel.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/Model.kt (97%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/ModelStore.kt (92%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/SimpleModelStore.kt (91%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => common}/modeling/SingletonModelStore.kt (91%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modules/IModule.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/service => common/services}/IServiceBuilder.kt (98%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/service => common/services}/IServiceProvider.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/service => common/services}/ServiceBuilder.kt (76%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/service => common/services}/ServiceProvider.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/service => common/services}/ServiceRegistration.kt (76%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/threading/ThreadUtils.kt (82%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => }/common/threading/Waiter.kt (95%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/CoreModule.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/CoreModule.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/backend/BackendException.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/BundleCompat.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/OneSignalUtils.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/exceptions/MainThreadException.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/{models => config}/ConfigModel.kt (95%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/config/ConfigModelStore.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/{listeners => config/impl}/ConfigModelStoreListener.kt (89%) delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/models/ModelStoreDefs.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/{ => operations}/listeners/ModelStoreListener.kt (59%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/{ => operations}/listeners/SingletonModelStoreListener.kt (57%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/permissions/{impl => }/AlertDialogPrepromptForAndroidSettings.kt (92%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/{ => impl}/TrackAmazonPurchase.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/purchases/{ => impl}/TrackGooglePurchase.kt (97%) delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/aliases/Alias.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/subscriptions/EmailSubscription.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/subscriptions/SmsSubscription.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/tags/Tag.kt delete mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/user/triggers/Trigger.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/debug/IDebugManager.kt (93%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/debug/LogLevel.kt (75%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/debug => debug/internal}/DebugManager.kt (68%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => debug}/internal/logging/Logging.kt (94%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/MisconfiguredIAMManager.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/internal/OneSignalImp.kt (80%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/MisconfiguredLocationManager.kt create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/MisconfiguredNotificationsManager.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/session/ISessionManager.kt (97%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/session/SessionModule.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/session => session/internal}/SessionManager.kt (75%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/IInfluenceManager.kt (91%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/Influence.kt (97%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/InfluenceChannel.kt (74%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/InfluenceType.kt (85%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/impl/ChannelTracker.kt (96%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/impl/IChannelTracker.kt (70%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/impl/IInfluenceDataRepository.kt (92%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/impl/InAppMessageTracker.kt (92%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/impl/InfluenceConstants.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/impl/InfluenceDataRepository.kt (96%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/impl/InfluenceManager.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/influence/impl/NotificationTracker.kt (85%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/IOutcomeEvent.kt (54%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/IOutcomeEventsController.kt (83%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/CachedUniqueOutcome.kt (76%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/IOutcomeEventsBackendService.kt (86%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/IOutcomeEventsPreferences.kt (83%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/IOutcomeEventsRepository.kt (91%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeConstants.kt (89%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeEvent.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeEventParams.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeEventsBackendService.kt (87%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeEventsController.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeEventsPreferences.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeEventsRepository.kt (97%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeSource.kt (94%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeSourceBody.kt (92%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomeTableProvider.kt (92%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/outcomes/impl/OutcomesDbContract.kt (96%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/session/ISessionLifecycleHandler.kt (84%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/session/ISessionService.kt (63%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/models => session/internal/session}/SessionModel.kt (89%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/session/internal/session/SessionModelStore.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/listeners => session/internal/session/impl}/SessionListener.kt (73%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => session}/internal/session/impl/SessionService.kt (87%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/user/IUserManager.kt (98%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/user/UserModule.kt create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/user/internal/EmailSubscription.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/user/subscriptions => user/internal}/PushSubscription.kt (65%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/user/internal/SmsSubscription.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/user/subscriptions => user/internal}/Subscription.kt (64%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/user => user/internal}/UserManager.kt (87%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/IIdentityBackendService.kt (96%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/ISubscriptionBackendService.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/IUserBackendService.kt (95%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/PropertiesDeltasObject.kt (69%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/PropertiesObject.kt (83%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/SubscriptionObject.kt (86%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/SubscriptionObjectType.kt (90%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/impl/IdentityBackendService.kt (84%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/impl/SubscriptionBackendService.kt (87%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/backend/impl/UserBackendService.kt (92%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/models => user/internal/identity}/IdentityModel.kt (77%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/user/internal/identity/IdentityModelStore.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/CreateSubscriptionOperation.kt (86%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/CreateUserOperation.kt (80%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/DeleteAliasOperation.kt (77%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/DeleteSubscriptionOperation.kt (79%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/DeleteTagOperation.kt (78%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/SetAliasOperation.kt (81%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/SetPropertyOperation.kt (80%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/SetTagOperation.kt (81%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/TrackPurchaseOperation.kt (87%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/TrackSessionOperation.kt (78%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => user}/internal/operations/UpdateSubscriptionOperation.kt (84%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/operations/impl => user/internal/operations/impl/executors}/IdentityOperationExecutor.kt (78%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/operations/impl => user/internal/operations/impl/executors}/SubscriptionOperationExecutor.kt (84%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/operations/impl => user/internal/operations/impl/executors}/UserOperationExecutor.kt (90%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => user/internal/operations/impl}/listeners/IdentityModelStoreListener.kt (68%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => user/internal/operations/impl}/listeners/PropertiesModelStoreListener.kt (69%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal => user/internal/operations/impl}/listeners/SubscriptionModelStoreListener.kt (67%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/models => user/internal/properties}/PropertiesModel.kt (93%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/user/internal/properties/PropertiesModelStore.kt create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/user/internal/subscriptions/ISubscriptionManager.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/models => user/internal/subscriptions}/SubscriptionModel.kt (91%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/user/internal/subscriptions/SubscriptionModelStore.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/user => user/internal/subscriptions/impl}/SubscriptionManager.kt (82%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core/internal/models => user/internal/triggers}/TriggerModel.kt (72%) create mode 100644 OneSignalSDK/onesignal/src/main/java/com/onesignal/user/internal/triggers/TriggerModelStore.kt rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/user/subscriptions/IEmailSubscription.kt (85%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/user/subscriptions/IPushSubscription.kt (90%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/user/subscriptions/ISmsSubscription.kt (88%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/user/subscriptions/ISubscription.kt (75%) rename OneSignalSDK/onesignal/src/main/java/com/onesignal/{core => }/user/subscriptions/SubscriptionList.kt (96%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/core}/internal/database/InitialOSDatabase.kt (97%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/core}/internal/database/OSDatabaseTests.kt (87%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/core}/internal/http/HttpClientTests.kt (94%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/core}/internal/http/MockHttpConnectionFactory.kt (98%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/core}/mocks/MockHelper.kt (80%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/core}/mocks/MockPreferencesService.kt (97%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core => }/tests/extensions/ContainedRobolectricRunner.kt (98%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core => }/tests/extensions/RobolectricExtension.kt (98%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/session}/internal/influence/InfluenceManagerTests.kt (96%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/session}/internal/outcomes/OutcomeEventsBackendServiceTests.kt (94%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/session}/internal/outcomes/OutcomeEventsControllerTests.kt (95%) rename OneSignalSDK/onesignal/src/test/java/com/onesignal/{core/tests => tests/session}/internal/session/SessionServiceTests.kt (94%) diff --git a/Examples/OneSignalDemo/app/build.gradle b/Examples/OneSignalDemo/app/build.gradle index 2cf76baad0..bcb520b5e0 100644 --- a/Examples/OneSignalDemo/app/build.gradle +++ b/Examples/OneSignalDemo/app/build.gradle @@ -1,10 +1,12 @@ -apply plugin: 'com.android.application' +plugins { + id 'com.android.application' +} android { - compileSdkVersion 31 + compileSdkVersion 33 defaultConfig { minSdkVersion 16 - targetSdkVersion 31 + targetSdkVersion 33 versionCode 1 versionName "1.0" multiDexEnabled true @@ -54,24 +56,28 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" - implementation 'com.android.support:multidex:1.0.3' - implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.appcompat:appcompat:1.4.0' + implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.vectordrawable:vectordrawable:1.1.0' - implementation 'com.google.android.gms:play-services-location:18.0.0' + implementation 'com.google.android.material:material:1.7.0' + implementation 'com.google.android.gms:play-services-location:21.0.0' implementation 'com.github.bumptech.glide:glide:4.12.0' + implementation('com.onesignal:OneSignal:4.8.2') + implementation('com.onesignal:Location:4.8.2') + implementation('com.onesignal:IAM:4.8.2') + /** START - Google Play Builds **/ - gmsImplementation('com.onesignal:OneSignal:4.6.3') + gmsImplementation('com.onesignal:Notification:4.8.2') /** END - Google Play Builds **/ /** START - Huawei Builds **/ // Omit Google / Firebase libraries for Huawei builds. - huaweiImplementation('com.onesignal:OneSignal:4.6.3') { + huaweiImplementation('com.onesignal:Notification:4.8.2') { exclude group: 'com.google.android.gms', module: 'play-services-gcm' exclude group: 'com.google.android.gms', module: 'play-services-analytics' exclude group: 'com.google.android.gms', module: 'play-services-location' diff --git a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/activity/MainActivity.java b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/activity/MainActivity.java index 3f21992ee7..202ed3e15e 100644 --- a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/activity/MainActivity.java +++ b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/activity/MainActivity.java @@ -6,7 +6,7 @@ import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; -import com.onesignal.core.OneSignal; +import com.onesignal.OneSignal; import com.onesignal.sdktest.R; import com.onesignal.sdktest.model.MainActivityViewModel; diff --git a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/application/MainApplication.java b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/application/MainApplication.java index 71c8d59c86..d802ff4482 100644 --- a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/application/MainApplication.java +++ b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/application/MainApplication.java @@ -7,12 +7,12 @@ import androidx.annotation.Nullable; import androidx.multidex.MultiDexApplication; -import com.onesignal.core.OneSignal; +import com.onesignal.OneSignal; import com.onesignal.iam.IInAppMessage; import com.onesignal.iam.IInAppMessageAction; import com.onesignal.iam.IInAppMessageClickHandler; import com.onesignal.iam.IInAppMessageLifecycleHandler; -import com.onesignal.core.debug.LogLevel; +import com.onesignal.debug.LogLevel; import com.onesignal.notification.INotification; import com.onesignal.sdktest.BuildConfig; import com.onesignal.sdktest.R; diff --git a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java index a1133f8a62..9e432afadc 100644 --- a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java +++ b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java @@ -24,12 +24,12 @@ import android.widget.Switch; import android.widget.TextView; -import com.onesignal.core.Continue; -import com.onesignal.core.OneSignal; +import com.onesignal.Continue; +import com.onesignal.OneSignal; import com.onesignal.notification.IPermissionStateChanges; -import com.onesignal.core.user.subscriptions.IEmailSubscription; -import com.onesignal.core.user.subscriptions.IPushSubscription; -import com.onesignal.core.user.subscriptions.ISmsSubscription; +import com.onesignal.user.subscriptions.IEmailSubscription; +import com.onesignal.user.subscriptions.IPushSubscription; +import com.onesignal.user.subscriptions.ISmsSubscription; import com.onesignal.sdktest.R; import com.onesignal.sdktest.activity.SecondaryActivity; import com.onesignal.sdktest.adapter.InAppMessageRecyclerViewAdapter; diff --git a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/SplashActivityViewModel.java b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/SplashActivityViewModel.java index 59cbd18a0d..0be310b958 100644 --- a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/SplashActivityViewModel.java +++ b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/SplashActivityViewModel.java @@ -8,7 +8,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; -import com.onesignal.core.OneSignal; +import com.onesignal.OneSignal; import com.onesignal.notification.IPermissionStateChanges; import com.onesignal.sdktest.constant.Tag; import com.onesignal.sdktest.constant.Text; diff --git a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/NotificationServiceExtension.java b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/NotificationServiceExtension.java index 0f5711cb74..08fe4406d6 100644 --- a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/NotificationServiceExtension.java +++ b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/NotificationServiceExtension.java @@ -2,8 +2,8 @@ import android.content.Context; -import com.onesignal.core.debug.LogLevel; -import com.onesignal.core.internal.logging.Logging; +import com.onesignal.debug.LogLevel; +import com.onesignal.debug.internal.logging.Logging; import com.onesignal.notification.IActionButton; import com.onesignal.notification.IMutableNotification; import com.onesignal.notification.INotification; diff --git a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/OneSignalNotificationSender.java b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/OneSignalNotificationSender.java index 309dfe17c7..6ec47c5990 100644 --- a/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/OneSignalNotificationSender.java +++ b/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/OneSignalNotificationSender.java @@ -2,9 +2,9 @@ import android.util.Log; -import com.onesignal.core.Continue; -import com.onesignal.core.OneSignal; -import com.onesignal.core.user.subscriptions.IPushSubscription; +import com.onesignal.Continue; +import com.onesignal.OneSignal; +import com.onesignal.user.subscriptions.IPushSubscription; import com.onesignal.sdktest.constant.Tag; import com.onesignal.sdktest.type.Notification; diff --git a/OneSignalSDK/build.gradle b/OneSignalSDK/build.gradle index a8b8667855..db196ad4bd 100644 --- a/OneSignalSDK/build.gradle +++ b/OneSignalSDK/build.gradle @@ -5,17 +5,19 @@ buildscript { ext { buildVersions = [ compileSdkVersion: 31, - targetSdkVersion: 31 + targetSdkVersion: 31, + minSdkVersion: 16 ] - androidGradlePluginVersion = '7.0.4' + androidGradlePluginVersion = '7.2.0' googleServicesGradlePluginVersion = '4.3.10' huaweiAgconnectVersion = '1.6.2.300' huaweiHMSPushVersion = '6.3.0.304' huaweiHMSLocationVersion = '4.0.0.300' - kotlinVersion = '1.6.21' + kotlinVersion = '1.7.10' kotestVersion = '5.5.0' ktlintVersion = '11.0.0' detektVersion = '1.21.0' + junitVersion = '4.13.2' } repositories { @@ -30,7 +32,6 @@ buildscript { classpath "com.google.gms:google-services:$googleServicesGradlePluginVersion" classpath "com.huawei.agconnect:agcp:$huaweiAgconnectVersion" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktlintVersion" classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion" } diff --git a/OneSignalSDK/gradle/wrapper/gradle-wrapper.properties b/OneSignalSDK/gradle/wrapper/gradle-wrapper.properties index 3cd8500c13..669386b870 100644 --- a/OneSignalSDK/gradle/wrapper/gradle-wrapper.properties +++ b/OneSignalSDK/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/OneSignalSDK/onesignal/build.gradle b/OneSignalSDK/onesignal/build.gradle index ce9c395a64..64daa87dba 100644 --- a/OneSignalSDK/onesignal/build.gradle +++ b/OneSignalSDK/onesignal/build.gradle @@ -1,22 +1,16 @@ -ext { - buildVersions = [ - minSdkVersion: 16 - ] +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'org.jlleitschuh.gradle.ktlint' + id 'io.gitlab.arturbosch.detekt' } -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'org.jlleitschuh.gradle.ktlint' -apply plugin: 'io.gitlab.arturbosch.detekt' - android { compileSdkVersion rootProject.buildVersions.compileSdkVersion defaultConfig { - minSdkVersion buildVersions.minSdkVersion - consumerProguardFiles 'consumer-proguard-rules.pro' + minSdkVersion rootProject.buildVersions.minSdkVersion + consumerProguardFiles 'consumer-rules.pro' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - testOptions.unitTests.includeAndroidResources = true } buildTypes { @@ -45,6 +39,10 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + kotlinOptions { + jvmTarget = '1.8' + } + namespace 'com.onesignal' } tasks.withType(Test) { @@ -62,79 +60,26 @@ tasks.withType(Test) { // make sure the latest minor value is a known stable version. Using a range for the // patch version is ok, since this allows getting bug fix versions. dependencies { - compileOnly fileTree(dir: 'libs', include: ['*.jar']) - compileOnly('com.amazon.device:amazon-appstore-sdk:[3.0.1, 3.0.99]') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" - implementation 'androidx.work:work-runtime-ktx:2.7.1' - - // play-services-location:16.0.0 is the last version before going to AndroidX - // play-services-location:17.0.0 is the first version using AndroidX - compileOnly('com.google.android.gms:play-services-location:[17.0.0, 18.0.99]') { - version { - require '[17.0.0, 18.0.99]' - prefer '18.0.0' - } - } - // play-services-base:16.1.0 is the last version before going to AndroidX - // play-services-base:17.0.0 is the first version using AndroidX - // Required for GoogleApiAvailability - implementation('com.google.android.gms:play-services-base') { - version { - require '[17.0.0, 17.6.99]' - prefer '17.6.0' - } - } - - // firebase-messaging:18.0.0 is the last version before going to AndroidX - // firebase-messaging:19.0.0 is the first version using AndroidX - api('com.google.firebase:firebase-messaging') { - version { - require '[19.0.0, 22.0.99]' - prefer '22.0.0' - } - } - - // Huawei PushKit - // KEEP as "compileOnly", so OneSignal isn't a direct dependency in the POM file. - compileOnly "com.huawei.hms:push:$huaweiHMSPushVersion" - compileOnly "com.huawei.hms:location:$huaweiHMSLocationVersion" + compileOnly('com.amazon.device:amazon-appstore-sdk:[3.0.1, 3.0.99]') - api('androidx.cardview:cardview') { - version { - require '[1.0.0, 1.0.99]' - prefer '1.0.0' - } - } api('androidx.legacy:legacy-support-v4') { version { require '[1.0.0, 1.0.99]' prefer '1.0.0' } } - api('androidx.browser:browser') { - version { - require '[1.0.0, 1.3.99]' - prefer '1.3.0' - } - } api('androidx.appcompat:appcompat') { version { require '[1.0.0, 1.3.99]' prefer '1.3.1' } } - api('androidx.work:work-runtime') { - version { - require '[2.1.0, 2.7.99]' - prefer '2.7.1' - } - } - testImplementation("junit:junit:4.13.2") + testImplementation("junit:junit:$junitVersion") testImplementation("io.kotest:kotest-runner-junit4:$kotestVersion") testImplementation("io.kotest:kotest-runner-junit4-jvm:$kotestVersion") testImplementation("io.kotest:kotest-assertions-core:$kotestVersion") @@ -144,7 +89,7 @@ dependencies { testImplementation("androidx.test:core:1.4.0") testImplementation("io.mockk:mockk:1.13.2") testImplementation("org.json:json:20180813") - testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" + testImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") } apply from: 'maven-push.gradle' diff --git a/OneSignalSDK/onesignal/consumer-proguard-rules.pro b/OneSignalSDK/onesignal/consumer-proguard-rules.pro deleted file mode 100644 index 450a7de7ed..0000000000 --- a/OneSignalSDK/onesignal/consumer-proguard-rules.pro +++ /dev/null @@ -1,89 +0,0 @@ --dontwarn com.onesignal.** - -# These 2 methods are called with reflection. --keep class com.google.android.gms.common.api.GoogleApiClient { - void connect(); - void disconnect(); -} - -# Need to keep as these 2 methods are called with reflection from com.onesignal.PushRegistratorFCM --keep class com.google.firebase.iid.FirebaseInstanceId { - static com.google.firebase.iid.FirebaseInstanceId getInstance(com.google.firebase.FirebaseApp); - java.lang.String getToken(java.lang.String, java.lang.String); -} - --keep class com.onesignal.ActivityLifecycleListenerCompat** {*;} - -# Observer backcall methods are called with reflection --keep class com.onesignal.OSSubscriptionState { - void changed(com.onesignal.OSPermissionState); -} - --keep class com.onesignal.OSPermissionChangedInternalObserver { - void changed(com.onesignal.OSPermissionState); -} - --keep class com.onesignal.OSSubscriptionChangedInternalObserver { - void changed(com.onesignal.OSSubscriptionState); -} - --keep class com.onesignal.OSEmailSubscriptionChangedInternalObserver { - void changed(com.onesignal.OSEmailSubscriptionState); -} - --keep class com.onesignal.OSSMSSubscriptionChangedInternalObserver { - void changed(com.onesignal.OSSMSSubscriptionState); -} - --keep class ** implements com.onesignal.OSPermissionObserver { - void onOSPermissionChanged(com.onesignal.OSPermissionStateChanges); -} - --keep class ** implements com.onesignal.OSSubscriptionObserver { - void onOSSubscriptionChanged(com.onesignal.OSSubscriptionStateChanges); -} - --keep class ** implements com.onesignal.OSEmailSubscriptionObserver { - void onOSEmailSubscriptionChanged(com.onesignal.OSEmailSubscriptionStateChanges); -} - --keep class ** implements com.onesignal.OSSMSSubscriptionObserver { - void onOSEmailSubscriptionChanged(com.onesignal.OSSMSSubscriptionStateChanges); -} - --keep class com.onesignal.shortcutbadger.impl.AdwHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.ApexHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.AsusHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.DefaultBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.EverythingMeHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.HuaweiHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.LGHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.NewHtcHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.NovaHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.OPPOHomeBader { (...); } --keep class com.onesignal.shortcutbadger.impl.SamsungHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.SonyHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.VivoHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.XiaomiHomeBadger { (...); } --keep class com.onesignal.shortcutbadger.impl.ZukHomeBadger { (...); } - - --dontwarn com.amazon.** - --dontwarn com.huawei.** - -# Proguard ends up removing this class even if it is used in AndroidManifest.xml so force keeping it. --keep public class com.onesignal.ADMMessageHandler {*;} - --keep public class com.onesignal.ADMMessageHandlerJob {*;} - -# OSRemoteNotificationReceivedHandler is an interface designed to be extend then referenced in the -# app's AndroidManifest.xml as a meta-data tag. -# This doesn't count as a hard reference so this entry is required. --keep class ** implements com.onesignal.OneSignal$OSRemoteNotificationReceivedHandler { - void remoteNotificationReceived(android.content.Context, com.onesignal.OSNotificationReceivedEvent); -} - --keep class com.onesignal.JobIntentService$* {*;} - --keep class com.onesignal.OneSignalUnityProxy {*;} \ No newline at end of file diff --git a/OneSignalSDK/onesignal/consumer-rules.pro b/OneSignalSDK/onesignal/consumer-rules.pro new file mode 100644 index 0000000000..24aa8bfa01 --- /dev/null +++ b/OneSignalSDK/onesignal/consumer-rules.pro @@ -0,0 +1,3 @@ +-dontwarn com.onesignal.** + +-dontwarn com.amazon.** \ No newline at end of file diff --git a/OneSignalSDK/onesignal/iam/.gitignore b/OneSignalSDK/onesignal/iam/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/OneSignalSDK/onesignal/iam/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/OneSignalSDK/onesignal/iam/build.gradle b/OneSignalSDK/onesignal/iam/build.gradle new file mode 100644 index 0000000000..44db8cc130 --- /dev/null +++ b/OneSignalSDK/onesignal/iam/build.gradle @@ -0,0 +1,86 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'org.jlleitschuh.gradle.ktlint' + id 'io.gitlab.arturbosch.detekt' +} + +android { + compileSdkVersion rootProject.buildVersions.compileSdkVersion + defaultConfig { + minSdkVersion rootProject.buildVersions.minSdkVersion + consumerProguardFiles "consumer-rules.pro" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + original { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + release { + minifyEnabled false + } + unity { + minifyEnabled false + } + } + testOptions { + unitTests.all { + maxParallelForks 1 + maxHeapSize '2048m' + } + unitTests { + includeAndroidResources = true + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + namespace 'com.onesignal.iam' +} + +tasks.withType(Test) { + testLogging { + exceptionFormat "full" + events "started", "skipped", "passed", "failed" + showStandardStreams false // Enable to have logging print + } +} + +dependencies { + implementation project(':onesignal') + implementation project(':onesignal:notification') + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" + + api('androidx.cardview:cardview') { + version { + require '[1.0.0, 1.0.99]' + prefer '1.0.0' + } + } + api('androidx.browser:browser') { + version { + require '[1.0.0, 1.3.99]' + prefer '1.3.0' + } + } + + testImplementation("junit:junit:$junitVersion") + testImplementation("io.kotest:kotest-runner-junit4:$kotestVersion") + testImplementation("io.kotest:kotest-runner-junit4-jvm:$kotestVersion") + testImplementation("io.kotest:kotest-assertions-core:$kotestVersion") + testImplementation("io.kotest:kotest-property:$kotestVersion") + testImplementation("org.robolectric:robolectric:4.8.1") + testImplementation("androidx.test:core-ktx:1.4.0") + testImplementation("androidx.test:core:1.4.0") + testImplementation("io.mockk:mockk:1.13.2") + testImplementation("org.json:json:20180813") + testImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") +} \ No newline at end of file diff --git a/OneSignalSDK/onesignal/iam/consumer-rules.pro b/OneSignalSDK/onesignal/iam/consumer-rules.pro new file mode 100644 index 0000000000..9f4d1d06b6 --- /dev/null +++ b/OneSignalSDK/onesignal/iam/consumer-rules.pro @@ -0,0 +1 @@ +-dontwarn com.onesignal.iam.** \ No newline at end of file diff --git a/OneSignalSDK/onesignal/iam/proguard-rules.pro b/OneSignalSDK/onesignal/iam/proguard-rules.pro new file mode 100644 index 0000000000..481bb43481 --- /dev/null +++ b/OneSignalSDK/onesignal/iam/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/OneSignalSDK/onesignal/iam/src/main/AndroidManifest.xml b/OneSignalSDK/onesignal/iam/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..44008a4332 --- /dev/null +++ b/OneSignalSDK/onesignal/iam/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMModule.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/IAMModule.kt similarity index 87% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMModule.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/IAMModule.kt index 63c72dbde5..6a7ff32a53 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMModule.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/IAMModule.kt @@ -1,9 +1,11 @@ -package com.onesignal.iam.internal +package com.onesignal.iam import android.os.Build -import com.onesignal.core.internal.service.ServiceBuilder +import com.onesignal.common.modules.IModule +import com.onesignal.common.services.ServiceBuilder import com.onesignal.core.internal.startup.IStartableService -import com.onesignal.iam.IIAMManager +import com.onesignal.iam.internal.DummyIAMManager +import com.onesignal.iam.internal.IAMManager import com.onesignal.iam.internal.backend.IInAppBackendService import com.onesignal.iam.internal.backend.impl.InAppBackendService import com.onesignal.iam.internal.display.IInAppDisplayer @@ -23,14 +25,12 @@ import com.onesignal.iam.internal.triggers.ITriggerController import com.onesignal.iam.internal.triggers.impl.DynamicTriggerController import com.onesignal.iam.internal.triggers.impl.TriggerController -internal object IAMModule { - fun register(builder: ServiceBuilder) { +internal class IAMModule : IModule { + override fun register(builder: ServiceBuilder) { // Make sure only Android 4.4 devices and higher can use IAMs if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) { - builder.register() - .provides() - } - else { + builder.register().provides() + } else { // Low level services builder.register().provides() builder.register().provides() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/DummyIAMManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/IAMManager.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/IAMManager.kt index cb8651935b..797ec25094 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/IAMManager.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/IAMManager.kt @@ -1,35 +1,28 @@ package com.onesignal.iam.internal import android.app.AlertDialog -import com.onesignal.R -import com.onesignal.core.debug.LogLevel +import com.onesignal.common.AndroidUtils +import com.onesignal.common.IDManager +import com.onesignal.common.JSONUtils +import com.onesignal.common.exceptions.BackendException +import com.onesignal.common.events.CallbackProducer +import com.onesignal.common.events.ICallbackProducer +import com.onesignal.common.modeling.ISingletonModelStoreChangeHandler +import com.onesignal.common.modeling.ModelChangedArgs +import com.onesignal.common.threading.suspendifyOnThread import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.backend.BackendException -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.common.IDManager -import com.onesignal.core.internal.common.JSONUtils -import com.onesignal.core.internal.common.events.CallbackProducer -import com.onesignal.core.internal.common.events.ICallbackProducer -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.influence.IInfluenceManager +import com.onesignal.core.internal.config.ConfigModel +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.language.ILanguageContext -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.modeling.ISingletonModelStoreChangeHandler -import com.onesignal.core.internal.modeling.ModelChangedArgs -import com.onesignal.core.internal.models.ConfigModel -import com.onesignal.core.internal.models.ConfigModelStore -import com.onesignal.core.internal.outcomes.IOutcomeEventsController -import com.onesignal.core.internal.session.ISessionLifecycleHandler -import com.onesignal.core.internal.session.ISessionService import com.onesignal.core.internal.startup.IStartableService import com.onesignal.core.internal.time.ITime -import com.onesignal.core.internal.user.ISubscriptionChangedHandler -import com.onesignal.core.internal.user.ISubscriptionManager -import com.onesignal.core.user.IUserManager +import com.onesignal.debug.LogLevel +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.IIAMManager import com.onesignal.iam.IInAppMessageClickHandler import com.onesignal.iam.IInAppMessageLifecycleHandler import com.onesignal.iam.InAppMessageActionUrlType +import com.onesignal.iam.R import com.onesignal.iam.internal.backend.IInAppBackendService import com.onesignal.iam.internal.common.InAppHelper import com.onesignal.iam.internal.common.OneSignalChromeTab @@ -42,6 +35,13 @@ import com.onesignal.iam.internal.repositories.IInAppRepository import com.onesignal.iam.internal.state.InAppStateService import com.onesignal.iam.internal.triggers.ITriggerController import com.onesignal.iam.internal.triggers.ITriggerHandler +import com.onesignal.session.internal.influence.IInfluenceManager +import com.onesignal.session.internal.outcomes.IOutcomeEventsController +import com.onesignal.session.internal.session.ISessionLifecycleHandler +import com.onesignal.session.internal.session.ISessionService +import com.onesignal.user.IUserManager +import com.onesignal.user.internal.subscriptions.ISubscriptionChangedHandler +import com.onesignal.user.internal.subscriptions.ISubscriptionManager import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessage.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessage.kt similarity index 99% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessage.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessage.kt index 2fb46908cc..685ce4c797 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessage.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessage.kt @@ -1,6 +1,6 @@ package com.onesignal.iam.internal -import com.onesignal.core.internal.common.DateUtils +import com.onesignal.common.DateUtils import com.onesignal.core.internal.time.ITime import com.onesignal.iam.IInAppMessage import org.json.JSONArray diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageAction.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageAction.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageAction.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageAction.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageContent.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageContent.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageContent.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageContent.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageOutcome.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageOutcome.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageOutcome.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageOutcome.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessagePage.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessagePage.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessagePage.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessagePage.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageRedisplayStats.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageRedisplayStats.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageRedisplayStats.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageRedisplayStats.kt index beb983046e..7801d6fd7c 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageRedisplayStats.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageRedisplayStats.kt @@ -1,7 +1,7 @@ package com.onesignal.iam.internal -import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import org.json.JSONException import org.json.JSONObject diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageTag.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageTag.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/InAppMessageTag.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/InAppMessageTag.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/Trigger.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/Trigger.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/Trigger.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/Trigger.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/backend/IInAppBackendService.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/backend/IInAppBackendService.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/backend/IInAppBackendService.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/backend/IInAppBackendService.kt index b9d15f0083..00eebc6363 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/backend/IInAppBackendService.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/backend/IInAppBackendService.kt @@ -1,6 +1,6 @@ package com.onesignal.iam.internal.backend -import com.onesignal.core.internal.backend.BackendException +import com.onesignal.common.exceptions.BackendException import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.InAppMessageContent diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/backend/impl/InAppBackendService.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/backend/impl/InAppBackendService.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/backend/impl/InAppBackendService.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/backend/impl/InAppBackendService.kt index 592a739b6e..971171b204 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/backend/impl/InAppBackendService.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/backend/impl/InAppBackendService.kt @@ -1,10 +1,10 @@ package com.onesignal.iam.internal.backend.impl -import com.onesignal.core.internal.backend.BackendException -import com.onesignal.core.internal.common.NetworkUtils +import com.onesignal.common.NetworkUtils +import com.onesignal.common.exceptions.BackendException import com.onesignal.core.internal.device.IDeviceService import com.onesignal.core.internal.http.IHttpClient -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.InAppMessageContent import com.onesignal.iam.internal.backend.GetIAMDataResponse diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/common/InAppHelper.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/common/InAppHelper.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/common/InAppHelper.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/common/InAppHelper.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/common/OneSignalChromeTab.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/common/OneSignalChromeTab.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/common/OneSignalChromeTab.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/common/OneSignalChromeTab.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/IInAppDisplayer.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/IInAppDisplayer.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/IInAppDisplayer.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/IInAppDisplayer.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/DraggableRelativeLayout.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/DraggableRelativeLayout.kt similarity index 99% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/DraggableRelativeLayout.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/DraggableRelativeLayout.kt index 759166b9c8..e7f28aa39a 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/DraggableRelativeLayout.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/DraggableRelativeLayout.kt @@ -7,7 +7,7 @@ import android.view.View import android.widget.RelativeLayout import androidx.core.view.ViewCompat import androidx.customview.widget.ViewDragHelper -import com.onesignal.core.internal.common.ViewUtils +import com.onesignal.common.ViewUtils internal class DraggableRelativeLayout(context: Context?) : RelativeLayout(context) { internal interface DraggableListener { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt index 24f5215827..ca7ec4b420 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/InAppDisplayer.kt @@ -5,11 +5,10 @@ import android.app.Activity import android.os.Build import android.util.Base64 import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.influence.IInfluenceManager +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.language.ILanguageContext -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.ConfigModelStore import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.InAppMessageContent import com.onesignal.iam.internal.backend.IInAppBackendService @@ -17,11 +16,11 @@ import com.onesignal.iam.internal.common.InAppHelper import com.onesignal.iam.internal.display.IInAppDisplayer import com.onesignal.iam.internal.lifecycle.IInAppLifecycleService import com.onesignal.iam.internal.prompt.IInAppMessagePromptFactory +import com.onesignal.session.internal.influence.IInfluenceManager import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.withContext import java.io.UnsupportedEncodingException -import java.lang.Exception // Manages WebView instances by pre-loading them, displaying them, and closing them when dismissed. // Includes a static map for pre-loading, showing, and dismissed so these events can't be duplicated. diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppMessageView.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/InAppMessageView.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppMessageView.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/InAppMessageView.kt index d33eed81f7..6d9eed6912 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/InAppMessageView.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/InAppMessageView.kt @@ -18,12 +18,12 @@ import android.widget.PopupWindow import android.widget.RelativeLayout import androidx.cardview.widget.CardView import androidx.core.widget.PopupWindowCompat -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.common.ViewUtils -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging +import com.onesignal.common.AndroidUtils +import com.onesignal.common.ViewUtils +import com.onesignal.common.threading.Waiter +import com.onesignal.common.threading.suspendifyOnThread +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.internal.InAppMessageContent -import com.onesignal.onesignal.core.internal.common.suspend.Waiter import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.withContext diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/OSWebView.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/OSWebView.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/OSWebView.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/OSWebView.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalAnimate.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalAnimate.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalAnimate.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalAnimate.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalBounceInterpolator.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalBounceInterpolator.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalBounceInterpolator.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/OneSignalBounceInterpolator.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/WebViewManager.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/WebViewManager.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/WebViewManager.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/WebViewManager.kt index dda153b2ee..e522c6d8e9 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/display/impl/WebViewManager.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/display/impl/WebViewManager.kt @@ -7,13 +7,13 @@ import android.os.Build import android.view.View import android.webkit.JavascriptInterface import android.webkit.WebView -import com.onesignal.core.debug.LogLevel +import com.onesignal.common.ViewUtils +import com.onesignal.common.threading.suspendifyOnMain +import com.onesignal.common.threading.suspendifyOnThread import com.onesignal.core.internal.application.IActivityLifecycleHandler import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.ViewUtils -import com.onesignal.core.internal.common.suspendifyOnMain -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.LogLevel +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.InAppMessageAction import com.onesignal.iam.internal.InAppMessageContent @@ -55,6 +55,7 @@ internal class WebViewManager( get() { when (this) { TOP_BANNER, BOTTOM_BANNER -> return true + else -> { return false } } return false } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/hydrators/InAppHydrator.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/hydrators/InAppHydrator.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/hydrators/InAppHydrator.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/hydrators/InAppHydrator.kt index 8fd3c7c51a..e7ee91c63a 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/hydrators/InAppHydrator.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/hydrators/InAppHydrator.kt @@ -1,14 +1,13 @@ package com.onesignal.iam.internal.hydrators -import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.time.ITime -import com.onesignal.core.user.IUserManager +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.InAppMessageContent +import com.onesignal.user.IUserManager import org.json.JSONArray import org.json.JSONException import org.json.JSONObject -import java.util.ArrayList internal class InAppHydrator( private val _time: ITime, diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleEventHandler.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleEventHandler.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleEventHandler.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleEventHandler.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleService.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleService.kt similarity index 92% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleService.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleService.kt index 9e4485f4d6..c9d5506b42 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleService.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/lifecycle/IInAppLifecycleService.kt @@ -1,6 +1,6 @@ package com.onesignal.iam.internal.lifecycle -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.common.events.IEventNotifier import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.InAppMessageAction import com.onesignal.iam.internal.InAppMessagePage diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/lifecycle/impl/IAMLifecycleService.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/lifecycle/impl/IAMLifecycleService.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/lifecycle/impl/IAMLifecycleService.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/lifecycle/impl/IAMLifecycleService.kt index 20e2fc15cd..d18f43253f 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/lifecycle/impl/IAMLifecycleService.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/lifecycle/impl/IAMLifecycleService.kt @@ -1,6 +1,6 @@ package com.onesignal.iam.internal.lifecycle.impl -import com.onesignal.core.internal.common.events.EventProducer +import com.onesignal.common.events.EventProducer import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.InAppMessageAction import com.onesignal.iam.internal.InAppMessagePage diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/preferences/IInAppPreferencesController.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/preferences/IInAppPreferencesController.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/preferences/IInAppPreferencesController.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/preferences/IInAppPreferencesController.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/preferences/impl/InAppPreferencesController.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/preferences/impl/InAppPreferencesController.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/preferences/impl/InAppPreferencesController.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/preferences/impl/InAppPreferencesController.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/preview/InAppMessagePreviewHandler.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/preview/InAppMessagePreviewHandler.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/preview/InAppMessagePreviewHandler.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/preview/InAppMessagePreviewHandler.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/IInAppMessagePromptFactory.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/IInAppMessagePromptFactory.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/IInAppMessagePromptFactory.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/IInAppMessagePromptFactory.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessageLocationPrompt.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessageLocationPrompt.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessageLocationPrompt.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessageLocationPrompt.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePrompt.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePrompt.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePrompt.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePrompt.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePromptFactory.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePromptFactory.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePromptFactory.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePromptFactory.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePushPrompt.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePushPrompt.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePushPrompt.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/prompt/impl/InAppMessagePushPrompt.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/repositories/IInAppRepository.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/impl/InAppRepository.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/repositories/impl/InAppRepository.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/impl/InAppRepository.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/repositories/impl/InAppRepository.kt index 657d448a44..7b8d8158b2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/repositories/impl/InAppRepository.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/repositories/impl/InAppRepository.kt @@ -1,11 +1,11 @@ package com.onesignal.iam.internal.repositories.impl import android.content.ContentValues -import com.onesignal.core.internal.common.JSONUtils +import com.onesignal.common.JSONUtils import com.onesignal.core.internal.database.IDatabaseProvider import com.onesignal.core.internal.database.impl.OneSignalDbContract -import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.InAppMessageRedisplayStats import com.onesignal.iam.internal.preferences.IInAppPreferencesController diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/state/InAppStateService.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/state/InAppStateService.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/state/InAppStateService.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/state/InAppStateService.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/ITriggerController.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/ITriggerController.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/ITriggerController.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/ITriggerController.kt index 6855bddc08..04d6a79256 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/ITriggerController.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/ITriggerController.kt @@ -1,6 +1,6 @@ package com.onesignal.iam.internal.triggers -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.common.events.IEventNotifier import com.onesignal.iam.internal.InAppMessage internal interface ITriggerController : IEventNotifier { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/ITriggerHandler.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/ITriggerHandler.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/ITriggerHandler.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/ITriggerHandler.kt index 0086130546..2cab67f74e 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/ITriggerHandler.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/ITriggerHandler.kt @@ -1,6 +1,6 @@ package com.onesignal.iam.internal.triggers -import com.onesignal.core.user.IUserManager +import com.onesignal.user.IUserManager /** * Implement this interface and subscribe it via [ITriggerController.subscribe] to be notified when diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerController.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerController.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerController.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerController.kt index 67c1e3b769..3edc8855a8 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerController.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerController.kt @@ -1,13 +1,13 @@ package com.onesignal.iam.internal.triggers.impl -import com.onesignal.core.internal.common.events.EventProducer -import com.onesignal.core.internal.common.events.IEventNotifier -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.session.ISessionService +import com.onesignal.common.events.EventProducer +import com.onesignal.common.events.IEventNotifier import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.internal.Trigger import com.onesignal.iam.internal.state.InAppStateService import com.onesignal.iam.internal.triggers.ITriggerHandler +import com.onesignal.session.internal.session.ISessionService import java.util.TimerTask import kotlin.math.abs @@ -61,6 +61,7 @@ internal class DynamicTriggerController( _time.currentTimeMillis - lastTimeAppDismissed } } + else -> {} } val triggerId = trigger.triggerId diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerTimer.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerTimer.kt similarity index 91% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerTimer.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerTimer.kt index 5caeced5b4..553fa18ca7 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerTimer.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/DynamicTriggerTimer.kt @@ -1,6 +1,6 @@ package com.onesignal.iam.internal.triggers.impl -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import java.util.Timer import java.util.TimerTask diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt rename to OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt index 932e65dbce..62f0423a96 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt +++ b/OneSignalSDK/onesignal/iam/src/main/java/com/onesignal/iam/internal/triggers/impl/TriggerController.kt @@ -1,15 +1,14 @@ package com.onesignal.iam.internal.triggers.impl -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.modeling.IModelStoreChangeHandler -import com.onesignal.core.internal.modeling.ModelChangedArgs -import com.onesignal.core.internal.models.TriggerModel -import com.onesignal.core.internal.models.TriggerModelStore +import com.onesignal.common.modeling.IModelStoreChangeHandler +import com.onesignal.common.modeling.ModelChangedArgs +import com.onesignal.debug.internal.logging.Logging import com.onesignal.iam.internal.InAppMessage import com.onesignal.iam.internal.Trigger import com.onesignal.iam.internal.triggers.ITriggerController import com.onesignal.iam.internal.triggers.ITriggerHandler -import java.lang.NumberFormatException +import com.onesignal.user.internal.triggers.TriggerModel +import com.onesignal.user.internal.triggers.TriggerModelStore import java.text.DecimalFormat import java.util.concurrent.ConcurrentHashMap diff --git a/OneSignalSDK/onesignal/iam/src/main/res/values/strings.xml b/OneSignalSDK/onesignal/iam/src/main/res/values/strings.xml new file mode 100644 index 0000000000..f2e5066711 --- /dev/null +++ b/OneSignalSDK/onesignal/iam/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ + + + App Missing Permission + Looks like this app doesn\'t have location services configured. Please see OneSignal docs for more information. + diff --git a/OneSignalSDK/onesignal/iam/src/test/java/com/onesignal/iam/ExampleUnitTest.kt b/OneSignalSDK/onesignal/iam/src/test/java/com/onesignal/iam/ExampleUnitTest.kt new file mode 100644 index 0000000000..a10e9ff93e --- /dev/null +++ b/OneSignalSDK/onesignal/iam/src/test/java/com/onesignal/iam/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.onesignal.iam + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/OneSignalSDK/onesignal/location/.gitignore b/OneSignalSDK/onesignal/location/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/OneSignalSDK/onesignal/location/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/OneSignalSDK/onesignal/location/build.gradle b/OneSignalSDK/onesignal/location/build.gradle new file mode 100644 index 0000000000..e681ba3092 --- /dev/null +++ b/OneSignalSDK/onesignal/location/build.gradle @@ -0,0 +1,85 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'org.jlleitschuh.gradle.ktlint' + id 'io.gitlab.arturbosch.detekt' +} + +android { + compileSdkVersion rootProject.buildVersions.compileSdkVersion + defaultConfig { + minSdkVersion rootProject.buildVersions.minSdkVersion + consumerProguardFiles "consumer-rules.pro" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + original { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + release { + minifyEnabled false + } + unity { + minifyEnabled false + } + } + testOptions { + unitTests.all { + maxParallelForks 1 + maxHeapSize '2048m' + } + unitTests { + includeAndroidResources = true + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + namespace 'com.onesignal.location' +} + +tasks.withType(Test) { + testLogging { + exceptionFormat "full" + events "started", "skipped", "passed", "failed" + showStandardStreams false // Enable to have logging print + } +} + +dependencies { + implementation project(':onesignal') + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" + + // play-services-location:16.0.0 is the last version before going to AndroidX + // play-services-location:17.0.0 is the first version using AndroidX + compileOnly('com.google.android.gms:play-services-location:[17.0.0, 18.0.99]') { + version { + require '[17.0.0, 18.0.99]' + prefer '18.0.0' + } + } + + // Huawei PushKit + // KEEP as "compileOnly", so OneSignal isn't a direct dependency in the POM file. + compileOnly "com.huawei.hms:location:$huaweiHMSLocationVersion" + + testImplementation("junit:junit:$junitVersion") + testImplementation("io.kotest:kotest-runner-junit4:$kotestVersion") + testImplementation("io.kotest:kotest-runner-junit4-jvm:$kotestVersion") + testImplementation("io.kotest:kotest-assertions-core:$kotestVersion") + testImplementation("io.kotest:kotest-property:$kotestVersion") + testImplementation("org.robolectric:robolectric:4.8.1") + testImplementation("androidx.test:core-ktx:1.4.0") + testImplementation("androidx.test:core:1.4.0") + testImplementation("io.mockk:mockk:1.13.2") + testImplementation("org.json:json:20180813") + testImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") +} \ No newline at end of file diff --git a/OneSignalSDK/onesignal/location/consumer-rules.pro b/OneSignalSDK/onesignal/location/consumer-rules.pro new file mode 100644 index 0000000000..7c1eb21f47 --- /dev/null +++ b/OneSignalSDK/onesignal/location/consumer-rules.pro @@ -0,0 +1 @@ +-dontwarn com.onesignal.location.** \ No newline at end of file diff --git a/OneSignalSDK/onesignal/location/proguard-rules.pro b/OneSignalSDK/onesignal/location/proguard-rules.pro new file mode 100644 index 0000000000..481bb43481 --- /dev/null +++ b/OneSignalSDK/onesignal/location/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/OneSignalSDK/onesignal/location/src/main/AndroidManifest.xml b/OneSignalSDK/onesignal/location/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..1c58b57653 --- /dev/null +++ b/OneSignalSDK/onesignal/location/src/main/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationModule.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/LocationModule.kt similarity index 78% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationModule.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/LocationModule.kt index 79854004e7..2ea152c3ae 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationModule.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/LocationModule.kt @@ -1,14 +1,16 @@ -package com.onesignal.location.internal +package com.onesignal.location +import com.onesignal.common.modules.IModule +import com.onesignal.common.services.ServiceBuilder import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.background.IBackgroundService import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.service.ServiceBuilder import com.onesignal.core.internal.startup.IStartableService -import com.onesignal.location.ILocationManager +import com.onesignal.location.internal.LocationManager import com.onesignal.location.internal.background.LocationBackgroundService import com.onesignal.location.internal.capture.ILocationCapturer import com.onesignal.location.internal.capture.impl.LocationCapturer +import com.onesignal.location.internal.common.LocationUtils import com.onesignal.location.internal.controller.ILocationController import com.onesignal.location.internal.controller.impl.GmsLocationController import com.onesignal.location.internal.controller.impl.HmsLocationController @@ -17,17 +19,17 @@ import com.onesignal.location.internal.permissions.LocationPermissionController import com.onesignal.location.internal.preferences.ILocationPreferencesService import com.onesignal.location.internal.preferences.impl.LocationPreferencesService -internal object LocationModule { - fun register(builder: ServiceBuilder) { +internal class LocationModule : IModule { + override fun register(builder: ServiceBuilder) { builder.register() .provides() .provides() builder.register { val deviceService = it.getService(IDeviceService::class.java) - val service = if (deviceService.isGooglePlayServicesAvailable) { + val service = if (deviceService.isAndroidDeviceType && LocationUtils.hasGMSLocationLibrary()) { GmsLocationController(it.getService(IApplicationService::class.java)) - } else if (deviceService.isHMSAvailable) { + } else if (deviceService.isHuaweiDeviceType && LocationUtils.hasHMSLocationLibrary()) { HmsLocationController(it.getService(IApplicationService::class.java)) } else { NullLocationController() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationManager.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/LocationManager.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationManager.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/LocationManager.kt index 01c5cb7872..5737b1e8a9 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/LocationManager.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/LocationManager.kt @@ -1,12 +1,12 @@ package com.onesignal.location.internal import android.os.Build -import com.onesignal.core.debug.LogLevel +import com.onesignal.common.AndroidUtils +import com.onesignal.common.threading.suspendifyOnThread import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.startup.IStartableService +import com.onesignal.debug.LogLevel +import com.onesignal.debug.internal.logging.Logging import com.onesignal.location.ILocationManager import com.onesignal.location.internal.capture.ILocationCapturer import com.onesignal.location.internal.common.LocationConstants diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/background/LocationBackgroundService.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/background/LocationBackgroundService.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/background/LocationBackgroundService.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/background/LocationBackgroundService.kt index e9f327ee57..1c51202bb6 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/background/LocationBackgroundService.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/background/LocationBackgroundService.kt @@ -2,8 +2,8 @@ package com.onesignal.location.internal.background import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.background.IBackgroundService -import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.location.ILocationManager import com.onesignal.location.internal.capture.ILocationCapturer import com.onesignal.location.internal.common.LocationConstants diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/ILocationCapturer.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/capture/ILocationCapturer.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/ILocationCapturer.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/capture/ILocationCapturer.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt index ac6e813101..ddc2395156 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/capture/impl/LocationCapturer.kt @@ -2,14 +2,14 @@ package com.onesignal.location.internal.capture.impl import android.location.Location import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.PropertiesModelStore import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.location.internal.capture.ILocationCapturer import com.onesignal.location.internal.common.LocationPoint import com.onesignal.location.internal.controller.ILocationController import com.onesignal.location.internal.controller.ILocationUpdatedHandler import com.onesignal.location.internal.preferences.ILocationPreferencesService +import com.onesignal.user.internal.properties.PropertiesModelStore import java.math.BigDecimal import java.math.RoundingMode diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/common/LocationConstants.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/common/LocationConstants.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/common/LocationConstants.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/common/LocationConstants.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/common/LocationPoint.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/common/LocationPoint.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/common/LocationPoint.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/common/LocationPoint.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/common/LocationUtils.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/common/LocationUtils.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/common/LocationUtils.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/common/LocationUtils.kt index ea152f6f11..4b159a492d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/common/LocationUtils.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/common/LocationUtils.kt @@ -5,7 +5,7 @@ import android.content.pm.PackageManager import androidx.core.content.ContextCompat import com.google.android.gms.location.LocationListener import com.huawei.hms.location.LocationCallback -import com.onesignal.core.internal.common.AndroidUtils +import com.onesignal.common.AndroidUtils internal object LocationUtils { fun hasGMSLocationLibrary(): Boolean { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/ILocationController.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/ILocationController.kt similarity index 84% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/ILocationController.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/ILocationController.kt index c2bf1f528e..c038635038 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/ILocationController.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/ILocationController.kt @@ -1,7 +1,7 @@ package com.onesignal.location.internal.controller import android.location.Location -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.common.events.IEventNotifier internal interface ILocationController : IEventNotifier { suspend fun start(): Boolean diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/GmsLocationController.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/GmsLocationController.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/GmsLocationController.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/GmsLocationController.kt index 06f3b3edb6..07db0e7c6f 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/GmsLocationController.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/GmsLocationController.kt @@ -10,12 +10,12 @@ import com.google.android.gms.common.api.GoogleApiClient import com.google.android.gms.location.LocationListener import com.google.android.gms.location.LocationRequest import com.google.android.gms.location.LocationServices -import com.onesignal.core.debug.LogLevel +import com.onesignal.common.events.EventProducer +import com.onesignal.common.threading.suspendifyOnThread import com.onesignal.core.internal.application.IApplicationLifecycleHandler import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.events.EventProducer -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.LogLevel +import com.onesignal.debug.internal.logging.Logging import com.onesignal.location.internal.common.LocationConstants import com.onesignal.location.internal.controller.ILocationController import com.onesignal.location.internal.controller.ILocationUpdatedHandler diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/GoogleApiClientCompatProxy.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/GoogleApiClientCompatProxy.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/GoogleApiClientCompatProxy.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/GoogleApiClientCompatProxy.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/HmsLocationController.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/HmsLocationController.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/HmsLocationController.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/HmsLocationController.kt index a91f56dbc1..b3a14ff8e2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/HmsLocationController.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/HmsLocationController.kt @@ -8,17 +8,17 @@ import com.huawei.hms.location.FusedLocationProviderClient import com.huawei.hms.location.LocationCallback import com.huawei.hms.location.LocationRequest import com.huawei.hms.location.LocationResult -import com.onesignal.core.debug.LogLevel +import com.onesignal.common.events.EventProducer +import com.onesignal.common.threading.Waiter +import com.onesignal.common.threading.WaiterWithValue +import com.onesignal.common.threading.suspendifyOnThread import com.onesignal.core.internal.application.IApplicationLifecycleHandler import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.events.EventProducer -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.LogLevel +import com.onesignal.debug.internal.logging.Logging import com.onesignal.location.internal.common.LocationConstants import com.onesignal.location.internal.controller.ILocationController import com.onesignal.location.internal.controller.ILocationUpdatedHandler -import com.onesignal.onesignal.core.internal.common.suspend.Waiter -import com.onesignal.onesignal.core.internal.common.suspend.WaiterWithValue import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/NullLocationController.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/NullLocationController.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/controller/impl/NullLocationController.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/controller/impl/NullLocationController.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt similarity index 93% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt index 4a45c9e617..628036689c 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt +++ b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/permissions/LocationPermissionController.kt @@ -27,16 +27,16 @@ package com.onesignal.location.internal.permissions -import com.onesignal.R +import com.onesignal.common.AndroidUtils +import com.onesignal.common.events.EventProducer +import com.onesignal.common.events.IEventNotifier +import com.onesignal.common.threading.WaiterWithValue import com.onesignal.core.internal.application.ApplicationLifecycleHandlerBase import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.common.events.EventProducer -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.core.internal.permissions.AlertDialogPrepromptForAndroidSettings import com.onesignal.core.internal.permissions.IRequestPermissionService -import com.onesignal.core.internal.permissions.impl.AlertDialogPrepromptForAndroidSettings import com.onesignal.core.internal.startup.IStartableService -import com.onesignal.onesignal.core.internal.common.suspend.WaiterWithValue +import com.onesignal.location.R internal interface ILocationPermissionChangedHandler { fun onLocationPermissionChanged(enabled: Boolean) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/NavigateToAndroidSettingsForLocation.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/permissions/NavigateToAndroidSettingsForLocation.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/permissions/NavigateToAndroidSettingsForLocation.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/permissions/NavigateToAndroidSettingsForLocation.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/preferences/ILocationPreferencesService.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/preferences/ILocationPreferencesService.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/preferences/ILocationPreferencesService.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/preferences/ILocationPreferencesService.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/preferences/impl/LocationPreferencesService.kt b/OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/preferences/impl/LocationPreferencesService.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/location/internal/preferences/impl/LocationPreferencesService.kt rename to OneSignalSDK/onesignal/location/src/main/java/com/onesignal/location/internal/preferences/impl/LocationPreferencesService.kt diff --git a/OneSignalSDK/onesignal/location/src/main/res/values/strings.xml b/OneSignalSDK/onesignal/location/src/main/res/values/strings.xml new file mode 100644 index 0000000000..eced8d9780 --- /dev/null +++ b/OneSignalSDK/onesignal/location/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ + + + Location + sharing your device location + diff --git a/OneSignalSDK/onesignal/location/src/test/java/com/onesignal/location/ExampleUnitTest.kt b/OneSignalSDK/onesignal/location/src/test/java/com/onesignal/location/ExampleUnitTest.kt new file mode 100644 index 0000000000..4ba0a25752 --- /dev/null +++ b/OneSignalSDK/onesignal/location/src/test/java/com/onesignal/location/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.onesignal.location + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/OneSignalSDK/onesignal/notification/.gitignore b/OneSignalSDK/onesignal/notification/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/OneSignalSDK/onesignal/notification/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/OneSignalSDK/onesignal/notification/build.gradle b/OneSignalSDK/onesignal/notification/build.gradle new file mode 100644 index 0000000000..b87c404fd7 --- /dev/null +++ b/OneSignalSDK/onesignal/notification/build.gradle @@ -0,0 +1,107 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'org.jlleitschuh.gradle.ktlint' + id 'io.gitlab.arturbosch.detekt' +} + +android { + compileSdkVersion rootProject.buildVersions.compileSdkVersion + defaultConfig { + minSdkVersion rootProject.buildVersions.minSdkVersion + consumerProguardFiles "consumer-rules.pro" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + original { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + release { + minifyEnabled false + } + unity { + minifyEnabled false + } + } + testOptions { + unitTests.all { + maxParallelForks 1 + maxHeapSize '2048m' + } + unitTests { + includeAndroidResources = true + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + namespace 'com.onesignal.notification' +} + +tasks.withType(Test) { + testLogging { + exceptionFormat "full" + events "started", "skipped", "passed", "failed" + showStandardStreams false // Enable to have logging print + } +} + +dependencies { + compileOnly fileTree(dir: 'libs', include: ['*.jar']) + + implementation project(':onesignal') + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" + implementation 'androidx.work:work-runtime-ktx:2.7.1' + + compileOnly('com.amazon.device:amazon-appstore-sdk:[3.0.1, 3.0.99]') + + // play-services-base:16.1.0 is the last version before going to AndroidX + // play-services-base:17.0.0 is the first version using AndroidX + // Required for GoogleApiAvailability + implementation('com.google.android.gms:play-services-base') { + version { + require '[17.0.0, 17.6.99]' + prefer '17.6.0' + } + } + + // firebase-messaging:18.0.0 is the last version before going to AndroidX + // firebase-messaging:19.0.0 is the first version using AndroidX + api('com.google.firebase:firebase-messaging') { + version { + require '[19.0.0, 22.0.99]' + prefer '22.0.0' + } + } + + // Huawei PushKit + // KEEP as "compileOnly", so OneSignal isn't a direct dependency in the POM file. + compileOnly "com.huawei.hms:push:$huaweiHMSPushVersion" + + api('androidx.work:work-runtime') { + version { + require '[2.1.0, 2.7.99]' + prefer '2.7.1' + } + } + + testImplementation("junit:junit:$junitVersion") + testImplementation("io.kotest:kotest-runner-junit4:$kotestVersion") + testImplementation("io.kotest:kotest-runner-junit4-jvm:$kotestVersion") + testImplementation("io.kotest:kotest-assertions-core:$kotestVersion") + testImplementation("io.kotest:kotest-property:$kotestVersion") + testImplementation("org.robolectric:robolectric:4.8.1") + testImplementation("androidx.test:core-ktx:1.4.0") + testImplementation("androidx.test:core:1.4.0") + testImplementation("io.mockk:mockk:1.13.2") + testImplementation("org.json:json:20180813") + testImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") +} \ No newline at end of file diff --git a/OneSignalSDK/onesignal/notification/consumer-rules.pro b/OneSignalSDK/onesignal/notification/consumer-rules.pro new file mode 100644 index 0000000000..39e357823f --- /dev/null +++ b/OneSignalSDK/onesignal/notification/consumer-rules.pro @@ -0,0 +1,39 @@ +-dontwarn com.onesignal.notification.** + +# These 2 methods are called with reflection. +-keep class com.google.android.gms.common.api.GoogleApiClient { + void connect(); + void disconnect(); +} + +# Need to keep as these 2 methods are called with reflection from com.onesignal.PushRegistratorFCM +-keep class com.google.firebase.iid.FirebaseInstanceId { + static com.google.firebase.iid.FirebaseInstanceId getInstance(com.google.firebase.FirebaseApp); + java.lang.String getToken(java.lang.String, java.lang.String); +} + +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.AdwHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.ApexHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.AsusHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.DefaultBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.EverythingMeHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.HuaweiHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.LGHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.NewHtcHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.NovaHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.OPPOHomeBader { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.SamsungHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.SonyHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.VivoHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.XiaomiHomeBadger { (...); } +-keep class com.onesignal.notification.internal.badges.impl.shortcutbadger.impl.ZukHomeBadger { (...); } + +-dontwarn com.huawei.** +-dontwarn com.amazon.** + +# Proguard ends up removing this class even if it is used in AndroidManifest.xml so force keeping it. +-keep public class com.onesignal.notification.services.ADMMessageHandler {*;} + +-keep public class com.onesignal.notification.services.ADMMessageHandlerJob {*;} + +-keep class com.onesignal.JobIntentService$* {*;} \ No newline at end of file diff --git a/OneSignalSDK/onesignal/libs/amazon-device-messaging-1.1.0.jar b/OneSignalSDK/onesignal/notification/libs/amazon-device-messaging-1.1.0.jar similarity index 100% rename from OneSignalSDK/onesignal/libs/amazon-device-messaging-1.1.0.jar rename to OneSignalSDK/onesignal/notification/libs/amazon-device-messaging-1.1.0.jar diff --git a/OneSignalSDK/onesignal/notification/proguard-rules.pro b/OneSignalSDK/onesignal/notification/proguard-rules.pro new file mode 100644 index 0000000000..481bb43481 --- /dev/null +++ b/OneSignalSDK/onesignal/notification/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/OneSignalSDK/onesignal/src/release/AndroidManifest.xml b/OneSignalSDK/onesignal/notification/src/debug/AndroidManifest.xml similarity index 95% rename from OneSignalSDK/onesignal/src/release/AndroidManifest.xml rename to OneSignalSDK/onesignal/notification/src/debug/AndroidManifest.xml index 7e161007c3..9e4cd5919f 100644 --- a/OneSignalSDK/onesignal/src/release/AndroidManifest.xml +++ b/OneSignalSDK/onesignal/notification/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + @@ -20,4 +19,4 @@ - + \ No newline at end of file diff --git a/OneSignalSDK/onesignal/notification/src/main/AndroidManifest.xml b/OneSignalSDK/onesignal/notification/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..738a2439fd --- /dev/null +++ b/OneSignalSDK/onesignal/notification/src/main/AndroidManifest.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationModule.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/NotificationModule.kt similarity index 91% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationModule.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/NotificationModule.kt index b4434f5517..6458486c84 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationModule.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/NotificationModule.kt @@ -1,12 +1,15 @@ -package com.onesignal.notification.internal +package com.onesignal.notification +import com.onesignal.common.modules.IModule +import com.onesignal.common.services.ServiceBuilder import com.onesignal.core.internal.application.IApplicationService +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.models.ConfigModelStore -import com.onesignal.core.internal.service.ServiceBuilder import com.onesignal.core.internal.startup.IStartableService import com.onesignal.core.internal.time.ITime -import com.onesignal.notification.INotificationsManager +import com.onesignal.notification.internal.INotificationActivityOpener +import com.onesignal.notification.internal.INotificationStateRefresher +import com.onesignal.notification.internal.NotificationsManager import com.onesignal.notification.internal.analytics.IAnalyticsTracker import com.onesignal.notification.internal.analytics.impl.FirebaseAnalyticsTracker import com.onesignal.notification.internal.analytics.impl.NoAnalyticsTracker @@ -66,8 +69,8 @@ import com.onesignal.notification.internal.restoration.impl.NotificationRestoreW import com.onesignal.notification.internal.summary.INotificationSummaryManager import com.onesignal.notification.internal.summary.impl.NotificationSummaryManager -internal object NotificationModule { - fun register(builder: ServiceBuilder) { +internal class NotificationModule : IModule { + override fun register(builder: ServiceBuilder) { builder.register().provides() builder.register().provides() @@ -114,7 +117,14 @@ internal object NotificationModule { PushRegistratorADM(it.getService(IApplicationService::class.java)) } else if (deviceService.isAndroidDeviceType) { if (deviceService.hasFCMLibrary) { - PushRegistratorFCM(it.getService(ConfigModelStore::class.java), it.getService(IApplicationService::class.java), it.getService(GooglePlayServicesUpgradePrompt::class.java), deviceService) + PushRegistratorFCM( + it.getService(ConfigModelStore::class.java), + it.getService( + IApplicationService::class.java + ), + it.getService(GooglePlayServicesUpgradePrompt::class.java), + deviceService + ) } else { PushRegistratorNone() } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivity.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivity.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivity.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivity.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityAndroid22AndOlder.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityAndroid22AndOlder.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityAndroid22AndOlder.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityAndroid22AndOlder.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityBase.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityBase.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityBase.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityBase.kt index 5b0f70f549..c7537569b1 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityBase.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityBase.kt @@ -29,8 +29,8 @@ package com.onesignal.notification.activities import android.app.Activity import android.content.Intent import android.os.Bundle -import com.onesignal.core.OneSignal -import com.onesignal.core.internal.common.suspendifyOnThread +import com.onesignal.OneSignal +import com.onesignal.common.threading.suspendifyOnThread import com.onesignal.notification.internal.open.INotificationOpenedProcessor abstract class NotificationOpenedActivityBase : Activity() { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityHMS.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityHMS.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityHMS.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityHMS.kt index 3ebc4e6e14..50956a1ba1 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityHMS.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/activities/NotificationOpenedActivityHMS.kt @@ -29,8 +29,8 @@ package com.onesignal.notification.activities import android.app.Activity import android.content.Intent import android.os.Bundle -import com.onesignal.core.OneSignal -import com.onesignal.core.internal.common.suspendifyBlocking +import com.onesignal.OneSignal +import com.onesignal.common.threading.suspendifyBlocking import com.onesignal.notification.internal.open.INotificationOpenedProcessorHMS // HMS Core creates a notification with an Intent when opened to start this Activity. diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/bridges/OneSignalHmsEventBridge.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/bridges/OneSignalHmsEventBridge.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/bridges/OneSignalHmsEventBridge.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/bridges/OneSignalHmsEventBridge.kt index 75475c1079..aac0970156 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/bridges/OneSignalHmsEventBridge.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/bridges/OneSignalHmsEventBridge.kt @@ -3,11 +3,11 @@ package com.onesignal.notification.bridges import android.content.Context import android.os.Bundle import com.huawei.hms.push.RemoteMessage -import com.onesignal.core.OneSignal -import com.onesignal.core.internal.common.JSONUtils -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging +import com.onesignal.OneSignal +import com.onesignal.common.JSONUtils +import com.onesignal.common.threading.suspendifyOnThread import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.bundle.INotificationBundleProcessor import com.onesignal.notification.internal.common.NotificationConstants import com.onesignal.notification.internal.registration.impl.IPushRegistratorCallback diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/MutableNotification.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/MutableNotification.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/MutableNotification.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/MutableNotification.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/Notification.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/Notification.kt similarity index 99% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/Notification.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/Notification.kt index 99afd9468d..9c95052214 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/Notification.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/Notification.kt @@ -1,8 +1,8 @@ package com.onesignal.notification.internal import androidx.core.app.NotificationCompat -import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.BackgroundImageLayout import com.onesignal.notification.IActionButton import com.onesignal.notification.IMutableNotification @@ -20,7 +20,7 @@ import org.json.JSONObject * [.groupedNotifications] - If the notification is a summary notification for a group, this will contain * all notification payloads it was created from. */ -internal open class Notification : INotification { +open class Notification : INotification { var notificationExtender: NotificationCompat.Extender? = null /** diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationAction.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationAction.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationAction.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationAction.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationOpenedResult.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationOpenedResult.kt similarity index 93% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationOpenedResult.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationOpenedResult.kt index 1a72bf9196..37162a0d0f 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationOpenedResult.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationOpenedResult.kt @@ -8,7 +8,7 @@ import com.onesignal.notification.INotificationOpenedResult * The data provided to [INotificationOpenedHandler.notificationOpened] when a notification * has been opened by the user. */ -internal class NotificationOpenedResult( +class NotificationOpenedResult( /** The notification that was opened by the user. **/ override val notification: INotification, diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationReceivedEvent.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationReceivedEvent.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationReceivedEvent.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationReceivedEvent.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt index 006a6bace5..c0920bc004 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/NotificationsManager.kt @@ -1,13 +1,13 @@ package com.onesignal.notification.internal import android.app.Activity +import com.onesignal.common.exceptions.BackendException +import com.onesignal.common.events.EventProducer +import com.onesignal.common.threading.suspendifyOnMain +import com.onesignal.common.threading.suspendifyOnThread import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.backend.BackendException -import com.onesignal.core.internal.common.events.EventProducer -import com.onesignal.core.internal.common.suspendifyOnMain -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.ConfigModelStore +import com.onesignal.core.internal.config.ConfigModelStore +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.INotificationOpenedHandler import com.onesignal.notification.INotificationWillShowInForegroundHandler import com.onesignal.notification.INotificationsManager @@ -27,11 +27,11 @@ import org.json.JSONArray import org.json.JSONException import org.json.JSONObject -internal interface INotificationStateRefresher { +interface INotificationStateRefresher { fun refreshNotificationState() } -internal interface INotificationActivityOpener { +interface INotificationActivityOpener { suspend fun openDestinationActivity(activity: Activity, pushPayloads: JSONArray) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/PermissionState.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/PermissionState.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/PermissionState.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/PermissionState.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/PermissionStateChanges.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/PermissionStateChanges.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/PermissionStateChanges.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/PermissionStateChanges.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/IAnalyticsTracker.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/analytics/IAnalyticsTracker.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/IAnalyticsTracker.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/analytics/IAnalyticsTracker.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt similarity index 99% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt index 5c1c2f5705..8bcbba714d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/analytics/impl/FirebaseAnalyticsTracker.kt @@ -29,7 +29,7 @@ package com.onesignal.notification.internal.analytics.impl import android.content.Context import android.os.Bundle import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.models.ConfigModelStore +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.time.ITime import com.onesignal.notification.internal.analytics.IAnalyticsTracker import java.lang.reflect.Method diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/NoAnalyticsTracker.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/analytics/impl/NoAnalyticsTracker.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/analytics/impl/NoAnalyticsTracker.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/analytics/impl/NoAnalyticsTracker.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/backend/INotificationBackendService.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/backend/INotificationBackendService.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/backend/INotificationBackendService.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/backend/INotificationBackendService.kt index 83f7d8ecc9..91b675aaf4 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/backend/INotificationBackendService.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/backend/INotificationBackendService.kt @@ -1,6 +1,6 @@ package com.onesignal.notification.internal.backend -import com.onesignal.core.internal.backend.BackendException +import com.onesignal.common.exceptions.BackendException import org.json.JSONObject /** diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/backend/impl/NotificationBackendService.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/backend/impl/NotificationBackendService.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/backend/impl/NotificationBackendService.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/backend/impl/NotificationBackendService.kt index 5ef36665b5..af9935df94 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/backend/impl/NotificationBackendService.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/backend/impl/NotificationBackendService.kt @@ -1,6 +1,6 @@ package com.onesignal.notification.internal.backend.impl -import com.onesignal.core.internal.backend.BackendException +import com.onesignal.common.exceptions.BackendException import com.onesignal.core.internal.http.IHttpClient import com.onesignal.notification.internal.backend.INotificationBackendService import org.json.JSONObject diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/IBadgeCountUpdater.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/IBadgeCountUpdater.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/IBadgeCountUpdater.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/IBadgeCountUpdater.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/BadgeCountUpdater.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/BadgeCountUpdater.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/BadgeCountUpdater.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/BadgeCountUpdater.kt index d11589c09c..fc49a73061 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/BadgeCountUpdater.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/BadgeCountUpdater.kt @@ -6,7 +6,7 @@ import androidx.annotation.RequiresApi import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.database.IDatabaseProvider import com.onesignal.core.internal.database.impl.OneSignalDbContract -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.badges.IBadgeCountUpdater import com.onesignal.notification.internal.badges.impl.shortcutbadger.ShortcutBadgeException import com.onesignal.notification.internal.badges.impl.shortcutbadger.ShortcutBadger diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/Badger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/Badger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/Badger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/Badger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadgeException.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadgeException.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadgeException.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadgeException.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/ShortcutBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AdwHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AdwHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AdwHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AdwHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ApexHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ApexHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ApexHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ApexHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AsusHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AsusHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AsusHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/AsusHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/DefaultBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/DefaultBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/DefaultBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/DefaultBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/EverythingMeHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/EverythingMeHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/EverythingMeHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/EverythingMeHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/HuaweiHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/HuaweiHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/HuaweiHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/HuaweiHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/LGHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/LGHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/LGHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/LGHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NewHtcHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NewHtcHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NewHtcHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NewHtcHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NovaHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NovaHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NovaHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/NovaHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/OPPOHomeBader.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/OPPOHomeBader.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/OPPOHomeBader.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/OPPOHomeBader.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SamsungHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SamsungHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SamsungHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SamsungHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SonyHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SonyHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SonyHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/SonyHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/VivoHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/VivoHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/VivoHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/VivoHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/XiaomiHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/XiaomiHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/XiaomiHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/XiaomiHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ZukHomeBadger.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ZukHomeBadger.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ZukHomeBadger.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/impl/ZukHomeBadger.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/BroadcastHelper.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/BroadcastHelper.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/BroadcastHelper.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/BroadcastHelper.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/CloseHelper.java b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/CloseHelper.java similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/CloseHelper.java rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/badges/impl/shortcutbadger/util/CloseHelper.java diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/bundle/INotificationBundleProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/bundle/INotificationBundleProcessor.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/bundle/INotificationBundleProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/bundle/INotificationBundleProcessor.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/bundle/impl/NotificationBundleProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/bundle/impl/NotificationBundleProcessor.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/bundle/impl/NotificationBundleProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/bundle/impl/NotificationBundleProcessor.kt index 778af2ef14..8e531bc3c7 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/bundle/impl/NotificationBundleProcessor.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/bundle/impl/NotificationBundleProcessor.kt @@ -2,7 +2,7 @@ package com.onesignal.notification.internal.bundle.impl import android.content.Context import android.os.Bundle -import com.onesignal.core.internal.common.JSONUtils +import com.onesignal.common.JSONUtils import com.onesignal.core.internal.time.ITime import com.onesignal.notification.internal.bundle.INotificationBundleProcessor import com.onesignal.notification.internal.common.NotificationConstants diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/channels/INotificationChannelManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/channels/INotificationChannelManager.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/channels/INotificationChannelManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/channels/INotificationChannelManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/channels/impl/NotificationChannelManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/channels/impl/NotificationChannelManager.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/channels/impl/NotificationChannelManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/channels/impl/NotificationChannelManager.kt index 08fc622467..205ffba257 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/channels/impl/NotificationChannelManager.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/channels/impl/NotificationChannelManager.kt @@ -10,18 +10,14 @@ import androidx.annotation.RequiresApi import androidx.core.app.NotificationManagerCompat import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.language.ILanguageContext -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.channels.INotificationChannelManager import com.onesignal.notification.internal.common.NotificationGenerationJob import com.onesignal.notification.internal.common.NotificationHelper import org.json.JSONArray import org.json.JSONException import org.json.JSONObject -import java.lang.IllegalArgumentException -import java.lang.NullPointerException import java.math.BigInteger -import java.util.ArrayList -import java.util.HashSet import java.util.regex.Pattern internal class NotificationChannelManager( @@ -48,7 +44,7 @@ internal class NotificationChannelManager( // Allow channels created outside the SDK if (jsonPayload.has("oth_chnl")) { - val otherChannel = jsonPayload?.optString("oth_chnl") + val otherChannel = jsonPayload.optString("oth_chnl") if (notificationManager.getNotificationChannel(otherChannel) != null) return otherChannel } if (!jsonPayload.has("chnl")) return createDefaultChannel(notificationManager) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntent.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntent.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntent.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntent.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntentFromPushPayload.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntentFromPushPayload.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntentFromPushPayload.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntentFromPushPayload.kt index f98707f93f..87412887fb 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntentFromPushPayload.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/GenerateNotificationOpenIntentFromPushPayload.kt @@ -3,7 +3,7 @@ package com.onesignal.notification.internal.common import android.content.Context import android.content.Intent import android.net.Uri -import com.onesignal.core.internal.common.AndroidUtils +import com.onesignal.common.AndroidUtils import org.json.JSONObject /** diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationConstants.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationConstants.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationConstants.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationConstants.kt index e621fc1f5f..00351cc431 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationConstants.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationConstants.kt @@ -1,6 +1,6 @@ package com.onesignal.notification.internal.common -internal object NotificationConstants { +object NotificationConstants { /** * The meta-data key within the AndroidManifest.xml that provides the class name for the * Notification Service Extension. diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationFormatHelper.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationFormatHelper.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationFormatHelper.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationFormatHelper.kt index fd4b4878bc..1608e7e8c8 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationFormatHelper.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationFormatHelper.kt @@ -2,7 +2,7 @@ package com.onesignal.notification.internal.common import android.content.Intent import android.os.Bundle -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import org.json.JSONException import org.json.JSONObject diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationGenerationJob.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationGenerationJob.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationGenerationJob.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationGenerationJob.kt index 6df145a97e..3a9ee25f32 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationGenerationJob.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationGenerationJob.kt @@ -6,7 +6,7 @@ import com.onesignal.notification.internal.Notification import org.json.JSONObject import java.security.SecureRandom -internal class NotificationGenerationJob { +class NotificationGenerationJob { var notification: Notification? get() = _notification set(value) { @@ -40,7 +40,7 @@ internal class NotificationGenerationJob { internal constructor() { } - internal constructor(jsonPayload: JSONObject?, time: ITime) : this( + constructor(jsonPayload: JSONObject?, time: ITime) : this( Notification(jsonPayload!!, time), jsonPayload ) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationHelper.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationHelper.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationHelper.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationHelper.kt index 173e238198..02db6e87a3 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/NotificationHelper.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/NotificationHelper.kt @@ -10,9 +10,9 @@ import android.service.notification.StatusBarNotification import androidx.annotation.RequiresApi import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.logging.Logging +import com.onesignal.common.AndroidUtils import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.INotification import com.onesignal.notification.INotificationAction import com.onesignal.notification.internal.NotificationAction @@ -20,10 +20,9 @@ import com.onesignal.notification.internal.NotificationOpenedResult import org.json.JSONArray import org.json.JSONException import org.json.JSONObject -import java.util.ArrayList import kotlin.math.min -internal object NotificationHelper { +object NotificationHelper { const val grouplessSummaryKey = "os_group_undefined" const val grouplessSummaryId = -718463522 diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenAppSettings.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenAppSettings.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenAppSettings.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenAppSettings.kt index 6bd565a9e5..3db8bdb333 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenAppSettings.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenAppSettings.kt @@ -1,7 +1,7 @@ package com.onesignal.notification.internal.common import android.content.Context -import com.onesignal.core.internal.common.AndroidUtils +import com.onesignal.common.AndroidUtils /*** * Settings that effect the OneSignal notification open behavior at the app level. diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenBehaviorFromPushPayload.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenBehaviorFromPushPayload.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenBehaviorFromPushPayload.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/common/OSNotificationOpenBehaviorFromPushPayload.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/INotificationQueryHelper.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/INotificationQueryHelper.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/INotificationQueryHelper.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/INotificationQueryHelper.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/INotificationRepository.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/INotificationRepository.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/INotificationRepository.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/INotificationRepository.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt index 9641d34eb0..94af56b3f8 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/impl/NotificationQueryHelper.kt @@ -1,7 +1,7 @@ package com.onesignal.notification.internal.data.impl +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.database.impl.OneSignalDbContract -import com.onesignal.core.internal.models.ConfigModelStore import com.onesignal.core.internal.time.ITime import com.onesignal.notification.internal.data.INotificationQueryHelper diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationRepository.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/impl/NotificationRepository.kt similarity index 99% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationRepository.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/impl/NotificationRepository.kt index 4373d5f752..1653bfe841 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/data/impl/NotificationRepository.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/data/impl/NotificationRepository.kt @@ -7,8 +7,8 @@ import android.text.TextUtils import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.database.IDatabaseProvider import com.onesignal.core.internal.database.impl.OneSignalDbContract -import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.badges.IBadgeCountUpdater import com.onesignal.notification.internal.common.NotificationHelper import com.onesignal.notification.internal.data.INotificationQueryHelper diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayBuilder.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayBuilder.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayBuilder.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayBuilder.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayer.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayer.kt similarity index 83% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayer.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayer.kt index 9aa0a80fc4..a745b9fe80 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayer.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/INotificationDisplayer.kt @@ -2,6 +2,6 @@ package com.onesignal.notification.internal.display import com.onesignal.notification.internal.common.NotificationGenerationJob -internal interface INotificationDisplayer { +interface INotificationDisplayer { suspend fun displayNotification(notificationJob: NotificationGenerationJob): Boolean } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/ISummaryNotificationDisplayer.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/ISummaryNotificationDisplayer.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/ISummaryNotificationDisplayer.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/ISummaryNotificationDisplayer.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/IntentGeneratorForAttachingToNotifications.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/IntentGeneratorForAttachingToNotifications.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/IntentGeneratorForAttachingToNotifications.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/IntentGeneratorForAttachingToNotifications.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayBuilder.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayBuilder.kt similarity index 99% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayBuilder.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayBuilder.kt index 270eeb6f34..18d7a986da 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayBuilder.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayBuilder.kt @@ -12,9 +12,9 @@ import android.net.Uri import android.os.Build import androidx.core.app.NotificationCompat import com.onesignal.R +import com.onesignal.common.AndroidUtils import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.bundle.impl.NotificationBundleProcessor import com.onesignal.notification.internal.channels.INotificationChannelManager import com.onesignal.notification.internal.common.NotificationConstants diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayer.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayer.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayer.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayer.kt index db6d10c3d3..d69ed45e02 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayer.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/NotificationDisplayer.kt @@ -13,12 +13,12 @@ import android.view.View import android.widget.RemoteViews import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat -import com.onesignal.R +import com.onesignal.common.AndroidSupportV4Compat +import com.onesignal.common.AndroidUtils +import com.onesignal.common.exceptions.MainThreadException import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidSupportV4Compat -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.common.exceptions.MainThreadException -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging +import com.onesignal.notification.R import com.onesignal.notification.internal.common.NotificationConstants import com.onesignal.notification.internal.common.NotificationGenerationJob import com.onesignal.notification.internal.common.NotificationHelper diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/SummaryNotificationDisplayer.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/SummaryNotificationDisplayer.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/display/impl/SummaryNotificationDisplayer.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/display/impl/SummaryNotificationDisplayer.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationProcessor.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationProcessor.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationWorkManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationWorkManager.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationWorkManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/INotificationGenerationWorkManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt index 685892b942..ad7880c0be 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationProcessor.kt @@ -1,12 +1,11 @@ package com.onesignal.notification.internal.generation.impl import android.content.Context +import com.onesignal.common.AndroidUtils import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.ConfigModelStore -import com.onesignal.core.internal.session.ISessionService +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.Notification import com.onesignal.notification.internal.NotificationReceivedEvent import com.onesignal.notification.internal.common.NotificationConstants @@ -16,6 +15,7 @@ import com.onesignal.notification.internal.display.INotificationDisplayer import com.onesignal.notification.internal.generation.INotificationGenerationProcessor import com.onesignal.notification.internal.lifecycle.INotificationLifecycleService import com.onesignal.notification.internal.summary.INotificationSummaryManager +import com.onesignal.session.internal.session.ISessionService import kotlinx.coroutines.delay import kotlinx.coroutines.withTimeout import org.json.JSONException diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationWorkManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationWorkManager.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationWorkManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationWorkManager.kt index 17711dfb25..4498dd006d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationWorkManager.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/generation/impl/NotificationGenerationWorkManager.kt @@ -7,9 +7,9 @@ import androidx.work.ExistingWorkPolicy import androidx.work.OneTimeWorkRequest import androidx.work.WorkManager import androidx.work.WorkerParameters -import com.onesignal.core.OneSignal -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.logging.Logging +import com.onesignal.OneSignal +import com.onesignal.common.AndroidUtils +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.common.NotificationFormatHelper import com.onesignal.notification.internal.generation.INotificationGenerationProcessor import com.onesignal.notification.internal.generation.INotificationGenerationWorkManager diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleCallback.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleCallback.kt similarity index 93% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleCallback.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleCallback.kt index f388d64b2e..04ca71c85c 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleCallback.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleCallback.kt @@ -3,7 +3,7 @@ package com.onesignal.notification.internal.lifecycle import android.app.Activity import org.json.JSONObject -internal interface INotificationLifecycleCallback { +interface INotificationLifecycleCallback { /** * Called when a OneSignal notification bundle has been received by the SDK. This * callback has the option to indicate to the bundle processor whether it should diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleEventHandler.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleEventHandler.kt similarity index 89% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleEventHandler.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleEventHandler.kt index f7e72e3339..9924bfa739 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleEventHandler.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleEventHandler.kt @@ -4,7 +4,7 @@ import android.app.Activity import com.onesignal.notification.internal.common.NotificationGenerationJob import org.json.JSONArray -internal interface INotificationLifecycleEventHandler { +interface INotificationLifecycleEventHandler { /** * Called *after* the notification has been generated and processed by the SDK. */ diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleService.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleService.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleService.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleService.kt index 9877037747..7036cc4367 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleService.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/INotificationLifecycleService.kt @@ -37,7 +37,7 @@ import org.json.JSONObject * 9. [INotificationLifecycleEventHandler.onNotificationOpened] To indicate the notification has been opened. * 10. [INotificationOpenedHandler.notificationOpened] To indicate the notification has been opened. */ -internal interface INotificationLifecycleService { +interface INotificationLifecycleService { fun addInternalNotificationLifecycleEventHandler(handler: INotificationLifecycleEventHandler) fun removeInternalNotificationLifecycleEventHandler(handler: INotificationLifecycleEventHandler) fun setInternalNotificationLifecycleCallback(callback: INotificationLifecycleCallback?) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/impl/NotificationLifecycleService.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/impl/NotificationLifecycleService.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/impl/NotificationLifecycleService.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/impl/NotificationLifecycleService.kt index f0aec8310d..2d9361e781 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/lifecycle/impl/NotificationLifecycleService.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/lifecycle/impl/NotificationLifecycleService.kt @@ -2,12 +2,12 @@ package com.onesignal.notification.internal.lifecycle.impl import android.app.Activity import android.content.Context +import com.onesignal.common.AndroidUtils +import com.onesignal.common.events.CallbackProducer +import com.onesignal.common.events.EventProducer import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.common.events.CallbackProducer -import com.onesignal.core.internal.common.events.EventProducer -import com.onesignal.core.internal.logging.Logging import com.onesignal.core.internal.time.ITime +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.INotificationOpenedHandler import com.onesignal.notification.INotificationReceivedEvent import com.onesignal.notification.INotificationWillShowInForegroundHandler diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/limiting/INotificationLimitManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/limiting/INotificationLimitManager.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/limiting/INotificationLimitManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/limiting/INotificationLimitManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/limiting/impl/NotificationLimitManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/limiting/impl/NotificationLimitManager.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/limiting/impl/NotificationLimitManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/limiting/impl/NotificationLimitManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ApplicationListener.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/ApplicationListener.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ApplicationListener.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/ApplicationListener.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt similarity index 76% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt index afb70675d5..a0a596d6bc 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/ConfigModelStoreListener.kt @@ -1,11 +1,11 @@ package com.onesignal.notification.internal.listeners -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.modeling.ISingletonModelStoreChangeHandler -import com.onesignal.core.internal.modeling.ModelChangeTags -import com.onesignal.core.internal.modeling.ModelChangedArgs -import com.onesignal.core.internal.models.ConfigModel -import com.onesignal.core.internal.models.ConfigModelStore +import com.onesignal.common.modeling.ISingletonModelStoreChangeHandler +import com.onesignal.common.modeling.ModelChangeTags +import com.onesignal.common.modeling.ModelChangedArgs +import com.onesignal.common.threading.suspendifyOnThread +import com.onesignal.core.internal.config.ConfigModel +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.startup.IStartableService import com.onesignal.notification.internal.channels.INotificationChannelManager import com.onesignal.notification.internal.pushtoken.IPushTokenManager diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt similarity index 93% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt index ac610452c0..5c1e983a4d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/NotificationListener.kt @@ -1,17 +1,15 @@ package com.onesignal.notification.internal.listeners import android.app.Activity +import com.onesignal.common.JSONUtils +import com.onesignal.common.exceptions.BackendException import com.onesignal.core.internal.application.AppEntryAction import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.backend.BackendException -import com.onesignal.core.internal.common.JSONUtils +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.influence.IInfluenceManager -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.ConfigModelStore import com.onesignal.core.internal.startup.IStartableService import com.onesignal.core.internal.time.ITime -import com.onesignal.core.internal.user.ISubscriptionManager +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.INotificationActivityOpener import com.onesignal.notification.internal.analytics.IAnalyticsTracker import com.onesignal.notification.internal.backend.INotificationBackendService @@ -22,6 +20,8 @@ import com.onesignal.notification.internal.common.OSNotificationOpenAppSettings import com.onesignal.notification.internal.lifecycle.INotificationLifecycleEventHandler import com.onesignal.notification.internal.lifecycle.INotificationLifecycleService import com.onesignal.notification.internal.receivereceipt.IReceiveReceiptWorkManager +import com.onesignal.session.internal.influence.IInfluenceManager +import com.onesignal.user.internal.subscriptions.ISubscriptionManager import org.json.JSONArray import org.json.JSONException import org.json.JSONObject diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt similarity index 93% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt index 4a04225240..5c51ea2273 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/listeners/PushTokenListener.kt @@ -1,11 +1,11 @@ package com.onesignal.notification.internal.listeners import com.onesignal.core.internal.startup.IStartableService -import com.onesignal.core.internal.user.ISubscriptionManager import com.onesignal.notification.internal.INotificationStateRefresher import com.onesignal.notification.internal.pushtoken.IPushTokenChangedHandler import com.onesignal.notification.internal.pushtoken.IPushTokenManager import com.onesignal.notification.internal.registration.IPushRegistrator +import com.onesignal.user.internal.subscriptions.ISubscriptionManager internal class PushTokenListener( private val _pushTokenManager: IPushTokenManager, diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessor.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessor.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessorHMS.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessorHMS.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessorHMS.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/INotificationOpenedProcessorHMS.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationIntentExtras.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/impl/NotificationIntentExtras.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationIntentExtras.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/impl/NotificationIntentExtras.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt index be63db8d8e..63d61cf0f1 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessor.kt @@ -33,10 +33,10 @@ import android.content.Context import android.content.Intent import android.os.Build import androidx.core.app.NotificationManagerCompat -import com.onesignal.core.internal.common.JSONUtils +import com.onesignal.common.JSONUtils +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.database.impl.OneSignalDbContract -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.ConfigModelStore +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.common.NotificationConstants import com.onesignal.notification.internal.common.NotificationFormatHelper import com.onesignal.notification.internal.common.NotificationHelper diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessorHMS.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessorHMS.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessorHMS.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessorHMS.kt index 839f52f73d..71236dff7a 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessorHMS.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/open/impl/NotificationOpenedProcessorHMS.kt @@ -2,7 +2,7 @@ package com.onesignal.notification.internal.open.impl import android.app.Activity import android.content.Intent -import com.onesignal.core.internal.common.JSONUtils +import com.onesignal.common.JSONUtils import com.onesignal.notification.internal.common.NotificationConstants import com.onesignal.notification.internal.common.NotificationFormatHelper import com.onesignal.notification.internal.common.NotificationHelper diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt similarity index 92% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt index ad489f98b2..a2b2ac1fa1 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/permissions/INotificationPermissionController.kt @@ -27,9 +27,10 @@ package com.onesignal.notification.internal.permissions -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.common.events.IEventNotifier -internal interface INotificationPermissionController : IEventNotifier { +internal interface INotificationPermissionController : + IEventNotifier { /** * Prompt the user for notification permission. Note it is possible the application * will be killed while the permission prompt is being displayed to the user. When the diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NavigateToAndroidSettingsForNotifications.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/permissions/impl/NavigateToAndroidSettingsForNotifications.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NavigateToAndroidSettingsForNotifications.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/permissions/impl/NavigateToAndroidSettingsForNotifications.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt index f44ede3c59..0f00e7c869 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/permissions/impl/NotificationPermissionController.kt @@ -29,17 +29,17 @@ package com.onesignal.notification.internal.permissions.impl import android.os.Build import androidx.annotation.ChecksSdkIntAtLeast -import com.onesignal.R +import com.onesignal.common.AndroidUtils +import com.onesignal.common.events.EventProducer +import com.onesignal.common.threading.WaiterWithValue import com.onesignal.core.internal.application.ApplicationLifecycleHandlerBase import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.common.events.EventProducer +import com.onesignal.core.internal.permissions.AlertDialogPrepromptForAndroidSettings import com.onesignal.core.internal.permissions.IRequestPermissionService -import com.onesignal.core.internal.permissions.impl.AlertDialogPrepromptForAndroidSettings +import com.onesignal.notification.R import com.onesignal.notification.internal.common.NotificationHelper import com.onesignal.notification.internal.permissions.INotificationPermissionChangedHandler import com.onesignal.notification.internal.permissions.INotificationPermissionController -import com.onesignal.onesignal.core.internal.common.suspend.WaiterWithValue import kotlinx.coroutines.yield internal class NotificationPermissionController( diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt similarity index 89% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt index b993b1eb4d..4df2ec55ee 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/pushtoken/IPushTokenManager.kt @@ -1,6 +1,6 @@ package com.onesignal.notification.internal.pushtoken -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.common.events.IEventNotifier import com.onesignal.notification.internal.registration.IPushRegistrator internal interface IPushTokenManager : IEventNotifier { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt index d4ffb9ec17..8dd94d95e3 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/pushtoken/PushTokenManager.kt @@ -1,8 +1,8 @@ package com.onesignal.notification.internal.pushtoken -import com.onesignal.core.internal.common.events.EventProducer +import com.onesignal.common.events.EventProducer import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.registration.IPushRegistrator /** diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptProcessor.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptProcessor.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptWorkManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptWorkManager.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptWorkManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/IReceiveReceiptWorkManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptProcessor.kt similarity index 89% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptProcessor.kt index 8fab701ae3..6c2a07cb4e 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptProcessor.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptProcessor.kt @@ -1,8 +1,8 @@ package com.onesignal.notification.internal.receivereceipt.impl -import com.onesignal.core.internal.backend.BackendException +import com.onesignal.common.exceptions.BackendException import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.backend.INotificationBackendService import com.onesignal.notification.internal.receivereceipt.IReceiveReceiptProcessor diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt similarity index 93% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt index 7697d14000..2c42d21a73 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/receivereceipt/impl/ReceiveReceiptWorkManager.kt @@ -9,14 +9,14 @@ import androidx.work.NetworkType import androidx.work.OneTimeWorkRequest import androidx.work.WorkManager import androidx.work.WorkerParameters -import com.onesignal.core.OneSignal +import com.onesignal.OneSignal +import com.onesignal.common.AndroidUtils import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidUtils -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.ConfigModelStore -import com.onesignal.core.internal.user.ISubscriptionManager +import com.onesignal.core.internal.config.ConfigModelStore +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.receivereceipt.IReceiveReceiptProcessor import com.onesignal.notification.internal.receivereceipt.IReceiveReceiptWorkManager +import com.onesignal.user.internal.subscriptions.ISubscriptionManager import java.util.concurrent.TimeUnit internal class ReceiveReceiptWorkManager( diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/IPushRegistrator.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/IPushRegistrator.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/IPushRegistrator.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/IPushRegistrator.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt index 6715b03c36..abf58bbada 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/GooglePlayServicesUpgradePrompt.kt @@ -5,10 +5,10 @@ import android.app.AlertDialog import android.app.PendingIntent.CanceledException import android.content.pm.PackageManager import com.google.android.gms.common.GoogleApiAvailability +import com.onesignal.common.AndroidUtils import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.common.AndroidUtils +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.models.ConfigModelStore import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/IPushRegistratorCallback.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/IPushRegistratorCallback.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/IPushRegistratorCallback.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/IPushRegistratorCallback.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorADM.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorADM.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorADM.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorADM.kt index 708eae3689..4102fb4260 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorADM.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorADM.kt @@ -1,10 +1,10 @@ package com.onesignal.notification.internal.registration.impl import com.amazon.device.messaging.ADM +import com.onesignal.common.threading.WaiterWithValue import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.registration.IPushRegistrator -import com.onesignal.onesignal.core.internal.common.suspend.WaiterWithValue import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt index 6ade3fae39..ef977d2738 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorAbstractGoogle.kt @@ -26,10 +26,10 @@ */ package com.onesignal.notification.internal.registration.impl -import com.onesignal.core.internal.common.AndroidUtils +import com.onesignal.common.AndroidUtils +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.ConfigModelStore +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.registration.IPushRegistrator import kotlinx.coroutines.delay import java.io.IOException diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt index 5103c9fd27..6db2409e2b 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorFCM.kt @@ -6,16 +6,14 @@ import com.google.firebase.FirebaseApp import com.google.firebase.FirebaseOptions import com.google.firebase.messaging.FirebaseMessaging import com.onesignal.core.internal.application.IApplicationService +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.logging.Logging -import com.onesignal.core.internal.models.ConfigModelStore +import com.onesignal.debug.internal.logging.Logging import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.IOException -import java.lang.Error -import java.lang.Exception import java.lang.reflect.InvocationTargetException import java.util.concurrent.ExecutionException diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorHMS.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorHMS.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorHMS.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorHMS.kt index 44cddea30c..4393bcde75 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorHMS.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorHMS.kt @@ -7,11 +7,11 @@ import com.huawei.hms.aaid.HmsInstanceId import com.huawei.hms.common.ApiException import com.huawei.hms.push.HmsMessaging import com.huawei.hms.support.api.entity.core.CommonCode +import com.onesignal.common.threading.WaiterWithValue import com.onesignal.core.internal.application.IApplicationService import com.onesignal.core.internal.device.IDeviceService -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.registration.IPushRegistrator -import com.onesignal.onesignal.core.internal.common.suspend.WaiterWithValue import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorNone.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorNone.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorNone.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/registration/impl/PushRegistratorNone.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreProcessor.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreProcessor.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreWorkManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreWorkManager.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreWorkManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/INotificationRestoreWorkManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreProcessor.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreProcessor.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreProcessor.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreProcessor.kt index 7461bccbec..919d4481c2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreProcessor.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreProcessor.kt @@ -2,7 +2,7 @@ package com.onesignal.notification.internal.restoration.impl import android.os.Build import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.badges.IBadgeCountUpdater import com.onesignal.notification.internal.common.NotificationHelper import com.onesignal.notification.internal.data.INotificationRepository diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreWorkManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreWorkManager.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreWorkManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreWorkManager.kt index c0d48d02ea..76bd1d5752 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreWorkManager.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/restoration/impl/NotificationRestoreWorkManager.kt @@ -6,7 +6,7 @@ import androidx.work.ExistingWorkPolicy import androidx.work.OneTimeWorkRequest import androidx.work.WorkManager import androidx.work.WorkerParameters -import com.onesignal.core.OneSignal +import com.onesignal.OneSignal import com.onesignal.notification.internal.common.NotificationHelper import com.onesignal.notification.internal.restoration.INotificationRestoreProcessor import com.onesignal.notification.internal.restoration.INotificationRestoreWorkManager diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/INotificationSummaryManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/summary/INotificationSummaryManager.kt similarity index 100% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/INotificationSummaryManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/summary/INotificationSummaryManager.kt diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt index f40f236c87..eeeffd1b00 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/internal/summary/impl/NotificationSummaryManager.kt @@ -1,7 +1,7 @@ package com.onesignal.notification.internal.summary.impl import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.models.ConfigModelStore +import com.onesignal.core.internal.config.ConfigModelStore import com.onesignal.notification.internal.common.NotificationGenerationJob import com.onesignal.notification.internal.common.NotificationHelper import com.onesignal.notification.internal.data.INotificationRepository diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/ADMMessageReceiver.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/ADMMessageReceiver.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/ADMMessageReceiver.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/ADMMessageReceiver.kt index cc33c4fca2..7c10f07a79 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/ADMMessageReceiver.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/ADMMessageReceiver.kt @@ -1,6 +1,6 @@ package com.onesignal.notification.receivers -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.services.ADMMessageHandler import com.onesignal.notification.services.ADMMessageHandlerJob diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/BootUpReceiver.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/BootUpReceiver.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/BootUpReceiver.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/BootUpReceiver.kt index 16b41444e7..b6c8ef665e 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/BootUpReceiver.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/BootUpReceiver.kt @@ -29,7 +29,7 @@ package com.onesignal.notification.receivers import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.onesignal.core.OneSignal +import com.onesignal.OneSignal import com.onesignal.notification.internal.restoration.INotificationRestoreWorkManager class BootUpReceiver : BroadcastReceiver() { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/FCMBroadcastReceiver.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/FCMBroadcastReceiver.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/FCMBroadcastReceiver.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/FCMBroadcastReceiver.kt index 6b7a206b23..048691fb70 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/FCMBroadcastReceiver.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/FCMBroadcastReceiver.kt @@ -4,7 +4,7 @@ import android.app.Activity import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.onesignal.core.OneSignal +import com.onesignal.OneSignal import com.onesignal.notification.internal.bundle.INotificationBundleProcessor // This is the entry point when a FCM payload is received from the Google Play services app diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/NotificationDismissReceiver.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/NotificationDismissReceiver.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/NotificationDismissReceiver.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/NotificationDismissReceiver.kt index e1c86ecddd..5956ecb763 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/NotificationDismissReceiver.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/NotificationDismissReceiver.kt @@ -27,8 +27,8 @@ package com.onesignal.notification.receivers import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.onesignal.core.OneSignal -import com.onesignal.core.internal.common.suspendifyBlocking +import com.onesignal.OneSignal +import com.onesignal.common.threading.suspendifyBlocking import com.onesignal.notification.internal.open.INotificationOpenedProcessor class NotificationDismissReceiver : BroadcastReceiver() { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/UpgradeReceiver.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/UpgradeReceiver.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/UpgradeReceiver.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/UpgradeReceiver.kt index 44fce877a6..4e4442c848 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/receivers/UpgradeReceiver.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/receivers/UpgradeReceiver.kt @@ -30,7 +30,7 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.os.Build -import com.onesignal.core.OneSignal +import com.onesignal.OneSignal import com.onesignal.notification.internal.restoration.INotificationRestoreWorkManager class UpgradeReceiver : BroadcastReceiver() { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/ADMMessageHandler.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/ADMMessageHandler.kt similarity index 92% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/ADMMessageHandler.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/ADMMessageHandler.kt index 1752978de5..5ebac53894 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/ADMMessageHandler.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/ADMMessageHandler.kt @@ -2,9 +2,9 @@ package com.onesignal.notification.services import android.content.Intent import com.amazon.device.messaging.ADMMessageHandlerBase -import com.onesignal.core.OneSignal -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging +import com.onesignal.OneSignal +import com.onesignal.common.threading.suspendifyOnThread +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.bundle.INotificationBundleProcessor import com.onesignal.notification.internal.registration.impl.IPushRegistratorCallback diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/ADMMessageHandlerJob.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/ADMMessageHandlerJob.kt similarity index 91% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/ADMMessageHandlerJob.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/ADMMessageHandlerJob.kt index b6e2961656..d322d8003d 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/ADMMessageHandlerJob.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/ADMMessageHandlerJob.kt @@ -3,9 +3,9 @@ package com.onesignal.notification.services import android.content.Context import android.content.Intent import com.amazon.device.messaging.ADMMessageHandlerJobBase -import com.onesignal.core.OneSignal -import com.onesignal.core.internal.common.suspendifyOnThread -import com.onesignal.core.internal.logging.Logging +import com.onesignal.OneSignal +import com.onesignal.common.threading.suspendifyOnThread +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.internal.bundle.INotificationBundleProcessor import com.onesignal.notification.internal.registration.impl.IPushRegistratorCallback diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/HmsMessageServiceOneSignal.kt b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/HmsMessageServiceOneSignal.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/HmsMessageServiceOneSignal.kt rename to OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/HmsMessageServiceOneSignal.kt index 814cb2ea1b..8aaed3cfa6 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/notification/services/HmsMessageServiceOneSignal.kt +++ b/OneSignalSDK/onesignal/notification/src/main/java/com/onesignal/notification/services/HmsMessageServiceOneSignal.kt @@ -3,7 +3,7 @@ package com.onesignal.notification.services import android.os.Bundle import com.huawei.hms.push.HmsMessageService import com.huawei.hms.push.RemoteMessage -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import com.onesignal.notification.bridges.OneSignalHmsEventBridge /** diff --git a/OneSignalSDK/onesignal/src/main/res/drawable-hdpi/ic_os_notification_fallback_white_24dp.png b/OneSignalSDK/onesignal/notification/src/main/res/drawable-hdpi/ic_os_notification_fallback_white_24dp.png similarity index 100% rename from OneSignalSDK/onesignal/src/main/res/drawable-hdpi/ic_os_notification_fallback_white_24dp.png rename to OneSignalSDK/onesignal/notification/src/main/res/drawable-hdpi/ic_os_notification_fallback_white_24dp.png diff --git a/OneSignalSDK/onesignal/src/main/res/drawable-mdpi/ic_os_notification_fallback_white_24dp.png b/OneSignalSDK/onesignal/notification/src/main/res/drawable-mdpi/ic_os_notification_fallback_white_24dp.png similarity index 100% rename from OneSignalSDK/onesignal/src/main/res/drawable-mdpi/ic_os_notification_fallback_white_24dp.png rename to OneSignalSDK/onesignal/notification/src/main/res/drawable-mdpi/ic_os_notification_fallback_white_24dp.png diff --git a/OneSignalSDK/onesignal/src/main/res/drawable-xhdpi/ic_os_notification_fallback_white_24dp.png b/OneSignalSDK/onesignal/notification/src/main/res/drawable-xhdpi/ic_os_notification_fallback_white_24dp.png similarity index 100% rename from OneSignalSDK/onesignal/src/main/res/drawable-xhdpi/ic_os_notification_fallback_white_24dp.png rename to OneSignalSDK/onesignal/notification/src/main/res/drawable-xhdpi/ic_os_notification_fallback_white_24dp.png diff --git a/OneSignalSDK/onesignal/src/main/res/drawable-xxhdpi/ic_os_notification_fallback_white_24dp.png b/OneSignalSDK/onesignal/notification/src/main/res/drawable-xxhdpi/ic_os_notification_fallback_white_24dp.png similarity index 100% rename from OneSignalSDK/onesignal/src/main/res/drawable-xxhdpi/ic_os_notification_fallback_white_24dp.png rename to OneSignalSDK/onesignal/notification/src/main/res/drawable-xxhdpi/ic_os_notification_fallback_white_24dp.png diff --git a/OneSignalSDK/onesignal/src/main/res/drawable-xxxhdpi/ic_os_notification_fallback_white_24dp.png b/OneSignalSDK/onesignal/notification/src/main/res/drawable-xxxhdpi/ic_os_notification_fallback_white_24dp.png similarity index 100% rename from OneSignalSDK/onesignal/src/main/res/drawable-xxxhdpi/ic_os_notification_fallback_white_24dp.png rename to OneSignalSDK/onesignal/notification/src/main/res/drawable-xxxhdpi/ic_os_notification_fallback_white_24dp.png diff --git a/OneSignalSDK/onesignal/src/main/res/layout/onesignal_bgimage_notif_layout.xml b/OneSignalSDK/onesignal/notification/src/main/res/layout/onesignal_bgimage_notif_layout.xml similarity index 100% rename from OneSignalSDK/onesignal/src/main/res/layout/onesignal_bgimage_notif_layout.xml rename to OneSignalSDK/onesignal/notification/src/main/res/layout/onesignal_bgimage_notif_layout.xml diff --git a/OneSignalSDK/onesignal/notification/src/main/res/raw/consumer_onesignal_keep.xml b/OneSignalSDK/onesignal/notification/src/main/res/raw/consumer_onesignal_keep.xml new file mode 100644 index 0000000000..d3205b682d --- /dev/null +++ b/OneSignalSDK/onesignal/notification/src/main/res/raw/consumer_onesignal_keep.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/OneSignalSDK/onesignal/notification/src/main/res/values/strings.xml b/OneSignalSDK/onesignal/notification/src/main/res/values/strings.xml new file mode 100644 index 0000000000..172eae517e --- /dev/null +++ b/OneSignalSDK/onesignal/notification/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ + + + Notifications + Notifications + diff --git a/OneSignalSDK/onesignal/src/debug/AndroidManifest.xml b/OneSignalSDK/onesignal/notification/src/release/AndroidManifest.xml similarity index 96% rename from OneSignalSDK/onesignal/src/debug/AndroidManifest.xml rename to OneSignalSDK/onesignal/notification/src/release/AndroidManifest.xml index 7e161007c3..3f928dae31 100644 --- a/OneSignalSDK/onesignal/src/debug/AndroidManifest.xml +++ b/OneSignalSDK/onesignal/notification/src/release/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/OneSignalSDK/onesignal/notification/src/test/java/com/onesignal/notification/ExampleUnitTest.kt b/OneSignalSDK/onesignal/notification/src/test/java/com/onesignal/notification/ExampleUnitTest.kt new file mode 100644 index 0000000000..46e4d565a6 --- /dev/null +++ b/OneSignalSDK/onesignal/notification/src/test/java/com/onesignal/notification/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.onesignal.notification + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/OneSignalSDK/onesignal/src/main/AndroidManifest.xml b/OneSignalSDK/onesignal/src/main/AndroidManifest.xml index 0fb166a9c6..f765cdd684 100644 --- a/OneSignalSDK/onesignal/src/main/AndroidManifest.xml +++ b/OneSignalSDK/onesignal/src/main/AndroidManifest.xml @@ -1,89 +1,10 @@ - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/Continue.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/Continue.kt similarity index 99% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/Continue.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/Continue.kt index 9e969422d6..51ad7d01c8 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/Continue.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/Continue.kt @@ -1,4 +1,4 @@ -package com.onesignal.core +package com.onesignal import android.os.Build import androidx.annotation.RequiresApi diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/IOneSignal.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/IOneSignal.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/IOneSignal.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/IOneSignal.kt index b8de03d29e..71b1239b11 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/IOneSignal.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/IOneSignal.kt @@ -1,14 +1,12 @@ -package com.onesignal.core +package com.onesignal import android.content.Context -import com.onesignal.core.OneSignal.login -import com.onesignal.core.OneSignal.user -import com.onesignal.core.debug.IDebugManager -import com.onesignal.core.session.ISessionManager -import com.onesignal.core.user.IUserManager +import com.onesignal.debug.IDebugManager import com.onesignal.iam.IIAMManager import com.onesignal.location.ILocationManager import com.onesignal.notification.INotificationsManager +import com.onesignal.session.ISessionManager +import com.onesignal.user.IUserManager interface IOneSignal { /** diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/OneSignal.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/OneSignal.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.kt index 35a87c66be..fa82d518f7 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/OneSignal.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.kt @@ -1,14 +1,14 @@ -package com.onesignal.core +package com.onesignal import android.content.Context -import com.onesignal.core.debug.IDebugManager -import com.onesignal.core.internal.OneSignalImp -import com.onesignal.core.internal.service.IServiceProvider -import com.onesignal.core.session.ISessionManager -import com.onesignal.core.user.IUserManager +import com.onesignal.common.services.IServiceProvider +import com.onesignal.debug.IDebugManager import com.onesignal.iam.IIAMManager +import com.onesignal.internal.OneSignalImp import com.onesignal.location.ILocationManager import com.onesignal.notification.INotificationsManager +import com.onesignal.session.ISessionManager +import com.onesignal.user.IUserManager /** * This singleton class is the entry point to the OneSignal SDK. It @@ -190,7 +190,7 @@ object OneSignal { * this purpose. */ @JvmStatic - internal fun initWithContext(context: Context) { + fun initWithContext(context: Context) { oneSignal.initWithContext(context, null) } @@ -198,17 +198,17 @@ object OneSignal { * Used to retrieve services from the SDK when constructor dependency injection is not an * option. */ - internal val services: IServiceProvider + val services: IServiceProvider get() = oneSignal as IServiceProvider /** * Inline function to retrieve a specific service */ - internal inline fun getService(): T { + inline fun getService(): T { return services.getService(T::class.java) } - internal inline fun getServiceOrNull(): T? { + inline fun getServiceOrNull(): T? { return services.getServiceOrNull(T::class.java) } } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidSupportV4Compat.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/AndroidSupportV4Compat.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidSupportV4Compat.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/AndroidSupportV4Compat.kt index 752dafcc09..82b4a184c6 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidSupportV4Compat.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/AndroidSupportV4Compat.kt @@ -26,7 +26,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package com.onesignal.core.internal.common +package com.onesignal.common import android.annotation.TargetApi import android.app.Activity @@ -37,8 +37,8 @@ import android.os.Process import android.util.Log // Designed as a compat for use of Android Support v4 revision 23.+ methods when an older revision of the library is included with the app developer's project. -internal class AndroidSupportV4Compat { - internal object ContextCompat { +class AndroidSupportV4Compat { + object ContextCompat { fun checkSelfPermission(context: Context, permission: String): Int { // Catch for rare "Unknown exception code: 1 msg null" exception // See https://github.com/one-signal/OneSignal-Android-SDK/issues/48 for more details. diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/AndroidUtils.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidUtils.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/AndroidUtils.kt index 091b3c6a10..c133080e87 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/AndroidUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/AndroidUtils.kt @@ -1,4 +1,4 @@ -package com.onesignal.core.internal.common +package com.onesignal.common import android.app.Activity import android.content.Context @@ -16,10 +16,10 @@ import androidx.core.app.JobIntentService import androidx.core.app.NotificationManagerCompat import androidx.legacy.content.WakefulBroadcastReceiver import com.onesignal.core.internal.application.IApplicationService -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import java.util.Random -internal object AndroidUtils { +object AndroidUtils { fun getRandomDelay(minDelay: Int, maxDelay: Int): Int { return Random().nextInt(maxDelay + 1 - minDelay) + minDelay } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/DateUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/DateUtils.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/DateUtils.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/DateUtils.kt index b2cd374f74..f02f0ab441 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/DateUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/DateUtils.kt @@ -24,12 +24,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package com.onesignal.core.internal.common +package com.onesignal.common import java.text.SimpleDateFormat import java.util.Locale -internal object DateUtils { +object DateUtils { fun iso8601Format(): SimpleDateFormat { return SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/DeviceUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/DeviceUtils.kt similarity index 96% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/DeviceUtils.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/DeviceUtils.kt index 971fb19b26..6b017d84d2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/DeviceUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/DeviceUtils.kt @@ -1,4 +1,4 @@ -package com.onesignal.core.internal.common +package com.onesignal.common import android.app.Activity import android.content.Context @@ -9,7 +9,7 @@ import android.util.DisplayMetrics import android.view.View import java.lang.ref.WeakReference -internal object DeviceUtils { +object DeviceUtils { private val MARGIN_ERROR_PX_SIZE = ViewUtils.dpToPx(24) /** diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/IDManager.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/IDManager.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/IDManager.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/IDManager.kt index d88a1797d4..5467fcfc25 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/IDManager.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/IDManager.kt @@ -1,6 +1,6 @@ -package com.onesignal.core.internal.common +package com.onesignal.common -import java.util.* +import java.util.UUID /** * Manages IDs that are initially generated locally, then regenerated on the backend. Generally when @@ -10,7 +10,7 @@ import java.util.* * The [IDManager] is able to handle IDs created locally in one application instance, and detected * as local/translated in a subsequent application instance. */ -internal object IDManager { +object IDManager { private const val LOCAL_PREFIX = "local-" private val _localIdMap = mutableMapOf() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/JSONObjectExtensions.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/JSONObjectExtensions.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/JSONObjectExtensions.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/JSONObjectExtensions.kt index 4b6fde2178..19a100e740 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/JSONObjectExtensions.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/JSONObjectExtensions.kt @@ -1,4 +1,4 @@ -package com.onesignal.core.internal.common +package com.onesignal.common import org.json.JSONObject diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/JSONUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/JSONUtils.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/JSONUtils.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/JSONUtils.kt index 92df7a2656..f00753370a 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/JSONUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/JSONUtils.kt @@ -1,14 +1,14 @@ -package com.onesignal.core.internal.common +package com.onesignal.common import android.os.Bundle -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import org.json.JSONArray import org.json.JSONException import org.json.JSONObject import java.util.regex.Matcher import java.util.regex.Pattern -internal object JSONUtils { +object JSONUtils { const val EXTERNAL_USER_ID = "external_user_id" /** diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/NetworkUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/NetworkUtils.kt similarity index 81% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/NetworkUtils.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/NetworkUtils.kt index 94c9873153..5f6d0177b2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/NetworkUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/NetworkUtils.kt @@ -1,6 +1,6 @@ -package com.onesignal.core.internal.common +package com.onesignal.common -internal object NetworkUtils { +object NetworkUtils { var MAX_NETWORK_REQUEST_ATTEMPT_COUNT = 3 val NO_RETRY_NETWROK_REQUEST_STATUS_CODES = intArrayOf(401, 402, 403, 404, 410) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/OneSignalUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/OneSignalUtils.kt new file mode 100644 index 0000000000..c550719bc4 --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/OneSignalUtils.kt @@ -0,0 +1,6 @@ +package com.onesignal.common + +object OneSignalUtils { + var sdkType = "native" + val sdkVersion: String = "050000" +} diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/RootToolsInternalMethods.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/RootToolsInternalMethods.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/RootToolsInternalMethods.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/RootToolsInternalMethods.kt index 17a87def59..d100325064 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/RootToolsInternalMethods.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/RootToolsInternalMethods.kt @@ -20,11 +20,11 @@ * limitations under that License. */ // Namespaced in com.onesignal to prevent class name conflicts if app developer includes the full RootTools library. -package com.onesignal.core.internal.common +package com.onesignal.common import java.io.File -internal object RootToolsInternalMethods { +object RootToolsInternalMethods { // workaround crash issue in Lenovo devices // issues #857 val isRooted: Boolean diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/TimeUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/TimeUtils.kt similarity index 89% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/TimeUtils.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/TimeUtils.kt index e0d704de4c..d126ecc21e 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/TimeUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/TimeUtils.kt @@ -1,4 +1,4 @@ -package com.onesignal.core.internal.common +package com.onesignal.common import android.os.Build import java.time.ZoneId @@ -6,7 +6,7 @@ import java.util.Calendar import java.util.Date import java.util.TimeZone -internal object TimeUtils { +object TimeUtils { fun getTimeZoneOffset(): Int { val timezone = Calendar.getInstance().timeZone var offset = timezone.rawOffset diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/ViewUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/ViewUtils.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/ViewUtils.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/ViewUtils.kt index 15bd33c8ee..4a83501fd3 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/ViewUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/ViewUtils.kt @@ -1,4 +1,4 @@ -package com.onesignal.core.internal.common +package com.onesignal.common import android.annotation.TargetApi import android.app.Activity @@ -11,7 +11,7 @@ import android.view.View import android.view.Window import kotlin.math.roundToInt -internal object ViewUtils { +object ViewUtils { fun dpToPx(dp: Int): Int { return (dp * Resources.getSystem().displayMetrics.density).toInt() } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/CallbackProducer.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/CallbackProducer.kt similarity index 88% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/CallbackProducer.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/CallbackProducer.kt index 06070b12d2..c7356524e7 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/CallbackProducer.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/CallbackProducer.kt @@ -1,10 +1,10 @@ -package com.onesignal.core.internal.common.events +package com.onesignal.common.events /** * A standard implementation that implements [ICallbackProducer] to make callbacks less burdensome * to the user. */ -internal open class CallbackProducer() : ICallbackProducer { +open class CallbackProducer() : ICallbackProducer { private var _callback: THandler? = null diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/EventProducer.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/EventProducer.kt similarity index 90% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/EventProducer.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/EventProducer.kt index 8cf5fc5b4a..41450257f5 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/EventProducer.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/EventProducer.kt @@ -1,10 +1,10 @@ -package com.onesignal.core.internal.common.events +package com.onesignal.common.events /** * A standard implementation that implements [IEventProducer] to make event firing less burdensome * to the user. */ -internal open class EventProducer : IEventProducer { +open class EventProducer : IEventProducer { private val _subscribers: MutableList = mutableListOf() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/ICallbackNotifier.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/ICallbackNotifier.kt similarity index 53% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/ICallbackNotifier.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/ICallbackNotifier.kt index bbf73d3eed..22a7d2149c 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/ICallbackNotifier.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/ICallbackNotifier.kt @@ -1,13 +1,17 @@ -package com.onesignal.core.internal.common.events +package com.onesignal.common.events /** * A generic interface which indicates the implementer has the ability to callback through the * generic [THandler] interface specified. When implemented, any outside component may set - * themselves to be the callback. + * themselves to be the callback via [set]. When the callback is to be called, the implementor + * will call a method within [THandler], the method(s) defined therein are entirely dependent on + * the implementor/definition. * - * Unlike [IEventNotifier], there can only be one (1) callback at any given time. + * Unlike [IEventNotifier], there can only be one zero or one callbacks at any given time. + * + * @param THandler The type that the implementor is expecting to callback to. */ -internal interface ICallbackNotifier { +interface ICallbackNotifier { /** * Whether there is a callback currently set. */ @@ -24,7 +28,9 @@ internal interface ICallbackNotifier { /** * An extension of [ICallbackNotifier] should be used internally to indicate the implementing * class is the producer of the callback. The interface exists for abstraction/testing purposes. + * + * @param THandler The type that the implementor is expecting to callback to. */ -internal interface ICallbackProducer : ICallbackNotifier { +interface ICallbackProducer : ICallbackNotifier { fun fire(callback: (THandler) -> Unit) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/IEventNotifier.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/IEventNotifier.kt similarity index 66% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/IEventNotifier.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/IEventNotifier.kt index cedf61a6a9..7624b9723f 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/events/IEventNotifier.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/events/IEventNotifier.kt @@ -1,13 +1,17 @@ -package com.onesignal.core.internal.common.events +package com.onesignal.common.events /** * A generic interface which indicates the implementer has the ability to notify events through the * generic [THandler] interface specified. When implemented, any outside component may subscribe - * to the events being notified. + * to the events being notified. When an event is to be raised, the implementor + * will call a method within [THandler], the method(s) defined therein are entirely dependent on + * the implementor/definition. * - * This should be used to extend an interface to broadcast it allows for subscriptions to an event. + * Unlike [ICallbackNotifier], there can be one zero or more event subscribers at any given time. + * + * @param THandler The type that the implementor is expecting to raise events to. */ -internal interface IEventNotifier { +interface IEventNotifier { /** * Subscribe to listen for events. @@ -27,8 +31,10 @@ internal interface IEventNotifier { /** * An extension of [IEventNotifier] should be used internally to indicate the implementing * class is the producer of the event. The interface exists for abstraction/testing purposes. + * + * @param THandler The type that the implementor is expecting to raise events to. */ -internal interface IEventProducer : IEventNotifier { +interface IEventProducer : IEventNotifier { /** * Call this to fire an event which will iterate through all subscribers * and allow the caller to drive the calling of the handler. It is done diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/exceptions/BackendException.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/exceptions/BackendException.kt new file mode 100644 index 0000000000..07b251a09a --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/exceptions/BackendException.kt @@ -0,0 +1,16 @@ +package com.onesignal.common.exceptions + +/** + * Raised when a backend service request has failed. + */ +class BackendException( + /** + * The status code of the response. + */ + val statusCode: Int, + + /** + * The response, if one exists. + */ + val response: String? +) : Exception() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/exceptions/MainThreadException.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/exceptions/MainThreadException.kt new file mode 100644 index 0000000000..7b548337cd --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/exceptions/MainThreadException.kt @@ -0,0 +1,6 @@ +package com.onesignal.common.exceptions + +/** + * Raised when processing is done on the main thread, when it should *not* be on the main thread. + */ +class MainThreadException(message: String?) : RuntimeException(message) diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelChangedHandler.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelChangedHandler.kt similarity index 92% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelChangedHandler.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelChangedHandler.kt index d135d77bc7..0935ca8f80 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelChangedHandler.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelChangedHandler.kt @@ -1,10 +1,10 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling /** * Implement [IModelChangedHandler] and subscribe implementation via [Model.subscribe] to * be notified when the [Model] has changed. */ -internal interface IModelChangedHandler { +interface IModelChangedHandler { /** * Called when the subscribed model has been changed. @@ -18,7 +18,7 @@ internal interface IModelChangedHandler { /** * The arguments passed to the [IModelChangedHandler] handler when subscribed via [Model.subscribe] */ -internal class ModelChangedArgs( +class ModelChangedArgs( /** * The full model in its current state. */ diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelStore.kt similarity index 91% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStore.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelStore.kt index cdfca9e68c..3a286ddf66 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelStore.kt @@ -1,13 +1,14 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.common.events.IEventNotifier import org.json.JSONObject /** * A model store provides access to the underlying models. A model store is a key store, each model * in the model store must have a unique [Model.id] for retrieving a specific model. */ -internal interface IModelStore : IEventNotifier> where TModel : Model { +interface IModelStore : + IEventNotifier> where TModel : Model { /** * Create a new instance of the model and add it to the store. The new instance is *not* added @@ -68,7 +69,7 @@ internal interface IModelStore : IEventNotifier, tag: String = ModelChangeTags.NORMAL) } -internal object ModelChangeTags { +object ModelChangeTags { /** * A change was performed through normal means. */ diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStoreChangeHandler.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelStoreChangeHandler.kt similarity index 90% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStoreChangeHandler.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelStoreChangeHandler.kt index bed4567449..d59f06e3bf 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/IModelStoreChangeHandler.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/IModelStoreChangeHandler.kt @@ -1,10 +1,10 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling /** * A handler interface for [IModelStore.subscribe]. Implement this interface to subscribe * to model change events for a specific model store. */ -internal interface IModelStoreChangeHandler where TModel : Model { +interface IModelStoreChangeHandler where TModel : Model { /** * Called when a model has been added to the model store. * diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ISingletonModelStore.kt similarity index 82% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStore.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ISingletonModelStore.kt index fd8e9e51ba..3592cb6743 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ISingletonModelStore.kt @@ -1,13 +1,13 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.common.events.IEventNotifier /** * A model store that expects to only contain a single [Model] within it. It behaves like an * [IModelStore] with the exception that there are no IDs, and there is an expectation that the * (one) model always exists. */ -internal interface ISingletonModelStore : +interface ISingletonModelStore : IEventNotifier> where TModel : Model { /** * The model managed by this singleton model store. diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStoreChangeHandler.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ISingletonModelStoreChangeHandler.kt similarity index 86% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStoreChangeHandler.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ISingletonModelStoreChangeHandler.kt index 00c67ea521..b0fcaf7215 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ISingletonModelStoreChangeHandler.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ISingletonModelStoreChangeHandler.kt @@ -1,10 +1,10 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling /** * A handler interface for [ISingletonModelStore.subscribe]. Implement this interface to subscribe * to model change events for a specific model store. */ -internal interface ISingletonModelStoreChangeHandler where TModel : Model { +interface ISingletonModelStoreChangeHandler where TModel : Model { /** * Called when the model has been replaced. diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/MapModel.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/MapModel.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/MapModel.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/MapModel.kt index fc272ee9c7..2934129495 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/MapModel.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/MapModel.kt @@ -1,11 +1,11 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling /** * A Map Model is a [MutableMap] that has a key of type string and a generically-specified * value. It is a [Model] which hooks the [MutableMap] into the model framework and allows for change * notification propagation for any adds, removes, or updates to the [MutableMap]. */ -internal open class MapModel( +open class MapModel( parentModel: Model? = null, parentProperty: String? = null ) : Model(parentModel, parentProperty), MutableMap { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/Model.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/Model.kt similarity index 97% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/Model.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/Model.kt index 303f0fff70..be2e82394a 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/Model.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/Model.kt @@ -1,8 +1,8 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling -import com.onesignal.core.internal.common.events.EventProducer -import com.onesignal.core.internal.common.events.IEventNotifier -import com.onesignal.core.internal.common.events.IEventProducer +import com.onesignal.common.events.EventProducer +import com.onesignal.common.events.IEventNotifier +import com.onesignal.common.events.IEventProducer import org.json.JSONArray import org.json.JSONObject @@ -38,7 +38,7 @@ import org.json.JSONObject * is nested the [createModelForProperty] and/or [createListForProperty] needs to be implemented * to aide in the deserialization process. */ -internal open class Model( +open class Model( /** * The optional parent model. When specified this model is a child model, any changes * to this model will *also* be propagated up to it's parent for notification. When diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ModelStore.kt similarity index 92% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ModelStore.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ModelStore.kt index 9381910de4..5414435cd5 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/ModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/ModelStore.kt @@ -1,7 +1,7 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling -import com.onesignal.core.internal.common.events.EventProducer -import com.onesignal.core.internal.common.events.IEventNotifier +import com.onesignal.common.events.EventProducer +import com.onesignal.common.events.IEventNotifier import com.onesignal.core.internal.preferences.IPreferencesService import com.onesignal.core.internal.preferences.PreferenceOneSignalKeys import com.onesignal.core.internal.preferences.PreferenceStores @@ -24,13 +24,15 @@ import org.json.JSONArray * Instantiating this model store with persistence will load any previously persisted models * as part of its initialization process. */ -internal abstract class ModelStore( +abstract class ModelStore( /** * The persistable name of the model store. If not specified no persisting will occur. */ val name: String? = null, private val _prefs: IPreferencesService? = null -) : IEventNotifier>, IModelStore, IModelChangedHandler where TModel : Model { +) : IEventNotifier>, + IModelStore, + IModelChangedHandler where TModel : Model { private val _changeSubscription: EventProducer> = EventProducer() private val _models: MutableList = mutableListOf() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SimpleModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/SimpleModelStore.kt similarity index 91% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SimpleModelStore.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/SimpleModelStore.kt index e59732ee72..ec0677dda4 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SimpleModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/SimpleModelStore.kt @@ -1,4 +1,4 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling import com.onesignal.core.internal.preferences.IPreferencesService import org.json.JSONObject @@ -8,7 +8,7 @@ import org.json.JSONObject * a basic implementation of the [create] method. Specifically, it will instantiate a * new instance of the [TModel] via the lambda [_create] passed in during initialization. */ -internal open class SimpleModelStore( +open class SimpleModelStore( /** * Will be called whenever a new [TModel] needs to be instantiated. */ diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SingletonModelStore.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/SingletonModelStore.kt similarity index 91% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SingletonModelStore.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/SingletonModelStore.kt index e35b71a15b..922a6da0d2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/modeling/SingletonModelStore.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modeling/SingletonModelStore.kt @@ -1,12 +1,12 @@ -package com.onesignal.core.internal.modeling +package com.onesignal.common.modeling -import com.onesignal.core.internal.common.events.EventProducer +import com.onesignal.common.events.EventProducer /** * A singleton model store implementation that wraps a backing [ModelStore] to manage * the single [Model] instance. */ -internal open class SingletonModelStore( +open class SingletonModelStore( val store: ModelStore ) : ISingletonModelStore, IModelStoreChangeHandler where TModel : Model { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modules/IModule.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modules/IModule.kt new file mode 100644 index 0000000000..474b1f2d23 --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/modules/IModule.kt @@ -0,0 +1,19 @@ +package com.onesignal.common.modules + +import com.onesignal.common.services.ServiceBuilder + +/** + * A module represents a container of functionality within the SDK, a module is responsible + * for registering the services and behaviors required for that functionality to function + * property. + */ +interface IModule { + + /** + * Register all services and behaviors for this module. This is called during the initialization + * of the OneSignal SDK. + * + * @param builder The [ServiceBuilder] that is used to register/provide services. + */ + fun register(builder: ServiceBuilder) +} diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/IServiceBuilder.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/IServiceBuilder.kt similarity index 98% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/IServiceBuilder.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/IServiceBuilder.kt index 0e24f18434..bd580e7f9f 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/IServiceBuilder.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/IServiceBuilder.kt @@ -1,4 +1,4 @@ -package com.onesignal.core.internal.service +package com.onesignal.common.services /** * A service builder allows for the registering of implementations and the associating of the diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/IServiceProvider.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/IServiceProvider.kt similarity index 94% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/IServiceProvider.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/IServiceProvider.kt index 07a60590d1..e47cc02a03 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/IServiceProvider.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/IServiceProvider.kt @@ -1,9 +1,9 @@ -package com.onesignal.core.internal.service +package com.onesignal.common.services /** * A service provider gives access to the implementations of a service. */ -internal interface IServiceProvider { +interface IServiceProvider { /** * Determine if the service provide has the provided service. * diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceBuilder.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceBuilder.kt similarity index 76% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceBuilder.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceBuilder.kt index ecea616625..56b469d0f2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceBuilder.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceBuilder.kt @@ -1,9 +1,13 @@ -package com.onesignal.core.internal.service +package com.onesignal.common.services -internal class ServiceBuilder : IServiceBuilder { +class ServiceBuilder : IServiceBuilder { private val _registrations: MutableList> = mutableListOf() - internal inline fun register(): ServiceRegistration { + /** + * A reified version of [register] to allow the use of generics when registering + * a service. + */ + inline fun register(): ServiceRegistration { return register(T::class.java) } diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceProvider.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceProvider.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceProvider.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceProvider.kt index c5593b34a2..18f86db8ad 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceProvider.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceProvider.kt @@ -1,11 +1,11 @@ -package com.onesignal.core.internal.service +package com.onesignal.common.services -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging /** * A service provider gives access to the implementations of a service. */ -internal class ServiceProvider( +class ServiceProvider( registrations: List> ) : IServiceProvider { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceRegistration.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceRegistration.kt similarity index 76% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceRegistration.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceRegistration.kt index 6ccc23bfe8..e717aa85bb 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/service/ServiceRegistration.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/services/ServiceRegistration.kt @@ -1,6 +1,6 @@ -package com.onesignal.core.internal.service +package com.onesignal.common.services -import com.onesignal.core.internal.logging.Logging +import com.onesignal.debug.internal.logging.Logging import java.lang.reflect.Constructor import java.lang.reflect.ParameterizedType import java.lang.reflect.WildcardType @@ -8,10 +8,10 @@ import java.lang.reflect.WildcardType /** * A registration of a service during the build phase. */ -internal abstract class ServiceRegistration { +abstract class ServiceRegistration { val services: MutableSet> = mutableSetOf() - internal inline fun provides(): ServiceRegistration { + inline fun provides(): ServiceRegistration { return provides(TService::class.java) } @@ -32,7 +32,21 @@ internal abstract class ServiceRegistration { abstract fun resolve(provider: IServiceProvider): Any? } -internal class ServiceRegistrationReflection( +/** + * A registration of a service that should use reflection to instantiate the + * service. This implementation takes as input [clazz] and using reflection + * will determine the best constructor to use for creating a new instance of + * that [clazz]. + * + * The constructor can have parameters, as long as the parameter types are: + * + * 1. A service that can be resolved via [IServiceProvider.getService]. + * 2. A generic list of a service that can be resolved via [IServiceProvider.getAllServices]. + * + * The instantiated service is treated as a singleton, instantiation will only + * happen once. + */ +class ServiceRegistrationReflection( private val clazz: Class<*> ) : ServiceRegistration() { @@ -45,7 +59,7 @@ internal class ServiceRegistrationReflection( } // use reflection to try to instantiate the thing - for (constructor in clazz!!.constructors) { + for (constructor in clazz.constructors) { if (doesHaveAllParameters(constructor, provider)) { Logging.info("${ServiceProvider.indent}Found constructor: $constructor") var paramList: MutableList = mutableListOf() @@ -117,14 +131,26 @@ internal class ServiceRegistrationReflection( } } -internal class ServiceRegistrationSingleton( +/** + * A registration of a service that is provided the instance of the service + * to use. This implementation takes as input [obj] and will return that + * instance whenever it is requested. + */ +class ServiceRegistrationSingleton( private var obj: T ) : ServiceRegistration() { override fun resolve(provider: IServiceProvider): Any? = obj } -internal class ServiceRegistrationLambda( +/** + * A registration of a service that should will call a lambda function [create] + * when the service is to be instantiated. + * + * The instantiated service is treated as a singleton, instantiation will only + * happen once. + */ +class ServiceRegistrationLambda( private val create: ((IServiceProvider) -> T) ) : ServiceRegistration() { diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/threading/ThreadUtils.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/threading/ThreadUtils.kt similarity index 82% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/threading/ThreadUtils.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/threading/ThreadUtils.kt index 4f1bc1533e..bc4da1e3f2 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/threading/ThreadUtils.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/threading/ThreadUtils.kt @@ -1,4 +1,4 @@ -package com.onesignal.core.internal.common +package com.onesignal.common.threading import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking @@ -17,17 +17,17 @@ import kotlin.concurrent.thread * code that is running on the main thread: * * ``` - * ThreadUtils.suspendify { + * suspendifyOnThread { * withContext(Dispatchers.Main) { * } * } * ``` * * The `withContext` will suspend until the main thread is available, but - * the main thread is parked via the `ThreadUtils.suspendify`. This will + * the main thread is parked via this `suspendifyBlocking`. This will * never recover. */ -internal fun suspendifyBlocking(block: suspend () -> Unit) { +fun suspendifyBlocking(block: suspend () -> Unit) { runBlocking { block() } @@ -39,7 +39,7 @@ internal fun suspendifyBlocking(block: suspend () -> Unit) { * the scope will start on a background thread and block as it switches * over to the main thread context. This will return immediately!!! */ -internal fun suspendifyOnMain(block: suspend () -> Unit) { +fun suspendifyOnMain(block: suspend () -> Unit) { thread { runBlocking { withContext(Dispatchers.Main) { @@ -55,7 +55,7 @@ internal fun suspendifyOnMain(block: suspend () -> Unit) { * means the scope will run on a background thread. This will * return immediately!!! */ -internal fun suspendifyOnThread(priority: Int = -1, block: suspend () -> Unit) { +fun suspendifyOnThread(priority: Int = -1, block: suspend () -> Unit) { thread(priority = priority) { runBlocking { block() diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/threading/Waiter.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/threading/Waiter.kt similarity index 95% rename from OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/threading/Waiter.kt rename to OneSignalSDK/onesignal/src/main/java/com/onesignal/common/threading/Waiter.kt index 0c00660ec9..4e94e6dd48 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/internal/common/threading/Waiter.kt +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/common/threading/Waiter.kt @@ -1,4 +1,4 @@ -package com.onesignal.onesignal.core.internal.common.suspend +package com.onesignal.common.threading import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.runBlocking diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/CoreModule.kt b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/CoreModule.kt new file mode 100644 index 0000000000..788b9054f0 --- /dev/null +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/core/CoreModule.kt @@ -0,0 +1,91 @@ +package com.onesignal.core + +import com.onesignal.common.modules.IModule +import com.onesignal.common.services.ServiceBuilder +import com.onesignal.core.internal.application.IApplicationService +import com.onesignal.core.internal.application.impl.ApplicationService +import com.onesignal.core.internal.backend.IParamsBackendService +import com.onesignal.core.internal.backend.impl.ParamsBackendService +import com.onesignal.core.internal.background.IBackgroundManager +import com.onesignal.core.internal.background.impl.BackgroundManager +import com.onesignal.core.internal.config.ConfigModelStore +import com.onesignal.core.internal.config.impl.ConfigModelStoreListener +import com.onesignal.core.internal.database.IDatabaseProvider +import com.onesignal.core.internal.database.impl.DatabaseProvider +import com.onesignal.core.internal.device.IDeviceService +import com.onesignal.core.internal.device.impl.DeviceService +import com.onesignal.core.internal.http.IHttpClient +import com.onesignal.core.internal.http.impl.HttpClient +import com.onesignal.core.internal.http.impl.HttpConnectionFactory +import com.onesignal.core.internal.http.impl.IHttpConnectionFactory +import com.onesignal.core.internal.language.ILanguageContext +import com.onesignal.core.internal.language.impl.LanguageContext +import com.onesignal.core.internal.operations.IOperationRepo +import com.onesignal.core.internal.operations.impl.OperationModelStore +import com.onesignal.core.internal.operations.impl.OperationRepo +import com.onesignal.core.internal.permissions.IRequestPermissionService +import com.onesignal.core.internal.permissions.impl.RequestPermissionService +import com.onesignal.core.internal.preferences.IPreferencesService +import com.onesignal.core.internal.preferences.impl.PreferencesService +import com.onesignal.core.internal.purchases.impl.TrackAmazonPurchase +import com.onesignal.core.internal.purchases.impl.TrackGooglePurchase +import com.onesignal.core.internal.startup.IStartableService +import com.onesignal.core.internal.startup.StartupService +import com.onesignal.core.internal.time.ITime +import com.onesignal.core.internal.time.impl.Time +import com.onesignal.iam.IIAMManager +import com.onesignal.iam.internal.MisconfiguredIAMManager +import com.onesignal.location.ILocationManager +import com.onesignal.location.internal.MisconfiguredLocationManager +import com.onesignal.notification.INotificationsManager +import com.onesignal.notification.internal.MisconfiguredNotificationsManager + +internal class CoreModule : IModule { + override fun register(builder: ServiceBuilder) { + // Low Level Services + builder.register() + .provides() + .provides() + builder.register().provides() + builder.register().provides() + builder.register().provides() + builder.register().provides() + builder.register