Skip to content

Commit

Permalink
fix login being navigated to wrong page
Browse files Browse the repository at this point in the history
  • Loading branch information
vauvenal5 committed Jan 12, 2021
1 parent 66538d2 commit 96bfd70
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 37 deletions.
7 changes: 7 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/1705.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- introducing multi-select
- allow sharing of multiple images
- fix ripple effect on image tiles
- fix NC behinde subpath issue
- fix fixedOrigin propagation for root mapping
- replace button bar with bottom nav to align style and fix reder issue
- fix issue of app not being properly navigated to grant access site
72 changes: 36 additions & 36 deletions lib/views/screens/nc_login_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,44 @@ class NextCloudLoginScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Sign in..."),
),
body: WebView(
key: UniqueKey(),
initialUrl: this._url.toString(),
userAgent: "Nextcloud Yaga",
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
webViewController.loadUrl(
this._url.toString() + "/index.php/login/flow",
headers: <String, String>{"OCS-APIREQUEST": "true"});
},
navigationDelegate: (NavigationRequest request) {
if (request.url.startsWith("nc")) {
//string of type: nc://login/server:<server>&user:<loginname>&password:<password>
Map<String, String> ncParas = request.url
.split("nc://login/")[1]
.split("&")
.map((e) => e.split(":"))
.map((e) => <String, String>{e.removeAt(0): e.join(":")})
.reduce((value, element) {
value.addAll(element);
return value;
});
appBar: AppBar(
title: Text("Sign in..."),
),
body: WebView(
key: UniqueKey(),
userAgent: "Nextcloud Yaga",
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
webViewController.loadUrl(
this._url.toString() + "/index.php/login/flow",
headers: <String, String>{"OCS-APIREQUEST": "true"});
},
navigationDelegate: (NavigationRequest request) async {
if (request.url.startsWith("nc")) {
//string of type: nc://login/server:<server>&user:<loginname>&password:<password>
Map<String, String> ncParas = request.url
.split("nc://login/")[1]
.split("&")
.map((e) => e.split(":"))
.map((e) => <String, String>{e.removeAt(0): e.join(":")})
.reduce((value, element) {
value.addAll(element);
return value;
});

getIt.get<NextCloudManager>().loginCommand(NextCloudLoginData(
Uri.parse(ncParas[NextCloudLoginDataKeys.server]),
Uri.decodeComponent(ncParas[NextCloudLoginDataKeys.user]),
ncParas[NextCloudLoginDataKeys.password]));
getIt.get<NextCloudManager>().loginCommand(NextCloudLoginData(
Uri.parse(ncParas[NextCloudLoginDataKeys.server]),
Uri.decodeComponent(ncParas[NextCloudLoginDataKeys.user]),
ncParas[NextCloudLoginDataKeys.password]));

Navigator.popUntil(
context, ModalRoute.withName(YagaHomeScreen.route));
return NavigationDecision.prevent;
}
Navigator.popUntil(
context, ModalRoute.withName(YagaHomeScreen.route));
return NavigationDecision.prevent;
}

return NavigationDecision.navigate;
},
));
return NavigationDecision.navigate;
},
),
);
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: A Nextcloud gallary app.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.17.4+1704
version: 0.17.5+1705

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit 96bfd70

Please sign in to comment.