@norcy/react-native-toolkit 0.3.12 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -10,6 +10,7 @@ ext.applyBuildscriptExt = {
|
|
|
10
10
|
ext.applyBuildscriptRepos = { handler ->
|
|
11
11
|
handler.maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
|
|
12
12
|
handler.maven { url 'https://repo1.maven.org/maven2/' }
|
|
13
|
+
handler.maven { url 'https://developer.huawei.com/repo/' }
|
|
13
14
|
handler.mavenCentral()
|
|
14
15
|
handler.google()
|
|
15
16
|
}
|
|
@@ -7,6 +7,7 @@ import com.facebook.react.ReactNativeHost;
|
|
|
7
7
|
import com.facebook.react.ReactPackage;
|
|
8
8
|
import com.facebook.react.soloader.OpenSourceMergedSoMapping;
|
|
9
9
|
import com.facebook.soloader.SoLoader;
|
|
10
|
+
import com.huawei.agconnect.AGConnectInstance;
|
|
10
11
|
|
|
11
12
|
import java.io.IOException;
|
|
12
13
|
import java.util.List;
|
|
@@ -65,5 +66,10 @@ public abstract class BaseToolkitApplication extends Application implements Reac
|
|
|
65
66
|
throw new RuntimeException(e);
|
|
66
67
|
}
|
|
67
68
|
UMengManager.getInstance().setup(this, getUmengAppKey());
|
|
69
|
+
try {
|
|
70
|
+
if (AGConnectInstance.getInstance() == null) {
|
|
71
|
+
AGConnectInstance.initialize(this);
|
|
72
|
+
}
|
|
73
|
+
} catch (Exception ignored) {}
|
|
68
74
|
}
|
|
69
75
|
}
|
|
@@ -2,6 +2,7 @@ package com.norcy.reactnativetoolkit;
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.content.Intent;
|
|
5
|
+
import android.util.Log;
|
|
5
6
|
|
|
6
7
|
import androidx.annotation.NonNull;
|
|
7
8
|
|
|
@@ -22,6 +23,7 @@ import com.huawei.hms.support.account.service.AccountAuthService;
|
|
|
22
23
|
|
|
23
24
|
public class HuaweiLoginModule extends ReactContextBaseJavaModule implements ActivityEventListener {
|
|
24
25
|
|
|
26
|
+
private static final String TAG = "HuaweiLogin";
|
|
25
27
|
private static final String NAME = "HuaweiLoginModule";
|
|
26
28
|
private static final int REQUEST_SIGN_IN = 0x8AC1;
|
|
27
29
|
|
|
@@ -57,6 +59,7 @@ public class HuaweiLoginModule extends ReactContextBaseJavaModule implements Act
|
|
|
57
59
|
Task<AuthAccount> task = service.silentSignIn();
|
|
58
60
|
task.addOnSuccessListener(account -> resolvePromise(promise, account));
|
|
59
61
|
task.addOnFailureListener(e -> {
|
|
62
|
+
Log.w(TAG, "silentSignIn failed: " + e.getMessage());
|
|
60
63
|
pendingPromise = promise;
|
|
61
64
|
try {
|
|
62
65
|
activity.startActivityForResult(service.getSignInIntent(), REQUEST_SIGN_IN);
|
|
@@ -110,12 +113,7 @@ public class HuaweiLoginModule extends ReactContextBaseJavaModule implements Act
|
|
|
110
113
|
return;
|
|
111
114
|
}
|
|
112
115
|
if (authAccountTask.isSuccessful()) {
|
|
113
|
-
|
|
114
|
-
resolvePromise(promise, account);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (resultCode != Activity.RESULT_OK) {
|
|
118
|
-
promise.reject("E_CANCELED", "Huawei sign-in canceled");
|
|
116
|
+
resolvePromise(promise, authAccountTask.getResult());
|
|
119
117
|
return;
|
|
120
118
|
}
|
|
121
119
|
Exception ex = authAccountTask.getException();
|