-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2151 from OneSignal/initWithContext-in-background
[Optimization] Init with context in background
- Loading branch information
Showing
6 changed files
with
94 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
...nalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/startup/StartupService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
package com.onesignal.core.internal.startup | ||
|
||
import com.onesignal.common.services.ServiceProvider | ||
|
||
internal class StartupService( | ||
private val _bootstrapServices: List<IBootstrapService>, | ||
private val _startableServices: List<IStartableService>, | ||
private val services: ServiceProvider, | ||
) { | ||
fun bootstrap() { | ||
// now that we have the params initialized, start everything else up | ||
for (bootstrapService in _bootstrapServices) | ||
bootstrapService.bootstrap() | ||
services.getAllServices<IBootstrapService>().forEach { it.bootstrap() } | ||
} | ||
|
||
fun start() { | ||
// now that we have the params initialized, start everything else up | ||
for (startableService in _startableServices) | ||
startableService.start() | ||
// schedule to start all startable services in a separate thread | ||
fun scheduleStart() { | ||
Thread { | ||
services.getAllServices<IStartableService>().forEach { it.start() } | ||
}.start() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters