From 88abc28b1ed9ce57643999e1212c12792fcea03e Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 16:32:59 +0300 Subject: [PATCH 01/21] Update index.js --- index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4b0d92e..c587cc8 100644 --- a/index.js +++ b/index.js @@ -12,5 +12,13 @@ smartLock.getCredentials = () => { }); } +smartLock.saveCredentials = (name, password) => { + return new Promise((resolve, reject) => { + SmartLockRN.saveCredentials(name, password) + .then(() => resolve()) + .catch(err => reject(err)); + }); +} + -export default smartLock; \ No newline at end of file +export default smartLock; From 5a6b03d0ce58bd451fed662c70c148190caa464e Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 16:42:25 +0300 Subject: [PATCH 02/21] Update SmartLockModule.java --- .../com/google/smartlock/SmartLockModule.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index eabb11b..ed82f76 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -166,4 +166,38 @@ private void handleSuccess(Credential credential) { } } + + @ReactMethod + public void saveCredentials(final String name, final String password) { + this.sLPromise = promise; + CredentialsClient mCredentialsClient; + mCredentialsClient = Credentials.getClient(this.mContext); + Credential credential = new Credential.Builder(name) + .setPassword(password) + .build(); + Auth.CredentialsApi.save(mCredentialsClient, + credential).setResultCallback(new ResultCallback() { + @Override + public void onResult(Status status) { + if (status.isSuccess()) { + Log.d(TAG, "Credential saved"); + sLPromise.resolve("Credential saved"); + } else { + if (status.hasResolution()) { + // Try to resolve the save request. This will prompt the user if + // the credential is new. + try { + status.startResolutionForResult(this, RC_SAVE); + sLPromise.resolve("Credential saved"); + } catch (IntentSender.SendIntentException e) { + Log.e("SmartLockModule", "Unsuccessful credential save resolution.", e); + sLPromise.reject("Unsuccessful credential save resolution.", "Unsuccessful credential save resolution."); + } + }else{ + Log.d("SmartLockModule", "Unsuccessful credential save."); + sLPromise.reject("Unsuccessful credential save.", "Unsuccessful credential save."); + } + } + }); + } } From 95f82d46bd6bb5a5232ebae063d661d6c194f56b Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 16:54:34 +0300 Subject: [PATCH 03/21] Update SmartLockModule.java --- android/src/main/java/com/google/smartlock/SmartLockModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index ed82f76..04f1aba 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -182,7 +182,7 @@ public void onResult(Status status) { if (status.isSuccess()) { Log.d(TAG, "Credential saved"); sLPromise.resolve("Credential saved"); - } else { + } else if (status.hasResolution()) { // Try to resolve the save request. This will prompt the user if // the credential is new. From 31404d6291c8e89ed15de52d43bb8aa1df73e84f Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 17:15:56 +0300 Subject: [PATCH 04/21] Update SmartLockModule.java --- .../src/main/java/com/google/smartlock/SmartLockModule.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index 04f1aba..4d5b9d5 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -27,6 +27,7 @@ import com.google.android.gms.common.api.ResolvableApiException; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; +import com.google.android.gms.common.api.ResultCallback; import org.json.JSONException; import org.json.JSONObject; @@ -168,7 +169,7 @@ private void handleSuccess(Credential credential) { } @ReactMethod - public void saveCredentials(final String name, final String password) { + public void saveCredentials(final Promise promise, final String name, final String password) { this.sLPromise = promise; CredentialsClient mCredentialsClient; mCredentialsClient = Credentials.getClient(this.mContext); From 0423d39e9beb5e06ceb4493e5161f1df9adfad64 Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 17:21:13 +0300 Subject: [PATCH 05/21] Update SmartLockModule.java --- .../java/com/google/smartlock/SmartLockModule.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index 4d5b9d5..3259ba0 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -10,6 +10,7 @@ import android.util.Log; import android.widget.Toast; +import com.google.android.gms.auth.api.Auth; import com.facebook.react.bridge.ActivityEventListener; import com.facebook.react.bridge.BaseActivityEventListener; import com.facebook.react.bridge.Promise; @@ -28,6 +29,7 @@ import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.android.gms.common.api.ResultCallback; +import com.google.android.gms.common.api.Status; import org.json.JSONException; import org.json.JSONObject; @@ -42,7 +44,7 @@ public class SmartLockModule extends ReactContextBaseJavaModule { private static final int RC_READ = 4; private static final int SUCCESS_CODE = -1; private static final int CANCEL_CODE = 1001; - + private static final int RC_SAVE = 1; public SmartLockModule(ReactApplicationContext reactContext, Application application) { @@ -177,11 +179,12 @@ public void saveCredentials(final Promise promise, final String name, final Stri .setPassword(password) .build(); Auth.CredentialsApi.save(mCredentialsClient, - credential).setResultCallback(new ResultCallback() { + credential).setResultCallback(new ResultCallback() { @Override - public void onResult(Status status) { + public void onResult(@NonNull CredentialRequestResult result) { + Status status = result.getStatus(); if (status.isSuccess()) { - Log.d(TAG, "Credential saved"); + Log.d("SmartLockModule", "Credential saved"); sLPromise.resolve("Credential saved"); } else if (status.hasResolution()) { From 8b04f27fe56517b8e6356ef75da87454fa207fdf Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 17:34:12 +0300 Subject: [PATCH 06/21] Update SmartLockModule.java --- .../com/google/smartlock/SmartLockModule.java | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index 3259ba0..3580f78 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -177,22 +177,35 @@ public void saveCredentials(final Promise promise, final String name, final Stri mCredentialsClient = Credentials.getClient(this.mContext); Credential credential = new Credential.Builder(name) .setPassword(password) + .setPasswordLoginSupported(true) + .setAccountTypes(IdentityProviders.GOOGLE) .build(); - Auth.CredentialsApi.save(mCredentialsClient, - credential).setResultCallback(new ResultCallback() { + mCredentialsClient.save(credential).addOnCompleteListener(new OnCompleteListener() { @Override - public void onResult(@NonNull CredentialRequestResult result) { - Status status = result.getStatus(); - if (status.isSuccess()) { + public void onComplete(Task task) { + if (task.isSuccessful()) { Log.d("SmartLockModule", "Credential saved"); sLPromise.resolve("Credential saved"); - } else - if (status.hasResolution()) { + return; + } + Exception e = task.getException(); + if (e instanceof ResolvableApiException) { // Try to resolve the save request. This will prompt the user if // the credential is new. - try { - status.startResolutionForResult(this, RC_SAVE); - sLPromise.resolve("Credential saved"); + try { + ResolvableApiException rae = (ResolvableApiException) e; + Activity activity = getCurrentActivity(); + if (activity == null) { + sLPromise.reject("Activity is null", "Activity is null"); + return; + } + try { + rae.startResolutionForResult(activity, RC_SAVE); + sLPromise.resolve("Credential saved"); + } catch (IntentSender.SendIntentException e) { + Log.e("SmartLockModule", "Failed to send Credentials intent.", e); + sLPromise.reject("Failed to send Credentials intent.", "Failed to send Credentials intent."); + } } catch (IntentSender.SendIntentException e) { Log.e("SmartLockModule", "Unsuccessful credential save resolution.", e); sLPromise.reject("Unsuccessful credential save resolution.", "Unsuccessful credential save resolution."); From bbf09cb99a7121f1093a866a77a1b0720bb69579 Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 17:37:09 +0300 Subject: [PATCH 07/21] Update SmartLockModule.java --- .../main/java/com/google/smartlock/SmartLockModule.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index 3580f78..4775ca8 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -177,7 +177,6 @@ public void saveCredentials(final Promise promise, final String name, final Stri mCredentialsClient = Credentials.getClient(this.mContext); Credential credential = new Credential.Builder(name) .setPassword(password) - .setPasswordLoginSupported(true) .setAccountTypes(IdentityProviders.GOOGLE) .build(); mCredentialsClient.save(credential).addOnCompleteListener(new OnCompleteListener() { @@ -202,12 +201,12 @@ public void onComplete(Task task) { try { rae.startResolutionForResult(activity, RC_SAVE); sLPromise.resolve("Credential saved"); - } catch (IntentSender.SendIntentException e) { - Log.e("SmartLockModule", "Failed to send Credentials intent.", e); + } catch (IntentSender.SendIntentException ex) { + Log.e("SmartLockModule", "Failed to send Credentials intent.", ex); sLPromise.reject("Failed to send Credentials intent.", "Failed to send Credentials intent."); } - } catch (IntentSender.SendIntentException e) { - Log.e("SmartLockModule", "Unsuccessful credential save resolution.", e); + } catch (IntentSender.SendIntentException ex) { + Log.e("SmartLockModule", "Unsuccessful credential save resolution.", ex); sLPromise.reject("Unsuccessful credential save resolution.", "Unsuccessful credential save resolution."); } }else{ From 7eab45bd08974d3f000ffbfb27fa8011cbe5ef9a Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 17:41:26 +0300 Subject: [PATCH 08/21] Update SmartLockModule.java --- android/src/main/java/com/google/smartlock/SmartLockModule.java | 1 - 1 file changed, 1 deletion(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index 4775ca8..5aedfbd 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -177,7 +177,6 @@ public void saveCredentials(final Promise promise, final String name, final Stri mCredentialsClient = Credentials.getClient(this.mContext); Credential credential = new Credential.Builder(name) .setPassword(password) - .setAccountTypes(IdentityProviders.GOOGLE) .build(); mCredentialsClient.save(credential).addOnCompleteListener(new OnCompleteListener() { @Override From 6783ec66b6a64caf18bed1662d83ec87750ed741 Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 17:43:07 +0300 Subject: [PATCH 09/21] Update SmartLockModule.java --- .../com/google/smartlock/SmartLockModule.java | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index 5aedfbd..cd578e9 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -189,24 +189,19 @@ public void onComplete(Task task) { Exception e = task.getException(); if (e instanceof ResolvableApiException) { // Try to resolve the save request. This will prompt the user if - // the credential is new. - try { - ResolvableApiException rae = (ResolvableApiException) e; - Activity activity = getCurrentActivity(); - if (activity == null) { - sLPromise.reject("Activity is null", "Activity is null"); - return; - } - try { - rae.startResolutionForResult(activity, RC_SAVE); - sLPromise.resolve("Credential saved"); - } catch (IntentSender.SendIntentException ex) { - Log.e("SmartLockModule", "Failed to send Credentials intent.", ex); - sLPromise.reject("Failed to send Credentials intent.", "Failed to send Credentials intent."); - } + // the credential is new. + ResolvableApiException rae = (ResolvableApiException) e; + Activity activity = getCurrentActivity(); + if (activity == null) { + sLPromise.reject("Activity is null", "Activity is null"); + return; + } + try { + rae.startResolutionForResult(activity, RC_SAVE); + sLPromise.resolve("Credential saved"); } catch (IntentSender.SendIntentException ex) { - Log.e("SmartLockModule", "Unsuccessful credential save resolution.", ex); - sLPromise.reject("Unsuccessful credential save resolution.", "Unsuccessful credential save resolution."); + Log.e("SmartLockModule", "Failed to send Credentials intent.", ex); + sLPromise.reject("Failed to send Credentials intent.", "Failed to send Credentials intent."); } }else{ Log.d("SmartLockModule", "Unsuccessful credential save."); From 7a21a7708745da6a2aadb3c6b4db9d824802713e Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 17:54:34 +0300 Subject: [PATCH 10/21] Update SmartLockModule.java --- android/src/main/java/com/google/smartlock/SmartLockModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index cd578e9..f287015 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -171,7 +171,7 @@ private void handleSuccess(Credential credential) { } @ReactMethod - public void saveCredentials(final Promise promise, final String name, final String password) { + public void saveCredentials(final String name, final String password, final Promise promise) { this.sLPromise = promise; CredentialsClient mCredentialsClient; mCredentialsClient = Credentials.getClient(this.mContext); From 7d39859c3a5a537527bf1e2769ff400bc0b3fae1 Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 16 Jan 2019 18:00:53 +0300 Subject: [PATCH 11/21] Update SmartLockModule.java --- android/src/main/java/com/google/smartlock/SmartLockModule.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index f287015..6a6cfe7 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -155,11 +155,13 @@ private void handleSuccess(Credential credential) { String name = credential.getName(); String id = credential.getId(); + String password = credential.getPassword(); List tokens = credential.getIdTokens(); obj.put("name", name); obj.put("id", id); + obj.put("password", password); obj.put("tokens", tokens.toString()); sLPromise.resolve(obj.toString()); From 4d519b53ba98639cb1229b779ec3248902838b12 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 18 Jan 2019 21:04:21 +0300 Subject: [PATCH 12/21] Update SmartLockModule.java --- .../src/main/java/com/google/smartlock/SmartLockModule.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index 6a6cfe7..dd9abfb 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -68,6 +68,9 @@ public void onActivityResult(Activity activity, int requestCode, int resultCode, System.out.println("----------RESULT CODE : "+resultCode+"-----------"); if (resultCode == SUCCESS_CODE) { + if(intent == null || Credential.EXTRA_KEY == null){ + return; + } Credential credential = intent.getParcelableExtra(Credential.EXTRA_KEY); if (credential == null) { return; From 311076c3c6d47ad7cbc24a20cd23b8e527eae6f3 Mon Sep 17 00:00:00 2001 From: Peter Date: Sat, 19 Jan 2019 16:45:51 +0300 Subject: [PATCH 13/21] Update build.gradle --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index c856ec4..c0aab73 100644 --- a/build.gradle +++ b/build.gradle @@ -20,12 +20,12 @@ repositories { // In this section you declare the dependencies for your production and test code dependencies { // The production code uses the SLF4J logging API at compile time - compile 'org.slf4j:slf4j-api:1.7.25' + implementation 'org.slf4j:slf4j-api:1.7.25' // Declare the dependency for your favourite test framework you want to use in your tests. // TestNG is also supported by the Gradle Test task. Just change the // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add // 'test.useTestNG()' to your build script. - testCompile 'junit:junit:4.12' + testImplementation 'junit:junit:4.12' } */ From 5e46560039e63e3b193ea0b1bae51586eaaf0c84 Mon Sep 17 00:00:00 2001 From: Peter Date: Sat, 19 Jan 2019 16:46:37 +0300 Subject: [PATCH 14/21] Update build.gradle --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index f426901..b6ba0aa 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -24,8 +24,8 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - testCompile 'junit:junit:4.12' + implementation fileTree(dir: 'libs', include: ['*.jar']) + testImplementation 'junit:junit:4.12' implementation 'com.google.android.gms:play-services-auth:11.8.0' implementation 'com.android.support:appcompat-v7:23.4.0' implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" From 540fc38e4af29bd82b1db6d30ebd34a1175e348e Mon Sep 17 00:00:00 2001 From: Peter Date: Sat, 19 Jan 2019 16:55:05 +0300 Subject: [PATCH 15/21] Update build.gradle --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index c0aab73..c856ec4 100644 --- a/build.gradle +++ b/build.gradle @@ -20,12 +20,12 @@ repositories { // In this section you declare the dependencies for your production and test code dependencies { // The production code uses the SLF4J logging API at compile time - implementation 'org.slf4j:slf4j-api:1.7.25' + compile 'org.slf4j:slf4j-api:1.7.25' // Declare the dependency for your favourite test framework you want to use in your tests. // TestNG is also supported by the Gradle Test task. Just change the // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add // 'test.useTestNG()' to your build script. - testImplementation 'junit:junit:4.12' + testCompile 'junit:junit:4.12' } */ From 6241b7080c1b6ad2973fafb732042358fb3bdfc8 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 23 Aug 2019 13:56:31 +0300 Subject: [PATCH 16/21] Update SmartLockModule.java --- .../java/com/google/smartlock/SmartLockModule.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockModule.java b/android/src/main/java/com/google/smartlock/SmartLockModule.java index dd9abfb..201edde 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockModule.java +++ b/android/src/main/java/com/google/smartlock/SmartLockModule.java @@ -22,6 +22,7 @@ import com.google.android.gms.auth.api.credentials.CredentialRequestResponse; import com.google.android.gms.auth.api.credentials.Credentials; import com.google.android.gms.auth.api.credentials.CredentialsClient; +import com.google.android.gms.auth.api.credentials.CredentialsOptions; import com.google.android.gms.auth.api.credentials.IdToken; import com.google.android.gms.auth.api.credentials.IdentityProviders; import com.google.android.gms.common.api.ApiException; @@ -174,12 +175,14 @@ private void handleSuccess(Credential credential) { } } - + @ReactMethod public void saveCredentials(final String name, final String password, final Promise promise) { this.sLPromise = promise; CredentialsClient mCredentialsClient; - mCredentialsClient = Credentials.getClient(this.mContext); + CredentialsOptions options = + new CredentialsOptions.Builder().forceEnableSaveDialog().build(); + mCredentialsClient = Credentials.getClient(this.mContext, options); Credential credential = new Credential.Builder(name) .setPassword(password) .build(); @@ -194,7 +197,7 @@ public void onComplete(Task task) { Exception e = task.getException(); if (e instanceof ResolvableApiException) { // Try to resolve the save request. This will prompt the user if - // the credential is new. + // the credential is new. ResolvableApiException rae = (ResolvableApiException) e; Activity activity = getCurrentActivity(); if (activity == null) { @@ -209,8 +212,8 @@ public void onComplete(Task task) { sLPromise.reject("Failed to send Credentials intent.", "Failed to send Credentials intent."); } }else{ - Log.d("SmartLockModule", "Unsuccessful credential save."); - sLPromise.reject("Unsuccessful credential save.", "Unsuccessful credential save."); + Log.d("SmartLockModule", "Unsuccessful credential save."); + sLPromise.reject("Unsuccessful credential save." + e, "Unsuccessful credential save." + e); } } }); From 3d9095e672f0e1ac12b819eeb33c346d50fd0dfd Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 23 Aug 2019 13:58:01 +0300 Subject: [PATCH 17/21] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index f76de70..1d148ba 100644 --- a/README.md +++ b/README.md @@ -67,4 +67,15 @@ smartLock.getCredentials() ``` +```javascript +smartLock.saveCredentials(username, JSON.stringify({'password': password})) + .then(() => { + console.warn('saved'); + }) + .catch(err => { + console.warn(err); + }); + +``` + From d7c4e6f3cc62bc0092bb4748ca81b687b62b71bc Mon Sep 17 00:00:00 2001 From: Lavesh Panjwani Date: Fri, 23 Aug 2019 17:42:13 +0400 Subject: [PATCH 18/21] Runtime Java Error --- .../src/main/java/com/google/smartlock/SmartLockPackager.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/android/src/main/java/com/google/smartlock/SmartLockPackager.java b/android/src/main/java/com/google/smartlock/SmartLockPackager.java index 9f718e8..83e4842 100644 --- a/android/src/main/java/com/google/smartlock/SmartLockPackager.java +++ b/android/src/main/java/com/google/smartlock/SmartLockPackager.java @@ -17,10 +17,6 @@ public class SmartLockPackager implements ReactPackage { private Application application; - public SmartLockPackager(Application application) { - this.application = application; - } - @Override public List createNativeModules(ReactApplicationContext reactContext) { return Arrays.asList(new SmartLockModule(reactContext, this.application)); From 6946e9b8f93451e3a873ff95ecb5acdd58e31d55 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 23 Aug 2019 16:57:30 +0300 Subject: [PATCH 19/21] Fix SmartLockPackager() call --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d148ba..d8bf4fd 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ So `getPackages()` should look like: protected List getPackages() { return Arrays.asList( new MainReactPackage(), - new SmartLockPackager(MainApplication.this), + new SmartLockPackager(), //..... ); } From 5fa597db3aa01595d3e08083c8ad7366c2e15b91 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 23 Aug 2019 17:03:37 +0300 Subject: [PATCH 20/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8bf4fd..fdaa789 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Add: 1. `import com.google.smartlock.smartlockrn.SmartLockPackager;` 2. In the `getPackages()` method register the module: -`new SmartLockPackager(MainApplication.this)` +`new SmartLockPackager()` So `getPackages()` should look like: From 17156e2f9d7887573fd52a7a798942226486cd1f Mon Sep 17 00:00:00 2001 From: RobTS Date: Wed, 25 Sep 2019 15:51:41 +0200 Subject: [PATCH 21/21] Play Services Auth updated to 17.0.0 --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index b6ba0aa..3de84d0 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,7 +26,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation 'junit:junit:4.12' - implementation 'com.google.android.gms:play-services-auth:11.8.0' + implementation 'com.google.android.gms:play-services-auth:17.0.0' implementation 'com.android.support:appcompat-v7:23.4.0' implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" }