-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move unused service initialization out of main thread
- Loading branch information
1 parent
429c1c9
commit e18e4b6
Showing
5 changed files
with
78 additions
and
66 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
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