Skip to content

Commit

Permalink
fix: make httpRedirect enable whatever
Browse files Browse the repository at this point in the history
  • Loading branch information
andychucs committed Sep 28, 2024
1 parent 6d903f9 commit c26adf5
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions lib/providers/generatable/webview_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,27 +264,10 @@ class WebController extends _$WebController {
}

Future<void> httpRedirect() async {
if (!inKancolleWindow) {
WebUri? currentUrl = await controller.getUrl();
if (currentUrl == null) {
Toast.showError(title: "Get Url Fail");
return;
}
if (currentUrl.path.startsWith(Uri.parse(kGameUrl).path)) {
// May be HTTPS or HTTP
if (Platform.isIOS) {
await controller.injectJavascriptFileFromAsset(
assetFilePath: httpRedirectJS);
}
inKancolleWindow = true;
}
Toast.show(title: S.current.KCViewFuncMsgAutoGameRedirect);
log("HTTP Redirect success");
} else {
Toast.show(title: S.current.KCViewFuncMsgAlreadyGameRedirect);
log("HTTP Redirect fail");
}
log("inKancolleWindow: $inKancolleWindow");
await controller.injectJavascriptFileFromAsset(assetFilePath: httpRedirectJS);
inKancolleWindow = true;
Toast.show(title: S.current.KCViewFuncMsgAutoGameRedirect);
log("HTTP Redirect success");
}

Future<void> adjustWindow() async {
Expand Down

0 comments on commit c26adf5

Please sign in to comment.