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