New strings + new camera permission handling

This commit is contained in:
ThomasSession 2024-09-06 09:25:34 +10:00
parent 4fd39614f5
commit 139f4ba39c
8 changed files with 10 additions and 17 deletions

View File

@ -313,7 +313,7 @@ public class AttachmentManager {
public void capturePhoto(Activity activity, int requestCode, Recipient recipient) {
String cameraPermissionDeniedTxt = Phrase.from(context, R.string.cameraGrantAccessDenied)
String cameraPermissionDeniedTxt = Phrase.from(context, R.string.permissionsCameraDenied)
.put(APP_NAME_KEY, context.getString(R.string.app_name))
.format().toString();
@ -324,7 +324,6 @@ public class AttachmentManager {
Permissions.with(activity)
.request(Manifest.permission.CAMERA)
.withPermanentDenialDialog(cameraPermissionDeniedTxt)
.withRationaleDialog(requireCameraPermissionTxt, R.drawable.ic_baseline_photo_camera_24)
.onAllGranted(() -> {
Intent captureIntent = MediaSendActivity.buildCameraIntent(activity, recipient);
if (captureIntent.resolveActivity(activity.getPackageManager()) != null) {

View File

@ -69,7 +69,7 @@ fun MediaOverviewScreen(
} else {
Toast.makeText(
context,
R.string.cameraGrantAccessDenied,
R.string.permissionsCameraDenied,
Toast.LENGTH_LONG
).show()
}

View File

@ -362,7 +362,7 @@ public class MediaSendActivity extends PassphraseRequiredActionBarActivity imple
private void navigateToCamera() {
Context c = getApplicationContext();
String permanentDenialTxt = Phrase.from(c, R.string.cameraGrantAccessDenied)
String permanentDenialTxt = Phrase.from(c, R.string.permissionsCameraDenied)
.put(APP_NAME_KEY, c.getString(R.string.app_name))
.format().toString();
String requireCameraPermissionsTxt = Phrase.from(c, R.string.cameraGrantAccessDescription)
@ -371,7 +371,6 @@ public class MediaSendActivity extends PassphraseRequiredActionBarActivity imple
Permissions.with(this)
.request(Manifest.permission.CAMERA)
.withRationaleDialog(requireCameraPermissionsTxt, R.drawable.ic_baseline_photo_camera_48)
.withPermanentDenialDialog(permanentDenialTxt)
.onAllGranted(() -> {
Camera1Fragment fragment = getOrCreateCameraFragment();

View File

@ -11,7 +11,7 @@ class SettingsDialog {
context.showSessionDialog {
title(R.string.permissionsRequired)
text(message)
button(R.string.theContinue, R.string.AccessibilityId_theContinue) {
button(R.string.sessionSettings, R.string.AccessibilityId_sessionSettings) {
context.startActivity(Permissions.getApplicationSettingsIntent(context))
}
cancelButton()

View File

@ -137,7 +137,7 @@ fun QRScannerScreen(
AlertDialog(
onDismissRequest = { showCameraPermissionDialog = false },
title = stringResource(R.string.permissionsRequired),
text = stringResource(R.string.cameraGrantAccessDenied), //todo UPDATE TO PROPER STRING !!!!!!!!!!!!!!!!!!!!!!!
text = stringResource(R.string.permissionsCameraDenied),
buttons = listOf(
DialogButtonModel(
text = GetString(stringResource(id = R.string.sessionSettings)),

View File

@ -1,6 +0,0 @@
<vector android:height="48dp" android:tint="?attr/colorControlNormal"
android:viewportHeight="24" android:viewportWidth="24"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
<path android:fillColor="@android:color/white" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
</vector>

View File

@ -43,7 +43,7 @@ object UpdateMessageBuilder {
// --- Group created or joined ---
is UpdateMessageData.Kind.GroupCreation -> {
if (!isOutgoing) {
context.getText(R.string.groupInviteYou)
context.getText(R.string.legacyGroupMemberYouNew)
} else {
"" // We no longer add a string like `disappearingMessagesNewGroup` ("You created a new group") and leave the group with its default empty state
}
@ -69,19 +69,19 @@ object UpdateMessageBuilder {
return ""
}
1 -> {
Phrase.from(context, R.string.groupMemberNew)
Phrase.from(context, R.string.legacyGroupMemberNew)
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.format()
}
2 -> {
Phrase.from(context, R.string.groupMemberNewTwo)
Phrase.from(context, R.string.legacyGroupMemberTwoNew)
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(OTHER_NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(1)))
.format()
}
else -> {
val newMemberCountMinusOne = newMemberCount - 1
Phrase.from(context, R.string.groupMemberNewMultiple)
Phrase.from(context, R.string.legacyGroupMemberNewMultiple)
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(COUNT_KEY, newMemberCountMinusOne)
.format()

View File

@ -163,6 +163,7 @@
<string name="cameraErrorUnavailable">Camera unavailable.</string>
<string name="cameraGrantAccess">Grant Camera Access</string>
<string name="cameraGrantAccessDenied">{app_name} needs camera access to take photos and videos, but it has been permanently denied. Please continue to app settings, select \"Permissions\", and enable \"Camera\".</string>
<string name="permissionsCameraDenied">{app_name} needs camera access to take photos and videos, but it has been permanently denied. Tap Settings -> Permissions and turn \"Camera\" on.</string>
<string name="cameraGrantAccessDescription">{app_name} needs camera access to take photos and videos, or scan QR codes.</string>
<string name="cameraGrantAccessQr">{app_name} needs camera access to scan QR codes</string>
<string name="cancel">Cancel</string>