File tree Expand file tree Collapse file tree 5 files changed +39
-16
lines changed
core/src/main/java/com/onesignal/core/internal/startup
in-app-messages/src/main/java/com/onesignal/inAppMessages
notifications/src/main/java/com/onesignal/notifications/internal/lifecycle/impl Expand file tree Collapse file tree 5 files changed +39
-16
lines changed Original file line number Diff line number Diff line change
1
+ package com.onesignal.core.internal.startup
2
+
3
+ import com.onesignal.OneSignal
4
+ import com.onesignal.core.internal.application.IApplicationService
5
+ import com.onesignal.core.internal.config.ConfigModel
6
+ import com.onesignal.core.internal.config.ConfigModelStore
7
+
8
+ /* *
9
+ * Implement and provide this interface as part of service registration to indicate the service
10
+ * wants to be instantiated and its [bootstrap] function called during the initialization process.
11
+ *
12
+ * When [IBootstrapService.bootstrap] is called, only [OneSignal.setAppId] have been called during
13
+ * [OneSignal.initWithContext].
14
+ *
15
+ * This means the following is true:
16
+ *
17
+ * 1) An appContext is available in [IApplicationService.appContext].
18
+ * 2) An appId is available in [ConfigModel.appId] via [ConfigModelStore.get]
19
+ * 3) None of the [IStartableService.start] is called
20
+ *
21
+ * When bootstrap there is no guarantee that any other data is available. Typically a bootstrap service
22
+ * must be instantiated immediately and will add their appropriate hooks to then respond to changes
23
+ * in the system.
24
+ */
25
+ interface IBootstrapService {
26
+ /* *
27
+ * Called when the service is to be bootstrap. The appId and appContext have already been established.
28
+ */
29
+
30
+ fun bootstrap ()
31
+ }
Original file line number Diff line number Diff line change @@ -15,9 +15,8 @@ import com.onesignal.core.internal.config.ConfigModelStore
15
15
* 1) An appContext is available in [IApplicationService.appContext].
16
16
* 2) An appId is available in [ConfigModel.appId] via [ConfigModelStore.get]
17
17
*
18
- * When started there is no guarantee that any other data is available. Typically a startable service
19
- * must be instantiated immediately and will add their appropriate hooks to then respond to changes
20
- * in the system.
18
+ * When started there is no guarantee that any other data is available. Typically a startable service
19
+ * can asynchronously start some lengthy process that doesn't require immediate use.
21
20
*/
22
21
interface IStartableService {
23
22
/* *
@@ -26,11 +25,3 @@ interface IStartableService {
26
25
*/
27
26
fun start ()
28
27
}
29
-
30
- internal interface IBootstrapService {
31
- /* *
32
- * Called when the service is to be started. The appId and appContext have already been
33
- * established.
34
- */
35
- fun bootstrap ()
36
- }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.onesignal.inAppMessages
3
3
import android.os.Build
4
4
import com.onesignal.common.modules.IModule
5
5
import com.onesignal.common.services.ServiceBuilder
6
+ import com.onesignal.core.internal.startup.IBootstrapService
6
7
import com.onesignal.core.internal.startup.IStartableService
7
8
import com.onesignal.inAppMessages.internal.DummyInAppMessagesManager
8
9
import com.onesignal.inAppMessages.internal.InAppMessagesManager
@@ -50,7 +51,7 @@ internal class InAppMessagesModule : IModule {
50
51
builder.register<InAppDisplayer >().provides<IInAppDisplayer >()
51
52
52
53
// Previews
53
- builder.register<InAppMessagePreviewHandler >().provides<IStartableService >()
54
+ builder.register<InAppMessagePreviewHandler >().provides<IBootstrapService >()
54
55
55
56
// Prompts
56
57
builder.register<InAppMessagePromptFactory >().provides<IInAppMessagePromptFactory >()
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package com.onesignal.inAppMessages.internal.preview
2
2
3
3
import android.app.Activity
4
4
import com.onesignal.core.internal.application.IApplicationService
5
- import com.onesignal.core.internal.startup.IStartableService
5
+ import com.onesignal.core.internal.startup.IBootstrapService
6
6
import com.onesignal.core.internal.time.ITime
7
7
import com.onesignal.inAppMessages.internal.display.IInAppDisplayer
8
8
import com.onesignal.inAppMessages.internal.state.InAppStateService
@@ -25,8 +25,8 @@ internal class InAppMessagePreviewHandler(
25
25
private val _notificationLifeCycle : INotificationLifecycleService ,
26
26
private val _state : InAppStateService ,
27
27
private val _time : ITime ,
28
- ) : IStartableService , INotificationLifecycleCallback {
29
- override fun start () {
28
+ ) : IBootstrapService , INotificationLifecycleCallback {
29
+ override fun bootstrap () {
30
30
_notificationLifeCycle .setInternalNotificationLifecycleCallback(this )
31
31
}
32
32
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ internal class NotificationLifecycleService(
87
87
activity : Activity ,
88
88
data : JSONObject ,
89
89
): Boolean {
90
- var canOpen = extOpenedCallback.hasSubscribers
90
+ var canOpen = true
91
91
intLifecycleCallback.suspendingFire { canOpen = it.canOpenNotification(activity, data) }
92
92
return canOpen
93
93
}
You can’t perform that action at this time.
0 commit comments