Skip to content

Commit

Permalink
⚡ 025
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Nov 2, 2023
1 parent bcbef17 commit 846c323
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 26 deletions.
2 changes: 1 addition & 1 deletion ci/version.code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.5.5
v1.6.1
2 changes: 1 addition & 1 deletion ci/version.info.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
v1.5.5
v1.6.1

- [x] ♻️ Network
38 changes: 21 additions & 17 deletions lib/configs/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,8 @@ class _LoginDialogState extends State<_LoginDialog> {
margin: const EdgeInsets.all(10),
child: MaterialButton(
color: Colors.orange.shade700,
onPressed: () async {
String? fen = await chooseMapDialog(
context,
values: {
"国际分流1": "aHR0cHM6Ly8xOGNvbWljLnZpcC9zaWdudXA=",
"国际分流2": "aHR0cHM6Ly8xOGNvbWljLm9yZy9zaWdudXA=",
"东南亚分流3": "aHR0cHM6Ly9qbWNvbWljLm1lL3NpZ251cA==",
"东南亚分流4": "aHR0cHM6Ly9qbWNvbWljMS5tZS9zaWdudXA=",
"内地分流5": "aHR0cHM6Ly9qbS1jb21pYzIuY2Mvc2lnbnVw",
"分流7": "aHR0cHM6Ly9qbS1jb21pYy5vcmcvc2lnbnVw",
"分流8": "aHR0cHM6Ly9qbWNvbWljMi5ncm91cC9zaWdudXA=",
},
title: "选择注册分流",
);
if (fen != null) {
openUrl(String.fromCharCodes(base64Decode(fen)));
}
onPressed: () {
regxxx(context);
},
child: Container(
padding: const EdgeInsets.all(10),
Expand Down Expand Up @@ -223,3 +208,22 @@ class _LoginDialogState extends State<_LoginDialog> {
);
}
}

Future regxxx(BuildContext context) async {
String? fen = await chooseMapDialog(
context,
values: {
"國際通用網域1": "aHR0cHM6Ly8xOGNvbWljLnZpcC9zaWdudXA=",
"國際通用網域2": "aHR0cHM6Ly8xOGNvbWljLm9yZy9zaWdudXA=",
"东南亚分流1": "aHR0cHM6Ly9qbWNvbWljLm1lL3NpZ251cA==",
"东南亚分流2": "aHR0cHM6Ly9qbWNvbWljMS5tZS9zaWdudXA=",
"内地分流0": "aHR0cHM6Ly8xOGNvbWljLWdvZC5jYy9zaWdudXA=",
"内地分流1": "aHR0cHM6Ly8xOGNvbWljLWdvZC5jbHViL3NpZ251cA==",
"内地分流2": "aHR0cHM6Ly8xOGNvbWljLWdvZC54eXovc2lnbnVw",
},
title: "选择注册分流",
);
if (fen != null) {
openUrl(String.fromCharCodes(base64Decode(fen)));
}
}
2 changes: 1 addition & 1 deletion lib/screens/app_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class _AppScreenState extends State<AppScreen> {

late final List<AppScreenData> _screens = [
AppScreenData(
BrowserScreen(searchBarController: _searchBarController),
BrowserScreenWrapper(searchBarController: _searchBarController),
'浏览',
const Icon(Icons.menu_book_outlined),
const Icon(Icons.menu_book),
Expand Down
55 changes: 55 additions & 0 deletions lib/screens/browser_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,64 @@ import 'package:jasmine/screens/components/comic_pager.dart';
import 'package:jasmine/screens/components/content_builder.dart';
import 'package:jasmine/screens/components/floating_search_bar.dart';

import '../configs/login.dart';
import 'components/browser_bottom_sheet.dart';
import 'components/actions.dart';
import 'components/comic_floating_search_bar.dart';
import 'components/content_error.dart';
import 'components/content_loading.dart';

class BrowserScreenWrapper extends StatefulWidget {
final FloatingSearchBarController searchBarController;

const BrowserScreenWrapper({Key? key, required this.searchBarController})
: super(key: key);

@override
State<StatefulWidget> createState() => _BrowserScreenWrapperState();
}

class _BrowserScreenWrapperState extends State<BrowserScreenWrapper> {
@override
void initState() {
loginEvent.subscribe(_setState);
super.initState();
}

@override
void dispose() {
loginEvent.unsubscribe(_setState);
super.dispose();
}

void _setState(_) {
setState(() {});
}

@override
Widget build(BuildContext context) {
switch (loginStatus) {
case LoginStatus.loginSuccess:
return BrowserScreen(searchBarController: widget.searchBarController);
case LoginStatus.loginField:
return ContentError(
error: "请先登录",
stackTrace: StackTrace.current,
onRefresh: () async {},
);
case LoginStatus.logging:
return const ContentLoading(
label: "登录中",
);
case LoginStatus.notSet:
return ContentError(
error: "请先登录",
stackTrace: StackTrace.current,
onRefresh: () async {},
);
}
}
}

class BrowserScreen extends StatefulWidget {
final FloatingSearchBarController searchBarController;
Expand Down
24 changes: 19 additions & 5 deletions lib/screens/calculator_screen.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../basic/web_dav_sync.dart';
import '../configs/login.dart';
import '../configs/passed.dart';

import 'app_screen.dart';
import 'first_login_screen.dart';

class CalculatorScreen extends StatelessWidget {
const CalculatorScreen({Key? key}) : super(key: key);
Expand Down Expand Up @@ -556,11 +559,22 @@ class ContentBodyState extends State<ContentBody> {
btnclick(e) {
if (sums == "5686648") {
firstPassed().then((value) {
Navigator.pushReplacement(context, MaterialPageRoute(
builder: (BuildContext context) {
return const AppScreen();
},
));
if (loginStatus == LoginStatus.notSet) {
Future.delayed(Duration.zero, () async {
await webDavSyncAuto(context);
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) {
return firstLoginScreen;
}),
);
});
} else {
Navigator.pushReplacement(context, MaterialPageRoute(
builder: (BuildContext context) {
return const AppScreen();
},
));
}
});
}
for (var element in list) {
Expand Down
7 changes: 7 additions & 0 deletions lib/screens/first_login_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ class _FirstLoginScreenState extends State<FirstLoginScreen> {
_passwordField(),
apiHostSetting(),
cdnHostSetting(),
const Divider(),
ListTile(
title: const Text("注册"),
onTap: () {
regxxx(context);
},
),
],
),
);
Expand Down
10 changes: 10 additions & 0 deletions lib/screens/init_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class _InitScreenState extends State<InitScreen> {
try {
await methods.init();
await initConfigs();
print("STATE : ${loginStatus}");
if (!currentPassed()) {
Future.delayed(Duration.zero, () async {
await webDavSyncAuto(context);
Expand All @@ -70,6 +71,15 @@ class _InitScreenState extends State<InitScreen> {
}),
);
});
} else if (loginStatus == LoginStatus.notSet) {
Future.delayed(Duration.zero, () async {
await webDavSyncAuto(context);
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) {
return firstLoginScreen;
}),
);
});
} else {
Future.delayed(Duration.zero, () async {
await webDavSyncAuto(context);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: jasmine comic browser

publish_to: 'none'

version: 1.5.5+23
version: 1.6.1+23

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

0 comments on commit 846c323

Please sign in to comment.