Skip to content

Commit cf9f830

Browse files
committed
适配 iOS webview new login
1 parent 82c8647 commit cf9f830

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

ios/Podfile.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ PODS:
55
- device_info_plus (0.0.1):
66
- Flutter
77
- Flutter (1.0.0)
8+
- flutter_inappwebview (0.0.1):
9+
- Flutter
10+
- flutter_inappwebview/Core (= 0.0.1)
11+
- OrderedSet (~> 5.0)
12+
- flutter_inappwebview/Core (0.0.1):
13+
- Flutter
14+
- OrderedSet (~> 5.0)
815
- fluttertoast (0.0.2):
916
- Flutter
1017
- Toast
1118
- FMDB (2.7.5):
1219
- FMDB/standard (= 2.7.5)
1320
- FMDB/standard (2.7.5)
21+
- OrderedSet (5.0.0)
1422
- package_info_plus (0.4.5):
1523
- Flutter
1624
- path_provider_foundation (0.0.1):
@@ -36,6 +44,7 @@ DEPENDENCIES:
3644
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
3745
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
3846
- Flutter (from `Flutter`)
47+
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
3948
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
4049
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
4150
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
@@ -51,6 +60,7 @@ SPEC REPOS:
5160
- FMDB
5261
- Toast
5362
trunk:
63+
- OrderedSet
5464
- ReachabilitySwift
5565

5666
EXTERNAL SOURCES:
@@ -60,6 +70,8 @@ EXTERNAL SOURCES:
6070
:path: ".symlinks/plugins/device_info_plus/ios"
6171
Flutter:
6272
:path: Flutter
73+
flutter_inappwebview:
74+
:path: ".symlinks/plugins/flutter_inappwebview/ios"
6375
fluttertoast:
6476
:path: ".symlinks/plugins/fluttertoast/ios"
6577
package_info_plus:
@@ -83,8 +95,10 @@ SPEC CHECKSUMS:
8395
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
8496
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
8597
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
98+
flutter_inappwebview: 3d32228f1304635e7c028b0d4252937730bbc6cf
8699
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
87100
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
101+
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
88102
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
89103
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
90104
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,12 @@
479479
inputPaths = (
480480
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
481481
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
482+
"${BUILT_PRODUCTS_DIR}/OrderedSet/OrderedSet.framework",
482483
"${BUILT_PRODUCTS_DIR}/ReachabilitySwift/Reachability.framework",
483484
"${BUILT_PRODUCTS_DIR}/Toast/Toast.framework",
484485
"${BUILT_PRODUCTS_DIR}/connectivity_plus/connectivity_plus.framework",
485486
"${BUILT_PRODUCTS_DIR}/device_info_plus/device_info_plus.framework",
487+
"${BUILT_PRODUCTS_DIR}/flutter_inappwebview/flutter_inappwebview.framework",
486488
"${BUILT_PRODUCTS_DIR}/fluttertoast/fluttertoast.framework",
487489
"${BUILT_PRODUCTS_DIR}/package_info_plus/package_info_plus.framework",
488490
"${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework",
@@ -495,10 +497,12 @@
495497
name = "[CP] Embed Pods Frameworks";
496498
outputPaths = (
497499
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
500+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OrderedSet.framework",
498501
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
499502
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Toast.framework",
500503
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity_plus.framework",
501504
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info_plus.framework",
505+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview.framework",
502506
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fluttertoast.framework",
503507
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info_plus.framework",
504508
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework",

lib/page/login/login_webview.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:io';
2+
13
import 'package:flutter/foundation.dart';
24
import 'package:flutter/material.dart';
35
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
@@ -74,6 +76,24 @@ class _LoginWebViewState extends State<LoginWebView> {
7476
isLoading = true;
7577
});
7678
},
79+
initialOptions: Platform.isIOS
80+
? InAppWebViewGroupOptions(
81+
crossPlatform: InAppWebViewOptions(
82+
useShouldOverrideUrlLoading: true,
83+
))
84+
: null,
85+
shouldOverrideUrlLoading: (controller, navigationAction) async {
86+
var url = navigationAction.request.url!.toString();
87+
if (url.startsWith("gsygithubapp://authed")) {
88+
var code = Uri.parse(url).queryParameters["code"];
89+
if (kDebugMode) {
90+
print("code $code");
91+
}
92+
Navigator.of(context).pop(code);
93+
return NavigationActionPolicy.CANCEL;
94+
}
95+
return NavigationActionPolicy.ALLOW;
96+
},
7797
onLoadStop: (controller, url) async {
7898
setState(() {
7999
isLoading = false;

0 commit comments

Comments
 (0)