Skip to content

Commit

Permalink
avoid file storage permission warning.
Browse files Browse the repository at this point in the history
"Sharing files from storage is not possible without permission" popped up after app startup because notification permission was requested.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
  • Loading branch information
mahibi committed Aug 24, 2023
1 parent e60c2b4 commit 68bf1ba
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -956,9 +956,11 @@ class ConversationsListActivity :
selectedMessageId = messageItem.messageEntry.messageId
showConversationByToken(conversationToken)
}

LoadMoreResultsItem.VIEW_TYPE -> {
loadMoreMessages()
}

ConversationItem.VIEW_TYPE -> {
handleConversation((Objects.requireNonNull(item) as ConversationItem).model)
}
Expand Down Expand Up @@ -1172,15 +1174,14 @@ class ConversationsListActivity :

override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == UploadAndShareFilesWorker.REQUEST_PERMISSION &&
grantResults.isNotEmpty() &&
grantResults[0] == PackageManager.PERMISSION_GRANTED
) {
Log.d(TAG, "upload starting after permissions were granted")
showSendFilesConfirmDialog()
} else {
Snackbar.make(binding.root, context.getString(R.string.read_storage_no_permission), Snackbar.LENGTH_LONG)
.show()
if (requestCode == UploadAndShareFilesWorker.REQUEST_PERMISSION) {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "upload starting after permissions were granted")
showSendFilesConfirmDialog()
} else {
Snackbar.make(binding.root, context.getString(R.string.read_storage_no_permission), Snackbar.LENGTH_LONG)
.show()
}
}
}

Expand Down Expand Up @@ -1219,6 +1220,7 @@ class ConversationsListActivity :
EventStatus.EventType.CONVERSATION_UPDATE -> if (eventStatus.isAllGood && !isRefreshing) {
fetchRooms()
}

else -> {}
}
}
Expand Down Expand Up @@ -1495,7 +1497,9 @@ class ConversationsListActivity :
filterState[FilterConversationFragment.UNREAD] = unread
}

fun setFilterableItems(items: MutableList<AbstractFlexibleItem<*>>) { filterableConversationItems = items }
fun setFilterableItems(items: MutableList<AbstractFlexibleItem<*>>) {
filterableConversationItems = items
}

fun updateFilterConversationButtonColor() {
if (filterState.containsValue(true)) {
Expand Down

0 comments on commit 68bf1ba

Please sign in to comment.