From 69b8bd739690f51540490d943b06f92ccb0a323a Mon Sep 17 00:00:00 2001 From: alansley Date: Thu, 22 Aug 2024 16:20:17 +1000 Subject: [PATCH] Added back app_name string so app names properly, fixed API 28 save issue, made some buttons display as red if they should --- .../securesms/media/MediaOverviewScreen.kt | 7 ++++--- .../securesms/preferences/SettingsActivity.kt | 2 ++ .../securesms/util/SaveAttachmentTask.kt | 13 ++++++++++++- libsession/src/main/res/values/strings.xml | 5 ++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt b/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt index ce479848a0..e395987e3f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt @@ -34,6 +34,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext @@ -228,11 +229,11 @@ private fun SaveAttachmentWarningDialog( val context = LocalContext.current AlertDialog( onDismissRequest = onDismissRequest, - title = context.getString(R.string.permissionsRequired), + title = context.getString(R.string.warning), text = context.resources.getString(R.string.attachmentsWarning), buttons = listOf( - DialogButtonModel(GetString(R.string.save), onClick = onAccepted), - DialogButtonModel(GetString(android.R.string.cancel), dismissOnClick = true) + DialogButtonModel(GetString(R.string.save), GetString(R.string.AccessibilityId_save), color = LocalColors.current.danger, onClick = onAccepted), + DialogButtonModel(GetString(android.R.string.cancel), GetString(R.string.AccessibilityId_cancel), dismissOnClick = true) ) ) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt index e02a3eff70..f299b5c775 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt @@ -409,6 +409,8 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() { showSessionDialog { title(R.string.profileDisplayPictureSet) view(R.layout.dialog_change_avatar) + + // Note: This is the only instance in a dialog where the "Save" button is not a `dangerButton` button(R.string.save) { startAvatarSelection() } if (prefs.getProfileAvatarId() != 0) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/SaveAttachmentTask.kt b/app/src/main/java/org/thoughtcrime/securesms/util/SaveAttachmentTask.kt index 502f616844..c1921f21aa 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/SaveAttachmentTask.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/SaveAttachmentTask.kt @@ -73,7 +73,7 @@ class SaveAttachmentTask @JvmOverloads constructor(context: Context, count: Int fun saveAttachment(context: Context, attachment: Attachment): String? { val contentType = checkNotNull(MediaUtil.getCorrectedMimeType(attachment.contentType)) var fileName = attachment.fileName - if (fileName == null) fileName = generateOutputFileName(contentType, attachment.date) + if (fileName.isNullOrEmpty()) fileName = generateOutputFileName(contentType, attachment.date) fileName = sanitizeOutputFileName(fileName) val outputUri: Uri = getMediaStoreContentUriForType(contentType) val mediaUri = createOutputUri(context, outputUri, contentType, fileName) @@ -132,6 +132,17 @@ class SaveAttachmentTask @JvmOverloads constructor(context: Context, count: Int } private fun createOutputUri(context: Context, outputUri: Uri, contentType: String, fileName: String): Uri? { + + if (fileName == null) + { + Log.w("ACL", "Filename is null - wtf!") + } + + if (fileName != null && fileName.isEmpty()) + { + Log.w("ACL", "Filename is empty - wtf!") + } + val fileParts: Array = getFileNameParts(fileName) val base = fileParts[0] val extension = fileParts[1] diff --git a/libsession/src/main/res/values/strings.xml b/libsession/src/main/res/values/strings.xml index fc929ddc80..cdfa119264 100644 --- a/libsession/src/main/res/values/strings.xml +++ b/libsession/src/main/res/values/strings.xml @@ -1326,7 +1326,6 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi Fast Mode You\'ll be notified of new messages reliably and immediately using Google\'s notification Servers. You\'ll be notified of new messages reliably and immediately using Apple\'s notification Servers. - Go to Android notification settings Go to device notification settings {name} to {conversation_name} You may have received messages while your {device} was restarting. @@ -1557,4 +1556,8 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi Uploading + + Session + \ No newline at end of file