From 3b919e7436fb9b5a816d150291f2e0215febc7c2 Mon Sep 17 00:00:00 2001 From: niuhuan Date: Wed, 21 Jun 2023 07:12:44 +0800 Subject: [PATCH] :rocket: Upgrade --- .github/workflows/Release.yml | 34 +++-- README.md | 8 +- .../opensource/{wax => wax22}/MainActivity.kt | 0 android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- ci/version.code.txt | 2 +- ci/version.info.txt | 10 +- ios/Podfile.lock | 4 +- ios/Runner.xcodeproj/project.pbxproj | 1 + lib/basic/methods.dart | 22 ++-- lib/configs/host.dart | 39 ++++-- lib/configs/versions.dart | 116 +++++++++++++++++ lib/screens/browser_screen.dart | 4 +- lib/screens/comic_reader_screen.dart | 4 +- .../components/browser_bottom_sheet.dart | 2 +- lib/screens/components/comic_pager.dart | 2 +- lib/screens/first_login_screen.dart | 123 +++++++++++++++--- lib/screens/init_screen.dart | 2 +- lib/screens/pro_screen.dart | 55 ++++++-- lib/screens/search_screen.dart | 4 +- protos/properties.proto | 4 - pubspec.lock | 100 +++++++------- pubspec.yaml | 10 +- 23 files changed, 409 insertions(+), 143 deletions(-) rename android/app/src/main/kotlin/opensource/{wax => wax22}/MainActivity.kt (100%) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 4045c39..5398c54 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -64,28 +64,34 @@ jobs: flutter_version: '2.10.3' - target: ios host: macos-latest - flutter_version: '3.7.3' + flutter_version: '3.10.5' - target: ios host: macos-latest flutter_version: '2.10.5' - target: android-arm32 host: ubuntu-20.04 flutter_version: '2.10.5' + jdk_version: '8' - target: android-arm64 host: ubuntu-20.04 flutter_version: '2.10.5' + jdk_version: '8' - target: android-x86_64 host: ubuntu-20.04 flutter_version: '2.10.5' + jdk_version: '8' - target: android-arm32 host: ubuntu-20.04 - flutter_version: '3.7.3' + flutter_version: '3.10.5' + jdk_version: '17' - target: android-arm64 host: ubuntu-20.04 - flutter_version: '3.7.3' + flutter_version: '3.10.5' + jdk_version: '17' - target: android-x86_64 host: ubuntu-20.04 - flutter_version: '3.7.3' + flutter_version: '3.10.5' + jdk_version: '17' runs-on: ${{ matrix.config.host }} @@ -200,7 +206,7 @@ jobs: if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' ) uses: actions/setup-java@v3 with: - java-version: 8 + java-version: ${{ matrix.config.jdk_version }} distribution: 'zulu' - name: Setup android tools (Android) @@ -240,19 +246,21 @@ jobs: go install github.com/go-flutter-desktop/hover@latest - name: Upgrade deps version (Android) - if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.host != 'macos-latest' && startsWith(matrix.config.flutter_version, '3') + if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.host != 'macos-latest' && startsWith(matrix.config.flutter_version, '2') run: | - sed -i "s/another_xlider: 1.0.1+2/another_xlider: ^1.0.1+2/g" pubspec.yaml - sed -i "s/flutter_styled_toast: 2.0.0/flutter_styled_toast: ^2.0.0/g" pubspec.yaml - sed -i "s/modal_bottom_sheet: 2.0.1/modal_bottom_sheet: ^3.0.0-pre/g" pubspec.yaml + sed -i "s/another_xlider: ^1.0.1+2/another_xlider: 1.0.1+2/g" pubspec.yaml + sed -i "s/flutter_styled_toast: ^2.0.0/flutter_styled_toast: 2.0.0/g" pubspec.yaml + sed -i "s/modal_bottom_sheet: ^3.0.0-pre/modal_bottom_sheet: 2.0.1/g" pubspec.yaml + sed -i "s/photo_view: ^0.14.0/photo_view: 0.13.0/g" pubspec.yaml - name: Upgrade deps version (iOS) - if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.host == 'macos-latest' && startsWith(matrix.config.flutter_version, '3') + if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.host == 'macos-latest' && startsWith(matrix.config.flutter_version, '2') run: | brew install gnu-sed - gsed -i "s/another_xlider: 1.0.1+2/another_xlider: ^1.0.1+2/g" pubspec.yaml - gsed -i "s/flutter_styled_toast: 2.0.0/flutter_styled_toast: ^2.0.0/g" pubspec.yaml - gsed -i "s/modal_bottom_sheet: 2.0.1/modal_bottom_sheet: ^3.0.0-pre/g" pubspec.yaml + gsed -i "s/another_xlider: ^1.0.1+2/another_xlider: 1.0.1+2/g" pubspec.yaml + gsed -i "s/flutter_styled_toast: ^2.0.0/flutter_styled_toast: 2.0.0/g" pubspec.yaml + gsed -i "s/modal_bottom_sheet: ^3.0.0-pre/modal_bottom_sheet: 2.0.1/g" pubspec.yaml + gsed -i "s/photo_view: ^0.14.0/photo_view: 0.13.0/g" pubspec.yaml - name: Install go mobile (mobile) if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'ios' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-arm32' || matrix.config.target == 'android-x86_64' ) diff --git a/README.md b/README.md index 9200458..5d46b92 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,11 @@ wax [![downloads](https://img.shields.io/github/downloads/niuhuan/wax/total)](https://github.com/niuhuan/wax/releases) - 美观易用且无广告的漫画客户端, 能运行在Windows/MacOS/Linux/Android/IOS中。 -- 此APP只是个客户端,不包含任何内容。需要您自行寻找漫画源使用。 -- 部分漫画源内容存在限制级别内容(例如 露骨/血腥/暴力/吸毒),18岁以下的用户需在监护人陪同下使用,并请您在遵守当地法律法规。 -- 您的star是对开发者的莫大鼓励,源仓库地址 [https://github.com/niuhuan/wax](https://github.com/niuhuan/wax) +- 此APP内容存在限制级别内容(例如 露骨/血腥/暴力/吸毒),18岁以下的用户需在监护人陪同下使用,并请您在遵守当地法律法规。 +- 您的star和issue是对开发者的莫大鼓励, 可以源仓库下载最新的源码/安装包, 表示支持/提出建议。 +- 源仓库地址 [https://github.com/niuhuan/wax](https://github.com/niuhuan/wax) + + ## 技术架构 diff --git a/android/app/src/main/kotlin/opensource/wax/MainActivity.kt b/android/app/src/main/kotlin/opensource/wax22/MainActivity.kt similarity index 100% rename from android/app/src/main/kotlin/opensource/wax/MainActivity.kt rename to android/app/src/main/kotlin/opensource/wax22/MainActivity.kt diff --git a/android/build.gradle b/android/build.gradle index 4256f91..63deb8f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:7.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index bc6a58a..cfe88f6 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/ci/version.code.txt b/ci/version.code.txt index f2c59f1..24e56e0 100644 --- a/ci/version.code.txt +++ b/ci/version.code.txt @@ -1 +1 @@ -v1.1.13 \ No newline at end of file +v1.2.1 \ No newline at end of file diff --git a/ci/version.info.txt b/ci/version.info.txt index 2d27924..7f47265 100644 --- a/ci/version.info.txt +++ b/ci/version.info.txt @@ -1,2 +1,8 @@ -v1.1.13 -- [x] 🚀FF +v1.2.1 +- [x] 🚀修复分流 +- [x] 🚀修复登录动画 +- [x] 🚀请重新注册以前一样的用户名 + +计划 +- [ ] 🚀代理设置 +- [ ] 🚀导出 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a071356..8ac807a 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,6 +1,6 @@ PODS: - Flutter (1.0.0) - - permission_handler_apple (9.0.4): + - permission_handler_apple (9.1.0): - Flutter - url_launcher_ios (0.0.1): - Flutter @@ -20,7 +20,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce + permission_handler_apple: 8f116445eff3c0e7c65ad60f5fef5490aa94b4e4 url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index c04e908..2856ba1 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -208,6 +208,7 @@ files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( diff --git a/lib/basic/methods.dart b/lib/basic/methods.dart index 6587ec5..83dd87e 100644 --- a/lib/basic/methods.dart +++ b/lib/basic/methods.dart @@ -189,6 +189,17 @@ class Methods { )); } + Future reloadPro() async { + return IsPro.fromBuffer(await _flatInvoke( + "reloadPro", + Empty(), + )); + } + + Future inputCdKey(String k) { + return _flatInvoke("inputCdKey", Puff(value: k)); + } + Future saveViewInfo(ComicInfoResult info) async { // todo } @@ -338,15 +349,4 @@ class Methods { ), ); } - - Future setIsPro( - bool isPro, - ) async { - return _flatInvoke( - "setIsPro", - SetIsPro( - isPro: isPro, - ), - ); - } } diff --git a/lib/configs/host.dart b/lib/configs/host.dart index fcdcd7a..ebde98c 100644 --- a/lib/configs/host.dart +++ b/lib/configs/host.dart @@ -3,11 +3,24 @@ import 'package:flutter/material.dart'; import 'package:wax/basic/commons.dart'; import 'package:wax/basic/methods.dart'; +const _defaultHost = "https://www.wnacg.com"; +const _hostMap = { + "https://www.wnacg.com": "MAIN", + "https://www.htmanga9.top": "TOP9", +}; + late String host; final hostEvent = Event(); Future initHost() async { + if (await methods.loadProperty(k: "fc_host") == "") { + await methods.saveProperty(k: "fc_host", v: "true"); + await methods.saveProperty(k: "host", v: _defaultHost); + } host = await methods.loadProperty(k: "host"); + if (host == "") { + host = _defaultHost; + } } Future _updateHost(String choose) async { @@ -16,15 +29,25 @@ Future _updateHost(String choose) async { hostEvent.broadcast(); } +currentHost() { + return _hostMap[host] ?? "自定义"; +} + Future chooseHost(BuildContext context) async { - var choose = await displayTextInputDialog(context, src: host); - if (choose != null) { - // 正则判断是否未网站uri - if (!RegExp(r"^https://[A-Za-z0-9\-_]+(\.[A-Za-z0-9\-_]+)+$").hasMatch(choose)) { - defaultToast(context, "请输入正确的网站地址, 必须以https开头, 结尾不能添加斜线。例如 https://aa.bb.cc"); - return; + var choose = + await chooseListDialog(context, values: ["选择预设", "手动输入"], title: '分流'); + if ("选择预设" == choose) { + choose = await chooseMapDialog(context, + title: "分流", + values: _hostMap.map((key, value) => MapEntry(value, key))); + if (choose != null) { + await _updateHost(choose); + } + } else if ("手动输入" == choose) { + choose = await displayTextInputDialog(context, src: host); + if (choose != null) { + await _updateHost(choose); } - await _updateHost(choose); } } @@ -33,7 +56,7 @@ Widget hostSetting() { builder: (BuildContext context, void Function(void Function()) setState) { return ListTile( title: const Text("分流"), - subtitle: Text(host), + subtitle: Text("${_hostMap[host]} (登录注册不上试试换分流或改变网络)"), onTap: () async { await chooseHost(context); setState(() {}); diff --git a/lib/configs/versions.dart b/lib/configs/versions.dart index 7b858f4..74a030c 100644 --- a/lib/configs/versions.dart +++ b/lib/configs/versions.dart @@ -1,10 +1,16 @@ import 'package:flutter/gestures.dart'; import 'dart:async' show Future; +import 'dart:convert'; import 'package:event/event.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show rootBundle; +import 'package:wax/basic/methods.dart'; + import '../basic/commons.dart'; +import '../screens/components/badge.dart'; +const _releasesUrl = "https://github.com/niuhuan/wax/releases"; +const _versionUrl = "https://api.github.com/repos/niuhuan/wax/releases/latest"; const _versionAssets = 'lib/assets/version.txt'; RegExp _versionExp = RegExp(r"^v\d+\.\d+.\d+$"); @@ -55,6 +61,17 @@ bool dirtyVersion() { // maybe exception Future _versionCheck() async { + if (_versionExp.hasMatch(_version)) { + var json = jsonDecode(await methods.httpGet(url: _versionUrl)); + if (json["name"] != null) { + String latestVersion = (json["name"]); + if (latestVersion != _version) { + _latestVersion = latestVersion; + _latestVersionInfo = json["body"] ?? ""; + } + } + } // else dirtyVersion + versionEvent.broadcast(); } String formatDateTimeToDateTime(DateTime c) { @@ -86,12 +103,56 @@ class _VersionInfoState extends State { height: 1.3, ), ), + Row( + children: [ + const Text( + "检查更新 : ", + style: TextStyle( + height: 1.3, + ), + ), + "dirty" == _version + ? _buildDirty() + : _buildNewVersion(_latestVersion), + Expanded(child: Container()), + ], + ), + _buildNewVersionInfo(_latestVersionInfo), ], ), ); } Widget _buildNewVersion(String? latestVersion) { + if (latestVersion != null) { + return Text.rich( + TextSpan( + children: [ + WidgetSpan( + child: VersionBadged( + child: Container( + padding: const EdgeInsets.only(right: 12), + child: Text( + latestVersion, + style: const TextStyle(height: 1.3), + ), + ), + ), + ), + const TextSpan(text: " "), + TextSpan( + text: "去下载", + style: TextStyle( + height: 1.3, + color: Theme.of(context).colorScheme.primary, + ), + recognizer: TapGestureRecognizer() + ..onTap = () => openUrl(_releasesUrl), + ), + ], + ), + ); + } return Text.rich( TextSpan( children: [ @@ -119,6 +180,61 @@ class _VersionInfoState extends State { ), ); } + + Widget _buildDirty() { + return VersionBadged( + child: Text.rich( + TextSpan( + text: "下载RELEASE版 ", + style: TextStyle( + height: 1.3, + color: Theme.of(context).colorScheme.primary, + ), + recognizer: TapGestureRecognizer() + ..onTap = () => openUrl(_releasesUrl), + ), + ), + ); + } + + Widget _buildNewVersionInfo(String? latestVersionInfo) { + if (latestVersionInfo != null) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider(), + const Text("更新内容:"), + Container( + padding: EdgeInsets.all(15), + child: Text( + latestVersionInfo, + style: TextStyle(), + ), + ), + ], + ); + } + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider(), + Container( + padding: const EdgeInsets.all(15), + child: Text.rich( + TextSpan( + text: "去RELEASE仓库", + style: TextStyle( + height: 1.3, + color: Theme.of(context).colorScheme.primary, + ), + recognizer: TapGestureRecognizer() + ..onTap = () => openUrl(_releasesUrl), + ), + ), + ), + ], + ); + } } var _display = true; diff --git a/lib/screens/browser_screen.dart b/lib/screens/browser_screen.dart index 1db7c5d..e6795e6 100644 --- a/lib/screens/browser_screen.dart +++ b/lib/screens/browser_screen.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:flutter_search_bar/flutter_search_bar.dart'; +import 'package:flutter_search_bar/flutter_search_bar.dart' as sb; import 'package:wax/basic/methods.dart'; import 'package:wax/configs/host.dart'; import 'package:wax/protos/properties.pb.dart'; @@ -57,7 +57,7 @@ class _BrowserScreenState extends State versionPop(context); } - late final SearchBar _searchBar = SearchBar( + late final sb.SearchBar _searchBar = sb.SearchBar( hintText: '搜索', inBar: false, setState: setState, diff --git a/lib/screens/comic_reader_screen.dart b/lib/screens/comic_reader_screen.dart index 45ff8e8..ebdf08b 100644 --- a/lib/screens/comic_reader_screen.dart +++ b/lib/screens/comic_reader_screen.dart @@ -226,8 +226,8 @@ abstract class _ComicReaderState extends State<_ComicReader> { Future _onFullScreenChange(bool fullScreen) async { setState(() { - SystemChrome.setEnabledSystemUIOverlays( - fullScreen ? [] : SystemUiOverlay.values); + SystemChrome.setEnabledSystemUIMode( + SystemUiMode.manual, overlays: fullScreen ? [] : SystemUiOverlay.values); _fullScreen = fullScreen; }); } diff --git a/lib/screens/components/browser_bottom_sheet.dart b/lib/screens/components/browser_bottom_sheet.dart index 63fba74..c8730bc 100644 --- a/lib/screens/components/browser_bottom_sheet.dart +++ b/lib/screens/components/browser_bottom_sheet.dart @@ -125,7 +125,7 @@ class _BrowserBottomSheetState extends State<_BrowserBottomSheet> { Expanded(child: Container()), _bottomIcon( icon: Icons.repeat_one, - title: host, + title: currentHost(), onPressed: () async { await chooseHost(context); setState(() {}); diff --git a/lib/screens/components/comic_pager.dart b/lib/screens/components/comic_pager.dart index 686ca5d..a81a8ac 100644 --- a/lib/screens/components/comic_pager.dart +++ b/lib/screens/components/comic_pager.dart @@ -160,7 +160,7 @@ class _StreamPagerState extends State<_StreamPager> { padding: const EdgeInsets.only(top: 10, bottom: 10), child: const Icon(Icons.sync_problem_rounded), ), - const Text('出错, 点击重试'), + const Text(' 出错, 点击重试'), ], ), ), diff --git a/lib/screens/first_login_screen.dart b/lib/screens/first_login_screen.dart index 3feb57c..45f4ebe 100644 --- a/lib/screens/first_login_screen.dart +++ b/lib/screens/first_login_screen.dart @@ -20,18 +20,76 @@ class FirstLoginScreen extends StatefulWidget { } class _FirstLoginScreenState extends State { + bool _logging = false; + String _username = ""; + String _password = ""; + int _onClickVersion = 0; + + Widget _usernameField() { + return ListTile( + title: const Text("账号"), + subtitle: Text(_username), + onTap: () async { + final input = await displayTextInputDialog( + context, + hint: "请输入账号", + title: "账号", + src: _username, + ); + if (input != null) { + setState(() { + _username = input; + }); + } + }, + ); + } + + Widget _passwordField() { + return ListTile( + title: const Text("密码"), + subtitle: Text(_password.isEmpty ? "" : '********'), + onTap: () async { + final input = await displayTextInputDialog( + context, + hint: "请输入密码", + title: "密码", + isPasswd: true, + src: _password, + ); + if (input != null) { + setState(() { + _password = input; + }); + } + }, + ); + } late final _saveButton = IconButton( onPressed: () async { - if (host.isEmpty) { - defaultToast(context, "请填写分流"); - return; + setState(() { + _logging = true; + }); + try { + await methods.login(_username, _password); + try { + await reloadIsPro(); + } catch (e, s) { + print("$e\n$s"); + } + Navigator.pushReplacement(context, MaterialPageRoute( + builder: (BuildContext context) { + return const AppScreen(); + }, + )); + } catch (e, s) { + print("$e\n$s"); + defaultToast(context, "$e", duration: 7); + setState(() { + _logging = false; + }); } - Navigator.pushReplacement(context, MaterialPageRoute( - builder: (BuildContext context) { - return const AppScreen(); - }, - )); }, icon: const Icon(Icons.save), ); @@ -41,15 +99,48 @@ class _FirstLoginScreenState extends State { return Scaffold( appBar: AppBar( title: const Text("登录"), - actions: [ - _saveButton, - ], - ), - body: ListView( - children: [ - hostSetting(), - ], + actions: _logging + ? [] + : [ + SizedBox( + width: 80, + child: IconButton( + onPressed: () async { + setState(() { + _onClickVersion++; + }); + if (_onClickVersion >= 7) { + setState(() { + _logging = true; + }); + try { + if (await registerDialog(context)) { + defaultToast(context, "注册成功", duration: 10); + } + } catch (e, s) { + print("$e\n$s"); + defaultToast(context, "$e", duration: 8); + } + setState(() { + _logging = false; + }); + } + }, + icon: Text(currentVersion()), + ), + ), + _saveButton, + ], ), + body: _logging + ? const Center(child: ContentLoading()) + : ListView( + children: [ + _usernameField(), + _passwordField(), + hostSetting(), + ], + ), ); } } diff --git a/lib/screens/init_screen.dart b/lib/screens/init_screen.dart index 9aad561..627707f 100644 --- a/lib/screens/init_screen.dart +++ b/lib/screens/init_screen.dart @@ -48,7 +48,7 @@ class _InitScreenState extends State { await initDownloadThreadCount(); autoCheckNewVersion(); await initLogin(); - if (host.isEmpty) { + if (await methods.loadProperty(k: "last_username") == "") { Future.delayed(Duration.zero, () async { Navigator.of(context).pushReplacement( MaterialPageRoute(builder: (BuildContext context) { diff --git a/lib/screens/pro_screen.dart b/lib/screens/pro_screen.dart index 43600b9..9c7d791 100644 --- a/lib/screens/pro_screen.dart +++ b/lib/screens/pro_screen.dart @@ -96,6 +96,24 @@ class _ProScreenState extends State { : Center(child: Text(_username)), Container(height: 20), const Divider(), + const Padding( + padding: EdgeInsets.all(20), + child: Text( + "点击\"我曾经发过电\"进同步发电状态\n" + "点击\"我刚才发了电\"兑换作者给您的礼物卡\n" + "去\"关于\"界面找到维护地址用爱发电", + ), + ), + const Divider(), + const Padding( + padding: EdgeInsets.all(20), + child: Text( + "发电小功能 \n" + " 多线程下载\n" + " 批量导入导出\n" + " 跳页", + ), + ), const Divider(), ListTile( title: const Text("发电详情"), @@ -107,21 +125,14 @@ class _ProScreenState extends State { ), const Divider(), ListTile( - title: const Text("设置发电状态"), + title: const Text("我曾经发过电"), onTap: () async { - var choose = await chooseListDialog( - context, - values: ["是", "否"], - title: '发电状态', - ); - if (choose == null) return; - if (choose == "是") { - await methods.setIsPro(true); - } else { - await methods.setIsPro(false); + if (_username.isEmpty) { + defaultToast(context, "先登录"); + return; } try { - await reloadIsPro(); + await methods.reloadPro(); defaultToast(context, "SUCCESS"); } catch (e, s) { defaultToast(context, "FAIL"); @@ -131,6 +142,26 @@ class _ProScreenState extends State { }, ), const Divider(), + ListTile( + title: const Text("我刚才发了电"), + onTap: () async { + if (_username.isEmpty) { + defaultToast(context, "先登录"); + return; + } + final code = await displayTextInputDialog(context, title: "输入代码"); + if (code != null && code.isNotEmpty) { + try { + await methods.inputCdKey(code); + defaultToast(context, "SUCCESS"); + } catch (e, s) { + defaultToast(context, "FAIL"); + } + } + await reloadIsPro(); + setState(() {}); + }, + ), const Divider(), ], ), diff --git a/lib/screens/search_screen.dart b/lib/screens/search_screen.dart index a4b8122..1c0ec9f 100644 --- a/lib/screens/search_screen.dart +++ b/lib/screens/search_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_search_bar/flutter_search_bar.dart'; +import 'package:flutter_search_bar/flutter_search_bar.dart' as sb; import 'package:wax/basic/methods.dart'; import '../protos/properties.pb.dart'; @@ -19,7 +19,7 @@ class SearchScreen extends StatefulWidget { class _SearchScreenState extends State { late final TextEditingController _textEditController = TextEditingController(text: widget.keyword); - late final SearchBar _searchBar = SearchBar( + late final sb.SearchBar _searchBar = sb.SearchBar( hintText: '搜索', controller: _textEditController, inBar: false, diff --git a/protos/properties.proto b/protos/properties.proto index 6bfef34..21592e2 100644 --- a/protos/properties.proto +++ b/protos/properties.proto @@ -230,8 +230,4 @@ message LoginUser { message DeleteFavoriteQuery { string host = 1; int64 favouriteId = 2; -} - -message SetIsPro { - bool isPro = 2; } \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index fef8cf5..275112f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: "direct main" description: name: another_xlider - sha256: fe9768800218fa107a47f43ed440d87083ac7d680bc58f4cde41db5693870101 + sha256: "1446d10af1aefd8fe527e62054214967684773c0c2bb3dd2a8d506983a1d2279" url: "https://pub.dev" source: hosted - version: "1.0.1+2" + version: "1.1.2" async: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clipboard: dependency: "direct main" description: @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" convert: dependency: "direct main" description: @@ -143,10 +143,10 @@ packages: dependency: "direct main" description: name: flutter_styled_toast - sha256: e6628460fa473d06b1c85f5670d7650cbaf95b42ca0373fbaf67d5878059f17c + sha256: cc32aed2a49ce77a1ed5844073c6c0f5e381c81fd6d694e0ba3c5dc2a645963d url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.3" flutter_svg: dependency: "direct main" description: @@ -169,18 +169,18 @@ packages: dependency: transitive description: name: intl - sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6 url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "0.18.0" js: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" lints: dependency: transitive description: @@ -193,10 +193,10 @@ packages: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.15" material_color_utilities: dependency: transitive description: @@ -209,26 +209,26 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" modal_bottom_sheet: dependency: "direct main" description: name: modal_bottom_sheet - sha256: "99f2de943df227978049ddd611b36d98241cb27f360b8af8b561d64818d8da28" + sha256: "3bba63c62d35c931bce7f8ae23a47f9a05836d8cb3c11122ada64e0b2f3d718f" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.0-pre" path: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_drawing: dependency: transitive description: @@ -245,46 +245,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - pedantic: - dependency: transitive - description: - name: pedantic - sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" - url: "https://pub.dev" - source: hosted - version: "1.11.1" permission_handler: dependency: "direct main" description: name: permission_handler - sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8" + sha256: "1b6b3e73f0bcbc856548bbdfb1c33084a401c4f143e220629a9055233d76c331" url: "https://pub.dev" source: hosted - version: "10.2.0" + version: "10.3.0" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: d8cc6a62ded6d0f49c6eac337e080b066ee3bce4d405bd9439a61e1f1927bfe8 + sha256: "8f6a95ccbca13766882f95d32684d7c9bfe6c45650c32bedba948ef1c6a4ddf7" url: "https://pub.dev" source: hosted - version: "10.2.1" + version: "10.2.3" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: ee96ac32f5a8e6f80756e25b25b9f8e535816c8e6665a96b6d70681f8c4f7e85 + sha256: "08dcb6ce628ac0b257e429944b4c652c2a4e6af725bdf12b498daa2c6b2b1edb" url: "https://pub.dev" source: hosted - version: "9.0.8" + version: "9.1.0" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: "68abbc472002b5e6dfce47fe9898c6b7d8328d58b5d2524f75e277c07a97eb84" + sha256: de20a5c3269229c1ae2e5a6b822f6cb59578b23e8255c93fbeebfc82116e6b11 url: "https://pub.dev" source: hosted - version: "3.9.0" + version: "3.10.0" permission_handler_windows: dependency: transitive description: @@ -297,18 +289,18 @@ packages: dependency: transitive description: name: petitparser - sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.4.0" photo_view: dependency: "direct main" description: name: photo_view - sha256: "26cb153080a2673bebccaf72d3283e82f8f41a47fe5f9bc5ba8634d2e8a9fc8e" + sha256: "8036802a00bae2a78fc197af8a158e3e2f7b500561ed23b4c458107685e645bb" url: "https://pub.dev" source: hosted - version: "0.13.0" + version: "0.14.0" plugin_platform_interface: dependency: transitive description: @@ -382,10 +374,10 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.1" typed_data: dependency: transitive description: @@ -406,10 +398,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "7aac14be5f4731b923cc697ae2d42043945076cd0dbb8806baecc92c1dc88891" + sha256: eed4e6a1164aa9794409325c3b707ff424d4d1c2a785e7db67f8bbda00e36e51 url: "https://pub.dev" source: hosted - version: "6.0.33" + version: "6.0.35" url_launcher_ios: dependency: transitive description: @@ -438,18 +430,18 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370" + sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "81fe91b6c4f84f222d186a9d23c73157dc4c8e1c71489c4d08be1ad3b228f1aa" + sha256: "6bb1e5d7fe53daf02a8fee85352432a40b1f868a81880e99ec7440113d5cfcab" url: "https://pub.dev" source: hosted - version: "2.0.16" + version: "2.0.17" url_launcher_windows: dependency: transitive description: @@ -470,10 +462,10 @@ packages: dependency: transitive description: name: xml - sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.3.0" sdks: - dart: ">=2.19.0 <3.0.0" - flutter: ">=3.3.0" + dart: ">=3.0.0-0 <4.0.0" + flutter: ">=3.7.0" diff --git a/pubspec.yaml b/pubspec.yaml index bac4862..b4dd5a8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 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: 1.1.13+13 +version: 1.1.6+6 environment: sdk: ">=2.16.1 <3.0.0" @@ -36,17 +36,17 @@ dependencies: cupertino_icons: ^1.0.2 protobuf: ^2.0.1 url_launcher: ^6.1.2 - flutter_styled_toast: 2.0.0 + flutter_styled_toast: ^2.0.0 permission_handler: ^10.1.0 flutter_colorpicker: ^1.0.3 crypto: ^3.0.2 event: ^2.1.2 convert: ^3.0.1 - modal_bottom_sheet: 2.0.1 + modal_bottom_sheet: ^3.0.0-pre clipboard: ^0.1.3 - photo_view: ^0.13.0 + photo_view: ^0.14.0 flutter_svg: ^1.0.3 - another_xlider: 1.0.1+2 + another_xlider: ^1.0.1+2 scrollable_positioned_list: ^0.2.0-nullsafety.0 flutter_search_bar: ^3.0.0-dev.1