Skip to content

Commit 2ccec91

Browse files
committed
Merge branch 'update_dependencies'
2 parents bbe8928 + 026e86d commit 2ccec91

File tree

9 files changed

+107
-340
lines changed

9 files changed

+107
-340
lines changed

android/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ apply plugin: 'com.android.application'
1515
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
1616

1717
android {
18-
compileSdkVersion 27
18+
compileSdkVersion 28
1919

2020
lintOptions {
2121
disable 'InvalidPackage'
@@ -28,7 +28,7 @@ android {
2828
targetSdkVersion 27
2929
versionCode 1
3030
versionName "1.2.2"
31-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
31+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3232
multiDexEnabled true
3333
}
3434

@@ -47,8 +47,8 @@ flutter {
4747

4848
dependencies {
4949
testImplementation 'junit:junit:4.12'
50-
androidTestImplementation 'com.android.support.test:runner:1.0.1'
51-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
50+
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
51+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
5252
compile 'com.google.firebase:firebase-core:11.8.0'
5353

5454
}

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.0.1'
8+
classpath 'com.android.tools.build:gradle:3.3.2'
99
classpath 'com.google.gms:google-services:3.2.0'
1010

1111
}

android/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
android.enableJetifier=true
2+
android.useAndroidX=true
13
org.gradle.jvmargs=-Xmx1536M
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
1+
#Tue Apr 02 01:36:58 EDT 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

lib/image_post.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ class _ImagePost extends State<ImagePost> {
138138
new CachedNetworkImage(
139139
imageUrl: mediaUrl,
140140
fit: BoxFit.fitWidth,
141-
placeholder: loadingPlaceHolder,
142-
errorWidget: new Icon(Icons.error),
141+
placeholder: (context, url) => loadingPlaceHolder,
142+
errorWidget: (context, url, error) => Icon(Icons.error),
143143
),
144144
showHeart
145145
? new Positioned(

lib/location.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ import 'package:geocoder/geocoder.dart';
77
import 'package:location/location.dart';
88

99
getUserLocation() async {
10-
Map<String, double> currentLocation = new Map();
11-
Map<String, double> myLocation;
10+
LocationData currentLocation;
1211
String error;
1312
Location location = new Location();
1413
try {
15-
myLocation = await location.getLocation();
14+
currentLocation = await location.getLocation();
1615
} on PlatformException catch (e) {
1716
if (e.code == 'PERMISSION_DENIED') {
1817
error = 'please grant permission';
@@ -22,11 +21,10 @@ getUserLocation() async {
2221
error = 'permission denied- please enable it from app settings';
2322
print(error);
2423
}
25-
myLocation = null;
24+
currentLocation = null;
2625
}
27-
currentLocation = myLocation;
2826
final coordinates = new Coordinates(
29-
currentLocation['latitude'], currentLocation['longitude']);
27+
currentLocation.latitude, currentLocation.longitude);
3028
var addresses =
3129
await Geocoder.local.findAddressesFromCoordinates(coordinates);
3230
var first = addresses.first;

lib/main.dart

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,47 @@ Future<Null> _ensureLoggedIn(BuildContext context) async {
3838
}
3939

4040
if (await auth.currentUser() == null) {
41-
GoogleSignInAuthentication credentials =
42-
await googleSignIn.currentUser.authentication;
43-
await auth.signInWithGoogle(
44-
idToken: credentials.idToken, accessToken: credentials.accessToken);
41+
42+
final GoogleSignInAccount googleUser = await googleSignIn.signIn();
43+
final GoogleSignInAuthentication googleAuth = await googleUser
44+
.authentication;
45+
46+
47+
final AuthCredential credential = GoogleAuthProvider.getCredential(
48+
accessToken: googleAuth.accessToken,
49+
idToken: googleAuth.idToken,
50+
);
51+
52+
await auth.signInWithCredential(credential);
4553
}
4654
}
4755

56+
Future<Null> _silentLogin(BuildContext context) async {
57+
GoogleSignInAccount user = googleSignIn.currentUser;
58+
59+
if (user == null) {
60+
user = await googleSignIn.signInSilently().then((_) {
61+
tryCreateUserRecord(context);
62+
});
63+
}
64+
65+
if (await auth.currentUser() == null && user != null) {
66+
final GoogleSignInAccount googleUser = await googleSignIn.signIn();
67+
final GoogleSignInAuthentication googleAuth = await googleUser
68+
.authentication;
69+
70+
71+
final AuthCredential credential = GoogleAuthProvider.getCredential(
72+
accessToken: googleAuth.accessToken,
73+
idToken: googleAuth.idToken,
74+
);
75+
76+
await auth.signInWithCredential(credential);
77+
}
78+
79+
80+
}
81+
4882
Future<Null> _setUpNotifications() async {
4983
if (Platform.isAndroid) {
5084
_firebaseMessaging.configure(
@@ -70,23 +104,6 @@ Future<Null> _setUpNotifications() async {
70104
}
71105
}
72106

73-
Future<Null> _silentLogin(BuildContext context) async {
74-
GoogleSignInAccount user = googleSignIn.currentUser;
75-
76-
if (user == null) {
77-
user = await googleSignIn.signInSilently().then((_) {
78-
tryCreateUserRecord(context);
79-
});
80-
}
81-
82-
if (await auth.currentUser() == null && user != null) {
83-
GoogleSignInAuthentication credentials =
84-
await googleSignIn.currentUser.authentication;
85-
await auth.signInWithGoogle(
86-
idToken: credentials.idToken, accessToken: credentials.accessToken);
87-
}
88-
}
89-
90107
tryCreateUserRecord(BuildContext context) async {
91108
GoogleSignInAccount user = googleSignIn.currentUser;
92109
if (user == null) {

0 commit comments

Comments
 (0)