migrated to Android X, updated dependencies, fixed breaking changes

This commit is contained in:
Matthew
2019-04-02 01:51:51 -04:00
parent f0c56f680a
commit 026e86d319
9 changed files with 107 additions and 340 deletions

View File

@ -15,7 +15,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 27 compileSdkVersion 28
lintOptions { lintOptions {
disable 'InvalidPackage' disable 'InvalidPackage'
@ -28,7 +28,7 @@ android {
targetSdkVersion 27 targetSdkVersion 27
versionCode 1 versionCode 1
versionName "1.2.2" versionName "1.2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true multiDexEnabled true
} }
@ -47,8 +47,8 @@ flutter {
dependencies { dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
compile 'com.google.firebase:firebase-core:11.8.0' compile 'com.google.firebase:firebase-core:11.8.0'
} }

View File

@ -5,7 +5,7 @@ buildscript {
} }
dependencies { 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' classpath 'com.google.gms:google-services:3.2.0'
} }

View File

@ -1 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M

View File

@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017 #Tue Apr 02 01:36:58 EDT 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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

View File

@ -138,8 +138,8 @@ class _ImagePost extends State<ImagePost> {
new CachedNetworkImage( new CachedNetworkImage(
imageUrl: mediaUrl, imageUrl: mediaUrl,
fit: BoxFit.fitWidth, fit: BoxFit.fitWidth,
placeholder: loadingPlaceHolder, placeholder: (context, url) => loadingPlaceHolder,
errorWidget: new Icon(Icons.error), errorWidget: (context, url, error) => Icon(Icons.error),
), ),
showHeart showHeart
? new Positioned( ? new Positioned(

View File

@ -7,12 +7,11 @@ import 'package:geocoder/geocoder.dart';
import 'package:location/location.dart'; import 'package:location/location.dart';
getUserLocation() async { getUserLocation() async {
Map<String, double> currentLocation = new Map(); LocationData currentLocation;
Map<String, double> myLocation;
String error; String error;
Location location = new Location(); Location location = new Location();
try { try {
myLocation = await location.getLocation(); currentLocation = await location.getLocation();
} on PlatformException catch (e) { } on PlatformException catch (e) {
if (e.code == 'PERMISSION_DENIED') { if (e.code == 'PERMISSION_DENIED') {
error = 'please grant permission'; error = 'please grant permission';
@ -22,11 +21,10 @@ getUserLocation() async {
error = 'permission denied- please enable it from app settings'; error = 'permission denied- please enable it from app settings';
print(error); print(error);
} }
myLocation = null; currentLocation = null;
} }
currentLocation = myLocation;
final coordinates = new Coordinates( final coordinates = new Coordinates(
currentLocation['latitude'], currentLocation['longitude']); currentLocation.latitude, currentLocation.longitude);
var addresses = var addresses =
await Geocoder.local.findAddressesFromCoordinates(coordinates); await Geocoder.local.findAddressesFromCoordinates(coordinates);
var first = addresses.first; var first = addresses.first;

View File

@ -38,13 +38,47 @@ Future<Null> _ensureLoggedIn(BuildContext context) async {
} }
if (await auth.currentUser() == null) { if (await auth.currentUser() == null) {
GoogleSignInAuthentication credentials =
await googleSignIn.currentUser.authentication; final GoogleSignInAccount googleUser = await googleSignIn.signIn();
await auth.signInWithGoogle( final GoogleSignInAuthentication googleAuth = await googleUser
idToken: credentials.idToken, accessToken: credentials.accessToken); .authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
await auth.signInWithCredential(credential);
} }
} }
Future<Null> _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<Null> _setUpNotifications() async { Future<Null> _setUpNotifications() async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
_firebaseMessaging.configure( _firebaseMessaging.configure(
@ -70,23 +104,6 @@ Future<Null> _setUpNotifications() async {
} }
} }
Future<Null> _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 { tryCreateUserRecord(BuildContext context) async {
GoogleSignInAccount user = googleSignIn.currentUser; GoogleSignInAccount user = googleSignIn.currentUser;
if (user == null) { if (user == null) {

View File

@ -1,48 +1,34 @@
# Generated by pub # Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile # See https://www.dartlang.org/tools/pub/glossary#lockfile
packages: packages:
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.33.0"
archive: archive:
dependency: transitive dependency: transitive
description: description:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "2.0.8"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.0" version: "1.5.1"
async: async:
dependency: "direct main" dependency: "direct main"
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.1.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
cached_network_image: cached_network_image:
dependency: "direct main" dependency: "direct main"
description: description:
name: cached_network_image name: cached_network_image
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.0" version: "0.7.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
@ -56,7 +42,7 @@ packages:
name: cloud_firestore name: cloud_firestore
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.8.2+1" version: "0.9.7+2"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -70,7 +56,7 @@ packages:
name: convert name: convert
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.1.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
@ -78,13 +64,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.6" version: "2.0.6"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.6"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -98,28 +77,28 @@ packages:
name: firebase_auth name: firebase_auth
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.2+1" version: "0.8.3"
firebase_core: firebase_core:
dependency: transitive dependency: transitive
description: description:
name: firebase_core name: firebase_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.5+1" version: "0.3.1+1"
firebase_messaging: firebase_messaging:
dependency: "direct main" dependency: "direct main"
description: description:
name: firebase_messaging name: firebase_messaging
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "4.0.0+1"
firebase_storage: firebase_storage:
dependency: "direct main" dependency: "direct main"
description: description:
name: firebase_storage name: firebase_storage
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "2.1.0+1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -131,68 +110,35 @@ packages:
name: flutter_cache_manager name: flutter_cache_manager
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "0.3.2"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
font_awesome_flutter: font_awesome_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
name: font_awesome_flutter name: font_awesome_flutter
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.0.1" version: "8.4.0"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6"
geocoder: geocoder:
dependency: "direct main" dependency: "direct main"
description: description:
name: geocoder name: geocoder
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.1" version: "0.1.2"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
google_sign_in: google_sign_in:
dependency: "direct main" dependency: "direct main"
description: description:
name: google_sign_in name: google_sign_in
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.1" version: "4.0.1+1"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3+3"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.0" version: "0.12.0+1"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -206,63 +152,21 @@ packages:
name: image name: image
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "2.0.7"
image_picker: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
name: image_picker name: image_picker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.1" version: "0.5.0+9"
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"
location: location:
dependency: "direct main" dependency: "direct main"
description: description:
name: location name: location
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.4.1" version: "2.3.3"
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"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -270,41 +174,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" 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: path:
dependency: transitive dependency: transitive
description: description:
@ -318,14 +187,14 @@ packages:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.1" version: "0.5.0+1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
name: petitparser name: petitparser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.1.1"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -333,109 +202,32 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.0" 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: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.3" version: "0.5.1+2"
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"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" 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: source_span:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.4.1" version: "1.5.4"
stack_trace: sqflite:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: sqflite
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.3" version: "1.1.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
@ -449,21 +241,14 @@ packages:
name: synchronized name: synchronized
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.3" version: "2.1.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.1.0"
test:
dependency: transitive
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.4"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -471,20 +256,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
utf:
dependency: transitive
description:
name: utf
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0+5"
uuid: uuid:
dependency: "direct main" dependency: "direct main"
description: description:
name: uuid name: uuid
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "2.0.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -492,41 +270,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" 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: xml:
dependency: transitive dependency: transitive
description: description:
name: xml name: xml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.3" version: "3.3.1"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.15"
sdks: sdks:
dart: ">=2.0.0 <3.0.0" dart: ">=2.1.0 <3.0.0"
flutter: ">=0.2.4 <2.0.0" flutter: ">=1.2.1 <2.0.0"

View File

@ -4,30 +4,30 @@ description: A new Flutter application.
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
cloud_firestore: ^0.8.2+1 cloud_firestore: ^0.9.7+2
image_picker: 0.4.1 image_picker: ^0.5.0+9
firebase_storage: 1.0.4 firebase_storage: ^2.1.0+1
firebase_auth: 0.6.2+1 firebase_auth: ^0.8.3
google_sign_in: ^3.2.1 google_sign_in: ^4.0.1+1
uuid: 1.0.3 uuid: ^2.0.0
image: 2.0.4 image: ^2.0.7
path_provider: 0.4.1 path_provider: ^0.5.0+1
font_awesome_flutter: 8.0.1 font_awesome_flutter: ^8.4.0
async: "^2.0.4" async: ^2.1.0
http: "^0.12.0" http: ^0.12.0+1
shared_preferences: "^0.4.1" shared_preferences: ^0.5.1+2
cached_network_image: "^0.5.0" cached_network_image: ^0.7.0
firebase_messaging: ^2.0.2 firebase_messaging: ^4.0.0+1
location: ^1.4.1 location: ^2.3.3
geocoder: ^0.1.1 geocoder: ^0.1.2
# 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.0 cupertino_icons: ^0.1.0
dev_dependencies: #dev_dependencies:
flutter_test: # flutter_test:
sdk: flutter # sdk: flutter
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the