Skip to content

Commit

Permalink
Fixes SignOut method that was not working and crashing the app.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Henrique Zinato committed Apr 20, 2017
1 parent ce4c1d5 commit cb0f133
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 24 deletions.
Binary file removed android/dist/googlesignin.jar
Binary file not shown.
Binary file removed android/dist/ti.googlesignin-android-1.0.6.zip
Binary file not shown.
Binary file removed android/dist/ti.googlesignin-android-1.0.7.zip
Binary file not shown.
Binary file removed android/dist/ti.googlesignin-android-1.0.8.zip
Binary file not shown.
Binary file removed android/dist/ti.googlesignin-android-1.0.9.zip
Binary file not shown.
Binary file removed android/dist/ti.googlesignin-android-1.1.0.zip
Binary file not shown.
Binary file removed android/dist/ti.googlesignin-android-1.1.1.zip
Binary file not shown.
Binary file removed android/dist/ti.googlesignin-android-1.1.2.zip
Binary file not shown.
Binary file removed android/libs/armeabi-v7a/libti.googlesignin.so
Binary file not shown.
Binary file removed android/libs/x86/libti.googlesignin.so
Binary file not shown.
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.1.2
version: 1.1.3
apiversion: 3
architectures: armeabi-v7a x86
description: googlesignin
Expand Down
46 changes: 26 additions & 20 deletions android/src/ti/googlesignin/GooglesigninModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ protected synchronized void initialize(KrollDict opts) {
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this).build();
googleApiClient.connect();
Log.d(LCAT, "googleApiClient built, finished initialized");
}

Expand Down Expand Up @@ -148,28 +149,33 @@ public void run() {

@Kroll.method
protected synchronized void signOut() {
if (googleApiClient == null)
return;
Auth.GoogleSignInApi.signOut(googleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
Log.d(LCAT, "oResult SignOut");
KrollDict kd = new KrollDict();
kd.put("status", status.getStatusMessage());

if (hasListeners("onsignout")) {
Log.e(LCAT,
"The 'onsignout' event is deprecated, use 'disconnect' instead.");
fireEvent("onsignout", kd);
}
if (googleApiClient != null) {
if(googleApiClient.isConnected()){
Auth.GoogleSignInApi.signOut(googleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
Log.d(LCAT, "oResult SignOut");
KrollDict kd = new KrollDict();
kd.put("status", status.getStatusMessage());

if (hasListeners("disconnect")) {
fireEvent("disconnect", kd);
}
}
});
if (hasListeners("onsignout")) {
Log.e(LCAT,
"The 'onsignout' event is deprecated, use 'disconnect' instead.");
fireEvent("onsignout", kd);
}

if (hasListeners("disconnect")) {
fireEvent("disconnect", kd);
}
}
});
}else{
Log.d(LCAT, "googleApiClient not connected yet");
}
}else{
Log.d(LCAT, "googleApiClient doesnt exist");
}
}

private final class SignInResultHandler implements TiActivityResultHandler {
Expand Down
4 changes: 1 addition & 3 deletions android/timodule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.version"
android:value="10298000"/>
<meta-data android:name="com.google.android.gms.version" android:value="10298000"/>
<activity android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
Expand Down

0 comments on commit cb0f133

Please sign in to comment.