mirror of https://github.com/NekoX-Dev/NekoX.git
Fix ask before call
This commit is contained in:
parent
5978900bec
commit
6798c1a2c2
|
@ -1505,7 +1505,7 @@ public class AlertsCreator {
|
||||||
AlertDialog dialog = new AlertDialog.Builder(context).setView(frameLayout)
|
AlertDialog dialog = new AlertDialog.Builder(context).setView(frameLayout)
|
||||||
.setPositiveButton(LocaleController.getString("Call", R.string.Call), (dialogInterface, i) -> {
|
.setPositiveButton(LocaleController.getString("Call", R.string.Call), (dialogInterface, i) -> {
|
||||||
final TLRPC.UserFull userFull = fragment.getMessagesController().getUserFull(user.id);
|
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)
|
.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null)
|
||||||
.create();
|
.create();
|
||||||
|
|
|
@ -99,6 +99,17 @@ public class VoIPHelper {
|
||||||
return;
|
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) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
int code;
|
int code;
|
||||||
ArrayList<String> permissions = new ArrayList<>();
|
ArrayList<String> permissions = new ArrayList<>();
|
||||||
|
@ -114,16 +125,6 @@ public class VoIPHelper {
|
||||||
activity.requestPermissions(permissions.toArray(new String[0]), videoCall ? 102 : 101);
|
activity.requestPermissions(permissions.toArray(new String[0]), videoCall ? 102 : 101);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
initiateCall(user, null, videoCall, canVideoCall, false, activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue