1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-11-17 16:26:23 +01:00

Add location request alert

This commit is contained in:
世界 2020-10-22 08:19:22 +00:00
parent 773ed3e05e
commit 03b1017a31
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 16 additions and 3 deletions

View File

@ -5,8 +5,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def verName = "7.1.3-rc06"
def verCode = 84
def verName = "7.1.3-rc07"
def verCode = 86
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -101,6 +101,9 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
public class ChatAttachAlertLocationLayout extends ChatAttachAlert.AttachAlertLayout implements NotificationCenter.NotificationCenterDelegate {
private ImageView locationButton;
@ -1617,7 +1620,17 @@ public class ChatAttachAlertLocationLayout extends ChatAttachAlert.AttachAlertLa
if (activity != null) {
checkPermission = false;
if (activity.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
activity.requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 2);
BottomBuilder builder = new BottomBuilder(activity);
builder.addTitle(LocaleController.getString("PermissionNoLocation", R.string.PermissionNoLocation), true);
builder.addItem(LocaleController.getString("Ok", R.string.OK),R.drawable.baseline_check_circle_24, __ -> {
activity.requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 2);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("Decline", R.string.Decline), R.drawable.baseline_block_24, __ -> {
parentAlert.dismiss();
return Unit.INSTANCE;
});
builder.show();
}
}
}