Skip to content

Commit

Permalink
🚀 version
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Apr 28, 2024
1 parent c59aeb3 commit c60612f
Show file tree
Hide file tree
Showing 65 changed files with 305 additions and 5,935 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
workflow_dispatch:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUST_TOOLCHAIN: nightly-2023-10-31
GH_TOKEN: ${{ secrets.GH_TOKEN }}
RUST_TOOLCHAIN: nightly-2024-04-15
NDK_VERSION: 25.2.9519653

jobs:
Expand All @@ -16,6 +16,7 @@ jobs:
needs:
- check_release
- build_release_assets
- community_notify
steps:
- run: exit 0

Expand Down Expand Up @@ -324,3 +325,36 @@ jobs:
cd ci
cargo run --bin upload-asset
community_notify:
name: community notify
runs-on: ubuntu-latest
needs:
- build_release_assets
env:
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
TG_CHAT_IDS: ${{ secrets.TG_CHAT_IDS }}
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
DISCORD_CHAT_IDS: ${{ secrets.DISCORD_CHAT_IDS }}
steps:

- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Checkout
uses: actions/checkout@v3

- run: |
cd ci
cargo run --bin community-notify
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
4 changes: 2 additions & 2 deletions ci/src/check_asset/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const UA: &str = "niuhuan jasmine ci";

#[tokio::main]
async fn main() -> Result<()> {
let gh_token = std::env::var("GITHUB_TOKEN")?;
let gh_token = std::env::var("GH_TOKEN")?;
if gh_token.is_empty() {
panic!("Please set GITHUB_TOKEN");
panic!("Please set GH_TOKEN");
}
let flutter_version = std::env::var("flutter_version")?;
if flutter_version.is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions ci/src/check_release/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const MAIN_BRANCH: &str = "master";
#[tokio::main]
async fn main() -> Result<()> {
// get ghToken
let gh_token = std::env::var("GITHUB_TOKEN")?;
let gh_token = std::env::var("GH_TOKEN")?;
if gh_token.is_empty() {
panic!("Please set GITHUB_TOKEN");
panic!("Please set GH_TOKEN");
}

let vs_code_txt = tokio::fs::read_to_string("version.code.txt").await?;
Expand Down
2 changes: 1 addition & 1 deletion ci/src/upload_asset/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const UA: &str = "niuhuan jasmine ci";
#[tokio::main]
async fn main() -> Result<()> {
// get ghToken
let gh_token = std::env::var("GITHUB_TOKEN")?;
let gh_token = std::env::var("GH_TOKEN")?;
let target = std::env::var("TARGET")?;
let flutter_version = std::env::var("flutter_version")?;

Expand Down
2 changes: 1 addition & 1 deletion ci/version.code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.6.2
v1.6.6
4 changes: 3 additions & 1 deletion ci/version.info.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
v1.6.2
v1.6.1

- [x] ♻️ Network
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PODS:
- DKImagePickerController/PhotoGallery
- Flutter
- Flutter (1.0.0)
- permission_handler_apple (9.0.4):
- permission_handler_apple (9.1.1):
- Flutter
- SDWebImage (5.13.4):
- SDWebImage/Core (= 5.13.4)
Expand Down Expand Up @@ -71,11 +71,11 @@ SPEC CHECKSUMS:
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
Binary file added lib/assets/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions lib/basic/entities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@ class SelfInfo {
expPercent = json['expPercent'];
badges = List.castFrom<dynamic, dynamic>(json['badges']);
albumFavoritesMax = json['album_favorites_max'];
favoriteList = List.from(json['favorite_list']).map((e)=>FavoriteFolder.fromJson(e)).toList();
favoriteList = List.from(json['favorite_list'])
.map((e) => FavoriteFolder.fromJson(e))
.toList();
}

Map<String, dynamic> toJson() {
Expand All @@ -708,7 +710,7 @@ class SelfInfo {
_data['expPercent'] = expPercent;
_data['badges'] = badges;
_data['album_favorites_max'] = albumFavoritesMax;
_data['favorite_list'] = favoriteList.map((e)=>e.toJson()).toList();
_data['favorite_list'] = favoriteList.map((e) => e.toJson()).toList();
return _data;
}
}
Expand Down Expand Up @@ -1211,7 +1213,7 @@ ComicBasic albumToSimple(AlbumResponse album) {
description: album.description,
name: album.name,
author: album.author.join(" / "),
image: album.images[0] ?? '',
image: album.images.isEmpty ? '' : album.images[0] ?? '',
);
}

Expand Down
7 changes: 6 additions & 1 deletion lib/basic/methods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,15 @@ class Methods {
}

Future<int> ping(String idx) async {
print("PING $idx");
print("PING API $idx");
return int.parse(await _invoke("ping_server", idx));
}

Future<int> pingCdn(String idx) async {
print("PING CDN $idx");
return int.parse(await _invoke("ping_cdn", idx));
}

Future mkdirs(String path) {
return _invoke("mkdirs", path);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/network_api_host.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:jasmine/basic/commons.dart';
import 'package:jasmine/basic/methods.dart';

late String _apiHost;
Expand All @@ -9,6 +8,7 @@ const apiHosts = {
"分流1": "1",
"分流2": "2",
"分流3": "3",
"分流4": "4",
};

String _apiHostName(String value) {
Expand Down
135 changes: 125 additions & 10 deletions lib/configs/network_cdn_host.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:jasmine/basic/commons.dart';
import 'package:jasmine/basic/methods.dart';

late String _cdnHost;
Expand All @@ -15,15 +14,7 @@ Future<void> initCdnHost() async {
}

Future chooseCdnHost(BuildContext context) async {
final choose = await chooseMapDialog(
context,
title: "图片分流",
values: {
"随机": "0",
"分流1": "1",
"分流2": "2",
},
);
final choose = await chooseCdnDialog(context);
if (choose != null) {
await methods.saveCdnHost(choose);
_cdnHost = choose;
Expand All @@ -44,3 +35,127 @@ Widget cdnHostSetting() {
},
);
}


var cdnHosts = {
"随机": "0",
"分流1": "1",
"分流2": "2",
"分流3": "3",
"分流4": "4",
};

Future<T?> chooseCdnDialog<T>(BuildContext buildContext) async {
return await showDialog<T>(
context: buildContext,
builder: (BuildContext context) {
return SimpleDialog(
title: const Text("图片分流"),
children: cdnHosts.entries
.map(
(e) => SimpleDialogOption(
child: CdnOptionRow(
e.key,
e.value,
key: Key("CDN:${e.value}"),
),
onPressed: () {
Navigator.of(context).pop(e.value);
},
),
)
.toList(),
);
},
);
}

class CdnOptionRow extends StatefulWidget {
final String title;
final String value;

const CdnOptionRow(this.title, this.value, {Key? key}) : super(key: key);

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

class _CdnOptionRowState extends State<CdnOptionRow> {
late Future<int> _feature;

@override
void initState() {
super.initState();
_feature = methods.pingCdn(widget.value);
}

@override
Widget build(BuildContext context) {
return Row(
children: [
Text(widget.title),
Expanded(child: Container()),
FutureBuilder(
future: _feature,
builder: (
BuildContext context,
AsyncSnapshot<int> snapshot,
) {
if (snapshot.connectionState != ConnectionState.done) {
return const PingStatus(
"测速中",
Colors.blue,
);
}
if (snapshot.hasError) {
return const PingStatus(
"失败",
Colors.red,
);
}
int ping = snapshot.requireData;
if (ping <= 200) {
return PingStatus(
"${ping}ms",
Colors.green,
);
}
if (ping <= 500) {
return PingStatus(
"${ping}ms",
Colors.yellow,
);
}
return PingStatus(
"${ping}ms",
Colors.orange,
);
},
),
],
);
}
}

class PingStatus extends StatelessWidget {
final String title;
final Color color;

const PingStatus(this.title, this.color, {Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Row(
children: [
Text(
'\u2022',
style: TextStyle(
color: color,
),
),
Text(" $title"),
],
);
}
}

32 changes: 20 additions & 12 deletions lib/screens/about_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,30 @@ class _AboutState extends State<AboutScreen> {
builder: (BuildContext context, BoxConstraints constraints) {
double? width, height;
if (constraints.maxWidth < constraints.maxHeight) {
width = constraints.maxWidth / 2;
width = constraints.maxWidth / 3;
} else {
height = constraints.maxHeight / 2;
height = constraints.maxHeight / 3;
}
return Container(
padding: const EdgeInsets.all(10),
child: Center(
child: SizedBox(
width: width,
height: height,
child: Image.asset(
"lib/assets/startup.png",
fit: BoxFit.contain,
double l = width ?? height!;
return Column(
children: [
Container(height: l / 4),
SizedBox(
width: l,
height: l,
child: ConstrainedBox(
constraints: const BoxConstraints.expand(),
child: Container(
padding: const EdgeInsets.all(10),
child: Image.asset(
"lib/assets/ic_launcher.png",
fit: BoxFit.contain,
),
),
),
),
),
Container(height: l / 4),
],
);
},
);
Expand Down
Loading

0 comments on commit c60612f

Please sign in to comment.