Add pricing entry flow and platform admin foundations
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
|
||||
class LocationAccessService {
|
||||
LocationAccessService._();
|
||||
|
||||
static Future<Position> getCurrentPosition() async {
|
||||
final enabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!enabled) {
|
||||
throw Exception(
|
||||
'Konum servisleri kapalı. Lütfen cihaz ayarlarından açın.');
|
||||
}
|
||||
|
||||
var permission = await Geolocator.checkPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
}
|
||||
|
||||
if (permission == LocationPermission.denied) {
|
||||
throw Exception('Konum izni verilmedi.');
|
||||
}
|
||||
|
||||
if (permission == LocationPermission.deniedForever) {
|
||||
throw Exception(
|
||||
'Konum izni kalıcı olarak reddedildi. Lütfen cihaz ayarlarından izin verin.',
|
||||
);
|
||||
}
|
||||
|
||||
return Geolocator.getCurrentPosition();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user