forked from GitHub-Mirror/riotX-android
Merge pull request #344 from vector-im/feature/play_store_crash
Feature/play store crash
This commit is contained in:
commit
4d2ab9fa31
@ -12,6 +12,7 @@ Other changes:
|
|||||||
|
|
||||||
Bugfix:
|
Bugfix:
|
||||||
- Fix regression on permalink click
|
- Fix regression on permalink click
|
||||||
|
- Fix crash reported by the PlayStore (#341)
|
||||||
|
|
||||||
Translations:
|
Translations:
|
||||||
-
|
-
|
||||||
|
@ -60,7 +60,7 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||||||
//The first time the notification drawer is refreshed, we force re-render of all notifications
|
//The first time the notification drawer is refreshed, we force re-render of all notifications
|
||||||
private var firstTime = true
|
private var firstTime = true
|
||||||
|
|
||||||
private var eventList = loadEventInfo()
|
private val eventList = loadEventInfo()
|
||||||
|
|
||||||
private val avatarSize = context.resources.getDimensionPixelSize(R.dimen.profile_avatar_size)
|
private val avatarSize = context.resources.getDimensionPixelSize(R.dimen.profile_avatar_size)
|
||||||
|
|
||||||
@ -121,11 +121,10 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||||||
Timber.v("clearMessageEventOfRoom $roomId")
|
Timber.v("clearMessageEventOfRoom $roomId")
|
||||||
|
|
||||||
if (roomId != null) {
|
if (roomId != null) {
|
||||||
eventList.removeAll { e ->
|
synchronized(eventList) {
|
||||||
if (e is NotifiableMessageEvent) {
|
eventList.removeAll { e ->
|
||||||
return@removeAll e.roomId == roomId
|
e is NotifiableMessageEvent && e.roomId == roomId
|
||||||
}
|
}
|
||||||
return@removeAll false
|
|
||||||
}
|
}
|
||||||
NotificationUtils.cancelNotificationMessage(context, roomId, ROOM_MESSAGES_NOTIFICATION_ID)
|
NotificationUtils.cancelNotificationMessage(context, roomId, ROOM_MESSAGES_NOTIFICATION_ID)
|
||||||
}
|
}
|
||||||
@ -150,7 +149,8 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||||||
fun homeActivityDidResume(matrixID: String?) {
|
fun homeActivityDidResume(matrixID: String?) {
|
||||||
synchronized(eventList) {
|
synchronized(eventList) {
|
||||||
eventList.removeAll { e ->
|
eventList.removeAll { e ->
|
||||||
return@removeAll e !is NotifiableMessageEvent //messages are cleared when entering room
|
// messages are cleared when entering room
|
||||||
|
e !is NotifiableMessageEvent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,10 +158,7 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||||||
fun clearMemberShipNotificationForRoom(roomId: String) {
|
fun clearMemberShipNotificationForRoom(roomId: String) {
|
||||||
synchronized(eventList) {
|
synchronized(eventList) {
|
||||||
eventList.removeAll { e ->
|
eventList.removeAll { e ->
|
||||||
if (e is InviteNotifiableEvent) {
|
e is InviteNotifiableEvent && e.roomId == roomId
|
||||||
return@removeAll e.roomId == roomId
|
|
||||||
}
|
|
||||||
return@removeAll false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -433,18 +430,20 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||||||
|
|
||||||
|
|
||||||
fun persistInfo() {
|
fun persistInfo() {
|
||||||
if (eventList.isEmpty()) {
|
synchronized(eventList) {
|
||||||
deleteCachedRoomNotifications(context)
|
if (eventList.isEmpty()) {
|
||||||
return
|
deleteCachedRoomNotifications(context)
|
||||||
}
|
return
|
||||||
try {
|
}
|
||||||
val file = File(context.applicationContext.cacheDir, ROOMS_NOTIFICATIONS_FILE_NAME)
|
try {
|
||||||
if (!file.exists()) file.createNewFile()
|
val file = File(context.applicationContext.cacheDir, ROOMS_NOTIFICATIONS_FILE_NAME)
|
||||||
FileOutputStream(file).use {
|
if (!file.exists()) file.createNewFile()
|
||||||
SecretStoringUtils.securelyStoreObject(eventList, "notificationMgr", it, this.context)
|
FileOutputStream(file).use {
|
||||||
|
SecretStoringUtils.securelyStoreObject(eventList, "notificationMgr", it, this.context)
|
||||||
|
}
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
Timber.e(e, "## Failed to save cached notification info")
|
||||||
}
|
}
|
||||||
} catch (e: Throwable) {
|
|
||||||
Timber.e(e, "## Failed to save cached notification info")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user