diff --git a/.idea/file.template.settings.xml b/.idea/file.template.settings.xml
new file mode 100644
index 00000000..d8cf7e7b
--- /dev/null
+++ b/.idea/file.template.settings.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/fileTemplates/includes/File Header.java b/.idea/fileTemplates/includes/File Header.java
new file mode 100644
index 00000000..e2f86c4c
--- /dev/null
+++ b/.idea/fileTemplates/includes/File Header.java
@@ -0,0 +1,16 @@
+/*
+ * Copyright ${YEAR}. joeloewi
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index a1a2231c..7a248893 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -21,8 +21,8 @@ android {
defaultConfig {
applicationId = "com.joeloewi.croissant"
- versionCode = 62
- versionName = "1.3.1"
+ versionCode = 63
+ versionName = "1.3.2"
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/kotlin/com/joeloewi/croissant/di/EntryPoints.kt b/app/src/main/kotlin/com/joeloewi/croissant/di/EntryPoints.kt
index 3a6c2230..b1e2fe17 100644
--- a/app/src/main/kotlin/com/joeloewi/croissant/di/EntryPoints.kt
+++ b/app/src/main/kotlin/com/joeloewi/croissant/di/EntryPoints.kt
@@ -17,42 +17,30 @@
package com.joeloewi.croissant.di
import android.content.Context
-import androidx.hilt.work.HiltWorkerFactory
-import coil.ImageLoader
-import com.joeloewi.croissant.data.di.DefaultDispatcherExecutor
-import com.joeloewi.croissant.util.NotificationGenerator
+import com.joeloewi.croissant.initializer.CoilInitializer
+import com.joeloewi.croissant.initializer.NotificationChannelInitializer
+import com.joeloewi.croissant.initializer.WorkManagerInitializer
import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.SingletonComponent
-import java.util.concurrent.Executor
-import kotlin.reflect.KClass
@EntryPoint
@InstallIn(SingletonComponent::class)
interface InitializerEntryPoint {
- fun imageLoader(): ImageLoader
- fun hiltWorkerFactory(): HiltWorkerFactory
+ fun injectCoilInitializer(coilInitializer: CoilInitializer)
+ fun injectNotificationChannelInitializer(initializer: NotificationChannelInitializer)
+ fun injectWorkManagerInitializer(workManagerInitializer: WorkManagerInitializer)
- @DefaultDispatcherExecutor
- fun executor(): Executor
- fun notificationGenerator(): NotificationGenerator
-}
-
-inline fun Context.entryPoints(): Lazy = EntryPointLazy(
- entryPointInterface = EntryPoint::class,
- context = this
-)
-
-class EntryPointLazy(
- private val entryPointInterface: KClass,
- private val context: Context
-) : Lazy {
- private var cached: EntryPoint? = null
- override val value: EntryPoint
- get() = EntryPointAccessors.fromApplication(context, entryPointInterface.java).also {
- cached = it
+ companion object {
+ fun resolve(context: Context): InitializerEntryPoint {
+ val appContext = context.applicationContext ?: throw IllegalStateException(
+ "applicationContext was not found in InitializerEntryPoint",
+ )
+ return EntryPointAccessors.fromApplication(
+ appContext,
+ InitializerEntryPoint::class.java,
+ )
}
-
- override fun isInitialized(): Boolean = cached != null
+ }
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/joeloewi/croissant/initializer/CoilInitializer.kt b/app/src/main/kotlin/com/joeloewi/croissant/initializer/CoilInitializer.kt
index bf5cd67f..3bbd2cf5 100644
--- a/app/src/main/kotlin/com/joeloewi/croissant/initializer/CoilInitializer.kt
+++ b/app/src/main/kotlin/com/joeloewi/croissant/initializer/CoilInitializer.kt
@@ -22,13 +22,15 @@ import coil.Coil
import coil.ImageLoader
import coil.imageLoader
import com.joeloewi.croissant.di.InitializerEntryPoint
-import com.joeloewi.croissant.di.entryPoints
+import javax.inject.Inject
class CoilInitializer : Initializer {
+ @set:Inject
+ internal lateinit var imageLoader: ImageLoader
+
override fun create(context: Context): ImageLoader {
- val initializerEntryPoint: InitializerEntryPoint by context.entryPoints()
- val imageLoader = initializerEntryPoint.imageLoader()
+ InitializerEntryPoint.resolve(context).injectCoilInitializer(this)
Coil.setImageLoader { imageLoader }
diff --git a/app/src/main/kotlin/com/joeloewi/croissant/initializer/NotificationChannelInitializer.kt b/app/src/main/kotlin/com/joeloewi/croissant/initializer/NotificationChannelInitializer.kt
index 8d7c5d5f..b6eddf75 100644
--- a/app/src/main/kotlin/com/joeloewi/croissant/initializer/NotificationChannelInitializer.kt
+++ b/app/src/main/kotlin/com/joeloewi/croissant/initializer/NotificationChannelInitializer.kt
@@ -3,13 +3,16 @@ package com.joeloewi.croissant.initializer
import android.content.Context
import androidx.startup.Initializer
import com.joeloewi.croissant.di.InitializerEntryPoint
-import com.joeloewi.croissant.di.entryPoints
+import com.joeloewi.croissant.util.NotificationGenerator
+import javax.inject.Inject
class NotificationChannelInitializer : Initializer {
+ @set:Inject
+ internal lateinit var notificationGenerator: NotificationGenerator
+
override fun create(context: Context) {
- val initializerEntryPoint: InitializerEntryPoint by context.entryPoints()
- val notificationGenerator = initializerEntryPoint.notificationGenerator()
+ InitializerEntryPoint.resolve(context).injectNotificationChannelInitializer(this)
notificationGenerator.createNotificationChannels()
}
diff --git a/app/src/main/kotlin/com/joeloewi/croissant/initializer/WorkManagerInitializer.kt b/app/src/main/kotlin/com/joeloewi/croissant/initializer/WorkManagerInitializer.kt
index 9be23f5f..b268449d 100644
--- a/app/src/main/kotlin/com/joeloewi/croissant/initializer/WorkManagerInitializer.kt
+++ b/app/src/main/kotlin/com/joeloewi/croissant/initializer/WorkManagerInitializer.kt
@@ -17,18 +17,26 @@
package com.joeloewi.croissant.initializer
import android.content.Context
+import androidx.hilt.work.HiltWorkerFactory
import androidx.startup.Initializer
import androidx.work.Configuration
import androidx.work.WorkManager
+import com.joeloewi.croissant.data.di.DefaultDispatcherExecutor
import com.joeloewi.croissant.di.InitializerEntryPoint
-import com.joeloewi.croissant.di.entryPoints
+import java.util.concurrent.Executor
+import javax.inject.Inject
class WorkManagerInitializer : Initializer {
+ @set:Inject
+ internal lateinit var hiltWorkerFactory: HiltWorkerFactory
+
+ @Inject
+ @DefaultDispatcherExecutor
+ lateinit var executor: Executor
+
override fun create(context: Context): WorkManager {
- val initializerEntryPoint: InitializerEntryPoint by context.entryPoints()
- val hiltWorkerFactory = initializerEntryPoint.hiltWorkerFactory()
- val executor = initializerEntryPoint.executor()
+ InitializerEntryPoint.resolve(context).injectWorkManagerInitializer(this)
WorkManager.initialize(
context,
diff --git a/app/src/main/kotlin/com/joeloewi/croissant/receiver/AlarmReceiver.kt b/app/src/main/kotlin/com/joeloewi/croissant/receiver/AlarmReceiver.kt
index ee73075d..482c0230 100644
--- a/app/src/main/kotlin/com/joeloewi/croissant/receiver/AlarmReceiver.kt
+++ b/app/src/main/kotlin/com/joeloewi/croissant/receiver/AlarmReceiver.kt
@@ -5,8 +5,7 @@ import android.app.Application
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
-import androidx.lifecycle.ProcessLifecycleOwner
-import androidx.lifecycle.lifecycleScope
+import android.util.Log
import androidx.work.ExistingWorkPolicy
import androidx.work.WorkManager
import com.google.firebase.Firebase
@@ -17,13 +16,13 @@ import com.joeloewi.croissant.util.AlarmScheduler
import com.joeloewi.croissant.worker.AttendCheckInEventWorker
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import javax.inject.Inject
@AndroidEntryPoint
class AlarmReceiver : BroadcastReceiver() {
- private val _processLifecycleScope = ProcessLifecycleOwner.get().lifecycleScope
private val _coroutineContext = Dispatchers.IO + CoroutineExceptionHandler { _, throwable ->
Firebase.crashlytics.apply {
log(this@AlarmReceiver.javaClass.simpleName)
@@ -49,10 +48,15 @@ class AlarmReceiver : BroadcastReceiver() {
@Inject
lateinit var alarmScheduler: AlarmScheduler
+ @Inject
+ lateinit var coroutineScope: CoroutineScope
+
override fun onReceive(p0: Context, p1: Intent) {
+ Log.d("123123", p1.action.toString())
+
when (p1.action) {
Intent.ACTION_BOOT_COMPLETED, Intent.ACTION_MY_PACKAGE_REPLACED, AlarmManager.ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED -> {
- _processLifecycleScope.launch(_coroutineContext) {
+ coroutineScope.launch(_coroutineContext) {
getAllOneShotAttendanceUseCase().forEach { attendance ->
attendance.runCatching {
alarmScheduler.scheduleCheckInAlarm(
@@ -65,7 +69,7 @@ class AlarmReceiver : BroadcastReceiver() {
}
RECEIVE_ATTEND_CHECK_IN_ALARM -> {
- _processLifecycleScope.launch(_coroutineContext) {
+ coroutineScope.launch(_coroutineContext) {
val attendanceId = p1.getLongExtra(ATTENDANCE_ID, Long.MIN_VALUE)
val attendanceWithGames = getOneAttendanceUseCase(attendanceId)
val attendance = attendanceWithGames.attendance
diff --git a/app/src/main/kotlin/com/joeloewi/croissant/receiver/MigrationHelper.kt b/app/src/main/kotlin/com/joeloewi/croissant/receiver/MigrationHelper.kt
index 1a7ce019..d514f668 100644
--- a/app/src/main/kotlin/com/joeloewi/croissant/receiver/MigrationHelper.kt
+++ b/app/src/main/kotlin/com/joeloewi/croissant/receiver/MigrationHelper.kt
@@ -4,8 +4,6 @@ import android.app.Application
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
-import androidx.lifecycle.ProcessLifecycleOwner
-import androidx.lifecycle.lifecycleScope
import androidx.work.WorkManager
import com.google.firebase.Firebase
import com.google.firebase.crashlytics.crashlytics
@@ -13,13 +11,13 @@ import com.joeloewi.croissant.domain.usecase.AttendanceUseCase
import com.joeloewi.croissant.domain.usecase.ResinStatusWidgetUseCase
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import javax.inject.Inject
@AndroidEntryPoint
class MigrationHelper : BroadcastReceiver() {
- private val _processLifecycleScope = ProcessLifecycleOwner.get().lifecycleScope
private val _coroutineContext = Dispatchers.IO + CoroutineExceptionHandler { _, throwable ->
Firebase.crashlytics.apply {
log(this@MigrationHelper.javaClass.simpleName)
@@ -42,10 +40,13 @@ class MigrationHelper : BroadcastReceiver() {
@Inject
lateinit var workManager: WorkManager
+ @Inject
+ lateinit var coroutineScope: CoroutineScope
+
override fun onReceive(p0: Context, p1: Intent) {
when (p1.action) {
Intent.ACTION_MY_PACKAGE_REPLACED -> {
- _processLifecycleScope.launch(_coroutineContext) {
+ coroutineScope.launch(_coroutineContext) {
//because work manager's job can be deferred, cancel check in event worker
//instead of work manager, use alarm manager
getAllOneShotAttendanceUseCase().forEach { attendance ->
diff --git a/app/src/main/kotlin/com/joeloewi/croissant/receiver/ResinStatusWidgetProvider.kt b/app/src/main/kotlin/com/joeloewi/croissant/receiver/ResinStatusWidgetProvider.kt
index 604fee06..7a406dc4 100644
--- a/app/src/main/kotlin/com/joeloewi/croissant/receiver/ResinStatusWidgetProvider.kt
+++ b/app/src/main/kotlin/com/joeloewi/croissant/receiver/ResinStatusWidgetProvider.kt
@@ -4,8 +4,6 @@ import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.Context
import android.os.PowerManager
-import androidx.lifecycle.ProcessLifecycleOwner
-import androidx.lifecycle.lifecycleScope
import androidx.work.ExistingWorkPolicy
import androidx.work.WorkManager
import com.google.firebase.Firebase
@@ -17,6 +15,7 @@ import com.joeloewi.croissant.worker.RefreshResinStatusWorker
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.async
@@ -26,7 +25,6 @@ import javax.inject.Inject
@AndroidEntryPoint
class ResinStatusWidgetProvider : AppWidgetProvider() {
- private val _processLifecycleScope = ProcessLifecycleOwner.get().lifecycleScope
private val _coroutineContext = Dispatchers.IO + CoroutineExceptionHandler { _, throwable ->
Firebase.crashlytics.apply {
log(this@ResinStatusWidgetProvider.javaClass.simpleName)
@@ -46,13 +44,16 @@ class ResinStatusWidgetProvider : AppWidgetProvider() {
@Inject
lateinit var workManager: WorkManager
+ @Inject
+ lateinit var coroutineScope: CoroutineScope
+
override fun onUpdate(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetIds: IntArray
) {
//this method also called when user put widget on home screen
- _processLifecycleScope.launch(_coroutineContext) {
+ coroutineScope.launch(_coroutineContext) {
appWidgetIds.map { appWidgetId ->
async(SupervisorJob() + Dispatchers.IO + CoroutineExceptionHandler { _, _ -> }) {
if (powerManager.isPowerSaveMode && !powerManager.isIgnoringBatteryOptimizationsCompat(
@@ -89,7 +90,7 @@ class ResinStatusWidgetProvider : AppWidgetProvider() {
}
override fun onDeleted(context: Context, appWidgetIds: IntArray) {
- _processLifecycleScope.launch(_coroutineContext) {
+ coroutineScope.launch(_coroutineContext) {
appWidgetIds.run {
map { appWidgetId ->
async(SupervisorJob() + Dispatchers.IO + CoroutineExceptionHandler { _, _ -> }) {
diff --git a/app/src/main/kotlin/com/joeloewi/croissant/receiver/TimeZoneChangedReceiver.kt b/app/src/main/kotlin/com/joeloewi/croissant/receiver/TimeZoneChangedReceiver.kt
index 7af900b8..11e524ff 100644
--- a/app/src/main/kotlin/com/joeloewi/croissant/receiver/TimeZoneChangedReceiver.kt
+++ b/app/src/main/kotlin/com/joeloewi/croissant/receiver/TimeZoneChangedReceiver.kt
@@ -3,13 +3,12 @@ package com.joeloewi.croissant.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
-import androidx.lifecycle.ProcessLifecycleOwner
-import androidx.lifecycle.lifecycleScope
import com.google.firebase.Firebase
import com.google.firebase.crashlytics.crashlytics
import com.joeloewi.croissant.util.NotificationGenerator
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.util.UUID
@@ -18,7 +17,6 @@ import javax.inject.Inject
@AndroidEntryPoint
class TimeZoneChangedReceiver @Inject constructor(
) : BroadcastReceiver() {
- private val _processLifecycleScope = ProcessLifecycleOwner.get().lifecycleScope
private val _coroutineContext = Dispatchers.IO + CoroutineExceptionHandler { _, throwable ->
Firebase.crashlytics.apply {
log(this@TimeZoneChangedReceiver.javaClass.simpleName)
@@ -29,10 +27,13 @@ class TimeZoneChangedReceiver @Inject constructor(
@Inject
lateinit var notificationGenerator: NotificationGenerator
+ @Inject
+ lateinit var coroutineScope: CoroutineScope
+
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
Intent.ACTION_TIMEZONE_CHANGED -> {
- _processLifecycleScope.launch(_coroutineContext) {
+ coroutineScope.launch(_coroutineContext) {
with(notificationGenerator) {
safeNotify(
UUID.randomUUID().toString(),
diff --git a/data/src/main/kotlin/com/joeloewi/croissant/data/api/dao/GenshinImpactCheckInService.kt b/data/src/main/kotlin/com/joeloewi/croissant/data/api/dao/GenshinImpactCheckInService.kt
index cd953ecf..6cec80c4 100644
--- a/data/src/main/kotlin/com/joeloewi/croissant/data/api/dao/GenshinImpactCheckInService.kt
+++ b/data/src/main/kotlin/com/joeloewi/croissant/data/api/dao/GenshinImpactCheckInService.kt
@@ -5,16 +5,15 @@ import com.skydoves.sandwich.ApiResponse
import retrofit2.http.Body
import retrofit2.http.Header
import retrofit2.http.POST
+import retrofit2.http.Query
import java.util.Locale
interface GenshinImpactCheckInService {
@POST("event/sol/sign")
suspend fun attend(
+ @Query("lang") language: String = Locale.getDefault().toLanguageTag().lowercase(),
@Header("Cookie") cookie: String,
- @Body params: Map = mapOf(
- "act_id" to "e202102251931481",
- "lang" to Locale.getDefault().toLanguageTag().lowercase()
- )
+ @Body params: Map = mapOf("act_id" to "e202102251931481")
): ApiResponse
}
\ No newline at end of file
diff --git a/data/src/main/kotlin/com/joeloewi/croissant/data/di/CoroutineScopeModule.kt b/data/src/main/kotlin/com/joeloewi/croissant/data/di/CoroutineScopeModule.kt
new file mode 100644
index 00000000..005621c8
--- /dev/null
+++ b/data/src/main/kotlin/com/joeloewi/croissant/data/di/CoroutineScopeModule.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2024. joeloewi
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.joeloewi.croissant.data.di
+
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.SupervisorJob
+import javax.inject.Singleton
+
+@Module
+@InstallIn(SingletonComponent::class)
+object CoroutineScopeModule {
+
+ @Singleton
+ @Provides
+ fun provideCoroutineScope(): CoroutineScope =
+ CoroutineScope(Dispatchers.Default + SupervisorJob())
+}
\ No newline at end of file
diff --git a/data/src/main/kotlin/com/joeloewi/croissant/data/di/NetworkEntryPoint.kt b/data/src/main/kotlin/com/joeloewi/croissant/data/di/NetworkEntryPoint.kt
new file mode 100644
index 00000000..0ef7080f
--- /dev/null
+++ b/data/src/main/kotlin/com/joeloewi/croissant/data/di/NetworkEntryPoint.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2024. joeloewi
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.joeloewi.croissant.data.di
+
+import android.content.Context
+import com.joeloewi.croissant.data.initializer.SandwichCustomInitializer
+import dagger.hilt.EntryPoint
+import dagger.hilt.InstallIn
+import dagger.hilt.android.EntryPointAccessors
+import dagger.hilt.components.SingletonComponent
+
+@EntryPoint
+@InstallIn(SingletonComponent::class)
+interface NetworkEntryPoint {
+ fun inject(sandwichCustomInitializer: SandwichCustomInitializer)
+
+ companion object {
+ fun resolve(context: Context): NetworkEntryPoint {
+ val appContext = context.applicationContext ?: throw IllegalStateException(
+ "applicationContext was not found in NetworkEntryPoint",
+ )
+ return EntryPointAccessors.fromApplication(
+ appContext,
+ NetworkEntryPoint::class.java,
+ )
+ }
+ }
+}
\ No newline at end of file
diff --git a/data/src/main/kotlin/com/joeloewi/croissant/data/initializer/SandwichCustomInitializer.kt b/data/src/main/kotlin/com/joeloewi/croissant/data/initializer/SandwichCustomInitializer.kt
index aed4a2f9..4b28bdbb 100644
--- a/data/src/main/kotlin/com/joeloewi/croissant/data/initializer/SandwichCustomInitializer.kt
+++ b/data/src/main/kotlin/com/joeloewi/croissant/data/initializer/SandwichCustomInitializer.kt
@@ -17,24 +17,24 @@
package com.joeloewi.croissant.data.initializer
import android.content.Context
-import androidx.lifecycle.ProcessLifecycleInitializer
-import androidx.lifecycle.ProcessLifecycleOwner
-import androidx.lifecycle.lifecycleScope
import androidx.startup.Initializer
+import com.joeloewi.croissant.data.di.NetworkEntryPoint
import com.skydoves.sandwich.SandwichInitializer
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.SupervisorJob
-import kotlinx.coroutines.plus
+import kotlinx.coroutines.CoroutineScope
+import javax.inject.Inject
class SandwichCustomInitializer : Initializer {
+ @set:Inject
+ internal lateinit var coroutineScope: CoroutineScope
+
override fun create(context: Context) {
+ NetworkEntryPoint.resolve(context).inject(this)
+
SandwichInitializer.apply {
- sandwichScope =
- ProcessLifecycleOwner.get().lifecycleScope.plus(Dispatchers.IO + SupervisorJob())
+ sandwichScope = coroutineScope
}
}
- override fun dependencies(): MutableList>> =
- mutableListOf(ProcessLifecycleInitializer::class.java)
+ override fun dependencies(): MutableList>> = mutableListOf()
}
\ No newline at end of file