├── .github
└── workflows
│ ├── publish.yml
│ ├── publishable.yml
│ └── runnable.yml
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── CODEOWNERS
├── LICENSE
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── build.gradle
├── libs
│ ├── auth_number_product-2.12.15-log-online-standard-release.aar
│ ├── crashshield-2.1.4-release.aar
│ ├── logger-2.1.8-release.aar
│ └── main-2.1.8-release.aar
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── fluttercandies
│ │ └── flutter_ali_auth
│ │ ├── AuthClient.java
│ │ ├── FlutterAliAuthPlugin.java
│ │ ├── config
│ │ ├── BaseUIConfig.java
│ │ ├── CustomAuthUIControlClickListener.java
│ │ ├── DialogBackgroundDrawable.java
│ │ ├── DialogBottomConfig.java
│ │ ├── DialogPortConfig.java
│ │ ├── FullPortConfig.java
│ │ └── FullPortPrivacyConfig.java
│ │ ├── mask
│ │ └── DecoyMaskActivity.java
│ │ ├── model
│ │ ├── AuthModel.java
│ │ ├── AuthResponseModel.java
│ │ ├── AuthUIModel.java
│ │ └── CustomViewBlock.java
│ │ └── utils
│ │ ├── AppUtils.java
│ │ └── Constant.java
│ └── res
│ ├── anim
│ ├── slide_down.xml
│ ├── slide_up.xml
│ ├── stay_animation.xml
│ ├── zoom_in.xml
│ └── zoom_out.xml
│ ├── color
│ ├── privacy_alert_btn_color.xml
│ └── selector_bottom_item_color.xml
│ ├── drawable-xxhdpi
│ ├── a.png
│ ├── b.png
│ ├── ic_launcher.png
│ ├── icon_check.png
│ ├── icon_close.png
│ ├── icon_notification.png
│ ├── icon_return.png
│ ├── icon_uncheck.png
│ ├── login_btn_normal.png
│ ├── login_btn_press.png
│ └── login_btn_unable.png
│ ├── drawable
│ ├── dialog_page_background.xml
│ ├── login_btn_bg.xml
│ ├── mytel_app_launcher.png
│ ├── phone.png
│ ├── rectangle.xml
│ ├── right.xml
│ ├── selector_btn.xml
│ ├── shap_btn_normal.xml
│ └── shap_btn_press.xml
│ ├── layout
│ ├── activity_custom_web.xml
│ ├── custom_port_dialog_action_bar.xml
│ ├── custom_switch_other.xml
│ └── dialog_action_bar.xml
│ ├── raw
│ └── keep.xml
│ ├── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── network_security_config.xml
├── build.yaml
├── example
├── .gitignore
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── fluttercandies
│ │ │ │ │ └── flutter_ali_auth_example
│ │ │ │ │ └── MainActivity.java
│ │ │ └── res
│ │ │ │ ├── drawable-v21
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-night
│ │ │ │ └── styles.xml
│ │ │ │ ├── values
│ │ │ │ └── styles.xml
│ │ │ │ └── xml
│ │ │ │ └── network_security_config.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── images
│ ├── app_bg.png
│ ├── check_icon.png
│ ├── flutter_candies_logo.png
│ ├── icon_close_gray.png
│ ├── icon_flutter.png
│ ├── login_btn_normal.png
│ ├── login_btn_press.png
│ ├── login_btn_unable.png
│ ├── tb.png
│ ├── uncheck_icon.png
│ ├── wb.png
│ └── wx.png
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
├── lib
│ ├── main.dart
│ └── pages
│ │ ├── debug_page.dart
│ │ └── release_page.dart
├── pubspec.lock
└── pubspec.yaml
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── AuthUIBuilder
│ │ ├── AuthUIBuilder.swift
│ │ ├── BuildAlertModel.swift
│ │ ├── BuildBottomSheetModel.swift
│ │ └── BuildFullScreenModel.swift
│ ├── FlutterAliAuthPlugin.h
│ ├── FlutterAliAuthPlugin.m
│ ├── Model
│ │ ├── AuthConfig.swift
│ │ └── ResponseModel.swift
│ ├── SwiftFlutterAliAuthPlugin.swift
│ └── Utils
│ │ ├── ColorExtension.swift
│ │ ├── Constants.swift
│ │ └── WindowUtils.swift
├── flutter_ali_auth.podspec
└── frameworks
│ ├── ATAuthSDK.framework
│ ├── ATAuthSDK
│ ├── ATAuthSDK.bundle
│ │ ├── icon_check@2x.png
│ │ ├── icon_check@3x.png
│ │ ├── icon_close_gray@2x.png
│ │ ├── icon_close_gray@3x.png
│ │ ├── icon_nav_back_gray@2x.png
│ │ ├── icon_nav_back_gray@3x.png
│ │ ├── icon_nav_back_light@2x.png
│ │ ├── icon_nav_back_light@3x.png
│ │ ├── icon_uncheck@2x.png
│ │ └── icon_uncheck@3x.png
│ ├── Headers
│ │ ├── ATAuthSDK.h
│ │ ├── PNSReporter.h
│ │ ├── PNSReturnCode.h
│ │ ├── TXCommonHandler.h
│ │ ├── TXCommonUtils.h
│ │ └── TXCustomModel.h
│ ├── Info.plist
│ └── Modules
│ │ └── module.modulemap
│ ├── YTXMonitor.framework
│ ├── Headers
│ │ ├── ACMLogger.h
│ │ ├── ACMManager.h
│ │ ├── ACMMonitor.h
│ │ ├── ACMProtocol.h
│ │ └── YTXMonitor.h
│ ├── Info.plist
│ ├── Modules
│ │ └── module.modulemap
│ └── YTXMonitor
│ └── YTXOperators.framework
│ ├── Headers
│ ├── YTXNetUtils.h
│ ├── YTXOperators.h
│ └── YTXVendorService.h
│ ├── Info.plist
│ ├── Modules
│ └── module.modulemap
│ └── YTXOperators
├── lib
├── flutter_ali_auth.dart
└── src
│ ├── auth_config
│ ├── alert_ui_config.dart
│ ├── alert_ui_config.g.dart
│ ├── auth_config.dart
│ ├── auth_config.g.dart
│ ├── auth_ui_config.dart
│ ├── full_screen_ui_config.dart
│ ├── full_screen_ui_config.g.dart
│ ├── part_ui_config.dart
│ └── part_ui_config.g.dart
│ ├── auth_response_model
│ ├── auth_response_model.dart
│ ├── auth_response_model.g.dart
│ └── auth_result_code.dart
│ └── internal
│ ├── ali_auth_client.dart
│ ├── flutter_ali_auth_method_channel.dart
│ └── flutter_ali_auth_platform_interface.dart
└── pubspec.yaml
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish
2 |
3 | on:
4 | release:
5 | types: [ published ]
6 | workflow_dispatch:
7 |
8 | jobs:
9 | publish:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout repo
13 | uses: actions/checkout@v3
14 | - name: Publish
15 | uses: k-paxian/dart-package-publisher@master
16 | with:
17 | credentialJson: ${{ secrets.CREDENTIAL_JSON }}
18 | flutter: true
19 | skipTests: true
20 |
--------------------------------------------------------------------------------
/.github/workflows/publishable.yml:
--------------------------------------------------------------------------------
1 | name: Publishable
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 | branches:
9 | - main
10 |
11 | jobs:
12 | dry_run:
13 | name: Dry run publish on ${{ matrix.os }}
14 | if: github.repository == 'fluttercandies/flutter_ali_auth'
15 | runs-on: ${{ matrix.os }}
16 | strategy:
17 | matrix:
18 | os: [ ubuntu-latest ]
19 | steps:
20 | - uses: actions/checkout@v3
21 | - uses: k-paxian/dart-package-publisher@master
22 | with:
23 | credentialJson: ${{ secrets.CREDENTIAL_JSON }}
24 | flutter: true
25 | dryRunOnly: true
26 |
--------------------------------------------------------------------------------
/.github/workflows/runnable.yml:
--------------------------------------------------------------------------------
1 | name: Runnable (stable)
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 | branches:
9 | - main
10 |
11 | jobs:
12 | analyze:
13 | name: Analyze on ${{ matrix.os }}
14 | runs-on: ${{ matrix.os }}
15 | strategy:
16 | matrix:
17 | os: [ ubuntu-latest ]
18 | steps:
19 | - uses: actions/checkout@v3
20 | - uses: actions/setup-java@v3
21 | with:
22 | distribution: 'adopt'
23 | java-version: '11.x'
24 | - uses: subosito/flutter-action@v2
25 | with:
26 | channel: 'stable'
27 | - name: Log Dart/Flutter versions
28 | run: |
29 | dart --version
30 | flutter --version
31 | - name: Prepare dependencies
32 | run: flutter pub get
33 | - name: Analyse the repo
34 | run: flutter analyze lib example/lib
35 |
36 | test_iOS:
37 | needs: analyze
38 | name: Test iOS on ${{ matrix.os }}
39 | runs-on: ${{ matrix.os }}
40 | strategy:
41 | matrix:
42 | os: [ macos-latest ]
43 | steps:
44 | - uses: actions/checkout@v3
45 | - uses: actions/setup-java@v3
46 | with:
47 | distribution: 'adopt'
48 | java-version: '11.x'
49 | - uses: subosito/flutter-action@v2
50 | with:
51 | architecture: x64
52 | channel: 'stable'
53 | - run: dart --version
54 | - run: flutter --version
55 | - run: flutter pub get
56 | - run: cd example; flutter build ios --no-codesign
57 |
58 | test_android:
59 | needs: analyze
60 | name: Test Android on ${{ matrix.os }}
61 | runs-on: ${{ matrix.os }}
62 | strategy:
63 | matrix:
64 | os: [ ubuntu-latest ]
65 | steps:
66 | - uses: actions/checkout@v3
67 | - uses: actions/setup-java@v3
68 | with:
69 | distribution: 'adopt'
70 | java-version: '11.x'
71 | - uses: subosito/flutter-action@v2
72 | with:
73 | channel: 'stable'
74 | - run: dart --version
75 | - run: flutter --version
76 | - run: flutter pub get
77 | - run: sudo echo "y" | sudo $ANDROID_HOME/tools/bin/sdkmanager "ndk;21.4.7075529"
78 | - run: cd example; flutter build apk --debug
79 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26 | /pubspec.lock
27 | **/doc/api/
28 | .dart_tool/
29 | .packages
30 | build/
31 | example/lib/pages/config.dart
32 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
8 | channel: stable
9 |
10 | project_type: plugin
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
17 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
18 | - platform: android
19 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
20 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
21 | - platform: ios
22 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
23 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
24 |
25 | # User provided section
26 |
27 | # List of Local paths (relative to this file) that should be
28 | # ignored by the migrate tool.
29 | #
30 | # Files that are not part of the templates will be ignored by default.
31 | unmanaged_files:
32 | - 'lib/main.dart'
33 | - 'ios/Runner.xcodeproj/project.pbxproj'
34 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
4 |
5 | # Changelog
6 |
7 | ## 0.7.0
8 | ### 🚀 Update sdk to v2.12-1.15
9 |
10 | ## 0.6.2
11 | ### 😅 Fixed Android unexpected error
12 |
13 | * 😅 Fixed Android unexpected error
14 |
15 | ## 0.6.1
16 | ### 🦖 Added missing Android judgment
17 |
18 | * 🦖️️ Added missing Android judgment
19 |
20 | ## 0.6.0
21 | ### 🔨 Fix android timeout issue
22 |
23 | * 🙇🏻♂️️ loginWithConfig with timeout
24 |
25 | ## 0.5.0
26 | ### 💥 Improve code
27 |
28 | * 🙇🏻♂️️ loginWithConfig with timeout
29 |
30 | ## 0.4.1
31 | ### 🔨 Enhance Android.
32 |
33 | * ✂️ enhance android
34 | * 🧩 add removeHandler method
35 |
36 | ## 0.4.0+1
37 | ### 🔨 Fix unexpected bugs on Android.
38 |
39 | * 🤖 Fix unexpected bugs on Android.
40 |
41 | ## 0.4.0
42 | ### 💥 Break Change
43 |
44 | * ✂️ remove checkVerifyEnable,accelerateLoginPage
45 | * 🌓 enable dark mode support
46 | * 🧩 update Aliyun sdk Sync with official
47 |
48 | ## 0.3.1
49 | ### 🤖️fixed android token handle
50 |
51 | * 🧸 ️fixed android token handle
52 |
53 | ## 0.3.0
54 | ### 🤖️Enhance android format
55 |
56 | * 🧸 use new json format
57 |
58 | ## 0.2.0
59 | ### 🔮Improve code
60 |
61 | * ⚡️ add removeListener
62 | * 🔫 provide the original sdk method,such as hideLoading,quitLoginPage
63 | * 🔖 update example and readme
64 |
65 | **Full Changelog**: https://github.com/fluttercandies/flutter_ali_auth/commits/Releases
66 |
67 |
68 | ## 0.1.0
69 | ### :seedling: First Release
70 | >flutter_ali_auth's development is based on ali auth native access,which are quick to configure and easy to use.
71 | - Specify the configuration.
72 | - Start to listen the native event and initialized.
73 |
74 |
75 | - Initial release.
76 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @ManInTheWind
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Kangkang
4 |
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | analyzer:
4 | exclude:
5 | - lib/**/**.g.dart
6 | linter:
7 | rules:
8 | - require_trailing_commas
9 | - sort_constructors_first
10 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
10 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.fluttercandies.flutter_ali_auth'
2 | version '1.0'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | mavenCentral()
8 | }
9 |
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:7.1.2'
12 | }
13 | }
14 |
15 | rootProject.allprojects {
16 | repositories {
17 | google()
18 | mavenCentral()
19 | // 阿里云一键登录依赖
20 | flatDir{
21 | dirs project(":flutter_ali_auth").file("libs")
22 | }
23 | }
24 | }
25 |
26 | apply plugin: 'com.android.library'
27 |
28 | android {
29 | compileSdkVersion 31
30 |
31 | aaptOptions {
32 | noCompress "mov" //表示不让aapt压缩的文件后缀
33 | }
34 |
35 | compileOptions {
36 | sourceCompatibility JavaVersion.VERSION_1_8
37 | targetCompatibility JavaVersion.VERSION_1_8
38 | }
39 |
40 | defaultConfig {
41 | minSdkVersion 16
42 | }
43 |
44 | buildTypes {
45 |
46 | release {
47 | debuggable false
48 | // minifyEnabled true
49 | zipAlignEnabled false
50 | multiDexEnabled true
51 |
52 | }
53 |
54 | debug {
55 | // minifyEnabled false
56 | zipAlignEnabled false
57 | multiDexEnabled true
58 | }
59 | }
60 | }
61 |
62 | dependencies{
63 | implementation "androidx.appcompat:appcompat:1.4.1"
64 |
65 | implementation "androidx.constraintlayout:constraintlayout:2.1.0"
66 |
67 | // implementation 'com.alibaba.fastjson2:fastjson2:2.0.14.android'
68 | // https://mvnrepository.com/artifact/com.google.code.gson/gson
69 | implementation 'com.google.code.gson:gson:2.9.0'
70 | implementation(name:'auth_number_product-2.12.15-log-online-standard-release', ext:'aar')
71 | implementation(name:'crashshield-2.1.4-release', ext:'aar')
72 | implementation(name:'main-2.1.8-release', ext:'aar')
73 | implementation(name:'logger-2.1.8-release', ext:'aar')
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/android/libs/auth_number_product-2.12.15-log-online-standard-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_ali_auth/65a0891b1e648b246a9e0aef00fe23503dc0bb3d/android/libs/auth_number_product-2.12.15-log-online-standard-release.aar
--------------------------------------------------------------------------------
/android/libs/crashshield-2.1.4-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_ali_auth/65a0891b1e648b246a9e0aef00fe23503dc0bb3d/android/libs/crashshield-2.1.4-release.aar
--------------------------------------------------------------------------------
/android/libs/logger-2.1.8-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_ali_auth/65a0891b1e648b246a9e0aef00fe23503dc0bb3d/android/libs/logger-2.1.8-release.aar
--------------------------------------------------------------------------------
/android/libs/main-2.1.8-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_ali_auth/65a0891b1e648b246a9e0aef00fe23503dc0bb3d/android/libs/main-2.1.8-release.aar
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'flutter_ali_auth'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
19 |
20 |
21 |
24 |
31 |
32 |
39 |
40 |
46 |
47 |
48 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/android/src/main/java/com/fluttercandies/flutter_ali_auth/FlutterAliAuthPlugin.java:
--------------------------------------------------------------------------------
1 | package com.fluttercandies.flutter_ali_auth;
2 |
3 | import static com.fluttercandies.flutter_ali_auth.model.AuthResponseModel.failedListeningMsg;
4 |
5 | import android.app.Activity;
6 | import android.content.res.AssetManager;
7 | import android.util.Log;
8 |
9 | import androidx.annotation.NonNull;
10 |
11 | import com.fluttercandies.flutter_ali_auth.model.AuthResponseModel;
12 | import com.fluttercandies.flutter_ali_auth.utils.AppUtils;
13 | import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
14 |
15 | import java.lang.ref.WeakReference;
16 | import java.util.Objects;
17 |
18 | import io.flutter.embedding.engine.plugins.FlutterPlugin;
19 | import io.flutter.embedding.engine.plugins.activity.ActivityAware;
20 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
21 | import io.flutter.plugin.common.EventChannel;
22 | import io.flutter.plugin.common.MethodCall;
23 | import io.flutter.plugin.common.MethodChannel;
24 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
25 | import io.flutter.plugin.common.MethodChannel.Result;
26 |
27 | /**
28 | * FlutterAliAuthPlugin
29 | */
30 | public class FlutterAliAuthPlugin implements FlutterPlugin,
31 | MethodCallHandler, ActivityAware {
32 |
33 | public static final String TAG = FlutterAliAuthPlugin.class.getSimpleName();
34 |
35 |
36 | private AuthClient authClient;
37 |
38 | /// The MethodChannel that will the communication between Flutter and native Android
39 | ///
40 | /// This local reference serves to register the plugin with the Flutter Engine and unregister it
41 | /// when the Flutter Engine is detached from the Activity
42 |
43 |
44 | @Override
45 | public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
46 | MethodChannel methodChannel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_ali_auth");
47 | authClient = AuthClient.getInstance();
48 | authClient.setChannel(methodChannel);
49 | methodChannel.setMethodCallHandler(this);
50 | authClient.setFlutterPluginBinding(flutterPluginBinding);
51 | }
52 |
53 |
54 | @Override
55 | public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
56 | switch (call.method) {
57 | case "getPlatformVersion":
58 | result.success("Android " + android.os.Build.VERSION.RELEASE);
59 | break;
60 | case "getAliAuthVersion":
61 | getAliAuthVersion(result);
62 | break;
63 | case "init":
64 | authClient.initSdk(call.arguments, result);
65 | break;
66 | case "login":
67 | authClient.getLoginToken(call.arguments, result);
68 | break;
69 | case "loginWithConfig":
70 | authClient.getLoginTokenWithConfig(call.arguments, result);
71 | break;
72 | case "hideLoginLoading":
73 | authClient.hideLoginLoading();
74 | result.success(null);
75 | break;
76 | case "quitLoginPage":
77 | authClient.quitLoginPage();
78 | result.success(null);
79 | break;
80 | default:
81 | result.notImplemented();
82 | }
83 | }
84 |
85 | private void getAliAuthVersion(@NonNull Result result) {
86 | String version = PhoneNumberAuthHelper.getVersion();
87 | result.success("阿里云一键登录版本:" + version);
88 | }
89 |
90 | @Override
91 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
92 | authClient.setFlutterPluginBinding(null);
93 | authClient.getChannel().setMethodCallHandler(null);
94 | }
95 |
96 | @Override
97 | public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
98 | WeakReference activityWeakReference = new WeakReference<>(binding.getActivity());
99 | authClient.setActivity(activityWeakReference);
100 | }
101 |
102 | @Override
103 | public void onDetachedFromActivityForConfigChanges() {
104 | }
105 |
106 | @Override
107 | public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
108 | }
109 |
110 | @Override
111 | public void onDetachedFromActivity() {
112 | authClient.setFlutterPluginBinding(null);
113 | authClient.getChannel().setMethodCallHandler(null);
114 | authClient.setActivity(null);
115 | }
116 |
117 |
118 |
119 | // @Override
120 | // public void onListen(Object arguments, EventChannel.EventSink events) {
121 | // if (authClient.getEventSink() != null) {
122 | // authClient.getEventSink().endOfStream();
123 | // authClient.setEventSink(null);
124 | // }
125 | // authClient.setEventSink(events);
126 | // }
127 | //
128 | // @Override
129 | // public void onCancel(Object arguments) {
130 | // if (Objects.nonNull(authClient.getEventSink())) {
131 | // authClient.setEventSink(null);
132 | // }
133 | // Log.i(FlutterAliAuthPlugin.TAG, "取消监听" + authClient.getEventSink());
134 | // }
135 | }
136 |
--------------------------------------------------------------------------------
/android/src/main/java/com/fluttercandies/flutter_ali_auth/config/CustomAuthUIControlClickListener.java:
--------------------------------------------------------------------------------
1 | package com.fluttercandies.flutter_ali_auth.config;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 | import android.util.Log;
6 | import android.widget.Toast;
7 |
8 | import com.fluttercandies.flutter_ali_auth.AuthClient;
9 | import com.fluttercandies.flutter_ali_auth.R;
10 | import com.fluttercandies.flutter_ali_auth.model.AuthResponseModel;
11 | import com.mobile.auth.gatewayauth.AuthUIControlClickListener;
12 | import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
13 | import com.mobile.auth.gatewayauth.ResultCode;
14 |
15 | import org.json.JSONException;
16 | import org.json.JSONObject;
17 |
18 | import io.flutter.plugin.common.EventChannel;
19 | import io.flutter.plugin.common.MethodChannel;
20 |
21 | public class CustomAuthUIControlClickListener implements AuthUIControlClickListener {
22 | private PhoneNumberAuthHelper mAuthHelper;
23 | private Context mContext;
24 | private MethodChannel mChannel;
25 | public CustomAuthUIControlClickListener(PhoneNumberAuthHelper phoneNumberAuthHelper,
26 | Context context, MethodChannel methodChannel){
27 | mAuthHelper = phoneNumberAuthHelper;
28 | mContext = context;
29 | mChannel = methodChannel;
30 | }
31 | @Override
32 | public void onClick(String code, Context context, String jsonString) {
33 | JSONObject jsonObj = null;
34 | AuthResponseModel responseModel = null;
35 | try {
36 | if(!TextUtils.isEmpty(jsonString)) {
37 | jsonObj = new JSONObject(jsonString);
38 | }
39 | } catch (JSONException e) {
40 | jsonObj = new JSONObject();
41 | }
42 | Log.i("点击回调-","jsonObj:"+jsonObj);
43 | switch (code) {
44 | //点击授权页默认样式的返回按钮
45 | case ResultCode.CODE_ERROR_USER_CANCEL:
46 | responseModel = new AuthResponseModel();
47 | responseModel.setRequestId(Long.toString(System.currentTimeMillis()));
48 | responseModel.setResultCode(ResultCode.CODE_ERROR_USER_CANCEL);
49 | responseModel.setMsg("点击了授权页默认返回按钮");
50 | // fEventSink.success(responseModel.toJson());
51 | mChannel.invokeMethod(AuthClient.DART_CALL_METHOD_ON_INIT,responseModel.toJson());
52 | mAuthHelper.quitLoginPage();
53 | // mActivity.finish();
54 | break;
55 | //点击授权页默认样式的切换其他登录方式 会关闭授权页
56 | //如果不希望关闭授权页那就setSwitchAccHidden(true)隐藏默认的 通过自定义view添加自己的
57 | case ResultCode.CODE_ERROR_USER_SWITCH:
58 | responseModel = new AuthResponseModel();
59 | responseModel.setRequestId(Long.toString(System.currentTimeMillis()));
60 |
61 | responseModel.setResultCode(ResultCode.CODE_ERROR_USER_SWITCH);
62 | responseModel.setMsg("用户切换其他登录方式");
63 | // fEventSink.success(responseModel.toJson());
64 | mChannel.invokeMethod(AuthClient.DART_CALL_METHOD_ON_INIT,responseModel.toJson());
65 | break;
66 | //点击一键登录按钮会发出此回调
67 | //当协议栏没有勾选时 点击按钮会有默认toast 如果不需要或者希望自定义内容 setLogBtnToastHidden(true)隐藏默认Toast
68 | //通过此回调自己设置toast
69 | case ResultCode.CODE_ERROR_USER_LOGIN_BTN:
70 | if (!jsonObj.optBoolean("isChecked")) {
71 | Toast.makeText(mContext, R.string.custom_toast, Toast.LENGTH_SHORT).show();
72 | }
73 |
74 | break;
75 | //checkbox状态改变触发此回调
76 | case ResultCode.CODE_ERROR_USER_CHECKBOX:
77 | responseModel = new AuthResponseModel();
78 | responseModel.setRequestId(Long.toString(System.currentTimeMillis()));
79 |
80 | responseModel.setResultCode(ResultCode.CODE_ERROR_USER_CHECKBOX);
81 | responseModel.setMsg("checkbox状态变为" + jsonObj.optBoolean("isChecked"));
82 | // fEventSink.success(responseModel.toJson());
83 | mChannel.invokeMethod(AuthClient.DART_CALL_METHOD_ON_INIT,responseModel.toJson());
84 |
85 | break;
86 | //点击协议栏触发此回调
87 | case ResultCode.CODE_ERROR_USER_PROTOCOL_CONTROL:
88 | responseModel = new AuthResponseModel();
89 | responseModel.setRequestId(Long.toString(System.currentTimeMillis()));
90 |
91 | responseModel.setResultCode(ResultCode.CODE_ERROR_USER_PROTOCOL_CONTROL);
92 | responseModel.setMsg("点击协议," + "name: " + jsonObj.optString("name") + ", url: " + jsonObj.optString("url"));
93 | // fEventSink.success(responseModel.toJson());
94 | mChannel.invokeMethod(AuthClient.DART_CALL_METHOD_ON_INIT,responseModel.toJson());
95 |
96 | break;
97 | case ResultCode.CODE_START_AUTH_PRIVACY:
98 | responseModel = new AuthResponseModel();
99 | responseModel.setRequestId(Long.toString(System.currentTimeMillis()));
100 |
101 | responseModel.setResultCode(ResultCode.CODE_START_AUTH_PRIVACY);
102 | responseModel.setMsg("点击授权页一键登录按钮拉起了授权页协议二次弹窗");
103 | // fEventSink.success(responseModel.toJson());
104 | mChannel.invokeMethod(AuthClient.DART_CALL_METHOD_ON_INIT,responseModel.toJson());
105 |
106 | break;
107 | case ResultCode.CODE_AUTH_PRIVACY_CLOSE:
108 | responseModel = new AuthResponseModel();
109 | responseModel.setRequestId(Long.toString(System.currentTimeMillis()));
110 |
111 | responseModel.setResultCode(ResultCode.CODE_AUTH_PRIVACY_CLOSE);
112 | responseModel.setMsg("授权页协议二次弹窗已关闭");
113 | // fEventSink.success(responseModel.toJson());
114 | mChannel.invokeMethod(AuthClient.DART_CALL_METHOD_ON_INIT,responseModel.toJson());
115 |
116 | break;
117 | case ResultCode.CODE_CLICK_AUTH_PRIVACY_CONFIRM:
118 | responseModel = new AuthResponseModel();
119 | responseModel.setRequestId(Long.toString(System.currentTimeMillis()));
120 |
121 | responseModel.setResultCode(ResultCode.CODE_CLICK_AUTH_PRIVACY_CONFIRM);
122 | responseModel.setMsg("授权页协议二次弹窗点击同意并继续");
123 | // fEventSink.success(responseModel.toJson());
124 | mChannel.invokeMethod(AuthClient.DART_CALL_METHOD_ON_INIT,responseModel.toJson());
125 |
126 | break;
127 | case ResultCode.CODE_CLICK_AUTH_PRIVACY_WEBURL:
128 | responseModel = new AuthResponseModel();
129 | responseModel.setRequestId(Long.toString(System.currentTimeMillis()));
130 |
131 | responseModel.setResultCode(ResultCode.CODE_CLICK_AUTH_PRIVACY_WEBURL);
132 | responseModel.setMsg("点击授权页协议二次弹窗协议");
133 | // fEventSink.success(responseModel.toJson());
134 | mChannel.invokeMethod(AuthClient.DART_CALL_METHOD_ON_INIT,responseModel.toJson());
135 |
136 | break;
137 | default:
138 | break;
139 |
140 | }
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/android/src/main/java/com/fluttercandies/flutter_ali_auth/config/DialogBackgroundDrawable.java:
--------------------------------------------------------------------------------
1 | package com.fluttercandies.flutter_ali_auth.config;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.ColorFilter;
5 | import android.graphics.Paint;
6 | import android.graphics.Path;
7 | import android.graphics.PixelFormat;
8 | import android.graphics.Rect;
9 | import android.graphics.RectF;
10 | import android.graphics.drawable.Drawable;
11 |
12 | import androidx.annotation.NonNull;
13 | import androidx.annotation.Nullable;
14 |
15 | public class DialogBackgroundDrawable extends Drawable {
16 | /**
17 | * 背景
18 | */
19 | private Paint mPaint;
20 | /**
21 | * 边框
22 | */
23 | private Paint mStrokePaint;
24 | private Path mPath;
25 | private RectF mRectF;
26 | private float mCornerRadius;
27 | private Float mBorderWidth;
28 |
29 | public DialogBackgroundDrawable(float cornerRadius, int color, Float borderWidth, Integer borderColor) {
30 | mCornerRadius = cornerRadius;
31 | mBorderWidth = borderWidth;
32 | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
33 | mPaint.setColor(color);
34 | mPath = new Path();
35 | mRectF = new RectF();
36 | mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
37 | mStrokePaint.setStyle(Paint.Style.STROKE);
38 | mStrokePaint.setStrokeWidth(borderWidth);
39 | if (borderColor != null){
40 | mStrokePaint.setColor(borderColor);
41 | }
42 | }
43 |
44 |
45 | @Override
46 | public void draw(@NonNull Canvas canvas) {
47 | mPath.reset();
48 | mRectF.set(getBounds());
49 | if (mBorderWidth != null) {
50 | mRectF.inset(mBorderWidth / 2, mBorderWidth / 2);
51 | }
52 | mPath.addRoundRect(mRectF, mCornerRadius, mCornerRadius, Path.Direction.CW);
53 | canvas.drawPath(mPath, mPaint);
54 | canvas.drawPath(mPath, mStrokePaint);
55 | }
56 |
57 | @Override
58 | public void setAlpha(int alpha) {
59 | mPaint.setAlpha(alpha);
60 | }
61 |
62 | @Override
63 | public void setColorFilter(@Nullable ColorFilter colorFilter) {
64 | mPaint.setColorFilter(colorFilter);
65 | }
66 |
67 | @Override
68 | public int getOpacity() {
69 | return PixelFormat.TRANSLUCENT;
70 | }
71 |
72 | @Override
73 | protected void onBoundsChange(Rect bounds) {
74 | super.onBoundsChange(bounds);
75 | mRectF.set(bounds);
76 | }
77 |
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/android/src/main/java/com/fluttercandies/flutter_ali_auth/mask/DecoyMaskActivity.java:
--------------------------------------------------------------------------------
1 | package com.fluttercandies.flutter_ali_auth.mask;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.util.Log;
7 |
8 | import androidx.annotation.Nullable;
9 |
10 | import com.fluttercandies.flutter_ali_auth.AuthClient;
11 | import com.fluttercandies.flutter_ali_auth.utils.Constant;
12 | import com.fluttercandies.flutter_ali_auth.R;
13 | import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
14 |
15 | import java.util.concurrent.Executors;
16 | import java.util.concurrent.ScheduledExecutorService;
17 | import java.util.concurrent.TimeUnit;
18 |
19 | public class DecoyMaskActivity extends Activity {
20 |
21 |
22 | public static final String TAG = DecoyMaskActivity.class.getSimpleName();
23 |
24 | // public static boolean isRunning = false;
25 |
26 | @Override
27 | protected void onCreate(@Nullable Bundle savedInstanceState) {
28 | // isRunning = true;
29 | Log.i(TAG, "onCreate");
30 | AuthClient authClient = AuthClient.getInstance();
31 | AuthClient.decoyMaskActivity = this;
32 | // override the auth path open enter animation
33 | if (authClient.getAuthModel().getAuthUIStyle() == Constant.DIALOG_PORT) {
34 | overridePendingTransition(R.anim.zoom_in, R.anim.stay_animation);
35 | } else {
36 | overridePendingTransition(R.anim.slide_up, R.anim.stay_animation);
37 | }
38 | PhoneNumberAuthHelper authHelper = authClient.mAuthHelper;
39 | authHelper.getLoginToken(this.getBaseContext(), authClient.getLoginTimeout());
40 | super.onCreate(savedInstanceState);
41 | }
42 |
43 | boolean isPause = false;
44 |
45 | @Override
46 | protected void onPause() {
47 | Log.i(TAG, "onPause");
48 | isPause = true;
49 | super.onPause();
50 | }
51 |
52 | @Override
53 | protected void onResume() {
54 | Log.i(TAG, "onResume");
55 |
56 | if (isPause) {
57 | //TopActivityBack
58 | Runnable runnable = new Runnable() {
59 | @Override
60 | public void run() {
61 | finish();
62 | }
63 | };
64 | ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
65 | scheduledExecutorService.schedule(runnable, 0, TimeUnit.MILLISECONDS);
66 | }
67 | super.onResume();
68 | }
69 |
70 |
71 | @Override
72 | public void finish() {
73 | super.finish();
74 | Log.i(TAG, "finish");
75 | AuthClient.decoyMaskActivity = null;
76 | }
77 |
78 | @Override
79 | protected void onDestroy() {
80 | super.onDestroy();
81 | // isRunning = false;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/android/src/main/java/com/fluttercandies/flutter_ali_auth/model/AuthModel.java:
--------------------------------------------------------------------------------
1 | package com.fluttercandies.flutter_ali_auth.model;
2 |
3 | import androidx.annotation.NonNull;
4 |
5 | import com.google.gson.Gson;
6 |
7 | import org.json.JSONException;
8 | import org.json.JSONObject;
9 |
10 | import java.util.Map;
11 |
12 |
13 | public class AuthModel {
14 | private String androidSdk;
15 | private Boolean enableLog;
16 | private Integer authUIStyle;
17 | private AuthUIModel authUIModel;
18 |
19 | // @NonNull
20 | // static public AuthModel Builder(Object params) {
21 | // AuthModel authModel = new Gson().fromJson(params.toString(), AuthModel.class);
22 | //
23 | // AuthUIModel authUIModel = JSON.to(AuthUIModel.class, json);
24 | // //Integer authUIStyle = (Integer) json.get("authUIStyle");
25 | // Integer authUIStyle = authModel.authUIStyle;
26 | // authModel.setAndroidSdk(json.getString("androidSdk"));
27 | // authModel.setEnableLog(Boolean.valueOf(json.getString("enableLog")));
28 | // authModel.setAuthUIStyle(authUIStyle);
29 | // authModel.setAuthUIModel(authUIModel);
30 | // return authModel;
31 | // }
32 |
33 |
34 | public void setAndroidSdk(String androidSdk) {
35 | this.androidSdk = androidSdk;
36 | }
37 |
38 | public void setEnableLog(Boolean enableLog) {
39 | this.enableLog = enableLog;
40 | }
41 |
42 | public void setAuthUIStyle(Integer authUIStyle) {
43 | this.authUIStyle = authUIStyle;
44 | }
45 |
46 | public void setAuthUIModel(AuthUIModel authUIModel) {
47 | this.authUIModel = authUIModel;
48 | }
49 |
50 | public String getAndroidSdk() {
51 | return androidSdk;
52 | }
53 |
54 | public Boolean getEnableLog() {
55 | return enableLog;
56 | }
57 |
58 | public Integer getAuthUIStyle() {
59 | return authUIStyle;
60 | }
61 |
62 | public AuthUIModel getAuthUIModel() {
63 | return authUIModel;
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/android/src/main/java/com/fluttercandies/flutter_ali_auth/model/AuthResponseModel.java:
--------------------------------------------------------------------------------
1 | package com.fluttercandies.flutter_ali_auth.model;
2 |
3 |
4 | import android.text.TextUtils;
5 | import android.util.Log;
6 |
7 | import androidx.annotation.Nullable;
8 |
9 | import com.google.gson.Gson;
10 | import com.google.gson.reflect.TypeToken;
11 | import com.mobile.auth.gatewayauth.ResultCode;
12 | import com.mobile.auth.gatewayauth.model.TokenRet;
13 |
14 | import org.json.JSONException;
15 | import org.json.JSONObject;
16 |
17 | import java.lang.reflect.Type;
18 | import java.util.HashMap;
19 | import java.util.Map;
20 | import java.util.Objects;
21 |
22 | public class AuthResponseModel {
23 | private String resultCode;
24 | private String msg;
25 | private String requestId;
26 | private String token;
27 | private String innerMsg;
28 | private String innerCode;
29 |
30 | public static String initFailedMsg = "初始化失败或未初始化";
31 | public static String nullSdkErrorMsg = "初始化失败,sdk为空";
32 | public static String failedListeningMsg = "请先对插件进行监听";
33 | public static String errorArgumentsMsg = "初始化失败,[AuthModel]解析失败";
34 | public static String tokenDecodeFailedMsg = "回调信息解析失败";
35 | public static String MSG_GET_MASK_SUCCESS = "600016";
36 | public static String preLoginSuccessMsg = "预取号成功";
37 |
38 | public static AuthResponseModel customModel(String resultCode, String msg) {
39 | String now = Long.toString(System.currentTimeMillis());
40 | AuthResponseModel authResponseModel = new AuthResponseModel();
41 | authResponseModel.setResultCode(resultCode);
42 | authResponseModel.setRequestId(now);
43 | authResponseModel.setMsg(msg);
44 | return authResponseModel;
45 | }
46 |
47 | public static AuthResponseModel initFailed(@Nullable String msg) {
48 | String now = Long.toString(System.currentTimeMillis());
49 | assert msg != null;
50 | AuthResponseModel authResponseModel = new AuthResponseModel();
51 | authResponseModel.setResultCode(ResultCode.CODE_ERROR_INVALID_PARAM);
52 | authResponseModel.setMsg(msg);
53 | authResponseModel.setRequestId(now);
54 | return authResponseModel;
55 | }
56 |
57 | public static AuthResponseModel nullSdkError() {
58 | String now = Long.toString(System.currentTimeMillis());
59 | AuthResponseModel authResponseModel = new AuthResponseModel();
60 | authResponseModel.setResultCode(ResultCode.CODE_ERROR_ANALYZE_SDK_INFO);
61 | authResponseModel.setMsg(nullSdkErrorMsg);
62 | authResponseModel.setRequestId(now);
63 | return authResponseModel;
64 | }
65 |
66 | public static AuthResponseModel tokenDecodeFailed() {
67 | String now = Long.toString(System.currentTimeMillis());
68 | AuthResponseModel authResponseModel = new AuthResponseModel();
69 | authResponseModel.setResultCode(ResultCode.MSG_ERROR_UNKNOWN_FAIL);
70 | authResponseModel.setMsg(tokenDecodeFailedMsg);
71 | authResponseModel.setRequestId(now);
72 | return authResponseModel;
73 | }
74 |
75 | public static AuthResponseModel onCustomViewBlocTap(Integer viewId) {
76 | String now = Long.toString(System.currentTimeMillis());
77 | AuthResponseModel authResponseModel = new AuthResponseModel();
78 | authResponseModel.setResultCode("700010");
79 | authResponseModel.setMsg(viewId.toString());
80 | authResponseModel.setRequestId(now);
81 | return authResponseModel;
82 | }
83 |
84 | public static AuthResponseModel accelerateLoginPageSuccess() {
85 | String now = Long.toString(System.currentTimeMillis());
86 | AuthResponseModel authResponseModel = new AuthResponseModel();
87 | authResponseModel.setResultCode(MSG_GET_MASK_SUCCESS);
88 | authResponseModel.setMsg("加速拉起授权页面成功");
89 | authResponseModel.setRequestId(now);
90 | return authResponseModel;
91 | }
92 |
93 | public static AuthResponseModel fromTokenRect(TokenRet tokenRet) throws JSONException {
94 |
95 | //TokenRet{vendorName='ct_sjl', code='600024', msg='终端支持认证', carrierFailedResultData=', requestId=8147329b-1618-4b9f-98ce-02e468d237ba', requestCode=0, token='null'}
96 |
97 | AuthResponseModel authResponseModel = new AuthResponseModel();
98 |
99 | authResponseModel.setResultCode(tokenRet.getCode());
100 |
101 | authResponseModel.setRequestId(tokenRet.getRequestId());
102 |
103 | authResponseModel.setMsg(tokenRet.getMsg());
104 |
105 | String token = tokenRet.getToken();
106 |
107 | if (Objects.nonNull(token) && !TextUtils.isEmpty(token) && !String.valueOf(token).equals("null")) {
108 | authResponseModel.setToken(token);
109 | }
110 | Map carrierFailedResultData = null;
111 | if (Objects.nonNull(tokenRet.getCarrierFailedResultData()) && !TextUtils.isEmpty(tokenRet.getCarrierFailedResultData()) && !String.valueOf(tokenRet.getCarrierFailedResultData()).equals("null")) {
112 | Gson gson = new Gson();
113 | carrierFailedResultData = gson.fromJson(tokenRet.getCarrierFailedResultData(), new TypeToken