Merge pull request #3268 from nextcloud/bugfix/3267/avoidFilesPermissionWarning

avoid file storage permission warning.
This commit is contained in:
Marcel Hibbe 2023-08-24 11:34:14 +02:00 committed by GitHub
commit f5f0ed132d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 28 deletions

View File

@ -430,7 +430,8 @@ class CallActivity : CallBaseActivity() {
Snackbar.make( Snackbar.make(
binding!!.root, binding!!.root,
context.resources.getString(R.string.record_active_info), context.resources.getString(R.string.record_active_info),
Snackbar.LENGTH_LONG).show() Snackbar.LENGTH_LONG
).show()
} }
} else if (viewState is RecordingStartingState) { } else if (viewState is RecordingStartingState) {
if (isAllowedToStartOrStopRecording) { if (isAllowedToStartOrStopRecording) {
@ -614,9 +615,11 @@ class CallActivity : CallBaseActivity() {
callRecordingViewModel!!.clickRecordButton() callRecordingViewModel!!.clickRecordButton()
} }
} else { } else {
Snackbar.make(binding!!.root, context.resources.getString(R.string.record_active_info), Snackbar Snackbar.make(
.LENGTH_LONG) binding!!.root,
.show() context.resources.getString(R.string.record_active_info),
Snackbar.LENGTH_LONG
).show()
} }
} }
binding!!.lowerHandButton.setOnClickListener { l: View? -> raiseHandViewModel!!.lowerHand() } binding!!.lowerHandButton.setOnClickListener { l: View? -> raiseHandViewModel!!.lowerHand() }

View File

@ -2366,16 +2366,20 @@ class ChatActivity :
} }
} catch (e: IllegalStateException) { } catch (e: IllegalStateException) {
context.resources?.getString(R.string.nc_upload_failed)?.let { context.resources?.getString(R.string.nc_upload_failed)?.let {
Snackbar.make(binding.root, it, Snackbar Snackbar.make(
.LENGTH_LONG) binding.root,
.show() it,
Snackbar.LENGTH_LONG
).show()
} }
Log.e(javaClass.simpleName, "Something went wrong when trying to upload file", e) Log.e(javaClass.simpleName, "Something went wrong when trying to upload file", e)
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
context.resources?.getString(R.string.nc_upload_failed)?.let { context.resources?.getString(R.string.nc_upload_failed)?.let {
Snackbar.make(binding.root, it, Snackbar Snackbar.make(
.LENGTH_LONG) binding.root,
.show() it,
Snackbar.LENGTH_LONG
).show()
} }
Log.e(javaClass.simpleName, "Something went wrong when trying to upload file", e) Log.e(javaClass.simpleName, "Something went wrong when trying to upload file", e)
} }

View File

@ -594,9 +594,11 @@ class ConversationInfoActivity :
} }
override fun onNext(genericOverall: GenericOverall) { override fun onNext(genericOverall: GenericOverall) {
Snackbar.make(binding.root, Snackbar.make(
binding.root,
context.getString(R.string.nc_clear_history_success), context.getString(R.string.nc_clear_history_success),
Snackbar.LENGTH_LONG).show() Snackbar.LENGTH_LONG
).show()
} }
override fun onError(e: Throwable) { override fun onError(e: Throwable) {

View File

@ -151,9 +151,11 @@ class GuestAccessHelper(
override fun onComplete() { override fun onComplete() {
if (resendInvitationsResult.successful) { if (resendInvitationsResult.successful) {
Snackbar.make(binding.root, Snackbar.make(
binding.root,
R.string.nc_guest_access_resend_invitations_successful, R.string.nc_guest_access_resend_invitations_successful,
Snackbar.LENGTH_SHORT).show() Snackbar.LENGTH_SHORT
).show()
} }
} }
} }

View File

@ -956,9 +956,11 @@ class ConversationsListActivity :
selectedMessageId = messageItem.messageEntry.messageId selectedMessageId = messageItem.messageEntry.messageId
showConversationByToken(conversationToken) showConversationByToken(conversationToken)
} }
LoadMoreResultsItem.VIEW_TYPE -> { LoadMoreResultsItem.VIEW_TYPE -> {
loadMoreMessages() loadMoreMessages()
} }
ConversationItem.VIEW_TYPE -> { ConversationItem.VIEW_TYPE -> {
handleConversation((Objects.requireNonNull(item) as ConversationItem).model) handleConversation((Objects.requireNonNull(item) as ConversationItem).model)
} }
@ -1172,15 +1174,17 @@ class ConversationsListActivity :
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) { override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults) super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == UploadAndShareFilesWorker.REQUEST_PERMISSION && if (requestCode == UploadAndShareFilesWorker.REQUEST_PERMISSION) {
grantResults.isNotEmpty() && if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
grantResults[0] == PackageManager.PERMISSION_GRANTED Log.d(TAG, "upload starting after permissions were granted")
) { showSendFilesConfirmDialog()
Log.d(TAG, "upload starting after permissions were granted") } else {
showSendFilesConfirmDialog() Snackbar.make(
} else { binding.root,
Snackbar.make(binding.root, context.getString(R.string.read_storage_no_permission), Snackbar.LENGTH_LONG) context.getString(R.string.read_storage_no_permission),
.show() Snackbar.LENGTH_LONG
).show()
}
} }
} }
@ -1219,6 +1223,7 @@ class ConversationsListActivity :
EventStatus.EventType.CONVERSATION_UPDATE -> if (eventStatus.isAllGood && !isRefreshing) { EventStatus.EventType.CONVERSATION_UPDATE -> if (eventStatus.isAllGood && !isRefreshing) {
fetchRooms() fetchRooms()
} }
else -> {} else -> {}
} }
} }
@ -1495,7 +1500,9 @@ class ConversationsListActivity :
filterState[FilterConversationFragment.UNREAD] = unread filterState[FilterConversationFragment.UNREAD] = unread
} }
fun setFilterableItems(items: MutableList<AbstractFlexibleItem<*>>) { filterableConversationItems = items } fun setFilterableItems(items: MutableList<AbstractFlexibleItem<*>>) {
filterableConversationItems = items
}
fun updateFilterConversationButtonColor() { fun updateFilterConversationButtonColor() {
if (filterState.containsValue(true)) { if (filterState.containsValue(true)) {

View File

@ -329,8 +329,11 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
Log.e(TAG, "Failed to get NC notification", e) Log.e(TAG, "Failed to get NC notification", e)
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Handler(Looper.getMainLooper()).post { Handler(Looper.getMainLooper()).post {
Snackbar.make(View(applicationContext), "Failed to get NC notification", Snackbar Snackbar.make(
.LENGTH_LONG).show() View(applicationContext),
"Failed to get NC notification",
Snackbar.LENGTH_LONG
).show()
} }
} }
} }
@ -744,7 +747,6 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
Manifest.permission.POST_NOTIFICATIONS Manifest.permission.POST_NOTIFICATIONS
) != PackageManager.PERMISSION_GRANTED ) != PackageManager.PERMISSION_GRANTED
) { ) {
// here to request the missing permissions, and then overriding // here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions, // public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults) // int[] grantResults)
@ -925,7 +927,6 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
Manifest.permission.POST_NOTIFICATIONS Manifest.permission.POST_NOTIFICATIONS
) != PackageManager.PERMISSION_GRANTED ) != PackageManager.PERMISSION_GRANTED
) { ) {
// here to request the missing permissions, and then overriding // here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions, // public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults) // int[] grantResults)