Skip to content

Commit

Permalink
Merge pull request #183 from tatsuz0u/develop
Browse files Browse the repository at this point in the history
Features
  • Loading branch information
tatsuz0u committed Nov 28, 2021
2 parents de994d9 + 96189a5 commit 3ec5916
Show file tree
Hide file tree
Showing 55 changed files with 708 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [closed]
env:
DEVELOPER_DIR: /Applications/Xcode_13.1.app
APP_VERSION: '1.4.0'
APP_VERSION: '1.5.0'
SCHEME_NAME: 'EhPanda'
ALTSTORE_JSON_PATH: './AltStore.json'
BUILDS_PATH: '/tmp/action-builds'
Expand Down
38 changes: 20 additions & 18 deletions EhPanda.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
AB10117E26986B7D00C2C1A9 /* GalleryStateMO+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB10117D26986B7D00C2C1A9 /* GalleryStateMO+CoreDataProperties.swift */; };
AB10118026986C1100C2C1A9 /* GalleryStateMO+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB10117F26986C1100C2C1A9 /* GalleryStateMO+CoreDataClass.swift */; };
AB19D619266E5C6700BA752A /* TTProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = AB19D618266E5C6700BA752A /* TTProgressHUD */; };
AB21CC9A274B4ED700C115B1 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = AB21CC99274B4ED700C115B1 /* Kingfisher */; };
AB21CCA0274B4F0C00C115B1 /* SwiftyBeaver in Frameworks */ = {isa = PBXBuildFile; productRef = AB21CC9F274B4F0C00C115B1 /* SwiftyBeaver */; };
AB2CED64268AB6AE003130F7 /* GalleryMO+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB2CED63268AB6AE003130F7 /* GalleryMO+CoreDataProperties.swift */; };
AB30E34826D277F7007420BC /* Toplists.html in Resources */ = {isa = PBXBuildFile; fileRef = AB30E34726D277F7007420BC /* Toplists.html */; };
Expand Down Expand Up @@ -73,6 +72,7 @@
ABC3C7892593699B00E0C11B /* Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC3C76D2593699A00E0C11B /* Defaults.swift */; };
ABC3C78F2593699B00E0C11B /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC3C7762593699A00E0C11B /* ViewModifiers.swift */; };
ABC3C7962593699B00E0C11B /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC3C7802593699A00E0C11B /* Models.swift */; };
ABC4A0792751B40E00968A4F /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = ABC4A0782751B40E00968A4F /* Kingfisher */; };
ABC681F326898D46007BBD69 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = ABC681F126898D46007BBD69 /* Model.xcdatamodeld */; };
ABCA93BE26918DE100A98BC6 /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABCA93BD26918DE100A98BC6 /* Persistence.swift */; };
ABCA93C02691925900A98BC6 /* GalleryMO+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABCA93BF2691925900A98BC6 /* GalleryMO+CoreDataClass.swift */; };
Expand Down Expand Up @@ -228,6 +228,7 @@
ABC3C76E2593699A00E0C11B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
ABC3C7762593699A00E0C11B /* ViewModifiers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewModifiers.swift; sourceTree = "<group>"; };
ABC3C7802593699A00E0C11B /* Models.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = "<group>"; };
ABC4A07A2753084100968A4F /* Model 5.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 5.xcdatamodel"; sourceTree = "<group>"; };
ABC681F226898D46007BBD69 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
ABCA93BD26918DE100A98BC6 /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; };
ABCA93BF2691925900A98BC6 /* GalleryMO+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GalleryMO+CoreDataClass.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -301,8 +302,8 @@
AB19D619266E5C6700BA752A /* TTProgressHUD in Frameworks */,
ABE9402D26FF89220085E158 /* AlertKit in Frameworks */,
AB60D0E9274C7ECE00F899AB /* WaterfallGrid in Frameworks */,
ABC4A0792751B40E00968A4F /* Kingfisher in Frameworks */,
AB0F68AF26A6D92F00AC3A54 /* DeprecatedAPI in Frameworks */,
AB21CC9A274B4ED700C115B1 /* Kingfisher in Frameworks */,
AB60D0CF274C7AA000F899AB /* BetterCodable in Frameworks */,
AB6505A026B0027800F91E9D /* SwiftUIPager in Frameworks */,
AB21CCA0274B4F0C00C115B1 /* SwiftyBeaver in Frameworks */,
Expand Down Expand Up @@ -681,10 +682,10 @@
ABD7005826B1C31500DC59C9 /* Kanna */,
ABAC82FD26BC4A96009F5026 /* OpenCC */,
ABE9402C26FF89220085E158 /* AlertKit */,
AB21CC99274B4ED700C115B1 /* Kingfisher */,
AB21CC9F274B4F0C00C115B1 /* SwiftyBeaver */,
AB60D0CE274C7AA000F899AB /* BetterCodable */,
AB60D0E8274C7ECE00F899AB /* WaterfallGrid */,
ABC4A0782751B40E00968A4F /* Kingfisher */,
);
productName = EhPanda;
productReference = ABC3C7542593696C00E0C11B /* EhPanda.app */;
Expand Down Expand Up @@ -750,10 +751,10 @@
ABD7005726B1C31500DC59C9 /* XCRemoteSwiftPackageReference "Kanna" */,
ABAC82FC26BC4866009F5026 /* XCRemoteSwiftPackageReference "SwiftyOpenCC" */,
ABE9402B26FF89220085E158 /* XCRemoteSwiftPackageReference "AlertKit" */,
AB21CC98274B4ED700C115B1 /* XCRemoteSwiftPackageReference "Kingfisher" */,
AB21CC9E274B4F0C00C115B1 /* XCRemoteSwiftPackageReference "SwiftyBeaver" */,
AB60D0CD274C7AA000F899AB /* XCRemoteSwiftPackageReference "BetterCodable" */,
AB60D0E7274C7ECE00F899AB /* XCRemoteSwiftPackageReference "WaterfallGrid" */,
ABC4A0772751B40E00968A4F /* XCRemoteSwiftPackageReference "Kingfisher" */,
);
productRefGroup = ABC3C7552593696C00E0C11B /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1326,14 +1327,6 @@
kind = branch;
};
};
AB21CC98274B4ED700C115B1 /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/tatsuz0u/Kingfisher.git";
requirement = {
branch = "fix/binder-loaded";
kind = branch;
};
};
AB21CC9E274B4F0C00C115B1 /* XCRemoteSwiftPackageReference "SwiftyBeaver" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/tatsuz0u/SwiftyBeaver.git";
Expand Down Expand Up @@ -1374,6 +1367,14 @@
minimumVersion = "2.0.0-beta";
};
};
ABC4A0772751B40E00968A4F /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/onevcat/Kingfisher.git";
requirement = {
branch = master;
kind = branch;
};
};
ABD7005726B1C31500DC59C9 /* XCRemoteSwiftPackageReference "Kanna" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/tid-kijyun/Kanna.git";
Expand Down Expand Up @@ -1403,11 +1404,6 @@
package = AB19D617266E5C6700BA752A /* XCRemoteSwiftPackageReference "TTProgressHUD" */;
productName = TTProgressHUD;
};
AB21CC99274B4ED700C115B1 /* Kingfisher */ = {
isa = XCSwiftPackageProductDependency;
package = AB21CC98274B4ED700C115B1 /* XCRemoteSwiftPackageReference "Kingfisher" */;
productName = Kingfisher;
};
AB21CC9F274B4F0C00C115B1 /* SwiftyBeaver */ = {
isa = XCSwiftPackageProductDependency;
package = AB21CC9E274B4F0C00C115B1 /* XCRemoteSwiftPackageReference "SwiftyBeaver" */;
Expand All @@ -1433,6 +1429,11 @@
package = ABAC82FC26BC4866009F5026 /* XCRemoteSwiftPackageReference "SwiftyOpenCC" */;
productName = OpenCC;
};
ABC4A0782751B40E00968A4F /* Kingfisher */ = {
isa = XCSwiftPackageProductDependency;
package = ABC4A0772751B40E00968A4F /* XCRemoteSwiftPackageReference "Kingfisher" */;
productName = Kingfisher;
};
ABD7005826B1C31500DC59C9 /* Kanna */ = {
isa = XCSwiftPackageProductDependency;
package = ABD7005726B1C31500DC59C9 /* XCRemoteSwiftPackageReference "Kanna" */;
Expand All @@ -1449,12 +1450,13 @@
ABC681F126898D46007BBD69 /* Model.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
ABC4A07A2753084100968A4F /* Model 5.xcdatamodel */,
ABE9401626FF2E610085E158 /* Model 4.xcdatamodel */,
AB543FF126DB7FD9009344C0 /* Model 3.xcdatamodel */,
AB48BCF626D2539B0021A06C /* Model 2.xcdatamodel */,
ABC681F226898D46007BBD69 /* Model.xcdatamodel */,
);
currentVersion = ABE9401626FF2E610085E158 /* Model 4.xcdatamodel */;
currentVersion = ABC4A07A2753084100968A4F /* Model 5.xcdatamodel */;
path = Model.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
},
{
"package": "Kingfisher",
"repositoryURL": "https://github.com/tatsuz0u/Kingfisher.git",
"repositoryURL": "https://github.com/onevcat/Kingfisher.git",
"state": {
"branch": "fix/binder-loaded",
"revision": "57744dfc08e6594f3df4490b12a89746ebf0f094",
"branch": "master",
"revision": "c874e5ef178a65b6a2b6a04d5981652d4fa95e22",
"version": null
}
},
Expand Down
52 changes: 31 additions & 21 deletions EhPanda/App/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ struct Defaults {
static let loginAct = "act=Login"
static let addfavAct = "act=addfav"
static let ignoreOffensive = "nw=always"
static let rowsLimit = "inline_set=tr_"
static let listCompact = "inline_set=dm_l"
static let previewNormal = "inline_set=ts_m"
static let previewLarge = "inline_set=ts_l"
static let rowsLimit = "inline_set=tr_4"
static let sortOrderByUpdateTime = "inline_set=fs_p"
static let sortOrderByFavoritedTime = "inline_set=fs_f"

// Filter
static let fCats = "f_cats="
Expand Down Expand Up @@ -163,39 +165,48 @@ extension Defaults.URL {
+ applyFilters(filter: filter)
)
}
static func frontpageList(pageNum: Int? = nil) -> String {
static func frontpageList(filter: Filter, pageNum: Int? = nil) -> String {
if let pageNum = pageNum {
return merge(urls: [host, page2 + String(pageNum)])
return merge(urls: [host, page2 + String(pageNum)] + applyFilters(filter: filter))
} else {
return host
return merge(urls: [host] + applyFilters(filter: filter))
}
}
static func moreFrontpageList(pageNum: Int, lastID: String) -> String {
merge(urls: [host, page2 + String(pageNum), from + lastID])
static func moreFrontpageList(filter: Filter, pageNum: Int, lastID: String) -> String {
merge(urls: [host, page2 + String(pageNum), from + lastID] + applyFilters(filter: filter))
}
static func popularList() -> String {
host + popular
static func popularList(filter: Filter) -> String {
merge(urls: [host + popular] + applyFilters(filter: filter))
}
static func watchedList(pageNum: Int? = nil) -> String {
static func watchedList(filter: Filter, pageNum: Int? = nil) -> String {
if let pageNum = pageNum {
return merge(urls: [host + watched, page2 + String(pageNum)])
} else {
return host + watched
return merge(urls: [host + watched] + applyFilters(filter: filter))
}
}
static func moreWatchedList(pageNum: Int, lastID: String) -> String {
merge(urls: [host + watched, page2 + String(pageNum), from + lastID])
static func moreWatchedList(filter: Filter, pageNum: Int, lastID: String) -> String {
merge(urls: [host + watched, page2 + String(pageNum), from + lastID] + applyFilters(filter: filter))
}
static func favoritesList(favIndex: Int, pageNum: Int? = nil) -> String {
static func favoritesList(favIndex: Int, pageNum: Int? = nil, sortOrder: FavoritesSortOrder? = nil) -> String {
var params = [host + favorites]
if favIndex == -1 {
if pageNum == nil { return params[0] }
if pageNum == nil {
guard let sortOrder = sortOrder else {
return merge(urls: params)
}
params.append(sortOrder == .favoritedTime ? sortOrderByFavoritedTime : sortOrderByUpdateTime)
return merge(urls: params)
}
} else {
params.append(favcat + "\(favIndex)")
}
if let pageNum = pageNum {
params.append(page2 + String(pageNum))
}
if let sortOrder = sortOrder {
params.append(sortOrder == .favoritedTime ? sortOrderByFavoritedTime : sortOrderByUpdateTime)
}
return merge(urls: params)
}
static func moreFavoritesList(favIndex: Int, pageNum: Int, lastID: String) -> String {
Expand Down Expand Up @@ -296,17 +307,14 @@ private extension Defaults.URL {
if filter.downvotedTags { filters.append(fSdt2On) }
if filter.expungedGalleries { filters.append(fShOn) }

if filter.minRatingActivated,
[2, 3, 4, 5].contains(filter.minRating)
{
if filter.minRatingActivated, [2, 3, 4, 5].contains(filter.minRating) {
filters.append(fSrOn)
filters.append(fSrdd + "\(filter.minRating)")
}

if filter.pageRangeActivated,
let minPages = Int(filter.pageLowerBound),
let maxPages = Int(filter.pageUpperBound),
minPages > 0 && maxPages > 0 && minPages <= maxPages
if filter.pageRangeActivated, let minPages = Int(filter.pageLowerBound),
let maxPages = Int(filter.pageUpperBound),
minPages > 0 && maxPages > 0 && minPages <= maxPages
{
filters.append(fSpOn)
filters.append(fSpf + "\(minPages)")
Expand Down Expand Up @@ -334,6 +342,8 @@ extension Defaults.URL {
// MARK: Tools
private extension Defaults.URL {
static func merge(urls: [String]) -> String {
guard !urls.isEmpty else { return "" }
guard urls.count > 1 else { return urls[0] }
let firstTwo = urls.prefix(2)
let remainder = urls.suffix(from: 2)

Expand Down
4 changes: 2 additions & 2 deletions EhPanda/App/EhPandaApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ private extension EhPandaApp {
configure(file: &file)
configure(console: &console)

SwiftyBeaver.addDestination(file)
Logger.addDestination(file)
#if DEBUG
guard !AppUtil.isUnitTesting else { return }
SwiftyBeaver.addDestination(console)
Logger.addDestination(console)
#endif
}
func configure(file: inout FileDestination) {
Expand Down
16 changes: 8 additions & 8 deletions EhPanda/App/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
//

import SwiftUI
import SwiftyBeaver

// MARK: UINavigationController
// Enables fullscreen swipe back gesture
extension UINavigationController: UIGestureRecognizerDelegate {
// Enables the swipe-back gesture in fullscreen
override open func viewDidLoad() {
super.viewDidLoad()
interactivePopGestureRecognizer?.delegate = self
}

public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
viewControllers.count > 1
}
// Gives the swipe-back gesture a higher priority
public func gestureRecognizer(
_ gestureRecognizer: UIGestureRecognizer,
shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer
) -> Bool { gestureRecognizer.isKind(of: UIScreenEdgePanGestureRecognizer.self) }
}

// MARK: Encodable
Expand Down Expand Up @@ -105,7 +105,7 @@ extension String {
if isValidURL {
return URL(string: self).forceUnwrapped
} else {
SwiftyBeaver.error("Invalid URL, redirect to default host...")
Logger.error("Invalid URL, redirect to default host...")
return URL(string: Defaults.URL.ehentai).forceUnwrapped
}
}
Expand Down Expand Up @@ -171,7 +171,7 @@ extension Optional {
if let value = self {
return value
}
SwiftyBeaver.error(
Logger.error(
"Failed in force unwrapping...",
context: ["type": Wrapped.self]
)
Expand Down
10 changes: 2 additions & 8 deletions EhPanda/App/Tools/AppEnvStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// Created by 荒木辰造 on R 3/07/10.
//

import SwiftyBeaver

@propertyWrapper
struct AppEnvStorage<T: Encodable> {
private var key: String
Expand All @@ -23,9 +21,7 @@ struct AppEnvStorage<T: Encodable> {
return value
}
}
SwiftyBeaver.error(
"Failed in force downcasting to generic type..."
)
Logger.error("Failed in force downcasting to generic type...")
return nil
}

Expand All @@ -45,9 +41,7 @@ struct AppEnvStorage<T: Encodable> {
if let key = key {
self.key = key
} else {
self.key = String(
describing: type
).lowercased()
self.key = String(describing: type).lowercased()
}
value = fetchedValue
}
Expand Down
Loading

0 comments on commit 3ec5916

Please sign in to comment.