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 98cda99 commit 34fe305
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 53 deletions.
10 changes: 5 additions & 5 deletions ci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ name = "community-notify"
path = "src/community_notify/main.rs"

[dependencies]
anyhow = "1.0.56"
anyhow = "1.0.75"
reqwest = { version = "0.11.10", features = ["json"] }
serde = "1.0.136"
serde_derive = "1.0.136"
serde_json = "1.0.79"
tokio = { version = "1.17.0", features = ["full"] }
serde = { version = "1.0.190", features = ["derive"] }
serde_derive = "1.0.190"
serde_json = "1.0.108"
tokio = { version = "1.33.0", features = ["full"] }
teloxide = { version = "0.9", features = ["macros", "auto-send"] }
serenity = { version = "0.11", features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"], default-features = false }
2 changes: 1 addition & 1 deletion ci/version.code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.3
v0.2.5
2 changes: 1 addition & 1 deletion ci/version.info.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
v0.2.3
v0.2.5

- [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)));
}
}
3 changes: 0 additions & 3 deletions lib/configs/network_cdn_host.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ Future chooseCdnHost(BuildContext context) async {
"随机": "0",
"分流1": "1",
"分流2": "2",
"分流3": "3",
"分流4": "4",
"分流5": "5",
},
);
if (choose != null) {
Expand Down
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 @@ -4,12 +4,67 @@ import 'package:flutter/material.dart';
import 'package:jenny/basic/methods.dart';
import 'package:jenny/screens/components/comic_pager.dart';
import 'package:jenny/screens/components/content_builder.dart';
import 'package:jenny/screens/components/content_error.dart';
import 'package:jenny/screens/components/content_loading.dart';
import 'package:jenny/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';

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
48 changes: 28 additions & 20 deletions lib/screens/first_login_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,39 @@ class _FirstLoginScreenState extends State<FirstLoginScreen> {
actions: _logging
? []
: [
IconButton(
onPressed: () {
setState(() {
_onClickVersion++;
});
if (_onClickVersion >= 7) {
openUrl(String.fromCharCodes(base64Decode("aHR0cHM6Ly9qbWNvbWljMS5yb2Nrcy9zaWdudXA=")));
}
},
icon: Text(currentVersion()),
),
_saveButton,
],
IconButton(
onPressed: () {
setState(() {
_onClickVersion++;
});
if (_onClickVersion >= 7) {
openUrl(String.fromCharCodes(base64Decode(
"aHR0cHM6Ly9qbWNvbWljMS5yb2Nrcy9zaWdudXA=")));
}
},
icon: Text(currentVersion()),
),
_saveButton,
],
),
body: ListView(
children: _logging
? [
const Center(child: ContentLoading()),
]
const Center(child: ContentLoading()),
]
: [
_usernameField(),
_passwordField(),
apiHostSetting(),
cdnHostSetting(),
],
_usernameField(),
_passwordField(),
apiHostSetting(),
cdnHostSetting(),
const Divider(),
ListTile(
title: const Text("注册"),
onTap: () {
regxxx(context);
},
),
],
),
);
}
Expand Down
7 changes: 3 additions & 4 deletions lib/screens/init_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import 'package:jenny/basic/commons.dart';
import 'package:jenny/basic/methods.dart';
import 'package:jenny/configs/configs.dart';
import 'package:jenny/configs/login.dart';
import 'package:jenny/configs/passed.dart';
import 'package:jenny/screens/calculator_screen.dart';

import '../basic/web_dav_sync.dart';
import 'app_screen.dart';
Expand Down Expand Up @@ -61,12 +59,13 @@ class _InitScreenState extends State<InitScreen> {
try {
await methods.init();
await initConfigs();
if (!currentPassed()) {
print("STATE : ${loginStatus}");
if (loginStatus == LoginStatus.notSet) {
Future.delayed(Duration.zero, () async {
await webDavSyncAuto(context);
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) {
return const CalculatorScreen();
return firstLoginScreen;
}),
);
});
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: jenny comic browser

publish_to: 'none'

version: 0.2.3+23
version: 0.2.2+22

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

0 comments on commit 34fe305

Please sign in to comment.