diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 31d91f9..42cb02a 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -11,11 +11,11 @@ android:label="zhiying_comm_example" android:icon="@mipmap/ic_launcher" android:allowBackup="false" - tools:replace="android:label, android:allowBackup"> + tools:replace="android:label,android:allowBackup"> diff --git a/example/pubspec.lock b/example/pubspec.lock index 2a985fd..81f6614 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -23,7 +23,7 @@ packages: name: bloc url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.0" + version: "5.0.1" boolean_selector: dependency: transitive description: @@ -87,6 +87,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" + cubit: + dependency: transitive + description: + name: cubit + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2" cupertino_icons: dependency: "direct main" description: @@ -165,11 +172,9 @@ packages: flutter_alibc: dependency: transitive description: - path: "." - ref: "0.0.6" - resolved-ref: "159f123705b3e3dc28d6991df5b39b24a54c41a0" - url: "http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_flutter_alibc.git" - source: git + path: "../../zhiying_flutter_alibc" + relative: true + source: path version: "0.0.15" flutter_bloc: dependency: transitive @@ -177,7 +182,7 @@ packages: name: flutter_bloc url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.1" + version: "5.0.1" flutter_cache_manager: dependency: transitive description: @@ -185,6 +190,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.4.2" + flutter_cubit: + dependency: transitive + description: + name: flutter_cubit + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.1" flutter_native_image: dependency: transitive description: diff --git a/lib/util/taobao/taobao_auth.dart b/lib/util/taobao/taobao_auth.dart index 651e937..53c8991 100644 --- a/lib/util/taobao/taobao_auth.dart +++ b/lib/util/taobao/taobao_auth.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_alibc/alibc_model.dart'; import 'package:flutter_alibc/flutter_alibc.dart'; import 'package:fluttertoast/fluttertoast.dart'; +import 'package:package_info/package_info.dart'; import 'package:zhiying_comm/models/profile/profile_model.dart'; import 'package:zhiying_comm/pages/auth_page/auth_success_page/auth_success_page.dart'; import 'package:zhiying_comm/util/taobao/taobao_auth_alert.dart'; @@ -13,6 +14,14 @@ import 'package:provider/provider.dart'; class TaobaoAuth { // static ProfileModel _profile; + static String name = ""; + static String alibcAppKey = ""; + + static setParams({@required String name, @required String alibcAppKey}) { + TaobaoAuth.name = name; + TaobaoAuth.alibcAppKey = alibcAppKey; + } + // 淘宝授权 static Future auth(BuildContext context) async { bool isAuth = await TaobaoAuth.isAuth(); @@ -28,7 +37,8 @@ class TaobaoAuth { return TaobaoAuthAlert(); }); if (isConfirm != null && isConfirm == true) { - Map data = Map.from(await NetUtil.post('/api/v1/taobao/auth', method: NetMethod.GET)); + Map data = Map.from( + await NetUtil.post('/api/v1/taobao/auth', method: NetMethod.GET)); Logger.debug(data); if (data['code'] != 1) { return null; @@ -37,7 +47,20 @@ class TaobaoAuth { print("授权链接" + url); TradeResult result; if (Platform.isAndroid) { - result = await FlutterAlibc.openByUrl(url: url, backUrl: "alisdk://", isAuth: true); + // result = await FlutterAlibc.openByUrl(url: url, backUrl: "alisdk://", isAuth: true); + print("name: $name" + "\n" + "alibcAppKey: $alibcAppKey"); + var resultMsg = await FlutterAlibc.taoKeLoginNew(name, alibcAppKey); + + if (!EmptyUtil.isEmpty(resultMsg["accessToken"])) { + print("access 成功 $resultMsg"); + Map params = {}; + params['access_token'] = resultMsg["accessToken"]?.toString(); + await NetUtil.post('/api/v1/tbredirect', + params: params, method: NetMethod.POST); + } else { + print("access 失败 $resultMsg"); + Fluttertoast.showToast(msg: "access 失败 $resultMsg"); + } // if(result.errorCode=="0"){ // await Navigator.push(context,MaterialPageRoute(builder: (_)=>AuthSuccessPage(authResultType: AuthResultType.success,)) ); // }else{ @@ -46,7 +69,7 @@ class TaobaoAuth { } else if (Platform.isIOS) { result = await FlutterAlibc.openByUrl(url: url); } - Logger.log('${result.errorCode} ${result.errorMessage} '); + // Logger.log('${result.errorCode} ${result.errorMessage} '); // if(null != result && result.errorCode == '0'){ // Provider.of(context, listen: false).updateUserAuth(true); // } @@ -60,12 +83,14 @@ class TaobaoAuth { // return _profile.isAuth; // } try { - Map data = Map.from(await NetUtil.post('/api/v1/user/profile', method: NetMethod.GET)); + Map data = Map.from( + await NetUtil.post('/api/v1/user/profile', method: NetMethod.GET)); if (data['code'] == 1) { - ProfileModel _profile = ProfileModel.fromJson(Map.from(data['data'])); + ProfileModel _profile = + ProfileModel.fromJson(Map.from(data['data'])); return _profile.isAuth; } - }catch(e, s){ + } catch (e, s) { Logger.error(e, s); } return false; @@ -74,17 +99,17 @@ class TaobaoAuth { // 返回是否授权 static void initAuth(BuildContext context) async { try { - Map data = Map.from(await NetUtil.post('/api/v1/user/profile', method: NetMethod.GET)); + Map data = Map.from( + await NetUtil.post('/api/v1/user/profile', method: NetMethod.GET)); if (data['code'] == 1) { - ProfileModel model = ProfileModel.fromJson(Map.from(data['data'])); - if(null != model && model.isAuth){ + ProfileModel model = + ProfileModel.fromJson(Map.from(data['data'])); + if (null != model && model.isAuth) { Provider.of(context, listen: false).updateUserAuth(true); } } - }catch(e, s){ + } catch (e, s) { Logger.error(e, s); } - } - } diff --git a/pubspec.lock b/pubspec.lock index 56ab56f..fc11425 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -30,49 +30,56 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.1" + version: "2.5.0-nullsafety.1" bloc: dependency: transitive description: name: bloc url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.0" + version: "5.0.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" cached_network_image: dependency: "direct main" description: name: cached_network_image url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.0+1" + version: "2.5.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.flutter-io.cn" source: hosted - version: "1.14.12" + version: "1.15.0-nullsafety.3" convert: dependency: transitive description: @@ -93,14 +100,21 @@ packages: name: crypto url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.4" + version: "2.1.5" + cubit: + dependency: transitive + description: + name: cubit + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2" device_info: dependency: "direct main" description: name: device_info url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.2+9" + version: "0.4.2+10" device_info_platform_interface: dependency: transitive description: @@ -128,7 +142,7 @@ packages: name: equatable url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.5" + version: "1.2.6" event_bus: dependency: "direct main" description: @@ -136,6 +150,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0-nullsafety.1" ffi: dependency: transitive description: @@ -158,11 +179,9 @@ packages: flutter_alibc: dependency: "direct main" description: - path: "." - ref: "0.0.4" - resolved-ref: "9786cccfb44cd4b38f2ca3f1ff1dc139c4e09d61" - url: "http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_flutter_alibc.git" - source: git + path: "../zhiying_flutter_alibc" + relative: true + source: path version: "0.0.15" flutter_bloc: dependency: "direct main" @@ -170,21 +189,35 @@ packages: name: flutter_bloc url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.1" + version: "5.0.1" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.5.0" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager url: "https://pub.flutter-io.cn" source: hosted - version: "1.4.2" + version: "2.1.0" + flutter_cubit: + dependency: transitive + description: + name: flutter_cubit + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.1" flutter_native_image: dependency: "direct main" description: name: flutter_native_image url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.5+2" + version: "0.0.5+3" flutter_screenutil: dependency: "direct main" description: @@ -225,6 +258,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.0.1" + fluwx: + dependency: "direct main" + description: + name: fluwx + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.6.2" http: dependency: transitive description: @@ -245,7 +285,7 @@ packages: name: image url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.12" + version: "2.1.19" imei_plugin: dependency: "direct main" description: @@ -280,14 +320,14 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" moblink: dependency: "direct main" description: @@ -303,7 +343,7 @@ packages: name: mobsms url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.2" + version: "1.1.3" nested: dependency: transitive description: @@ -311,27 +351,34 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.0.4" + octo_image: + dependency: transitive + description: + name: octo_image + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.0" package_info: dependency: "direct main" description: name: package_info url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.3" + version: "0.4.3+4" path: dependency: transitive description: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.flutter-io.cn" source: hosted - version: "1.6.21" + version: "1.6.28" path_provider_linux: dependency: transitive description: @@ -345,28 +392,28 @@ packages: name: path_provider_macos url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.4+4" + version: "0.0.4+8" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.3" + version: "1.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.4+1" + version: "0.0.4+3" pedantic: dependency: transitive description: name: pedantic url: "https://pub.flutter-io.cn" source: hosted - version: "1.9.0" + version: "1.9.2" permission_handler: dependency: "direct main" description: @@ -382,14 +429,14 @@ packages: name: permission_handler_platform_interface url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.1" + version: "2.0.2" petitparser: dependency: transitive description: name: petitparser url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.0" + version: "3.1.0" photo_view: dependency: "direct main" description: @@ -424,34 +471,31 @@ packages: name: provider url: "https://pub.flutter-io.cn" source: hosted - version: "4.3.2+2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.1.3" + version: "4.3.3" rxdart: dependency: transitive description: name: rxdart url: "https://pub.flutter-io.cn" source: hosted - version: "0.24.1" + version: "0.25.0" save_image: dependency: "direct main" description: - name: save_image - url: "https://pub.flutter-io.cn" - source: hosted + path: "." + ref: "0.0.1" + resolved-ref: b719ab2d77298cbfa5ce3397d83d5ba253ed29c1 + url: "http://192.168.0.138:3000/FnuoOS_ZhiYing/save_image.git" + source: git version: "1.0.1" secverify: dependency: "direct main" description: - name: secverify - url: "https://pub.flutter-io.cn" - source: hosted + path: "." + ref: "0.0.2" + resolved-ref: "5ec756e9fe63339209cc6906a37a778952ac61f1" + url: "http://192.168.0.138:3000/FnuoOS_ZhiYing/secverify.git" + source: git version: "1.0.2" shared_preferences: dependency: "direct main" @@ -459,21 +503,21 @@ packages: name: shared_preferences url: "https://pub.flutter-io.cn" source: hosted - version: "0.5.12+2" + version: "0.5.12+4" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.2+2" + version: "0.0.2+4" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.1+10" + version: "0.0.1+11" shared_preferences_platform_interface: dependency: transitive description: @@ -494,13 +538,15 @@ packages: name: shared_preferences_windows url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.1+1" + version: "0.0.2+3" sharesdk_plugin: dependency: "direct main" description: - name: sharesdk_plugin - url: "https://pub.flutter-io.cn" - source: hosted + path: "." + ref: "0.0.1" + resolved-ref: f947c09803374acdc4fb720ccb5356d0779afe2f + url: "http://192.168.0.138:3000/FnuoOS_ZhiYing/sharesdk_plugin.git" + source: git version: "1.2.9" shimmer: dependency: "direct main" @@ -520,42 +566,42 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" sqflite: dependency: transitive description: name: sqflite url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.1+1" + version: "1.3.1+2" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.2+1" + version: "1.0.3+3" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.flutter-io.cn" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" synchronized: dependency: transitive description: @@ -569,14 +615,14 @@ packages: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.15" + version: "0.2.19-nullsafety.2" tobias: dependency: "direct main" description: @@ -592,49 +638,49 @@ packages: name: typed_data url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" url_launcher: dependency: "direct main" description: name: url_launcher url: "https://pub.flutter-io.cn" source: hosted - version: "5.7.5" + version: "5.7.10" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.1+1" + version: "0.0.1+4" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.1+8" + version: "0.0.1+9" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.8" + version: "1.0.9" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.4+1" + version: "0.1.5+3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.1+1" + version: "0.0.1+3" uuid: dependency: transitive description: @@ -648,35 +694,35 @@ packages: name: vector_math url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" webview_flutter: dependency: "direct main" description: name: webview_flutter url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.24" + version: "1.0.7" win32: dependency: transitive description: name: win32 url: "https://pub.flutter-io.cn" source: hosted - version: "1.7.3" + version: "1.7.4+1" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.0" + version: "0.1.2" xml: dependency: transitive description: name: xml url: "https://pub.flutter-io.cn" source: hosted - version: "3.6.1" + version: "4.5.1" sdks: - dart: ">=2.8.0 <3.0.0" - flutter: ">=1.16.0 <2.0.0" + dart: ">=2.10.0 <2.11.0" + flutter: ">=1.22.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c99a068..21ea213 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,10 +41,10 @@ dependencies: # app更新dialogUI(用于IOS,以便统一样式) flutter_update_dialog: 1.0.0 flutter_alibc: -# path: ../zhiying_flutter_alibc - git: - ref: 0.0.6 - url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_flutter_alibc.git + path: ../zhiying_flutter_alibc +# git: +# ref: 0.0.6 +# url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_flutter_alibc.git url_launcher: ^5.6.0 #图片预览控件 photo_view: ^0.10.3