fix: update geolocator, google maps, and remove public my Google API Key

This commit is contained in:
Supan Adit Pratama 2021-11-03 22:32:24 +07:00
parent cc0fd1cd84
commit 7891b4dbe1
6 changed files with 90 additions and 112 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Geo Smart App</string> <string name="app_name">Geo Smart App</string>
<string name="api_key">AIzaSyCjhBV5aq1gsTCYsr6QCCxYusFlBa3DEMs</string> <string name="api_key">YOUR_API_KEY</string>
</resources> </resources>

View File

@ -7,7 +7,7 @@ import Flutter
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
GMSServices.provideAPIKey("AIzaSyCjhBV5aq1gsTCYsr6QCCxYusFlBa3DEMs") GMSServices.provideAPIKey("YOUR_API_KEY")
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }

View File

@ -1,5 +1,5 @@
class Config { class Config {
static const String api = "http://192.168.1.7:8080"; static const String api = "http://api.geosmart.supanadit.com";
static const bool dynamicHostSetting = true; static const bool dynamicHostSetting = false;
static const bool showInterceptor = true; static const bool showInterceptor = true;
} }

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:geolocator/geolocator.dart' as geo; import 'package:geolocator/geolocator.dart' as geo;
import 'package:geolocator/geolocator.dart';
import 'package:geosmart/bloc/bloc.dart'; import 'package:geosmart/bloc/bloc.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
@ -27,35 +28,26 @@ class _MapPageState extends State<MapPage> {
setState(() { setState(() {
isChecking = true; isChecking = true;
}); });
// geo.Geolocator()..forceAndroidLocationManager = true; Geolocator.checkPermission().then((value) {
geo.Geolocator().checkGeolocationPermissionStatus().then(
(v) {
isGranted = true;
var geolocator = geo.Geolocator();
var locationOptions = geo.LocationOptions(
accuracy: geo.LocationAccuracy.high,
);
geolocator.getPositionStream(locationOptions).listen(
(geo.Position position) {
if (isTracking && isGranted) {
BlocProvider.of<PositionBloc>(context).add(
PositionSend(
lat: position.latitude.toString(),
lng: position.longitude.toString(),
),
);
}
},
);
},
).catchError((e) {
isGranted = false;
}).whenComplete(() {
setState(() { setState(() {
isChecking = false; if (value != LocationPermission.deniedForever) {
setState(() {
isChecking = false;
isGranted = true;
});
}
}); });
}); });
Geolocator.getPositionStream().listen((Position position) {
if (isTracking && isGranted) {
BlocProvider.of<PositionBloc>(context).add(
PositionSend(
lat: position.latitude.toString(),
lng: position.longitude.toString(),
),
);
}
});
} }
static final CameraPosition _kGooglePlex = CameraPosition( static final CameraPosition _kGooglePlex = CameraPosition(

View File

@ -8,27 +8,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.3"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.1" version: "2.4.2"
bloc: bloc:
dependency: transitive dependency: transitive
description: description:
@ -43,6 +29,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
@ -64,27 +57,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.3" version: "3.0.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.14.12" version: "1.14.13"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -106,6 +92,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.3" version: "1.2.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
@ -169,28 +162,28 @@ packages:
name: geolocator name: geolocator
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.3.2+2" version: "6.1.14"
google_api_availability: geolocator_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: google_api_availability name: geolocator_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "1.0.9"
google_maps_flutter: google_maps_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
name: google_maps_flutter name: google_maps_flutter
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.28+1" version: "0.5.33"
google_maps_flutter_platform_interface: google_maps_flutter_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: google_maps_flutter_platform_interface name: google_maps_flutter_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.2.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
@ -205,13 +198,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.4" version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
intl: intl:
dependency: transitive dependency: transitive
description: description:
@ -219,13 +205,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.16.1" version: "0.16.1"
location_permissions:
dependency: transitive
description:
name: location_permissions
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+1"
logging: logging:
dependency: transitive dependency: transitive
description: description:
@ -239,7 +218,7 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.6" version: "0.12.8"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -281,7 +260,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.4" version: "1.7.0"
path_provider: path_provider:
dependency: transitive dependency: transitive
description: description:
@ -309,7 +288,14 @@ packages:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.4"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+3"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
@ -331,13 +317,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -366,13 +345,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.3.1" version: "4.3.1"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
rxdart: rxdart:
dependency: "direct main" dependency: "direct main"
description: description:
@ -407,7 +379,14 @@ packages:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.7+3" version: "0.5.12+4"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2+4"
shared_preferences_macos: shared_preferences_macos:
dependency: transitive dependency: transitive
description: description:
@ -429,6 +408,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.2+7" version: "0.1.2+7"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2+3"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -447,7 +433,7 @@ packages:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.3" version: "1.9.5"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
@ -482,14 +468,14 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.15" version: "0.2.17"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" version: "1.2.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -525,6 +511,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4+2" version: "0.1.4+2"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.4+1"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@ -532,13 +525,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.0" version: "0.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks: sdks:
dart: ">=2.7.0 <3.0.0" dart: ">=2.9.0-14.0.dev <3.0.0"
flutter: ">=1.16.3 <2.0.0" flutter: ">=1.16.3 <2.0.0"

View File

@ -28,10 +28,10 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3 cupertino_icons: ^0.1.3
geolocator: ^5.3.2+2 geolocator: ^6.1.14
http: ^0.12.1 http: ^0.12.1
google_maps_flutter: ^0.5.28+1 google_maps_flutter: ^0.5.33
shared_preferences: ^0.5.7+3 shared_preferences: ^0.5.12+4
rxdart: ^0.24.1 rxdart: ^0.24.1
dio: ^3.0.9 dio: ^3.0.9
flutter_bloc: ^6.0.1 flutter_bloc: ^6.0.1