Skip to content

Commit

Permalink
Remove the setting of automatically redirecting to the EH site, now i…
Browse files Browse the repository at this point in the history
…t is enabled by default

去除自动重定向至表站的是设置,现在会强制优先访问表站画廊链接
  • Loading branch information
jiangtian616 committed Dec 30, 2023
1 parent 5b1cf90 commit c10e063
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
version: ${{ steps.get_version.outputs.version }}
runs-on: ${{ matrix.os }}
env:
FLUTTER_VERSION: 3.13.9
FLUTTER_VERSION: 3.16.5
steps:
# Checkout branch
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ Now you can submit your PR, I'll do the remaining things. Or you can go on with:

1. You need to manage your Android signing by yourself,
check https://docs.flutter.dev/deployment/android#signing-the-app
2. Just run this project via IDEA or VSCode simply.

## Main Dart Dependencies

Expand Down
1 change: 1 addition & 0 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ App翻译:
## 项目编译相关

1. 你需要自己管理安卓签名文件,见https://docs.flutter.dev/deployment/android#signing-the-app
2. 使用IDEA或者VSCode直接运行即可

## 主要dart依赖

Expand Down
4 changes: 3 additions & 1 deletion changelog/v7.4.8+147.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
- 优化保存图片时的图片命名规则
- 优化解压归档时的icon显示
- 收藏页和关注页搜索不再继承关键字
- 去除自动重定向至表站的是设置,现在会强制优先访问表站画廊链接

------------------------------------------------------------------------------------------

- Fix the bug that auto reading mode cannot scroll to the end in some scenes
- Optimize the toast message when canceling favorites
- Optimize the image naming rules when saving images
- Optimize the icon display when decompressing archives
- The search in favorites and following page no longer inherits keywords
- The search in favorites and following page no longer inherits keywords
- Remove the setting of automatically redirecting to the EH site, now it is enabled by default
13 changes: 5 additions & 8 deletions lib/src/pages/details/details_page_logic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -706,17 +706,14 @@ class DetailsPageLogic extends GetxController with LoginRequiredMixin, Scroll2To
}

Future<Map<String, dynamic>> _getDetailsWithRedirectAndFallback({bool useCache = true}) async {
final String? firstLink;
final String? secondLink;
final String firstLink;
final String secondLink;

/// 1. if redirect is enabled, try EH site first for EX link
/// 1. Try EH site first for EX link
/// 2. if a gallery can't be found in EH site, it may be moved into EX site
if (state.galleryUrl.contains(EHConsts.EXIndex) && EHSetting.redirect2Eh.isTrue) {
if (state.galleryUrl.contains(EHConsts.EXIndex)) {
firstLink = state.galleryUrl.replaceFirst(EHConsts.EXIndex, EHConsts.EHIndex);
secondLink = state.galleryUrl;
} else if (state.galleryUrl.contains(EHConsts.EXIndex) && EHSetting.redirect2Eh.isFalse) {
firstLink = null;
secondLink = state.galleryUrl;
} else {
firstLink = state.galleryUrl;
secondLink = state.galleryUrl.replaceFirst(EHConsts.EHIndex, EHConsts.EXIndex);
Expand All @@ -726,7 +723,7 @@ class DetailsPageLogic extends GetxController with LoginRequiredMixin, Scroll2To
if (!isEmptyOrNull(firstLink)) {
try {
Map<String, dynamic> galleryAndDetailAndApikey = await EHRequest.requestDetailPage<Map<String, dynamic>>(
galleryUrl: firstLink!,
galleryUrl: firstLink,
parser: EHSpiderParser.detailPage2GalleryAndDetailAndApikey,
useCacheIfAvailable: useCache,
);
Expand Down
14 changes: 0 additions & 14 deletions lib/src/pages/setting/eh/setting_eh_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class _SettingEHPageState extends State<SettingEHPage> {
padding: const EdgeInsets.only(top: 16),
children: [
_buildSiteSegmentControl(),
_buildRedirect2EH(),
_buildUseSeparateProfile(),
_buildSiteSetting(),
_buildImageLimit(),
Expand All @@ -81,19 +80,6 @@ class _SettingEHPageState extends State<SettingEHPage> {
);
}

Widget _buildRedirect2EH() {
if (EHSetting.site.value == 'EH') {
return const SizedBox();
}

return FadeIn(
child: ListTile(
title: Text('redirect2Eh'.tr),
trailing: Switch(value: EHSetting.redirect2Eh.value, onChanged: EHSetting.saveRedirect2Eh),
),
);
}

Widget _buildUseSeparateProfile() {
return ListTile(
title: Text('useSeparateProfile'.tr),
Expand Down
9 changes: 0 additions & 9 deletions lib/src/setting/eh_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import '../utils/eh_spider_parser.dart';

class EHSetting {
static RxString site = 'EH'.obs;
static RxBool redirect2Eh = true.obs;
static Rx<LoadingState> refreshState = LoadingState.idle.obs;
static RxInt currentConsumption = (-1).obs;
static RxInt totalLimit = 5000.obs;
Expand Down Expand Up @@ -80,12 +79,6 @@ class EHSetting {
SiteSetting.refresh();
}

static saveRedirect2Eh(bool redirect2Eh) {
Log.debug('saveRedirect2Eh:$redirect2Eh');
EHSetting.redirect2Eh.value = redirect2Eh;
_save();
}

static saveTotalLimit(int totalLimit) {
Log.debug('saveTotalLimit:$totalLimit');
EHSetting.totalLimit.value = totalLimit;
Expand All @@ -106,14 +99,12 @@ class EHSetting {
static Map<String, dynamic> _toMap() {
return {
'site': site.value,
'redirect2Eh': redirect2Eh.value,
'totalLimit': totalLimit.value,
};
}

static _initFromMap(Map<String, dynamic> map) {
site.value = map['site'];
redirect2Eh.value = map['redirect2Eh'] ?? redirect2Eh.value;
totalLimit.value = map['totalLimit'];
}
}
Loading

0 comments on commit c10e063

Please sign in to comment.