Added back app_name string so app names properly, fixed API 28 save issue, made some buttons display as red if they should

This commit is contained in:
alansley 2024-08-22 16:20:17 +10:00
parent e3cab9c0d9
commit 69b8bd7396
4 changed files with 22 additions and 5 deletions

View File

@ -34,6 +34,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
@ -228,11 +229,11 @@ private fun SaveAttachmentWarningDialog(
val context = LocalContext.current val context = LocalContext.current
AlertDialog( AlertDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
title = context.getString(R.string.permissionsRequired), title = context.getString(R.string.warning),
text = context.resources.getString(R.string.attachmentsWarning), text = context.resources.getString(R.string.attachmentsWarning),
buttons = listOf( buttons = listOf(
DialogButtonModel(GetString(R.string.save), onClick = onAccepted), DialogButtonModel(GetString(R.string.save), GetString(R.string.AccessibilityId_save), color = LocalColors.current.danger, onClick = onAccepted),
DialogButtonModel(GetString(android.R.string.cancel), dismissOnClick = true) DialogButtonModel(GetString(android.R.string.cancel), GetString(R.string.AccessibilityId_cancel), dismissOnClick = true)
) )
) )
} }

View File

@ -409,6 +409,8 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
showSessionDialog { showSessionDialog {
title(R.string.profileDisplayPictureSet) title(R.string.profileDisplayPictureSet)
view(R.layout.dialog_change_avatar) 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() } button(R.string.save) { startAvatarSelection() }
if (prefs.getProfileAvatarId() != 0) { if (prefs.getProfileAvatarId() != 0) {

View File

@ -73,7 +73,7 @@ class SaveAttachmentTask @JvmOverloads constructor(context: Context, count: Int
fun saveAttachment(context: Context, attachment: Attachment): String? { fun saveAttachment(context: Context, attachment: Attachment): String? {
val contentType = checkNotNull(MediaUtil.getCorrectedMimeType(attachment.contentType)) val contentType = checkNotNull(MediaUtil.getCorrectedMimeType(attachment.contentType))
var fileName = attachment.fileName var fileName = attachment.fileName
if (fileName == null) fileName = generateOutputFileName(contentType, attachment.date) if (fileName.isNullOrEmpty()) fileName = generateOutputFileName(contentType, attachment.date)
fileName = sanitizeOutputFileName(fileName) fileName = sanitizeOutputFileName(fileName)
val outputUri: Uri = getMediaStoreContentUriForType(contentType) val outputUri: Uri = getMediaStoreContentUriForType(contentType)
val mediaUri = createOutputUri(context, outputUri, contentType, fileName) 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? { 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<String> = getFileNameParts(fileName) val fileParts: Array<String> = getFileNameParts(fileName)
val base = fileParts[0] val base = fileParts[0]
val extension = fileParts[1] val extension = fileParts[1]

View File

@ -1326,7 +1326,6 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="notificationsFastMode">Fast Mode</string> <string name="notificationsFastMode">Fast Mode</string>
<string name="notificationsFastModeDescriptionAndroid">You\'ll be notified of new messages reliably and immediately using Google\'s notification Servers.</string> <string name="notificationsFastModeDescriptionAndroid">You\'ll be notified of new messages reliably and immediately using Google\'s notification Servers.</string>
<string name="notificationsFastModeDescriptionIos">You\'ll be notified of new messages reliably and immediately using Apple\'s notification Servers.</string> <string name="notificationsFastModeDescriptionIos">You\'ll be notified of new messages reliably and immediately using Apple\'s notification Servers.</string>
<string name="notificationsGoToAndroidSettings">Go to Android notification settings</string>
<string name="notificationsGoToDevice">Go to device notification settings</string> <string name="notificationsGoToDevice">Go to device notification settings</string>
<string name="notificationsIosGroup">{name} to {conversation_name}</string> <string name="notificationsIosGroup">{name} to {conversation_name}</string>
<string name="notificationsIosRestart">You may have received messages while your {device} was restarting.</string> <string name="notificationsIosRestart">You may have received messages while your {device} was restarting.</string>
@ -1557,4 +1556,8 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<!-- Missing from CrowdIn circa 2024-08-22 --> <!-- Missing from CrowdIn circa 2024-08-22 -->
<string name="messageStatusUploading">Uploading</string> <string name="messageStatusUploading">Uploading</string>
<!-- We need a non-translatable app_name string because we cannot get the NonTranslatableStringConstants.APP_NAME
value for use in the AndroidManifest to name the app! -->
<string name="app_name" translatable="false">Session</string>
</resources> </resources>