Option to auto check for extension updates (#2680)

* Option to auto check for extension updates

* Addressing comments

* Added foreground check for extensions

* Added Extension Preference widget
This commit is contained in:
Jays2Kings
2020-03-20 19:22:39 -07:00
committed by GitHub
parent fd4876be24
commit 9585f9a1a6
16 changed files with 308 additions and 10 deletions
@@ -437,5 +437,19 @@ class NotificationReceiver : BroadcastReceiver() {
}
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
}
/**
* Returns [PendingIntent] that opens the extensions controller.
*
* @param context context of application
*/
internal fun openExtensionsPendingActivity(context: Context): PendingIntent {
val newIntent =
Intent(context, MainActivity::class.java).setAction(MainActivity.SHORTCUT_EXTENSIONS)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
return PendingIntent.getActivity(
context, 0, newIntent, PendingIntent.FLAG_UPDATE_CURRENT
)
}
}
}
@@ -39,6 +39,12 @@ object Notifications {
const val ID_NEW_CHAPTERS = -301
const val GROUP_NEW_CHAPTERS = "eu.kanade.tachiyomi.NEW_CHAPTERS"
/**
* Notification channel and ids used by the library updater.
*/
const val CHANNEL_UPDATES_TO_EXTS = "updates_ext_channel"
const val ID_UPDATES_TO_EXTS = -401
/**
* Creates the notification channels introduced in Android Oreo.
*
@@ -59,7 +65,10 @@ object Notifications {
setShowBadge(false)
},
NotificationChannel(CHANNEL_NEW_CHAPTERS, context.getString(R.string.channel_new_chapters),
NotificationManager.IMPORTANCE_DEFAULT)
NotificationManager.IMPORTANCE_DEFAULT),
NotificationChannel(CHANNEL_UPDATES_TO_EXTS, context.getString(R.string.channel_ext_updates),
NotificationManager.IMPORTANCE_DEFAULT
)
)
context.notificationManager.createNotificationChannels(channels)
}