Fix ask before call

This commit is contained in:
世界 2020-10-01 12:34:06 +08:00
parent 5978900bec
commit 6798c1a2c2
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 12 additions and 11 deletions

View File

@ -1505,7 +1505,7 @@ public class AlertsCreator {
AlertDialog dialog = new AlertDialog.Builder(context).setView(frameLayout)
.setPositiveButton(LocaleController.getString("Call", R.string.Call), (dialogInterface, i) -> {
final TLRPC.UserFull userFull = fragment.getMessagesController().getUserFull(user.id);
VoIPHelper.startCall(user, videoCall, userFull != null && userFull.video_calls_available, fragment.getParentActivity(), userFull);
VoIPHelper.startCall(user, videoCall, userFull != null && userFull.video_calls_available, fragment.getParentActivity(), userFull, true);
})
.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null)
.create();

View File

@ -99,6 +99,17 @@ public class VoIPHelper {
return;
}
if (!confirmed && NekoConfig.askBeforeCall) {
new AlertDialog.Builder(activity)
.setTitle(LocaleController.getString("ConfirmCall", R.string.ConfirmCall))
.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("CallTo", R.string.CallTo,
ContactsController.formatName(user.first_name, user.last_name))))
.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialog, which) -> startCall(user, videoCall, canVideoCall, activity, userFull, true))
.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null)
.show();
return;
}
if (Build.VERSION.SDK_INT >= 23) {
int code;
ArrayList<String> permissions = new ArrayList<>();
@ -114,16 +125,6 @@ public class VoIPHelper {
activity.requestPermissions(permissions.toArray(new String[0]), videoCall ? 102 : 101);
}
} else {
if (!confirmed && NekoConfig.askBeforeCall) {
new AlertDialog.Builder(activity)
.setTitle(LocaleController.getString("ConfirmCall", R.string.ConfirmCall))
.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("CallTo", R.string.CallTo,
ContactsController.formatName(user.first_name, user.last_name))))
.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialog, which) -> startCall(user, videoCall, canVideoCall, activity, userFull, true))
.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null)
.show();
return;
}
initiateCall(user, null, videoCall, canVideoCall, false, activity);
}
}