mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dd0cbcee6a | |||
| ca14e0dcc6 | |||
| 04ad02f56d | |||
| e578853a62 | |||
| fc25f2ed9e |
@@ -569,8 +569,11 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
} else if (itemId == R.id.menu_show_map) {
|
||||
WebxdcActivity.openMaps(this, chatId);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_start_call) {
|
||||
CallUtil.startCall(this, chatId);
|
||||
} else if (itemId == R.id.menu_audio_call) {
|
||||
CallUtil.startCall(this, chatId, true);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_video_call) {
|
||||
CallUtil.startCall(this, chatId, false);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_all_media) {
|
||||
handleAllMedia();
|
||||
|
||||
@@ -19,23 +19,40 @@ public class CallUtil {
|
||||
private static final String TAG = CallUtil.class.getSimpleName();
|
||||
|
||||
public static void startCall(Activity activity, int chatId) {
|
||||
startCall(activity, chatId, false);
|
||||
}
|
||||
|
||||
public static void startCall(Activity activity, int chatId, boolean audioOnly) {
|
||||
String[] permissions = audioOnly
|
||||
? new String[] { Manifest.permission.RECORD_AUDIO }
|
||||
: new String[] { Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO };
|
||||
|
||||
String permissionExplanation = audioOnly
|
||||
? activity.getString(R.string.perm_explain_access_to_mic_for_calls_denied)
|
||||
: activity.getString(R.string.perm_explain_access_to_camera_and_mic_denied);
|
||||
|
||||
Permissions.with(activity)
|
||||
.request(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||
.request(permissions)
|
||||
.ifNecessary()
|
||||
.withPermanentDenialDialog(activity.getString(R.string.perm_explain_access_to_camera_denied))
|
||||
.withPermanentDenialDialog(permissionExplanation)
|
||||
.onAllGranted(() -> {
|
||||
int accId = DcHelper.getContext(activity).getAccountId();
|
||||
startCall(activity, accId, chatId);
|
||||
startCall(activity, accId, chatId, audioOnly);
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
|
||||
public static void startCall(Context context, int accId, int chatId) {
|
||||
startCall(context, accId, chatId, false);
|
||||
}
|
||||
|
||||
public static void startCall(Context context, int accId, int chatId, boolean audioOnly) {
|
||||
Intent intent = new Intent(context, CallActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.putExtra(CallActivity.EXTRA_ACCOUNT_ID, accId);
|
||||
intent.putExtra(CallActivity.EXTRA_CHAT_ID, chatId);
|
||||
intent.putExtra(CallActivity.EXTRA_HASH, "#startCall");
|
||||
String hash = audioOnly ? "?disableVideoCompletely#startCall" : "#startCall";
|
||||
intent.putExtra(CallActivity.EXTRA_HASH, hash);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,14 @@
|
||||
<item android:id="@+id/menu_start_call"
|
||||
android:title="@string/start_call"
|
||||
android:icon="@drawable/ic_videocam_white_24dp"
|
||||
app:showAsAction="always" />
|
||||
app:showAsAction="always">
|
||||
<menu>
|
||||
<item android:id="@+id/menu_audio_call"
|
||||
android:title="@string/start_audio_call" />
|
||||
<item android:id="@+id/menu_video_call"
|
||||
android:title="@string/start_video_call" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item android:id="@+id/menu_all_media"
|
||||
android:title="@string/apps_and_media"
|
||||
|
||||
@@ -380,6 +380,8 @@
|
||||
|
||||
<!-- the action "to call someone", used as a tooltip for the "phone" icon. not: "the call" -->
|
||||
<string name="start_call">Call</string>
|
||||
<string name="start_audio_call">Audio Call</string>
|
||||
<string name="start_video_call">Video Call</string>
|
||||
<!-- the action "to answer" or to "accept" or to "pick up" a call. not: "the answer" -->
|
||||
<string name="answer_call">Answer</string>
|
||||
<!-- the action "to decline" a call, not: "the decline" -->
|
||||
@@ -1037,6 +1039,8 @@
|
||||
<string name="perm_explain_access_to_camera_denied">To take photos or capture videos, go to the app settings, select \"Permissions\", and enable \"Camera\".</string>
|
||||
<!-- give the user an idea where to find the "Microphone" option. the hint is only shown if access was initially denied by the user. pick up wordings really used on the systems, but do not be overly precise: things shift around often and there are too many system we support to track every detail and click path -->
|
||||
<string name="perm_explain_access_to_mic_denied">To send audio messages, go to system or app settings, select "Permissions" or "Privacy & Security", and enable \"Microphone\".</string>
|
||||
<string name="perm_explain_access_to_camera_and_mic_denied">To make video calls, go to the app settings, select \"Permissions\", and enable \"Camera\" and \"Microphone\".</string>
|
||||
<string name="perm_explain_access_to_mic_for_calls_denied">To make audio calls, go to system or app settings, select "Permissions" or "Privacy & Security", and enable \"Microphone\".</string>
|
||||
<string name="perm_explain_access_to_storage_denied">To receive or send files, go to the app settings, select \"Permissions\", and enable \"Storage\".</string>
|
||||
<string name="perm_explain_access_to_location_denied">To attach a location, go to the app settings, select \"Permissions\", and enable \"Location\".</string>
|
||||
<string name="perm_explain_access_to_notifications_denied">To receive notifications, go to \"System Settings / Apps / Delta Chat\" and enable \"Notifications\".</string>
|
||||
|
||||
Reference in New Issue
Block a user