bugfixes and themes
This commit is contained in:
parent
960c2b4113
commit
9c0ef7a788
57 changed files with 699 additions and 381 deletions
|
@ -40,7 +40,7 @@ class AlarmReceiver : BroadcastReceiver() {
|
|||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
)
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
val curTime = loadData<Int>("subscriptions_time_r", context) ?: defaultTime
|
||||
val curTime = loadData<Int>("subscriptions_time_s", context) ?: defaultTime
|
||||
|
||||
if (timeMinutes[curTime] > 0)
|
||||
alarmManager.setRepeating(
|
||||
|
|
|
@ -16,8 +16,8 @@ import kotlinx.coroutines.launch
|
|||
@SuppressLint("MissingPermission")
|
||||
class Subscription {
|
||||
companion object {
|
||||
const val defaultTime = 3
|
||||
val timeMinutes = arrayOf(0L, 120, 180, 240, 360, 480, 720, 1440)
|
||||
const val defaultTime = 1
|
||||
val timeMinutes = arrayOf(0L, 720, 1440)
|
||||
|
||||
private var alreadyStarted = false
|
||||
fun Context.startSubscription(force: Boolean = false) {
|
||||
|
|
|
@ -22,7 +22,7 @@ class SubscriptionWorker(val context: Context, params: WorkerParameters) : Corou
|
|||
|
||||
private const val SUBSCRIPTION_WORK_NAME = "work_subscription"
|
||||
fun enqueue(context: Context) {
|
||||
val curTime = loadData<Int>("subscriptions_time_r") ?: defaultTime
|
||||
val curTime = loadData<Int>("subscriptions_time_s") ?: defaultTime
|
||||
if(timeMinutes[curTime]>0L) {
|
||||
val constraints = Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build()
|
||||
val periodicSyncDataWork = PeriodicWorkRequest.Builder(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue