Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	EhPanda.xcodeproj/project.pbxproj
  • Loading branch information
tatsuz0u committed Jul 12, 2021
2 parents 1cd575a + 15e6b45 commit 756839f
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 68 deletions.
4 changes: 2 additions & 2 deletions EhPanda.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 57;
CURRENT_PROJECT_VERSION = 58;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
ENABLE_PREVIEWS = YES;
Expand All @@ -749,7 +749,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 57;
CURRENT_PROJECT_VERSION = 58;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
ENABLE_PREVIEWS = YES;
Expand Down
16 changes: 10 additions & 6 deletions EhPanda/App/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
// Created by 荒木辰造 on R 3/01/08.
//

import UIKit
import SwiftUI
import Combine
import Foundation
import SwiftyBeaver

extension Dictionary where Key == String, Value == String {
Expand Down Expand Up @@ -135,9 +133,12 @@ extension String {
}

func safeURL() -> URL {
isValidURL
? URL(string: self)!
: URL(string: Defaults.URL.ehentai)!
if isValidURL {
return URL(string: self).forceUnwrapped
} else {
SwiftyBeaver.error("Invalid URL, redirect to default host...")
return URL(string: Defaults.URL.ehentai).forceUnwrapped
}
}

var isValidURL: Bool {
Expand Down Expand Up @@ -234,7 +235,10 @@ extension Optional {
}
SwiftyBeaver.error(
"Failed in force unwrapping..."
+ "Shutting down now..."
+ "Shutting down now...",
context: [
"type": Wrapped.self
]
)
fatalError()
}
Expand Down
17 changes: 10 additions & 7 deletions EhPanda/App/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,29 @@
"Are you sure to logout?" = "本当にログアウトしますか?";
"Are you sure to clear?" = "本当に削除しますか?";
"Clear" = "削除";
"Copy cookies" = "クッキーをコピー";

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

"Appearance" = "外観";
"Global" = "全般";
"Theme" = "テーマ";
"Tint Color" = "テーマの色";
"App Icon" = "アプリアイコン";
"Translate category" = "カテゴリーを訳す";
"Translates category" = "カテゴリーを訳す";
"List" = "リスト";
"Show tags in list" = "リストでタグを表示";
"Set maximum number of tags" = "リストでのタグ数を制限";
"Shows tags in list" = "リストでタグを表示";
"Sets maximum number of tags" = "リストでのタグ数を制限";
"Maximum number of tags" = "タグ数上限";

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

// MARK: LogsView
Expand Down
17 changes: 10 additions & 7 deletions EhPanda/App/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,29 @@
"Are you sure to logout?" = "确定要退出登录吗?";
"Are you sure to clear?" = "确定要清空吗?";
"Clear" = "清空";
"Copy cookies" = "复制Cookies";

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

"Appearance" = "外观";
"Global" = "全局";
"Theme" = "主题";
"Tint Color" = "主题色";
"App Icon" = "应用图标";
"Translate category" = "显示分类的翻译版本";
"Translates category" = "显示分类的翻译版本";
"List" = "列表";
"Show tags in list" = "在列表中显示标签";
"Set maximum number of tags" = "设置标签数量上限";
"Shows tags in list" = "在列表中显示标签";
"Sets maximum number of tags" = "设置标签数量上限";
"Maximum number of tags" = "标签数量上限";

"Reading" = "阅读";
Expand All @@ -111,6 +113,7 @@
"Version" = "版本";
"Contacts" = "联系";
"Website" = "网站";
"AltStore Source" = "AltStore源";
"Acknowledgement" = "致谢";

// MARK: LogsView
Expand Down
17 changes: 10 additions & 7 deletions EhPanda/App/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,29 @@
"Are you sure to logout?" = "確定要登出嗎?";
"Are you sure to clear?" = "確定要清空嗎?";
"Clear" = "清空";
"Copy cookies" = "複製Cookies";

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

"Appearance" = "外觀";
"Global" = "全局";
"Theme" = "主題";
"Tint Color" = "主題色";
"App Icon" = "應用圖標";
"Translate category" = "翻譯分類";
"Translates category" = "翻譯分類";
"List" = "列表";
"Show tags in list" = "在列表中顯示標籤";
"Set maximum number of tags" = "設定標籤數量上限";
"Shows tags in list" = "在列表中顯示標籤";
"Sets maximum number of tags" = "設定標籤數量上限";
"Maximum number of tags" = "標籤數量上限";

"Reading" = "閱讀";
Expand All @@ -111,6 +113,7 @@
"Version" = "版本";
"Contacts" = "聯絡";
"Website" = "網站";
"AltStore Source" = "AltStore源";
"Acknowledgement" = "致謝";

// MARK: LogsView
Expand Down
12 changes: 11 additions & 1 deletion EhPanda/DataFlow/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,22 @@ final class Store: ObservableObject {
appState.settings.user.favoriteNames = names
}

case .fetchMangaItemReverse(let detailURL):
case .fetchMangaItemReverse(var detailURL):
appState.environment.mangaItemReverseLoadFailed = false

if appState.environment.mangaItemReverseLoading { break }
appState.environment.mangaItemReverseLoading = true

if appState.settings.setting.redirectsLinksToSelectedHost {
detailURL = detailURL.replacingOccurrences(
of: Defaults.URL.ehentai,
with: Defaults.URL.host
)
.replacingOccurrences(
of: Defaults.URL.exhentai,
with: Defaults.URL.host
)
}
appCommand = FetchMangaItemReverseCommand(detailURL: detailURL)
case .fetchMangaItemReverseDone(let result):
appState.environment.mangaItemReverseLoading = false
Expand Down
4 changes: 2 additions & 2 deletions EhPanda/DataFlow/StoreAccessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ extension StoreAccessor {
var autoLockPolicy: AutoLockPolicy {
setting.autoLockPolicy
}
var detectGalleryFromPasteboard: Bool {
setting.detectGalleryFromPasteboard
var detectsLinksFromPasteboard: Bool {
setting.detectsLinksFromPasteboard
}
}

Expand Down
11 changes: 6 additions & 5 deletions EhPanda/Models/Setting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ struct Setting: Codable {
var showNewDawnGreeting = false

// General
var detectGalleryFromPasteboard = false
var allowsDetectionWhenNoChange = false
var closeSlideMenuAfterSelection = true
var closesSlideMenuAfterSelection = true
var redirectsLinksToSelectedHost = false
var detectsLinksFromPasteboard = false
var allowsDetectionWhenNoChanges = false
var diskImageCacheSize = "0 KB"
var allowsResignActiveBlur = true
var autoLockPolicy: AutoLockPolicy = .never
Expand All @@ -40,8 +41,8 @@ struct Setting: Codable {
var preferredColorScheme: PreferredColorScheme = .automatic
var accentColor: Color = .blue
var appIconType: IconType = .default
var translateCategory = true
var showSummaryRowTags = false
var translatesCategory = true
var showsSummaryRowTags = false
var summaryRowTagsMaximumActivated = false
var summaryRowTagsMaximum: Int = 5

Expand Down
12 changes: 6 additions & 6 deletions EhPanda/View/Detail/DetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ struct DetailView: View, StoreAccessor, PersistenceAccessor {
VStack(spacing: 30) {
HeaderView(
manga: manga, detail: detail,
translateCategory: setting
.translateCategory,
translatesCategory: setting
.translatesCategory,
favoriteNames: user.favoriteNames,
addFavAction: addFavorite,
deleteFavAction: deleteFavorite
Expand Down Expand Up @@ -229,22 +229,22 @@ private extension DetailView {
private struct HeaderView: View {
private let manga: Manga
private let detail: MangaDetail
private let translateCategory: Bool
private let translatesCategory: Bool
private let favoriteNames: [Int: String]?
private let addFavAction: (Int) -> Void
private let deleteFavAction: () -> Void

init(
manga: Manga,
detail: MangaDetail,
translateCategory: Bool,
translatesCategory: Bool,
favoriteNames: [Int: String]?,
addFavAction: @escaping (Int) -> Void,
deleteFavAction: @escaping () -> Void
) {
self.manga = manga
self.detail = detail
self.translateCategory = translateCategory
self.translatesCategory = translatesCategory
self.favoriteNames = favoriteNames
self.addFavAction = addFavAction
self.deleteFavAction = deleteFavAction
Expand Down Expand Up @@ -339,7 +339,7 @@ private extension HeaderView {
}
}
var category: String {
if translateCategory {
if translatesCategory {
return manga.category.rawValue.localized()
} else {
return manga.category.rawValue
Expand Down
4 changes: 2 additions & 2 deletions EhPanda/View/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private extension HomeView {
}

var hasJumpPermission: Bool {
detectGalleryFromPasteboard
detectsLinksFromPasteboard
&& viewControllersCount == 1
}
var suggestions: [String] {
Expand Down Expand Up @@ -365,7 +365,7 @@ private extension HomeView {
store.dispatch(.replaceMangaCommentJumpID(gid: gid))
}
func getPasteboardLinkIfAllowed() -> URL? {
if setting.allowsDetectionWhenNoChange {
if setting.allowsDetectionWhenNoChanges {
return getPasteboardLink()
} else {
let currentChangeCount = UIPasteboard.general.changeCount
Expand Down
4 changes: 2 additions & 2 deletions EhPanda/View/Home/SlideMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private extension SlideMenu {
store.dispatch(.toggleHomeList(type: item))
impactFeedback(style: .soft)

if setting.closeSlideMenuAfterSelection {
if setting.closesSlideMenuAfterSelection {
performTransition(offset: -width)
}
}
Expand All @@ -90,7 +90,7 @@ private extension SlideMenu {
store.dispatch(.toggleHomeViewSheet(state: .setting))
}
func onFavoritesIndexChange(_ : Int) {
if setting.closeSlideMenuAfterSelection {
if setting.closesSlideMenuAfterSelection {
performTransition(offset: -width)
}
}
Expand Down
14 changes: 7 additions & 7 deletions EhPanda/View/Setting/AppearanceSettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ struct AppearanceSettingView: View, StoreAccessor {
ColorPicker("Tint Color", selection: settingBinding.accentColor)
Button("App Icon", action: onAppIconButtonTap)
.foregroundStyle(.primary).withArrow()
Toggle("Translate category", isOn: settingBinding.translateCategory)
Toggle("Translates category", isOn: settingBinding.translatesCategory)
.disabled(Locale.current.languageCode == "en")
}
Section(header: Text("List")) {
Toggle(isOn: settingBinding.showSummaryRowTags) {
Toggle(isOn: settingBinding.showsSummaryRowTags) {
HStack {
Text("Show tags in list")
Text("Shows tags in list")
Image(systemName: "exclamationmark.triangle.fill")
.opacity(setting.showSummaryRowTags ? 1 : 0)
.opacity(setting.showsSummaryRowTags ? 1 : 0)
.foregroundStyle(.yellow)
}
}
Toggle(isOn: settingBinding.summaryRowTagsMaximumActivated) {
Text("Set maximum number of tags")
Text("Sets maximum number of tags")
}
.disabled(!setting.showSummaryRowTags)
.disabled(!setting.showsSummaryRowTags)
HStack {
Text("Maximum number of tags")
Spacer()
Expand All @@ -80,7 +80,7 @@ struct AppearanceSettingView: View, StoreAccessor {
}
.disabled(
!setting.summaryRowTagsMaximumActivated
|| !setting.showSummaryRowTags
|| !setting.showsSummaryRowTags
)
}
}
Expand Down
7 changes: 7 additions & 0 deletions EhPanda/View/Setting/EhPandaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ struct EhPandaView: View, StoreAccessor {
Info(
url: "https://t.me/ehpanda",
text: "Telegram"
),
Info(
url: "altstore://source?url="
+ "https://github.com/tatsuz0u"
+ "/EhPanda-PromotionResources"
+ "/raw/main/altStore.json",
text: "AltStore Source".localized()
)
]
}
Expand Down
Loading

0 comments on commit 756839f

Please sign in to comment.