Explicitly add READ_APP_SPECIFIC_LOCALES permission
Some devices are throwing a SecurityException (calling getApplicationLocales) for some reason.
This commit is contained in:
parent
a8c5780963
commit
7e74949d38
@ -23,6 +23,7 @@
|
|||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.READ_APP_SPECIFIC_LOCALES" />
|
||||||
|
|
||||||
<!-- Remove permission from Firebase dependency -->
|
<!-- Remove permission from Firebase dependency -->
|
||||||
<uses-permission android:name="com.google.android.gms.permission.AD_ID"
|
<uses-permission android:name="com.google.android.gms.permission.AD_ID"
|
||||||
|
@ -197,7 +197,6 @@ class NotificationReceiver : BroadcastReceiver() {
|
|||||||
* @param notificationId id of notification
|
* @param notificationId id of notification
|
||||||
*/
|
*/
|
||||||
private fun deleteImage(context: Context, path: String, notificationId: Int) {
|
private fun deleteImage(context: Context, path: String, notificationId: Int) {
|
||||||
// Dismiss notification
|
|
||||||
dismissNotification(context, notificationId)
|
dismissNotification(context, notificationId)
|
||||||
|
|
||||||
// Delete file
|
// Delete file
|
||||||
|
@ -20,21 +20,13 @@ import eu.kanade.tachiyomi.util.system.notificationManager
|
|||||||
*/
|
*/
|
||||||
class SaveImageNotifier(private val context: Context) {
|
class SaveImageNotifier(private val context: Context) {
|
||||||
|
|
||||||
/**
|
|
||||||
* Notification builder.
|
|
||||||
*/
|
|
||||||
private val notificationBuilder = context.notificationBuilder(Notifications.CHANNEL_COMMON)
|
private val notificationBuilder = context.notificationBuilder(Notifications.CHANNEL_COMMON)
|
||||||
|
private val notificationId: Int = Notifications.ID_DOWNLOAD_IMAGE
|
||||||
/**
|
|
||||||
* Id of the notification.
|
|
||||||
*/
|
|
||||||
private val notificationId: Int
|
|
||||||
get() = Notifications.ID_DOWNLOAD_IMAGE
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when image download/copy is complete.
|
* Called when image download/copy is complete.
|
||||||
*
|
*
|
||||||
* @param file image file containing downloaded page image.
|
* @param uri image file containing downloaded page image.
|
||||||
*/
|
*/
|
||||||
fun onComplete(uri: Uri) {
|
fun onComplete(uri: Uri) {
|
||||||
val request = ImageRequest.Builder(context)
|
val request = ImageRequest.Builder(context)
|
||||||
@ -53,6 +45,27 @@ class SaveImageNotifier(private val context: Context) {
|
|||||||
context.imageLoader.enqueue(request)
|
context.imageLoader.enqueue(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the notification message.
|
||||||
|
*/
|
||||||
|
fun onClear() {
|
||||||
|
context.notificationManager.cancel(notificationId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called on error while downloading image.
|
||||||
|
* @param error string containing error information.
|
||||||
|
*/
|
||||||
|
fun onError(error: String?) {
|
||||||
|
// Create notification
|
||||||
|
with(notificationBuilder) {
|
||||||
|
setContentTitle(context.getString(R.string.download_notifier_title_error))
|
||||||
|
setContentText(error ?: context.getString(R.string.unknown_error))
|
||||||
|
setSmallIcon(android.R.drawable.ic_menu_report_image)
|
||||||
|
}
|
||||||
|
updateNotification()
|
||||||
|
}
|
||||||
|
|
||||||
private fun showCompleteNotification(uri: Uri, image: Bitmap) {
|
private fun showCompleteNotification(uri: Uri, image: Bitmap) {
|
||||||
with(notificationBuilder) {
|
with(notificationBuilder) {
|
||||||
setContentTitle(context.getString(R.string.picture_saved))
|
setContentTitle(context.getString(R.string.picture_saved))
|
||||||
@ -82,29 +95,8 @@ class SaveImageNotifier(private val context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the notification message.
|
|
||||||
*/
|
|
||||||
fun onClear() {
|
|
||||||
context.notificationManager.cancel(notificationId)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateNotification() {
|
private fun updateNotification() {
|
||||||
// Displays the progress bar on notification
|
// Displays the progress bar on notification
|
||||||
context.notificationManager.notify(notificationId, notificationBuilder.build())
|
context.notificationManager.notify(notificationId, notificationBuilder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called on error while downloading image.
|
|
||||||
* @param error string containing error information.
|
|
||||||
*/
|
|
||||||
fun onError(error: String?) {
|
|
||||||
// Create notification
|
|
||||||
with(notificationBuilder) {
|
|
||||||
setContentTitle(context.getString(R.string.download_notifier_title_error))
|
|
||||||
setContentText(error ?: context.getString(R.string.unknown_error))
|
|
||||||
setSmallIcon(android.R.drawable.ic_menu_report_image)
|
|
||||||
}
|
|
||||||
updateNotification()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user