Skip to content

Commit

Permalink
Added back app_name string so app names properly, fixed API 28 save i…
Browse files Browse the repository at this point in the history
…ssue, made some buttons display as red if they should
  • Loading branch information
alansley committed Aug 22, 2024
1 parent e3cab9c commit 69b8bd7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<String> = getFileNameParts(fileName)
val base = fileParts[0]
val extension = fileParts[1]
Expand Down
5 changes: 4 additions & 1 deletion libsession/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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="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="notificationsGoToAndroidSettings">Go to Android notification settings</string>
<string name="notificationsGoToDevice">Go to device notification settings</string>
<string name="notificationsIosGroup">{name} to {conversation_name}</string>
<string name="notificationsIosRestart">You may have received messages while your {device} was restarting.</string>
Expand Down Expand Up @@ -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 -->
<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>

0 comments on commit 69b8bd7

Please sign in to comment.