Skip to content

Commit

Permalink
Initlizing the ServiceWorker in onCreate method of CoreApp clas…
Browse files Browse the repository at this point in the history
…s so that all necessary application setup is complete before the service worker is initialized and provides better control over the initialization sequence.
  • Loading branch information
MohitMaliDeveloper authored and kelson42 committed Jun 15, 2024
1 parent 824aa96 commit 4c3af12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ abstract class CoreApp : Application() {
.build()
AndroidThreeTen.init(this)
coreComponent.inject(this)
serviceWorkerInitialiser.init(this)
downloadMonitor.init()
nightModeConfig.init()
fileLogger.writeLogFile(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ import androidx.webkit.WebViewFeature
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
import javax.inject.Inject

class ServiceWorkerInitialiser @Inject constructor(
context: Context,
zimReaderContainer: ZimReaderContainer
) {
init {
class ServiceWorkerInitialiser @Inject constructor(val zimReaderContainer: ZimReaderContainer) {
fun init(context: Context) {
if (isMainProcess(context) &&
WebViewFeature.isFeatureSupported(WebViewFeature.SERVICE_WORKER_BASIC_USAGE)
) {
Expand Down

0 comments on commit 4c3af12

Please sign in to comment.