confirm on location permissions
parent
f45835d215
commit
760fc63da0
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:aman_kassa_flutter/core/models/dialog_models.dart';
|
||||||
import 'package:aman_kassa_flutter/widgets/fields/busy_button_icon.dart';
|
import 'package:aman_kassa_flutter/widgets/fields/busy_button_icon.dart';
|
||||||
import 'package:flutter_bluetooth_basic/flutter_bluetooth_basic.dart';
|
import 'package:flutter_bluetooth_basic/flutter_bluetooth_basic.dart';
|
||||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||||
|
|
@ -164,7 +165,15 @@ class _SettingPrinterViewState extends State<SettingPrinterView> {
|
||||||
void _permission() async {
|
void _permission() async {
|
||||||
if( Platform.isAndroid) {
|
if( Platform.isAndroid) {
|
||||||
var status = await Permission.locationAlways.status;
|
var status = await Permission.locationAlways.status;
|
||||||
|
log.i(status);
|
||||||
if (status.isUndetermined || status.isDenied || status.isPermanentlyDenied) {
|
if (status.isUndetermined || status.isDenied || status.isPermanentlyDenied) {
|
||||||
|
DialogResponse response = await _dialogService.showConfirmationDialog(
|
||||||
|
title: 'Доступ',
|
||||||
|
description: 'Для поиска устройств Bluetooth необходимо предоставить доступ к отслеживанию геолокации.',
|
||||||
|
cancelTitle: 'Нет',
|
||||||
|
confirmationTitle: 'Хорошо',
|
||||||
|
);
|
||||||
|
if (response.confirmed) {
|
||||||
if (await Permission.locationAlways
|
if (await Permission.locationAlways
|
||||||
.request()
|
.request()
|
||||||
.isGranted) {
|
.isGranted) {
|
||||||
|
|
@ -172,6 +181,10 @@ class _SettingPrinterViewState extends State<SettingPrinterView> {
|
||||||
} else {
|
} else {
|
||||||
_dialogService.showDialog(
|
_dialogService.showDialog(
|
||||||
description: 'Необходимо указать постоянный доступ к местоположении для поиска принтера');
|
description: 'Необходимо указать постоянный доступ к местоположении для поиска принтера');
|
||||||
|
_navigatorService.pop();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_navigatorService.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue