Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuz0u committed Jun 26, 2021
2 parents 31046e6 + 8e5e052 commit 59f1c24
Show file tree
Hide file tree
Showing 26 changed files with 253 additions and 177 deletions.
63 changes: 40 additions & 23 deletions EhPanda.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
objects = {

/* Begin PBXBuildFile section */
AB19224F26727A2500F48E60 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = AB19224E26727A2500F48E60 /* Kingfisher */; };
AB018DD2268756D000EB0EA9 /* Kanna in Frameworks */ = {isa = PBXBuildFile; productRef = AB018DD1268756D000EB0EA9 /* Kanna */; };
AB19D619266E5C6700BA752A /* TTProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = AB19D618266E5C6700BA752A /* TTProgressHUD */; };
AB324F66266EFF4200F34A12 /* Kanna in Frameworks */ = {isa = PBXBuildFile; productRef = AB324F65266EFF4200F34A12 /* Kanna */; };
AB2B0F3B2684228400777944 /* SwiftyBeaver in Frameworks */ = {isa = PBXBuildFile; productRef = AB2B0F3A2684228400777944 /* SwiftyBeaver */; };
AB2F72BF2685A8B00088DECA /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = AB2F72BE2685A8B00088DECA /* Kingfisher */; };
AB38A0CB25CA993D00764D64 /* ColorCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB38A0CA25CA993D00764D64 /* ColorCodable.swift */; };
AB40CFDC25983EC200D1DC9A /* FileStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB40CFDB25983EC200D1DC9A /* FileStorage.swift */; };
AB40CFDF25983EDF00D1DC9A /* FileHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB40CFDE25983EDF00D1DC9A /* FileHelper.swift */; };
Expand Down Expand Up @@ -152,10 +153,11 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB19224F26727A2500F48E60 /* Kingfisher in Frameworks */,
ABE0FA2F25D4CAEC00E52F18 /* SDWebImageSwiftUI in Frameworks */,
AB324F66266EFF4200F34A12 /* Kanna in Frameworks */,
AB2B0F3B2684228400777944 /* SwiftyBeaver in Frameworks */,
AB19D619266E5C6700BA752A /* TTProgressHUD in Frameworks */,
AB2F72BF2685A8B00088DECA /* Kingfisher in Frameworks */,
AB018DD2268756D000EB0EA9 /* Kanna in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -364,8 +366,9 @@
packageProductDependencies = (
ABE0FA2E25D4CAEC00E52F18 /* SDWebImageSwiftUI */,
AB19D618266E5C6700BA752A /* TTProgressHUD */,
AB324F65266EFF4200F34A12 /* Kanna */,
AB19224E26727A2500F48E60 /* Kingfisher */,
AB2B0F3A2684228400777944 /* SwiftyBeaver */,
AB2F72BE2685A8B00088DECA /* Kingfisher */,
AB018DD1268756D000EB0EA9 /* Kanna */,
);
productName = EhPanda;
productReference = ABC3C7542593696C00E0C11B /* EhPanda.app */;
Expand Down Expand Up @@ -400,8 +403,9 @@
packageReferences = (
ABE0FA2D25D4CAEC00E52F18 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */,
AB19D617266E5C6700BA752A /* XCRemoteSwiftPackageReference "TTProgressHUD" */,
AB324F64266EFF4200F34A12 /* XCRemoteSwiftPackageReference "Kanna" */,
AB19224D26727A2500F48E60 /* XCRemoteSwiftPackageReference "Kingfisher" */,
AB2B0F392684228400777944 /* XCRemoteSwiftPackageReference "SwiftyBeaver" */,
AB2F72BD2685A8B00088DECA /* XCRemoteSwiftPackageReference "Kingfisher" */,
AB018DD0268756D000EB0EA9 /* XCRemoteSwiftPackageReference "Kanna" */,
);
productRefGroup = ABC3C7552593696C00E0C11B /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -666,7 +670,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 53;
CURRENT_PROJECT_VERSION = 54;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
ENABLE_PREVIEWS = YES;
Expand All @@ -693,7 +697,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 53;
CURRENT_PROJECT_VERSION = 54;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -737,12 +741,12 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
AB19224D26727A2500F48E60 /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
AB018DD0268756D000EB0EA9 /* XCRemoteSwiftPackageReference "Kanna" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/tatsuz0u/Kingfisher.git";
repositoryURL = "https://github.com/tid-kijyun/Kanna.git";
requirement = {
branch = "Remove-Accelerate";
kind = branch;
kind = revision;
revision = 211beb276b7563eb9bb09474ce2d5f2176976232;
};
};
AB19D617266E5C6700BA752A /* XCRemoteSwiftPackageReference "TTProgressHUD" */ = {
Expand All @@ -753,12 +757,20 @@
kind = branch;
};
};
AB324F64266EFF4200F34A12 /* XCRemoteSwiftPackageReference "Kanna" */ = {
AB2B0F392684228400777944 /* XCRemoteSwiftPackageReference "SwiftyBeaver" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/tid-kijyun/Kanna.git";
repositoryURL = "https://github.com/SwiftyBeaver/SwiftyBeaver.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 5.0.0;
minimumVersion = 1.9.5;
};
};
AB2F72BD2685A8B00088DECA /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/tatsuz0u/Kingfisher";
requirement = {
branch = "Xcode-13-fix";
kind = branch;
};
};
ABE0FA2D25D4CAEC00E52F18 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = {
Expand All @@ -772,20 +784,25 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
AB19224E26727A2500F48E60 /* Kingfisher */ = {
AB018DD1268756D000EB0EA9 /* Kanna */ = {
isa = XCSwiftPackageProductDependency;
package = AB19224D26727A2500F48E60 /* XCRemoteSwiftPackageReference "Kingfisher" */;
productName = Kingfisher;
package = AB018DD0268756D000EB0EA9 /* XCRemoteSwiftPackageReference "Kanna" */;
productName = Kanna;
};
AB19D618266E5C6700BA752A /* TTProgressHUD */ = {
isa = XCSwiftPackageProductDependency;
package = AB19D617266E5C6700BA752A /* XCRemoteSwiftPackageReference "TTProgressHUD" */;
productName = TTProgressHUD;
};
AB324F65266EFF4200F34A12 /* Kanna */ = {
AB2B0F3A2684228400777944 /* SwiftyBeaver */ = {
isa = XCSwiftPackageProductDependency;
package = AB324F64266EFF4200F34A12 /* XCRemoteSwiftPackageReference "Kanna" */;
productName = Kanna;
package = AB2B0F392684228400777944 /* XCRemoteSwiftPackageReference "SwiftyBeaver" */;
productName = SwiftyBeaver;
};
AB2F72BE2685A8B00088DECA /* Kingfisher */ = {
isa = XCSwiftPackageProductDependency;
package = AB2F72BD2685A8B00088DECA /* XCRemoteSwiftPackageReference "Kingfisher" */;
productName = Kingfisher;
};
ABE0FA2E25D4CAEC00E52F18 /* SDWebImageSwiftUI */ = {
isa = XCSwiftPackageProductDependency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"repositoryURL": "https://github.com/tid-kijyun/Kanna.git",
"state": {
"branch": null,
"revision": "c657fb9f5827ef138068215c76ad0bb62bbc92da",
"version": "5.2.4"
"revision": "211beb276b7563eb9bb09474ce2d5f2176976232",
"version": null
}
},
{
"package": "Kingfisher",
"repositoryURL": "https://github.com/tatsuz0u/Kingfisher.git",
"repositoryURL": "https://github.com/tatsuz0u/Kingfisher",
"state": {
"branch": "Remove-Accelerate",
"revision": "a057f36f4e4af94a6fe3b3a1e6c70ada5f704050",
"branch": "Xcode-13-fix",
"revision": "ff901f1bbde87c923fb79bb084bb28a75d63b8dc",
"version": null
}
},
Expand All @@ -37,6 +37,15 @@
"version": "2.0.2"
}
},
{
"package": "SwiftyBeaver",
"repositoryURL": "https://github.com/SwiftyBeaver/SwiftyBeaver.git",
"state": {
"branch": null,
"revision": "2c039501d6eeb4d4cd4aec4a8d884ad28862e044",
"version": "1.9.5"
}
},
{
"package": "TTProgressHUD",
"repositoryURL": "https://github.com/tatsuz0u/TTProgressHUD.git",
Expand Down
12 changes: 6 additions & 6 deletions EhPanda/App/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ extension Defaults.URL {
merge(urls: [
host,
listCompact,
fSearch + keyword.URLString()
fSearch + keyword.urlEncoded()
]
+ applyFilters(filter: filter)
)
Expand All @@ -139,7 +139,7 @@ extension Defaults.URL {
urls: [
host,
listCompact,
fSearch + keyword.URLString(),
fSearch + keyword.urlEncoded(),
page + pageNum,
from + lastID
]
Expand Down Expand Up @@ -192,7 +192,7 @@ extension Defaults.URL {
merge(keyword: keyword, pageNum: nil, lastID: nil)
}
static func similarGallery(keyword: String) -> String {
merge(urls: [host, listCompact, fSearch + keyword.URLString()])
merge(urls: [host, listCompact, fSearch + keyword.urlEncoded()])
}
static func moreAssociatedItemsRedir(keyword: AssociatedKeyword, lastID: String, pageNum: String) -> String {
if let title = keyword.title {
Expand All @@ -211,7 +211,7 @@ extension Defaults.URL {
merge(urls: [
host,
listCompact,
fSearch + keyword.URLString(),
fSearch + keyword.urlEncoded(),
page + pageNum,
from + lastID
])
Expand Down Expand Up @@ -334,8 +334,8 @@ private extension Defaults.URL {
}
static func merge(keyword: (String, String), pageNum: String?, lastID: String?) -> String {
guard let pageNum = pageNum, let lastID = lastID else {
return host + tag + "\(keyword.0):\(keyword.1.URLString())"
return host + tag + "\(keyword.0):\(keyword.1.urlEncoded())"
}
return merge(urls: [host + tag + "\(keyword.0):\(keyword.1.URLString())/\(pageNum)", from + lastID])
return merge(urls: [host + tag + "\(keyword.0):\(keyword.1.urlEncoded())/\(pageNum)", from + lastID])
}
}
38 changes: 38 additions & 0 deletions EhPanda/App/EhPandaApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

import SwiftUI
import Kingfisher
import SwiftyBeaver
import SDWebImageSwiftUI

@main
struct EhPandaApp: App {
@StateObject private var store = Store()

init() {
configureLogging()
configureWebImage()
clearImageCachesIfNeeded()
}
Expand Down Expand Up @@ -57,6 +59,42 @@ private extension EhPandaApp {
}
}

func configureLogging() {
var file = FileDestination()
var console = ConsoleDestination()
let format = [
"$Dyyyy-MM-dd HH:mm:ss.SSS$d",
"$C$L$c $N.$F:$l - $M $X"
].joined(separator: " ")

file.format = format
console.format = format
configure(file: &file)
configure(console: &console)

SwiftyBeaver.addDestination(file)
#if DEBUG
SwiftyBeaver.addDestination(console)
#endif
}
func configure(file: inout FileDestination) {
file.logFileAmount = 5
file.logFileURL = try? FileManager.default.url(
for: .documentDirectory, in: .userDomainMask,
appropriateFor: nil, create: true
).appendingPathComponent("EhPanda.log")
}
func configure(console: inout ConsoleDestination) {
#if DEBUG
console.asynchronously = false
#endif
console.levelColor.verbose = "😪"
console.levelColor.debug = "🐛"
console.levelColor.info = "📖"
console.levelColor.warning = "⚠️"
console.levelColor.error = "‼️"
}

func configureWebImage() {
let config = KingfisherManager.shared.downloader.sessionConfiguration
config.httpCookieStorage = HTTPCookieStorage.shared
Expand Down
6 changes: 3 additions & 3 deletions EhPanda/App/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Combine
import Foundation

extension Dictionary where Key == String, Value == String {
func jsonString() -> String {
func dictString() -> String {
var array = [String]()
keys.forEach { key in
let value = self[key]!
Expand Down Expand Up @@ -68,8 +68,8 @@ extension String {
String(localized: StringLocalizationKey(self))
}

func URLString() -> String {
self.addingPercentEncoding(
func urlEncoded() -> String {
addingPercentEncoding(
withAllowedCharacters: .urlQueryAllowed
) ?? ""
}
Expand Down
4 changes: 4 additions & 0 deletions EhPanda/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>NSFaceIDUsageDescription</key>
<string>We need this permission to provide Face ID option while unlocking the App.</string>
<key>UIApplicationSceneManifest</key>
Expand All @@ -86,6 +88,8 @@
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchScreen</key>
<dict/>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
21 changes: 10 additions & 11 deletions EhPanda/App/Tools/Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -952,19 +952,16 @@ extension Parser {
static func parseCommentContent(node: XMLElement) -> [CommentContent] {
var contents = [CommentContent]()

for div in node.xpath("//div") {
node.removeChild(div)
}
for span in node.xpath("span") {
node.removeChild(span)
}

guard var rawContent = node.innerHTML?
.replacingOccurrences(of: "<br>", with: "\n")
.replacingOccurrences(of: "</span>", with: "")
.replacingOccurrences(
of: "<div.*?>.*?</div>",
with: "",
options: .regularExpression
)
.replacingOccurrences(
of: "<span.*?>",
with: "",
options: .regularExpression
)
else { return [] }

while (node.xpath("//a").count
Expand Down Expand Up @@ -994,7 +991,9 @@ extension Parser {
}

guard let link = tmpLink,
let html = link.toHTML,
let html = link.toHTML?
.replacingOccurrences(of: "<br>", with: "\n")
.replacingOccurrences(of: "</span>", with: ""),
let range = rawContent.range(of: html)
else { continue }

Expand Down
22 changes: 11 additions & 11 deletions EhPanda/DataFlow/AppAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ enum AppAction {
case replaceMangaCommentJumpID(gid: String?)
case updateIsSlideMenuClosed(isClosed: Bool)

case toggleAppUnlocked(isUnlocked: Bool)
case toggleBlurEffect(effectOn: Bool)
case toggleHomeListType(type: HomeListType)
case toggleFavoriteIndex(index: Int)
case toggleNavBarHidden(isHidden: Bool)
case toggleHomeViewSheetState(state: HomeViewSheetState?)
case toggleSettingViewSheetState(state: SettingViewSheetState?)
case toggleSettingViewActionSheetState(state: SettingViewActionSheetState)
case toggleFilterViewActionSheetState(state: FilterViewActionSheetState)
case toggleDetailViewSheetState(state: DetailViewSheetState?)
case toggleCommentViewSheetState(state: CommentViewSheetState?)
case toggleApp(unlocked: Bool)
case toggleBlur(effectOn: Bool)
case toggleHomeList(type: HomeListType)
case toggleFavorite(index: Int)
case toggleNavBar(hidden: Bool)
case toggleHomeViewSheet(state: HomeViewSheetState?)
case toggleSettingViewSheet(state: SettingViewSheetState?)
case toggleSettingViewActionSheet(state: SettingViewActionSheetState)
case toggleFilterViewActionSheet(state: FilterViewActionSheetState)
case toggleDetailViewSheet(state: DetailViewSheetState?)
case toggleCommentViewSheet(state: CommentViewSheetState?)

case fetchGreeting
case fetchGreetingDone(result: Result<Greeting, AppError>)
Expand Down
Loading

0 comments on commit 59f1c24

Please sign in to comment.