-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing the crash on the locale change because of missing dagger bindings
- Loading branch information
1 parent
4bf1272
commit f80ea5e
Showing
5 changed files
with
32 additions
and
50 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
21 changes: 0 additions & 21 deletions
21
app/src/main/java/com/kevalpatel2106/yip/utils/BootCompleteReceiver.kt
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
app/src/main/java/com/kevalpatel2106/yip/utils/LocaleChangedReceiver.kt
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
app/src/main/java/com/kevalpatel2106/yip/utils/SysEventsReceiver.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.kevalpatel2106.yip.utils | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.BroadcastReceiver | ||
import android.content.Context | ||
import android.content.Intent | ||
import com.kevalpatel2106.yip.notifications.ProgressNotificationReceiver | ||
import com.kevalpatel2106.yip.repo.providers.AlarmProvider | ||
import dagger.android.AndroidInjection | ||
import javax.inject.Inject | ||
|
||
internal class SysEventsReceiver : BroadcastReceiver() { | ||
|
||
@Inject | ||
internal lateinit var alarmProvider: AlarmProvider | ||
|
||
@SuppressLint("UnsafeProtectedBroadcastReceiver") | ||
override fun onReceive(context: Context, intent: Intent) { | ||
if (intent.isValidIntent()) { | ||
AndroidInjection.inject(this, context) | ||
alarmProvider.updateAlarms(ProgressNotificationReceiver::class.java) | ||
} | ||
} | ||
|
||
private fun Intent.isValidIntent(): Boolean { | ||
return action == Intent.ACTION_BOOT_COMPLETED && action == Intent.ACTION_LOCALE_CHANGED | ||
} | ||
} |