@norcy/react-native-toolkit 0.3.11 → 0.3.13
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
|
}
|
|
@@ -100,7 +100,7 @@ public class HuaweiLoginModule extends ReactContextBaseJavaModule implements Act
|
|
|
100
100
|
}
|
|
101
101
|
Promise promise = pendingPromise;
|
|
102
102
|
pendingPromise = null;
|
|
103
|
-
if (
|
|
103
|
+
if (intent == null) {
|
|
104
104
|
promise.reject("E_CANCELED", "Huawei sign-in canceled");
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
@@ -112,16 +112,18 @@ public class HuaweiLoginModule extends ReactContextBaseJavaModule implements Act
|
|
|
112
112
|
if (authAccountTask.isSuccessful()) {
|
|
113
113
|
AuthAccount account = authAccountTask.getResult();
|
|
114
114
|
resolvePromise(promise, account);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (resultCode != Activity.RESULT_OK) {
|
|
118
|
+
promise.reject("E_CANCELED", "Huawei sign-in canceled");
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
Exception ex = authAccountTask.getException();
|
|
122
|
+
String code = "E_SIGN_IN";
|
|
123
|
+
if (ex instanceof ApiException) {
|
|
124
|
+
code = String.valueOf(((ApiException) ex).getStatusCode());
|
|
124
125
|
}
|
|
126
|
+
promise.reject(code, ex != null ? ex.getMessage() : "sign in failed", ex);
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
@Override
|