From 026e86d319332aa4e1f97c4310a2a94fc3a4b8ea Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 2 Apr 2019 01:51:51 -0400 Subject: [PATCH] migrated to Android X, updated dependencies, fixed breaking changes --- android/app/build.gradle | 8 +- android/build.gradle | 2 +- android/gradle.properties | 2 + .../gradle/wrapper/gradle-wrapper.properties | 4 +- lib/image_post.dart | 4 +- lib/location.dart | 10 +- lib/main.dart | 59 ++-- pubspec.lock | 312 ++---------------- pubspec.yaml | 46 +-- 9 files changed, 107 insertions(+), 340 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 009c65f..ccf0dc5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -15,7 +15,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 27 + compileSdkVersion 28 lintOptions { disable 'InvalidPackage' @@ -28,7 +28,7 @@ android { targetSdkVersion 27 versionCode 1 versionName "1.2.2" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true } @@ -47,8 +47,8 @@ flutter { dependencies { testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.1' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + androidTestImplementation 'androidx.test:runner:1.1.0-alpha4' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4' compile 'com.google.firebase:firebase-core:11.8.0' } diff --git a/android/build.gradle b/android/build.gradle index 781e1e4..7d14e25 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.3.2' classpath 'com.google.gms:google-services:3.2.0' } diff --git a/android/gradle.properties b/android/gradle.properties index 8bd86f6..53ae0ae 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1 +1,3 @@ +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536M diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index aa901e1..269a514 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 23 08:50:38 CEST 2017 +#Tue Apr 02 01:36:58 EDT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip diff --git a/lib/image_post.dart b/lib/image_post.dart index a314d3d..0925a58 100644 --- a/lib/image_post.dart +++ b/lib/image_post.dart @@ -138,8 +138,8 @@ class _ImagePost extends State { new CachedNetworkImage( imageUrl: mediaUrl, fit: BoxFit.fitWidth, - placeholder: loadingPlaceHolder, - errorWidget: new Icon(Icons.error), + placeholder: (context, url) => loadingPlaceHolder, + errorWidget: (context, url, error) => Icon(Icons.error), ), showHeart ? new Positioned( diff --git a/lib/location.dart b/lib/location.dart index 36361c1..773de61 100644 --- a/lib/location.dart +++ b/lib/location.dart @@ -7,12 +7,11 @@ import 'package:geocoder/geocoder.dart'; import 'package:location/location.dart'; getUserLocation() async { - Map currentLocation = new Map(); - Map myLocation; + LocationData currentLocation; String error; Location location = new Location(); try { - myLocation = await location.getLocation(); + currentLocation = await location.getLocation(); } on PlatformException catch (e) { if (e.code == 'PERMISSION_DENIED') { error = 'please grant permission'; @@ -22,11 +21,10 @@ getUserLocation() async { error = 'permission denied- please enable it from app settings'; print(error); } - myLocation = null; + currentLocation = null; } - currentLocation = myLocation; final coordinates = new Coordinates( - currentLocation['latitude'], currentLocation['longitude']); + currentLocation.latitude, currentLocation.longitude); var addresses = await Geocoder.local.findAddressesFromCoordinates(coordinates); var first = addresses.first; diff --git a/lib/main.dart b/lib/main.dart index 102d8f6..78c69df 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -38,13 +38,47 @@ Future _ensureLoggedIn(BuildContext context) async { } if (await auth.currentUser() == null) { - GoogleSignInAuthentication credentials = - await googleSignIn.currentUser.authentication; - await auth.signInWithGoogle( - idToken: credentials.idToken, accessToken: credentials.accessToken); + + final GoogleSignInAccount googleUser = await googleSignIn.signIn(); + final GoogleSignInAuthentication googleAuth = await googleUser + .authentication; + + + final AuthCredential credential = GoogleAuthProvider.getCredential( + accessToken: googleAuth.accessToken, + idToken: googleAuth.idToken, + ); + + await auth.signInWithCredential(credential); } } +Future _silentLogin(BuildContext context) async { + GoogleSignInAccount user = googleSignIn.currentUser; + + if (user == null) { + user = await googleSignIn.signInSilently().then((_) { + tryCreateUserRecord(context); + }); + } + + if (await auth.currentUser() == null && user != null) { + final GoogleSignInAccount googleUser = await googleSignIn.signIn(); + final GoogleSignInAuthentication googleAuth = await googleUser + .authentication; + + + final AuthCredential credential = GoogleAuthProvider.getCredential( + accessToken: googleAuth.accessToken, + idToken: googleAuth.idToken, + ); + + await auth.signInWithCredential(credential); + } + + +} + Future _setUpNotifications() async { if (Platform.isAndroid) { _firebaseMessaging.configure( @@ -70,23 +104,6 @@ Future _setUpNotifications() async { } } -Future _silentLogin(BuildContext context) async { - GoogleSignInAccount user = googleSignIn.currentUser; - - if (user == null) { - user = await googleSignIn.signInSilently().then((_) { - tryCreateUserRecord(context); - }); - } - - if (await auth.currentUser() == null && user != null) { - GoogleSignInAuthentication credentials = - await googleSignIn.currentUser.authentication; - await auth.signInWithGoogle( - idToken: credentials.idToken, accessToken: credentials.accessToken); - } -} - tryCreateUserRecord(BuildContext context) async { GoogleSignInAccount user = googleSignIn.currentUser; if (user == null) { diff --git a/pubspec.lock b/pubspec.lock index 67d4027..77138c7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,48 +1,34 @@ # Generated by pub # See https://www.dartlang.org/tools/pub/glossary#lockfile packages: - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.dartlang.org" - source: hosted - version: "0.33.0" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.8" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.0" + version: "1.5.1" async: dependency: "direct main" description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" + version: "2.1.0" cached_network_image: dependency: "direct main" description: name: cached_network_image url: "https://pub.dartlang.org" source: hosted - version: "0.5.0" + version: "0.7.0" charcode: dependency: transitive description: @@ -56,7 +42,7 @@ packages: name: cloud_firestore url: "https://pub.dartlang.org" source: hosted - version: "0.8.2+1" + version: "0.9.7+2" collection: dependency: transitive description: @@ -70,7 +56,7 @@ packages: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.1" crypto: dependency: transitive description: @@ -78,13 +64,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.6" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.6" cupertino_icons: dependency: "direct main" description: @@ -98,28 +77,28 @@ packages: name: firebase_auth url: "https://pub.dartlang.org" source: hosted - version: "0.6.2+1" + version: "0.8.3" firebase_core: dependency: transitive description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.2.5+1" + version: "0.3.1+1" firebase_messaging: dependency: "direct main" description: name: firebase_messaging url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "4.0.0+1" firebase_storage: dependency: "direct main" description: name: firebase_storage url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.1.0+1" flutter: dependency: "direct main" description: flutter @@ -131,68 +110,35 @@ packages: name: flutter_cache_manager url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" + version: "0.3.2" font_awesome_flutter: dependency: "direct main" description: name: font_awesome_flutter url: "https://pub.dartlang.org" source: hosted - version: "8.0.1" - front_end: - dependency: transitive - description: - name: front_end - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.6" + version: "8.4.0" geocoder: dependency: "direct main" description: name: geocoder url: "https://pub.dartlang.org" source: hosted - version: "0.1.1" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.7" + version: "0.1.2" google_sign_in: dependency: "direct main" description: name: google_sign_in url: "https://pub.dartlang.org" source: hosted - version: "3.2.1" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.3+3" + version: "4.0.1+1" http: dependency: "direct main" description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.0" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "0.12.0+1" http_parser: dependency: transitive description: @@ -206,63 +152,21 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.7" image_picker: dependency: "direct main" description: name: image_picker url: "https://pub.dartlang.org" source: hosted - version: "0.4.1" - io: - dependency: transitive - description: - name: io - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.3" - js: - dependency: transitive - description: - name: js - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.1+1" - json_rpc_2: - dependency: transitive - description: - name: json_rpc_2 - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.9" - kernel: - dependency: transitive - description: - name: kernel - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.6" + version: "0.5.0+9" location: dependency: "direct main" description: name: location url: "https://pub.dartlang.org" source: hosted - version: "1.4.1" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.dartlang.org" - source: hosted - version: "0.11.3+2" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.3+1" + version: "2.3.3" meta: dependency: transitive description: @@ -270,41 +174,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.6+2" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - node_preamble: - dependency: transitive - description: - name: node_preamble - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.4" - package_config: - dependency: transitive - description: - name: package_config - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.6" path: dependency: transitive description: @@ -318,14 +187,14 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "0.4.1" + version: "0.5.0+1" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.1" platform: dependency: transitive description: @@ -333,109 +202,32 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.2.0" - plugin: - dependency: transitive - description: - name: plugin - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0+3" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.6" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0+1" shared_preferences: dependency: "direct main" description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.dartlang.org" - source: hosted - version: "0.7.3+3" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" - shelf_static: - dependency: transitive - description: - name: shelf_static - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.8" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.2+4" + version: "0.5.1+2" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.5" - source_maps: - dependency: transitive - description: - name: source_maps - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.8" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.4.1" - stack_trace: + version: "1.5.4" + sqflite: dependency: transitive description: - name: stack_trace + name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.8" + version: "1.1.3" string_scanner: dependency: transitive description: @@ -449,21 +241,14 @@ packages: name: synchronized url: "https://pub.dartlang.org" source: hosted - version: "1.5.3" + version: "2.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" - test: - dependency: transitive - description: - name: test - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.4" + version: "1.1.0" typed_data: dependency: transitive description: @@ -471,20 +256,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" - utf: - dependency: transitive - description: - name: utf - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.0+5" uuid: dependency: "direct main" description: name: uuid url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" vector_math: dependency: transitive description: @@ -492,41 +270,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" - vm_service_client: - dependency: transitive - description: - name: vm_service_client - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.6" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.7+10" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.9" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.2.3" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.15" + version: "3.3.1" sdks: - dart: ">=2.0.0 <3.0.0" - flutter: ">=0.2.4 <2.0.0" + dart: ">=2.1.0 <3.0.0" + flutter: ">=1.2.1 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index f86c2a5..942b9e9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,30 +4,30 @@ description: A new Flutter application. dependencies: flutter: sdk: flutter - cloud_firestore: ^0.8.2+1 - image_picker: 0.4.1 - firebase_storage: 1.0.4 - firebase_auth: 0.6.2+1 - google_sign_in: ^3.2.1 - uuid: 1.0.3 - image: 2.0.4 - path_provider: 0.4.1 - font_awesome_flutter: 8.0.1 - async: "^2.0.4" - http: "^0.12.0" - shared_preferences: "^0.4.1" - cached_network_image: "^0.5.0" - firebase_messaging: ^2.0.2 - location: ^1.4.1 - geocoder: ^0.1.1 + cloud_firestore: ^0.9.7+2 + image_picker: ^0.5.0+9 + firebase_storage: ^2.1.0+1 + firebase_auth: ^0.8.3 + google_sign_in: ^4.0.1+1 + uuid: ^2.0.0 + image: ^2.0.7 + path_provider: ^0.5.0+1 + font_awesome_flutter: ^8.4.0 + async: ^2.1.0 + http: ^0.12.0+1 + shared_preferences: ^0.5.1+2 + cached_network_image: ^0.7.0 + firebase_messaging: ^4.0.0+1 + location: ^2.3.3 + geocoder: ^0.1.2 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.0 -dev_dependencies: - flutter_test: - sdk: flutter +#dev_dependencies: +# flutter_test: +# sdk: flutter # For information on the generic Dart part of this file, see the @@ -41,11 +41,11 @@ flutter: # the material Icons class. uses-material-design: true fonts: - - family: Billabong - fonts: - - asset: assets/fonts/Billabong.ttf + - family: Billabong + fonts: + - asset: assets/fonts/Billabong.ttf assets: - - assets/images/google_signin_button.png + - assets/images/google_signin_button.png # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg