Skip to content

Commit 5c4ece2

Browse files
committed
update to 1.3.2
1 parent ec366c2 commit 5c4ece2

29 files changed

+343
-119
lines changed

CHANGELOG-zh.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
#
22

3+
## 1.3.2
4+
* 更新android sdk 为 2.14.7
5+
* 更新ios sdk 为 2.14.6
6+
* 更新web sdk 为 2.1.12
7+
* 添加方法:queryCheckBoxIsChecked
8+
* 添加Android字段:fullScreen
9+
* 添加Android字段:authPageUseDayLight
10+
* 添加Android字段:keepAllPageHideNavigationBar
11+
* 添加Android字段:closeAuthPageReturnBack
12+
13+
314
## 1.3.1
415
* 更新android sdk 为 2.14.5
516
* 更新ios sdk 为 2.14.5

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#
22

3+
## 1.3.2
4+
* Update Android SDK to 2.14.7
5+
* Update iOS SDK to 2.14.6
6+
* Update Web SDK to 2.1.12
7+
* Add method:queryCheckBoxIsChecked
8+
* Android fields:fullScreen
9+
* Android fields:authPageUseDayLight
10+
* Android fields:keepAllPageHideNavigationBar
11+
* Android fields:closeAuthPageReturnBack
12+
313
## 1.3.1
414
* Update Android SDK to 2.14.5
515
* Update iOS SDK to 2.14.5

android/build-clone.gradle

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
apply plugin: 'com.android.library'
2+
group 'com.sean.rao.ali_auth'
3+
version '1.3.1'
4+
5+
buildscript {
6+
repositories {
7+
mavenLocal()
8+
// google()
9+
// jcenter()
10+
// JitPack 远程仓库:https://jitpack.io
11+
maven { url 'https://jitpack.io' }
12+
maven { url 'https://download.flutter.io'}
13+
maven { url 'https://maven.aliyun.com/repository/public' }
14+
maven { url 'https://maven.aliyun.com/repository/google' }
15+
}
16+
17+
dependencies {
18+
classpath 'com.android.tools.build:gradle:4.1.3'
19+
}
20+
}
21+
22+
rootProject.allprojects {
23+
repositories {
24+
mavenLocal()
25+
// google()
26+
// jcenter()
27+
// JitPack 远程仓库:https://jitpack.io
28+
maven { url 'https://jitpack.io' }
29+
maven { url 'https://download.flutter.io'}
30+
maven { url 'https://maven.aliyun.com/repository/public' }
31+
maven { url 'https://maven.aliyun.com/repository/google' }
32+
}
33+
}
34+
35+
android {
36+
if (project.android.hasProperty("namespace")) {
37+
namespace = "com.sean.rao.ali_auth"
38+
}
39+
40+
compileSdkVersion 34
41+
42+
compileOptions {
43+
sourceCompatibility JavaVersion.VERSION_1_8
44+
targetCompatibility JavaVersion.VERSION_1_8
45+
}
46+
47+
sourceSets {
48+
main {
49+
jniLibs.srcDirs = ['libs']
50+
}
51+
}
52+
53+
defaultConfig {
54+
minSdkVersion 21
55+
}
56+
57+
aaptOptions {
58+
noCompress "mov" //表示不让aapt压缩的文件后缀
59+
}
60+
61+
buildTypes {
62+
release {
63+
debuggable false
64+
// minifyEnabled true
65+
proguardFile file('proguard-rules.pro')
66+
zipAlignEnabled false
67+
multiDexEnabled true
68+
}
69+
70+
debug {
71+
// minifyEnabled false
72+
zipAlignEnabled false
73+
multiDexEnabled true
74+
}
75+
}
76+
77+
dependencies {
78+
implementation "androidx.appcompat:appcompat:1.7.1"
79+
80+
// 兼容安卓版本的fastjson库
81+
implementation 'com.alibaba.fastjson2:fastjson2:2.0.51.android5'
82+
// implementation 'com.google.code.gson:gson:2.10.1'
83+
// implementation 'com.alibaba:fastjson:1.2.83'
84+
85+
implementation files("libs/auth_number_product-${authLibVersion}-release.aar")
86+
implementation files("libs/logger-${loggerVersion}-release.aar")
87+
implementation files("libs/main-${mainVersion}-release.aar")
88+
89+
// 吐司框架:https://github.com/getActivity/Toaster
90+
implementation 'com.github.getActivity:Toaster:12.2'
91+
92+
// uc的crash收集库,客户可自行选择是否需要集成
93+
// implementation 'com.ucweb.wpk:crashsdk:3.2.2.2'
94+
}
95+
}

android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ org.gradle.jvmargs=-Xmx1536m
1616
# org.gradle.parallel=true
1717
android.injected.testOnly=false
1818

19-
authLibVersion=2.14.5
19+
authLibVersion=2.14.7
2020
loggerVersion=2.2.2
2121
mainVersion=2.2.3
-1.14 MB
Binary file not shown.
1.14 MB
Binary file not shown.

android/src/main/java/com/sean/rao/ali_auth/AliAuthPlugin.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ public IToast createToast(IToastStyle<?> style) {
177177
case "checkEnvAvailable":
178178
oneKeyLoginPublic.checkEnvAvailable(2);
179179
break;
180+
case "queryCheckBoxIsChecked":
181+
boolean status = oneKeyLoginPublic.queryCheckBoxIsChecked();
182+
result.success(status);
183+
break;
180184
case "checkCellularDataEnable":
181185
isNetEnabled(mContext, result);
182186
break;
@@ -304,7 +308,6 @@ public void isNetEnabled(Context context, @NonNull Result result) {
304308
}
305309

306310
// 注册回调
307-
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
308311
private void registerNetworkCallback(Context context) {
309312
ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
310313
NetworkRequest.Builder builder = new NetworkRequest.Builder();
@@ -314,7 +317,6 @@ private void registerNetworkCallback(Context context) {
314317
}
315318

316319
// 注销回调
317-
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
318320
private void unregisterNetworkCallback(Context context) {
319321
ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
320322
cm.unregisterNetworkCallback(callback);
@@ -329,7 +331,7 @@ private void unregisterNetworkCallback(Context context) {
329331
public boolean isNetContected(Context context) {
330332
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
331333
NetworkInfo info = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
332-
if (cm != null && info != null && info.isConnected()) {
334+
if (info != null && info.isConnected()) {
333335
Log.i(TAG, "移动网络连接成功");
334336
return true;
335337
}

android/src/main/java/com/sean/rao/ali_auth/common/CustomAuthUIControlClickListener.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@ public void onClick(String code, Context context, String jsonString) {
4444
//点击授权页默认样式的返回按钮
4545
case ResultCode.CODE_ERROR_USER_CANCEL:
4646
Log.e(TAG, "点击了授权页默认返回按钮");
47-
mAuthHelper.quitLoginPage();
4847
break;
4948
//点击授权页默认样式的切换其他登录方式 会关闭授权页
5049
//如果不希望关闭授权页那就setSwitchAccHidden(true)隐藏默认的 通过自定义view添加自己的
5150
case ResultCode.CODE_ERROR_USER_SWITCH:
52-
mAuthHelper.quitLoginPage();
5351
Log.e(TAG, "点击了授权页默认切换其他登录方式");
5452
break;
5553
//点击一键登录按钮会发出此回调

android/src/main/java/com/sean/rao/ali_auth/login/OneKeyLoginPublic.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ public void onTokenSuccess(String s) {
6969
if (ResultCode.CODE_SUCCESS.equals(tokenRet.getCode())) {
7070
Log.i("TAG", "获取token成功:" + s);
7171
mAuthHelper.setAuthListener(null);
72-
if (jsonObject.getBooleanValue("autoQuitPage")) {
73-
mAuthHelper.quitLoginPage();
74-
}
7572
}
7673
showResult(tokenRet.getCode(), null, tokenRet.getToken());
7774
} catch (Exception e) {
@@ -100,7 +97,22 @@ public void onTokenFailed(String s) {
10097
mAuthHelper.getReporter().setLoggerEnable(jsonObject.getBooleanValue("isDebug"));
10198
mAuthHelper.setAuthSDKInfo(jsonObject.getString("androidSk"));
10299

100+
// 授权页是否跟随系统深色模式
101+
mAuthHelper.setAuthPageUseDayLight(jsonObject.getBooleanValue("authPageUseDayLight", false));
102+
// 横屏水滴屏全屏适配
103+
mAuthHelper.keepAuthPageLandscapeFullSreen(jsonObject.getBooleanValue("autoQuitPage", false));
104+
// 用户控制返回键及左上角返回按钮效果, 是否自动退出授权页面,false时由用户自己控制
105+
if (!jsonObject.getBooleanValue("autoQuitPage", false)) {
106+
mAuthHelper.userControlAuthPageCancel();
107+
}
108+
// SDK内置所有界面隐藏底部导航栏
109+
if (jsonObject.getBooleanValue("keepAllPageHideNavigationBar", false)) {
110+
mAuthHelper.keepAllPageHideNavigationBar();
111+
}
112+
// 授权页物理返回键禁用
113+
mAuthHelper.closeAuthPageReturnBack(jsonObject.getBooleanValue("closeAuthPageReturnBack", false));
103114
/// 延时的情况下进行预取号,加快拉取授权页面
115+
104116
if (jsonObject.getBooleanValue("isDelay")) {
105117
mAuthHelper.checkEnvAvailable(PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN);
106118
}
@@ -132,8 +144,6 @@ public String getCurrentCarrierName(){
132144
* 进入app就需要登录的场景使用
133145
*/
134146
private void oneKeyLogin() {
135-
mAuthHelper = PhoneNumberAuthHelper.getInstance(mActivity.getApplicationContext(), mTokenResultListener);
136-
mAuthHelper.checkEnvAvailable(2);
137147
mUIConfig.configAuthPage();
138148
mAuthHelper.getLoginToken(mContext, 5000);
139149
}
@@ -180,9 +190,6 @@ public void onTokenSuccess(String s) {
180190
if (ResultCode.CODE_SUCCESS.equals(tokenRet.getCode())) {
181191
Log.i(TAG, "获取token成功:" + s);
182192
mAuthHelper.setAuthListener(null);
183-
if (jsonObject.getBooleanValue("autoQuitPage")) {
184-
mAuthHelper.quitLoginPage();
185-
}
186193
}
187194
} catch (Exception e) {
188195
e.fillInStackTrace();
@@ -201,9 +208,6 @@ public void onTokenFailed(String s) {
201208
}
202209
// 失败时也不关闭
203210
mAuthHelper.setAuthListener(null);
204-
if (jsonObject.getBooleanValue("autoQuitPage")) {
205-
mAuthHelper.quitLoginPage();
206-
}
207211
}
208212
};
209213
mAuthHelper.setAuthListener(mTokenResultListener);
@@ -218,7 +222,15 @@ public void onTokenFailed(String s) {
218222
* 600013 系统维护,功能不可⽤
219223
*/
220224
public void checkEnvAvailable(@IntRange(from = 1, to = 2) int type){
221-
mAuthHelper.checkEnvAvailable(PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN);
225+
mAuthHelper.checkEnvAvailable(type);
226+
}
227+
228+
229+
/**
230+
* 获取授权页协议勾选框选中状态
231+
*/
232+
public boolean queryCheckBoxIsChecked(){
233+
return mAuthHelper.queryCheckBoxIsChecked();
222234
}
223235

224236
/**

example/android/app/build.gradle

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ plugins {
55
id "dev.flutter.flutter-gradle-plugin"
66
}
77

8+
// 添加签名信息
9+
def keystorePropertiesFile = rootProject.file("key.properties")
10+
def keystoreProperties = new Properties()
11+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
12+
// end
13+
814
android {
915
namespace = "com.sean.rao.aliAuth"
1016
compileSdk = flutter.compileSdkVersion
11-
ndkVersion = flutter.ndkVersion
17+
ndkVersion = "27.0.12077973"
1218

1319
compileOptions {
1420
sourceCompatibility JavaVersion.VERSION_1_8
@@ -29,30 +35,39 @@ android {
2935
versionName "1.0.0"
3036
}
3137

38+
// 添加签名信息
39+
signingConfigs {
40+
release {
41+
keyAlias keystoreProperties['keyAlias']
42+
keyPassword keystoreProperties['keyPassword']
43+
storeFile file(keystoreProperties['storeFile'])
44+
storePassword keystoreProperties['storePassword']
45+
}
46+
}
47+
// end
3248

3349
buildTypes {
3450
debug {
3551
ndk {
36-
abiFilters "armeabi", "armeabi-v7a","arm64-v8a", "x86", "arm64"
52+
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
3753
}
38-
signingConfig signingConfigs.debug
54+
signingConfig signingConfigs.release
3955
}
4056
release {
4157
ndk{
4258
//这里其实我觉可以直接是用"armeabi-v7a",但国内几个大哥之前使用的都是"armeabi"
43-
abiFilters "armeabi", "armeabi-v7a"
59+
abiFilters "armeabi-v7a", "arm64-v8a", "x86_64"
4460
// abiFilters "armeabi", "armeabi-v7a","arm64-v8a", "x86", "arm64"
4561
}
4662
// TODO: Add your own signing config for the release build.
4763
// Signing with the debug keys for now, so `flutter run --release` works.
48-
signingConfig signingConfigs.debug
64+
signingConfig signingConfigs.release
4965
}
5066
}
5167
}
5268

53-
5469
dependencies {
55-
implementation "androidx.appcompat:appcompat:1.3.0"
70+
implementation "androidx.appcompat:appcompat:1.7.1"
5671
}
5772

5873
flutter {

0 commit comments

Comments
 (0)