Skip to content

Commit 756839f

Browse files
author
たつぞう
committed
Merge branch 'develop'
# Conflicts: # EhPanda.xcodeproj/project.pbxproj
2 parents 1cd575a + 15e6b45 commit 756839f

File tree

15 files changed

+103
-68
lines changed

15 files changed

+103
-68
lines changed

EhPanda.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@
722722
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
723723
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
724724
CODE_SIGN_STYLE = Automatic;
725-
CURRENT_PROJECT_VERSION = 57;
725+
CURRENT_PROJECT_VERSION = 58;
726726
DEVELOPMENT_ASSET_PATHS = "";
727727
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
728728
ENABLE_PREVIEWS = YES;
@@ -749,7 +749,7 @@
749749
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
750750
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
751751
CODE_SIGN_STYLE = Automatic;
752-
CURRENT_PROJECT_VERSION = 57;
752+
CURRENT_PROJECT_VERSION = 58;
753753
DEVELOPMENT_ASSET_PATHS = "";
754754
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
755755
ENABLE_PREVIEWS = YES;

EhPanda/App/Extensions.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
// Created by 荒木辰造 on R 3/01/08.
66
//
77

8-
import UIKit
98
import SwiftUI
109
import Combine
11-
import Foundation
1210
import SwiftyBeaver
1311

1412
extension Dictionary where Key == String, Value == String {
@@ -135,9 +133,12 @@ extension String {
135133
}
136134

137135
func safeURL() -> URL {
138-
isValidURL
139-
? URL(string: self)!
140-
: URL(string: Defaults.URL.ehentai)!
136+
if isValidURL {
137+
return URL(string: self).forceUnwrapped
138+
} else {
139+
SwiftyBeaver.error("Invalid URL, redirect to default host...")
140+
return URL(string: Defaults.URL.ehentai).forceUnwrapped
141+
}
141142
}
142143

143144
var isValidURL: Bool {
@@ -234,7 +235,10 @@ extension Optional {
234235
}
235236
SwiftyBeaver.error(
236237
"Failed in force unwrapping..."
237-
+ "Shutting down now..."
238+
+ "Shutting down now...",
239+
context: [
240+
"type": Wrapped.self
241+
]
238242
)
239243
fatalError()
240244
}

EhPanda/App/ja.lproj/Localizable.strings

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,29 @@
7777
"Are you sure to logout?" = "本当にログアウトしますか?";
7878
"Are you sure to clear?" = "本当に削除しますか?";
7979
"Clear" = "削除";
80+
"Copy cookies" = "クッキーをコピー";
8081

8182
"General" = "一般";
82-
"Close slide menu after selection" = "選択後スライドメニューを閉じる";
83-
"Detect link from the clipboard" = "クリップボードからリンクを探知";
84-
"Allows detection even when no change" = "変化なしの場合でも探知を有効化";
83+
"Closes slide menu after selection" = "選択後スライドメニューを閉じる";
84+
"Navigation" = "ナビゲーション";
85+
"Redirects links to the selected host" = "リンクを選択されたホストへリダイレクト";
86+
"Detects links from the clipboard" = "クリップボードからリンクを探知";
87+
"Allows detection even when no changes" = "変化なしの場合でも探知を有効化";
8588
"Security" = "セキュリティ";
8689
"Auto-Lock" = "自動ロック";
8790
"App switcher blur" = "アプリスイッチャーぼかし";
8891
"Cache" = "キャッシュ";
8992
"Clear image caches" = "画像キャッシュを削除";
90-
"Copy cookies" = "クッキーをコピー";
9193

9294
"Appearance" = "外観";
9395
"Global" = "全般";
9496
"Theme" = "テーマ";
9597
"Tint Color" = "テーマの色";
9698
"App Icon" = "アプリアイコン";
97-
"Translate category" = "カテゴリーを訳す";
99+
"Translates category" = "カテゴリーを訳す";
98100
"List" = "リスト";
99-
"Show tags in list" = "リストでタグを表示";
100-
"Set maximum number of tags" = "リストでのタグ数を制限";
101+
"Shows tags in list" = "リストでタグを表示";
102+
"Sets maximum number of tags" = "リストでのタグ数を制限";
101103
"Maximum number of tags" = "タグ数上限";
102104

103105
"Reading" = "閲覧";
@@ -111,6 +113,7 @@
111113
"Version" = "バージョン";
112114
"Contacts" = "連絡";
113115
"Website" = "ウェブサイト";
116+
"AltStore Source" = "AltStoreソース";
114117
"Acknowledgement" = "謝辞";
115118

116119
// MARK: LogsView

EhPanda/App/zh-Hans.lproj/Localizable.strings

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,29 @@
7777
"Are you sure to logout?" = "确定要退出登录吗?";
7878
"Are you sure to clear?" = "确定要清空吗?";
7979
"Clear" = "清空";
80+
"Copy cookies" = "复制Cookies";
8081

8182
"General" = "一般";
82-
"Close slide menu after selection" = "选择后关闭侧边栏";
83-
"Detect link from the clipboard" = "从剪切板检测链接";
84-
"Allows detection even when no change" = "无变化时依旧检测";
83+
"Closes slide menu after selection" = "选择后关闭侧边栏";
84+
"Navigation" = "导航";
85+
"Redirects links to the selected host" = "重定向链接到选定的站点";
86+
"Detects links from the clipboard" = "从剪切板检测链接";
87+
"Allows detection even when no changes" = "无变化时依旧检测";
8588
"Security" = "安全";
8689
"Auto-Lock" = "自动锁定";
8790
"App switcher blur" = "在应用切换器中模糊处理";
8891
"Cache" = "缓存";
8992
"Clear image caches" = "清空图片缓存";
90-
"Copy cookies" = "复制Cookies";
9193

9294
"Appearance" = "外观";
9395
"Global" = "全局";
9496
"Theme" = "主题";
9597
"Tint Color" = "主题色";
9698
"App Icon" = "应用图标";
97-
"Translate category" = "显示分类的翻译版本";
99+
"Translates category" = "显示分类的翻译版本";
98100
"List" = "列表";
99-
"Show tags in list" = "在列表中显示标签";
100-
"Set maximum number of tags" = "设置标签数量上限";
101+
"Shows tags in list" = "在列表中显示标签";
102+
"Sets maximum number of tags" = "设置标签数量上限";
101103
"Maximum number of tags" = "标签数量上限";
102104

103105
"Reading" = "阅读";
@@ -111,6 +113,7 @@
111113
"Version" = "版本";
112114
"Contacts" = "联系";
113115
"Website" = "网站";
116+
"AltStore Source" = "AltStore源";
114117
"Acknowledgement" = "致谢";
115118

116119
// MARK: LogsView

EhPanda/App/zh-Hant.lproj/Localizable.strings

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,29 @@
7777
"Are you sure to logout?" = "確定要登出嗎?";
7878
"Are you sure to clear?" = "確定要清空嗎?";
7979
"Clear" = "清空";
80+
"Copy cookies" = "複製Cookies";
8081

8182
"General" = "一般";
82-
"Close slide menu after selection" = "選擇後關閉側邊選單";
83-
"Detect link from the clipboard" = "偵測剪貼簿中的連結";
84-
"Allows detection even when no change" = "沒有變化時仍然偵測";
83+
"Closes slide menu after selection" = "選擇後關閉側邊選單";
84+
"Navigation" = "導航";
85+
"Redirects links to the selected host" = "重定向連結到選定的站點";
86+
"Detects links from the clipboard" = "偵測剪貼簿中的連結";
87+
"Allows detection even when no changes" = "沒有變化時仍然偵測";
8588
"Security" = "安全";
8689
"Auto-Lock" = "自動鎖定";
8790
"App switcher blur" = "模糊多工處理中的預覽";
8891
"Cache" = "快取";
8992
"Clear image caches" = "清空圖片快取";
90-
"Copy cookies" = "複製Cookies";
9193

9294
"Appearance" = "外觀";
9395
"Global" = "全局";
9496
"Theme" = "主題";
9597
"Tint Color" = "主題色";
9698
"App Icon" = "應用圖標";
97-
"Translate category" = "翻譯分類";
99+
"Translates category" = "翻譯分類";
98100
"List" = "列表";
99-
"Show tags in list" = "在列表中顯示標籤";
100-
"Set maximum number of tags" = "設定標籤數量上限";
101+
"Shows tags in list" = "在列表中顯示標籤";
102+
"Sets maximum number of tags" = "設定標籤數量上限";
101103
"Maximum number of tags" = "標籤數量上限";
102104

103105
"Reading" = "閱讀";
@@ -111,6 +113,7 @@
111113
"Version" = "版本";
112114
"Contacts" = "聯絡";
113115
"Website" = "網站";
116+
"AltStore Source" = "AltStore源";
114117
"Acknowledgement" = "致謝";
115118

116119
// MARK: LogsView

EhPanda/DataFlow/Store.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,22 @@ final class Store: ObservableObject {
146146
appState.settings.user.favoriteNames = names
147147
}
148148

149-
case .fetchMangaItemReverse(let detailURL):
149+
case .fetchMangaItemReverse(var detailURL):
150150
appState.environment.mangaItemReverseLoadFailed = false
151151

152152
if appState.environment.mangaItemReverseLoading { break }
153153
appState.environment.mangaItemReverseLoading = true
154154

155+
if appState.settings.setting.redirectsLinksToSelectedHost {
156+
detailURL = detailURL.replacingOccurrences(
157+
of: Defaults.URL.ehentai,
158+
with: Defaults.URL.host
159+
)
160+
.replacingOccurrences(
161+
of: Defaults.URL.exhentai,
162+
with: Defaults.URL.host
163+
)
164+
}
155165
appCommand = FetchMangaItemReverseCommand(detailURL: detailURL)
156166
case .fetchMangaItemReverseDone(let result):
157167
appState.environment.mangaItemReverseLoading = false

EhPanda/DataFlow/StoreAccessor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ extension StoreAccessor {
8282
var autoLockPolicy: AutoLockPolicy {
8383
setting.autoLockPolicy
8484
}
85-
var detectGalleryFromPasteboard: Bool {
86-
setting.detectGalleryFromPasteboard
85+
var detectsLinksFromPasteboard: Bool {
86+
setting.detectsLinksFromPasteboard
8787
}
8888
}
8989

EhPanda/Models/Setting.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ struct Setting: Codable {
1919
var showNewDawnGreeting = false
2020

2121
// General
22-
var detectGalleryFromPasteboard = false
23-
var allowsDetectionWhenNoChange = false
24-
var closeSlideMenuAfterSelection = true
22+
var closesSlideMenuAfterSelection = true
23+
var redirectsLinksToSelectedHost = false
24+
var detectsLinksFromPasteboard = false
25+
var allowsDetectionWhenNoChanges = false
2526
var diskImageCacheSize = "0 KB"
2627
var allowsResignActiveBlur = true
2728
var autoLockPolicy: AutoLockPolicy = .never
@@ -40,8 +41,8 @@ struct Setting: Codable {
4041
var preferredColorScheme: PreferredColorScheme = .automatic
4142
var accentColor: Color = .blue
4243
var appIconType: IconType = .default
43-
var translateCategory = true
44-
var showSummaryRowTags = false
44+
var translatesCategory = true
45+
var showsSummaryRowTags = false
4546
var summaryRowTagsMaximumActivated = false
4647
var summaryRowTagsMaximum: Int = 5
4748

EhPanda/View/Detail/DetailView.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ struct DetailView: View, StoreAccessor, PersistenceAccessor {
3939
VStack(spacing: 30) {
4040
HeaderView(
4141
manga: manga, detail: detail,
42-
translateCategory: setting
43-
.translateCategory,
42+
translatesCategory: setting
43+
.translatesCategory,
4444
favoriteNames: user.favoriteNames,
4545
addFavAction: addFavorite,
4646
deleteFavAction: deleteFavorite
@@ -229,22 +229,22 @@ private extension DetailView {
229229
private struct HeaderView: View {
230230
private let manga: Manga
231231
private let detail: MangaDetail
232-
private let translateCategory: Bool
232+
private let translatesCategory: Bool
233233
private let favoriteNames: [Int: String]?
234234
private let addFavAction: (Int) -> Void
235235
private let deleteFavAction: () -> Void
236236

237237
init(
238238
manga: Manga,
239239
detail: MangaDetail,
240-
translateCategory: Bool,
240+
translatesCategory: Bool,
241241
favoriteNames: [Int: String]?,
242242
addFavAction: @escaping (Int) -> Void,
243243
deleteFavAction: @escaping () -> Void
244244
) {
245245
self.manga = manga
246246
self.detail = detail
247-
self.translateCategory = translateCategory
247+
self.translatesCategory = translatesCategory
248248
self.favoriteNames = favoriteNames
249249
self.addFavAction = addFavAction
250250
self.deleteFavAction = deleteFavAction
@@ -339,7 +339,7 @@ private extension HeaderView {
339339
}
340340
}
341341
var category: String {
342-
if translateCategory {
342+
if translatesCategory {
343343
return manga.category.rawValue.localized()
344344
} else {
345345
return manga.category.rawValue

EhPanda/View/Home/HomeView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private extension HomeView {
142142
}
143143

144144
var hasJumpPermission: Bool {
145-
detectGalleryFromPasteboard
145+
detectsLinksFromPasteboard
146146
&& viewControllersCount == 1
147147
}
148148
var suggestions: [String] {
@@ -365,7 +365,7 @@ private extension HomeView {
365365
store.dispatch(.replaceMangaCommentJumpID(gid: gid))
366366
}
367367
func getPasteboardLinkIfAllowed() -> URL? {
368-
if setting.allowsDetectionWhenNoChange {
368+
if setting.allowsDetectionWhenNoChanges {
369369
return getPasteboardLink()
370370
} else {
371371
let currentChangeCount = UIPasteboard.general.changeCount

0 commit comments

Comments
 (0)