mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 20:45:17 +00:00
New strings + new camera permission handling
This commit is contained in:
parent
4fd39614f5
commit
139f4ba39c
@ -313,7 +313,7 @@ public class AttachmentManager {
|
|||||||
|
|
||||||
public void capturePhoto(Activity activity, int requestCode, Recipient recipient) {
|
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))
|
.put(APP_NAME_KEY, context.getString(R.string.app_name))
|
||||||
.format().toString();
|
.format().toString();
|
||||||
|
|
||||||
@ -324,7 +324,6 @@ public class AttachmentManager {
|
|||||||
Permissions.with(activity)
|
Permissions.with(activity)
|
||||||
.request(Manifest.permission.CAMERA)
|
.request(Manifest.permission.CAMERA)
|
||||||
.withPermanentDenialDialog(cameraPermissionDeniedTxt)
|
.withPermanentDenialDialog(cameraPermissionDeniedTxt)
|
||||||
.withRationaleDialog(requireCameraPermissionTxt, R.drawable.ic_baseline_photo_camera_24)
|
|
||||||
.onAllGranted(() -> {
|
.onAllGranted(() -> {
|
||||||
Intent captureIntent = MediaSendActivity.buildCameraIntent(activity, recipient);
|
Intent captureIntent = MediaSendActivity.buildCameraIntent(activity, recipient);
|
||||||
if (captureIntent.resolveActivity(activity.getPackageManager()) != null) {
|
if (captureIntent.resolveActivity(activity.getPackageManager()) != null) {
|
||||||
|
@ -69,7 +69,7 @@ fun MediaOverviewScreen(
|
|||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
R.string.cameraGrantAccessDenied,
|
R.string.permissionsCameraDenied,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ public class MediaSendActivity extends PassphraseRequiredActionBarActivity imple
|
|||||||
private void navigateToCamera() {
|
private void navigateToCamera() {
|
||||||
|
|
||||||
Context c = getApplicationContext();
|
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))
|
.put(APP_NAME_KEY, c.getString(R.string.app_name))
|
||||||
.format().toString();
|
.format().toString();
|
||||||
String requireCameraPermissionsTxt = Phrase.from(c, R.string.cameraGrantAccessDescription)
|
String requireCameraPermissionsTxt = Phrase.from(c, R.string.cameraGrantAccessDescription)
|
||||||
@ -371,7 +371,6 @@ public class MediaSendActivity extends PassphraseRequiredActionBarActivity imple
|
|||||||
|
|
||||||
Permissions.with(this)
|
Permissions.with(this)
|
||||||
.request(Manifest.permission.CAMERA)
|
.request(Manifest.permission.CAMERA)
|
||||||
.withRationaleDialog(requireCameraPermissionsTxt, R.drawable.ic_baseline_photo_camera_48)
|
|
||||||
.withPermanentDenialDialog(permanentDenialTxt)
|
.withPermanentDenialDialog(permanentDenialTxt)
|
||||||
.onAllGranted(() -> {
|
.onAllGranted(() -> {
|
||||||
Camera1Fragment fragment = getOrCreateCameraFragment();
|
Camera1Fragment fragment = getOrCreateCameraFragment();
|
||||||
|
@ -11,7 +11,7 @@ class SettingsDialog {
|
|||||||
context.showSessionDialog {
|
context.showSessionDialog {
|
||||||
title(R.string.permissionsRequired)
|
title(R.string.permissionsRequired)
|
||||||
text(message)
|
text(message)
|
||||||
button(R.string.theContinue, R.string.AccessibilityId_theContinue) {
|
button(R.string.sessionSettings, R.string.AccessibilityId_sessionSettings) {
|
||||||
context.startActivity(Permissions.getApplicationSettingsIntent(context))
|
context.startActivity(Permissions.getApplicationSettingsIntent(context))
|
||||||
}
|
}
|
||||||
cancelButton()
|
cancelButton()
|
||||||
|
@ -137,7 +137,7 @@ fun QRScannerScreen(
|
|||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = { showCameraPermissionDialog = false },
|
onDismissRequest = { showCameraPermissionDialog = false },
|
||||||
title = stringResource(R.string.permissionsRequired),
|
title = stringResource(R.string.permissionsRequired),
|
||||||
text = stringResource(R.string.cameraGrantAccessDenied), //todo UPDATE TO PROPER STRING !!!!!!!!!!!!!!!!!!!!!!!
|
text = stringResource(R.string.permissionsCameraDenied),
|
||||||
buttons = listOf(
|
buttons = listOf(
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(stringResource(id = R.string.sessionSettings)),
|
text = GetString(stringResource(id = R.string.sessionSettings)),
|
||||||
|
@ -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>
|
|
@ -43,7 +43,7 @@ object UpdateMessageBuilder {
|
|||||||
// --- Group created or joined ---
|
// --- Group created or joined ---
|
||||||
is UpdateMessageData.Kind.GroupCreation -> {
|
is UpdateMessageData.Kind.GroupCreation -> {
|
||||||
if (!isOutgoing) {
|
if (!isOutgoing) {
|
||||||
context.getText(R.string.groupInviteYou)
|
context.getText(R.string.legacyGroupMemberYouNew)
|
||||||
} else {
|
} else {
|
||||||
"" // We no longer add a string like `disappearingMessagesNewGroup` ("You created a new group") and leave the group with its default empty state
|
"" // 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 ""
|
return ""
|
||||||
}
|
}
|
||||||
1 -> {
|
1 -> {
|
||||||
Phrase.from(context, R.string.groupMemberNew)
|
Phrase.from(context, R.string.legacyGroupMemberNew)
|
||||||
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
|
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
|
||||||
.format()
|
.format()
|
||||||
}
|
}
|
||||||
2 -> {
|
2 -> {
|
||||||
Phrase.from(context, R.string.groupMemberNewTwo)
|
Phrase.from(context, R.string.legacyGroupMemberTwoNew)
|
||||||
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
|
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
|
||||||
.put(OTHER_NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(1)))
|
.put(OTHER_NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(1)))
|
||||||
.format()
|
.format()
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val newMemberCountMinusOne = newMemberCount - 1
|
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(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
|
||||||
.put(COUNT_KEY, newMemberCountMinusOne)
|
.put(COUNT_KEY, newMemberCountMinusOne)
|
||||||
.format()
|
.format()
|
||||||
|
@ -163,6 +163,7 @@
|
|||||||
<string name="cameraErrorUnavailable">Camera unavailable.</string>
|
<string name="cameraErrorUnavailable">Camera unavailable.</string>
|
||||||
<string name="cameraGrantAccess">Grant Camera Access</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="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="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="cameraGrantAccessQr">{app_name} needs camera access to scan QR codes</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user