update for ios permission

This commit is contained in:
Mohamed Nouffer
2022-09-12 19:52:28 +05:30
parent 6802083a0a
commit b5932f2578
9 changed files with 124 additions and 23 deletions

View File

@ -34,8 +34,73 @@ target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end end
# post_install do |installer|
# installer.pods_project.targets.each do |target|
# flutter_additional_ios_build_settings(target)
# end
# end
post_install do |installer| post_install do |installer|
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target) flutter_additional_ios_build_settings(target)
# Start of the permission_handler configuration
target.build_configurations.each do |config|
# You can enable the permissions needed here. For example to enable camera
# permission, just remove the `#` character in front so it looks like this:
#
# ## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1'
#
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',
## dart: PermissionGroup.reminders
# 'PERMISSION_REMINDERS=1',
## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=1',
## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
# 'PERMISSION_SPEECH_RECOGNIZER=1',
## dart: PermissionGroup.photos
# 'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1'
## dart: PermissionGroup.notification
# 'PERMISSION_NOTIFICATIONS=1',
## dart: PermissionGroup.mediaLibrary
# 'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
# 'PERMISSION_SENSORS=1',
## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',
## dart: PermissionGroup.appTrackingTransparency
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
# 'PERMISSION_CRITICAL_ALERTS=1'
]
end
# End of the permission_handler configuration
end end
end end

View File

@ -21,7 +21,7 @@ PODS:
- Flutter - Flutter
- path_provider_ios (0.0.1): - path_provider_ios (0.0.1):
- Flutter - Flutter
- "permission_handler (5.1.0+2)": - permission_handler_apple (9.0.4):
- Flutter - Flutter
- sqflite (0.0.2): - sqflite (0.0.2):
- Flutter - Flutter
@ -37,7 +37,7 @@ DEPENDENCIES:
- google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`) - google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
@ -61,8 +61,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
path_provider_ios: path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios" :path: ".symlinks/plugins/path_provider_ios/ios"
permission_handler: permission_handler_apple:
:path: ".symlinks/plugins/permission_handler/ios" :path: ".symlinks/plugins/permission_handler_apple/ios"
sqflite: sqflite:
:path: ".symlinks/plugins/sqflite/ios" :path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios: url_launcher_ios:
@ -78,10 +78,10 @@ SPEC CHECKSUMS:
GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c PODFILE CHECKSUM: 0793805c7f7ae4910c8f6c28aaed7fe0a31e9dce
COCOAPODS: 1.11.2 COCOAPODS: 1.11.2

View File

@ -45,6 +45,10 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app need location access</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This all need location access</string>
<key>NSLocationWhenInUseUsageDescription</key> <key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location when open.</string> <string>This app needs access to location when open.</string>
<key>NSLocationAlwaysUsageDescription</key> <key>NSLocationAlwaysUsageDescription</key>

View File

@ -41,7 +41,7 @@ class LocationService{
if(cat.isNotEmpty){ if(cat.isNotEmpty){
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
var grp = indexController.currentUser[0]["group"]; var grp = indexController.currentUser[0]['user']['group'];
url = '${server_url}/api/inperf/?rog=True&perf=' + perfecture + '&cat=' + cat + "&grp=${grp}"; url = '${server_url}/api/inperf/?rog=True&perf=' + perfecture + '&cat=' + cat + "&grp=${grp}";
} }
else { else {
@ -50,7 +50,7 @@ class LocationService{
} }
else{ else{
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
var grp = indexController.currentUser[0]["group"]; var grp = indexController.currentUser[0]['user']['group'];
url = '${server_url}/api/inperf/?rog=True&perf=' + perfecture + "&grp=${grp}"; url = '${server_url}/api/inperf/?rog=True&perf=' + perfecture + "&grp=${grp}";
} }
else { else {
@ -79,7 +79,7 @@ class LocationService{
String server_url = ConstValues.currentServer(); String server_url = ConstValues.currentServer();
if(cat.isNotEmpty){ if(cat.isNotEmpty){
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
var grp = indexController.currentUser[0]["group"]; var grp = indexController.currentUser[0]['user']['group'];
url = '${server_url}/api/insubperf?rog=True&subperf=' + subperfecture + '&cat=' + cat + "&grp=${grp}"; url = '${server_url}/api/insubperf?rog=True&subperf=' + subperfecture + '&cat=' + cat + "&grp=${grp}";
} }
else{ else{
@ -88,7 +88,7 @@ class LocationService{
} }
else{ else{
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
var grp = indexController.currentUser[0]["group"]; var grp = indexController.currentUser[0]['user']['group'];
url = '${server_url}/api/insubperf?rog=True&subperf=' + subperfecture + "&grp=${grp}"; url = '${server_url}/api/insubperf?rog=True&subperf=' + subperfecture + "&grp=${grp}";
} }
else{ else{
@ -112,12 +112,13 @@ class LocationService{
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async { static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
print("-------- in location for bound -------------");
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
String url = ""; String url = "";
String server_url = ConstValues.currentServer(); String server_url = ConstValues.currentServer();
if(cat.isNotEmpty){ if(cat.isNotEmpty){
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
var grp = indexController.currentUser[0]["group"]; var grp = indexController.currentUser[0]['user']['group'];
url = '${server_url}/api/inbound?rog=True&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat + "&grp=${grp}"; url = '${server_url}/api/inbound?rog=True&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat + "&grp=${grp}";
} }
else{ else{
@ -126,7 +127,8 @@ class LocationService{
} }
else{ else{
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
var grp = indexController.currentUser[0]["group"]; var grp = indexController.currentUser[0]['user']['group'];
print("-------- requested user group ${grp} -------------");
url = '${server_url}/api/inbound?rog=True&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&grp=${grp}'; url = '${server_url}/api/inbound?rog=True&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&grp=${grp}';
} }
else{ else{
@ -167,7 +169,7 @@ class LocationService{
print("loadCustomLocations url is ----- ${cat}"); print("loadCustomLocations url is ----- ${cat}");
if(cat.isNotEmpty){ if(cat.isNotEmpty){
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
var grp = indexController.currentUser[0]["group"]; var grp = indexController.currentUser[0]['user']['group'];
url = '${server_url}/api/custom_area/?rog=True&&cat=' + cat + "&grp=${grp}"; url = '${server_url}/api/custom_area/?rog=True&&cat=' + cat + "&grp=${grp}";
} }
else{ else{
@ -176,7 +178,7 @@ class LocationService{
} }
else{ else{
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
var grp = indexController.currentUser[0]["group"]; var grp = indexController.currentUser[0]['user']['group'];
url = '${server_url}/api/customarea?rog=True&name=${name}' + "&grp=${grp}"; url = '${server_url}/api/customarea?rog=True&name=${name}' + "&grp=${grp}";
} }
else{ else{

View File

@ -117,19 +117,21 @@ class MapWidget extends StatelessWidget {
}, },
size: Size(40, 40), size: Size(40, 40),
anchor: AnchorPos.align(AnchorAlign.center), anchor: AnchorPos.align(AnchorAlign.left),
fitBoundsOptions: const FitBoundsOptions( fitBoundsOptions: const FitBoundsOptions(
padding: EdgeInsets.all(50), padding: EdgeInsets.all(50),
maxZoom: 265, maxZoom: 265,
), ),
markers:indexController.locations[0].collection.map((i) { markers:indexController.locations[0].collection.map((i) {
print("i si ${i.properties!['location_id']}"); print("i si ${i.properties!['location_id']}");
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint; GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}"); print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
return Marker( return Marker(
anchorPos: AnchorPos.align(AnchorAlign.center), anchorPos: AnchorPos.exactly(Anchor(108.0, 18.0)),
height: 22.0, height: 32.0,
width: 22.0, width: 120.0,
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude), point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
//builder: (ctx) => Icon(Icons.pin_drop), //builder: (ctx) => Icon(Icons.pin_drop),
// builder: (ctx) => i.properties!["category"] != null ? // builder: (ctx) => i.properties!["category"] != null ?
@ -141,8 +143,11 @@ class MapWidget extends StatelessWidget {
// : Icon(Icons.pin_drop), // : Icon(Icons.pin_drop),
builder: (ctx){ builder: (ctx){
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Container( Container(
height: 32,
width: 32,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.transparent, color: Colors.transparent,
@ -152,9 +157,9 @@ class MapWidget extends StatelessWidget {
style: BorderStyle.solid style: BorderStyle.solid
) )
), ),
child: Icon(Icons.circle,size: 14.0,) child: Icon(Icons.circle,size: 6.0,)
), ),
Text(i.properties!['cp'] > 0 ? i.properties!['cp'].toString() : "", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,)), Container(color: Colors.white, child: Text(i.properties!['cp'] > 0 ? "${i.properties!['cp'].toString().replaceAll(regex, '')}{${i.properties!['checkin_point'].toString()}}" : "", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
], ],
); );
}, },

View File

@ -512,7 +512,21 @@ packages:
name: permission_handler name: permission_handler
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.3.0" version: "10.0.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
url: "https://pub.dartlang.org"
source: hosted
version: "10.0.0"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.4"
permission_handler_platform_interface: permission_handler_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -520,6 +534,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.7.0" version: "3.7.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:

View File

@ -38,7 +38,7 @@ dependencies:
get: ^4.6.5 get: ^4.6.5
flutter_map: any flutter_map: any
geolocator: ^8.0.1 geolocator: ^8.0.1
permission_handler: ^8.3.0 permission_handler: ^10.0.0
google_api_availability: ^3.0.1 google_api_availability: ^3.0.1
tuple: ^2.0.0 tuple: ^2.0.0
latlong2: ^0.8.1 latlong2: ^0.8.1

View File

@ -7,11 +7,14 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <geolocator_windows/geolocator_windows.h> #include <geolocator_windows/geolocator_windows.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
GeolocatorWindowsRegisterWithRegistrar( GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows")); registry->GetRegistrarForPlugin("GeolocatorWindows"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows")); registry->GetRegistrarForPlugin("UrlLauncherWindows"));
} }

View File

@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
geolocator_windows geolocator_windows
permission_handler_windows
url_launcher_windows url_launcher_windows
) )