Skip to content

Commit 18b889d

Browse files
author
たつぞう
committed
Merge branch 'develop'
2 parents 1c91494 + 29a300d commit 18b889d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+883
-626
lines changed

EhPanda.xcodeproj/project.pbxproj

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
AB018DD2268756D000EB0EA9 /* Kanna in Frameworks */ = {isa = PBXBuildFile; productRef = AB018DD1268756D000EB0EA9 /* Kanna */; };
11+
AB0F68AF26A6D92F00AC3A54 /* DeprecatedAPI in Frameworks */ = {isa = PBXBuildFile; productRef = AB0F68AE26A6D92F00AC3A54 /* DeprecatedAPI */; };
1112
AB10117E26986B7D00C2C1A9 /* MangaStateMO+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB10117D26986B7D00C2C1A9 /* MangaStateMO+CoreDataProperties.swift */; };
1213
AB10118026986C1100C2C1A9 /* MangaStateMO+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB10117F26986C1100C2C1A9 /* MangaStateMO+CoreDataClass.swift */; };
1314
AB19D619266E5C6700BA752A /* TTProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = AB19D618266E5C6700BA752A /* TTProgressHUD */; };
@@ -33,8 +34,10 @@
3334
AB63EADD2699AC9100090535 /* AppEnvMO+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB63EADC2699AC9100090535 /* AppEnvMO+CoreDataClass.swift */; };
3435
AB6DE897268822390087C579 /* LogsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB6DE896268822390087C579 /* LogsView.swift */; };
3536
AB7E6B3025D24FE00035CC68 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AB7E6B3225D24FE00035CC68 /* InfoPlist.strings */; };
37+
AB9A7E3A26A6AF2500779319 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = AB9A7E3926A6AF2500779319 /* Kingfisher */; };
3638
ABA732D925A8018A00B3D9AB /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA732D825A8018A00B3D9AB /* Extensions.swift */; };
3739
ABA732DF25A852D800B3D9AB /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA732DE25A852D800B3D9AB /* Filter.swift */; };
40+
ABAFFE4026A86E3000EE8661 /* MeasureTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABAFFE3F26A86E3000EE8661 /* MeasureTool.swift */; };
3841
ABC1FAB6264152C800A9F352 /* StoreAccessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC1FAB5264152C800A9F352 /* StoreAccessor.swift */; };
3942
ABC1FAB82642C37D00A9F352 /* NewDawnView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC1FAB72642C37D00A9F352 /* NewDawnView.swift */; };
4043
ABC3C7852593699B00E0C11B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABC3C7692593699A00E0C11B /* Assets.xcassets */; };
@@ -52,7 +55,6 @@
5255
ABCD2F0E25976B95008E5A20 /* Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABCD2F0D25976B95008E5A20 /* Parser.swift */; };
5356
ABD5FDD4263D05110021A4C6 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = ABD5FDD3263D05110021A4C6 /* .swiftlint.yml */; };
5457
ABE1867826A1733000689FDC /* LaboratorySettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE1867726A1733000689FDC /* LaboratorySettingView.swift */; };
55-
ABE1867926A18D4E00689FDC /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = AB370E7B26A03B0300A1402D /* Kingfisher */; };
5658
ABE1867F26A18DD000689FDC /* SwiftyBeaver in Frameworks */ = {isa = PBXBuildFile; productRef = ABE1867E26A18DD000689FDC /* SwiftyBeaver */; };
5759
ABE2AE752699F238001D47AA /* AppEnvStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE2AE742699F238001D47AA /* AppEnvStorage.swift */; };
5860
ABEA1FE625A9B40B002966B9 /* Setting.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABEA1FE525A9B40B002966B9 /* Setting.swift */; };
@@ -118,9 +120,11 @@
118120
AB7E6B3125D24FE00035CC68 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = "<group>"; };
119121
AB7E6B3425D24FE40035CC68 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
120122
AB7E6B3525D24FE50035CC68 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
123+
AB86149B26A9C91E003A1F5A /* Model 2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 2.xcdatamodel"; sourceTree = "<group>"; };
121124
AB994DBB25986F7A00E9A367 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
122125
ABA732D825A8018A00B3D9AB /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
123126
ABA732DE25A852D800B3D9AB /* Filter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Filter.swift; sourceTree = "<group>"; };
127+
ABAFFE3F26A86E3000EE8661 /* MeasureTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeasureTool.swift; sourceTree = "<group>"; };
124128
ABB5013026A41EBA00B542D9 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; };
125129
ABB5013126A41EBA00B542D9 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/InfoPlist.strings; sourceTree = "<group>"; };
126130
ABC1FAB5264152C800A9F352 /* StoreAccessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreAccessor.swift; sourceTree = "<group>"; };
@@ -188,8 +192,9 @@
188192
isa = PBXFrameworksBuildPhase;
189193
buildActionMask = 2147483647;
190194
files = (
191-
ABE1867926A18D4E00689FDC /* Kingfisher in Frameworks */,
195+
AB9A7E3A26A6AF2500779319 /* Kingfisher in Frameworks */,
192196
AB19D619266E5C6700BA752A /* TTProgressHUD in Frameworks */,
197+
AB0F68AF26A6D92F00AC3A54 /* DeprecatedAPI in Frameworks */,
193198
AB018DD2268756D000EB0EA9 /* Kanna in Frameworks */,
194199
ABE1867F26A18DD000689FDC /* SwiftyBeaver in Frameworks */,
195200
);
@@ -365,6 +370,7 @@
365370
ABF45AC725F3313D00ECB568 /* TagCloudView.swift */,
366371
ABF45ACB25F3313D00ECB568 /* LinkedText.swift */,
367372
ABF45ACA25F3313D00ECB568 /* RatingView.swift */,
373+
ABAFFE3F26A86E3000EE8661 /* MeasureTool.swift */,
368374
);
369375
path = Tools;
370376
sourceTree = "<group>";
@@ -425,8 +431,9 @@
425431
packageProductDependencies = (
426432
AB19D618266E5C6700BA752A /* TTProgressHUD */,
427433
AB018DD1268756D000EB0EA9 /* Kanna */,
428-
AB370E7B26A03B0300A1402D /* Kingfisher */,
429434
ABE1867E26A18DD000689FDC /* SwiftyBeaver */,
435+
AB9A7E3926A6AF2500779319 /* Kingfisher */,
436+
AB0F68AE26A6D92F00AC3A54 /* DeprecatedAPI */,
430437
);
431438
productName = EhPanda;
432439
productReference = ABC3C7542593696C00E0C11B /* EhPanda.app */;
@@ -462,8 +469,9 @@
462469
packageReferences = (
463470
AB19D617266E5C6700BA752A /* XCRemoteSwiftPackageReference "TTProgressHUD" */,
464471
AB018DD0268756D000EB0EA9 /* XCRemoteSwiftPackageReference "Kanna" */,
465-
AB370E7A26A03B0300A1402D /* XCRemoteSwiftPackageReference "Kingfisher" */,
466472
ABE1867D26A18DD000689FDC /* XCRemoteSwiftPackageReference "SwiftyBeaver" */,
473+
AB9A7E3826A6AF2500779319 /* XCRemoteSwiftPackageReference "Kingfisher" */,
474+
AB0F68AD26A6D92F00AC3A54 /* XCRemoteSwiftPackageReference "DeprecatedAPI" */,
467475
);
468476
productRefGroup = ABC3C7552593696C00E0C11B /* Products */;
469477
projectDirPath = "";
@@ -558,6 +566,7 @@
558566
ABC681F326898D46007BBD69 /* Model.xcdatamodeld in Sources */,
559567
ABF45AE125F3313D00ECB568 /* Home.swift in Sources */,
560568
AB4FD2C1268AB83300A95968 /* MangaDetailMO+CoreDataProperties.swift in Sources */,
569+
ABAFFE4026A86E3000EE8661 /* MeasureTool.swift in Sources */,
561570
AB6DE897268822390087C579 /* LogsView.swift in Sources */,
562571
ABF45AF025F3313D00ECB568 /* CommentView.swift in Sources */,
563572
ABF45AE325F3313D00ECB568 /* SlideMenu.swift in Sources */,
@@ -747,7 +756,7 @@
747756
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
748757
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
749758
CODE_SIGN_STYLE = Automatic;
750-
CURRENT_PROJECT_VERSION = 61;
759+
CURRENT_PROJECT_VERSION = 62;
751760
DEVELOPMENT_ASSET_PATHS = "";
752761
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
753762
ENABLE_PREVIEWS = YES;
@@ -774,7 +783,7 @@
774783
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
775784
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
776785
CODE_SIGN_STYLE = Automatic;
777-
CURRENT_PROJECT_VERSION = 61;
786+
CURRENT_PROJECT_VERSION = 62;
778787
DEVELOPMENT_ASSET_PATHS = "";
779788
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
780789
ENABLE_PREVIEWS = YES;
@@ -826,6 +835,14 @@
826835
kind = branch;
827836
};
828837
};
838+
AB0F68AD26A6D92F00AC3A54 /* XCRemoteSwiftPackageReference "DeprecatedAPI" */ = {
839+
isa = XCRemoteSwiftPackageReference;
840+
repositoryURL = "https://github.com/tatsuz0u/DeprecatedAPI.git";
841+
requirement = {
842+
branch = main;
843+
kind = branch;
844+
};
845+
};
829846
AB19D617266E5C6700BA752A /* XCRemoteSwiftPackageReference "TTProgressHUD" */ = {
830847
isa = XCRemoteSwiftPackageReference;
831848
repositoryURL = "https://github.com/tatsuz0u/TTProgressHUD.git";
@@ -834,11 +851,11 @@
834851
kind = branch;
835852
};
836853
};
837-
AB370E7A26A03B0300A1402D /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
854+
AB9A7E3826A6AF2500779319 /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
838855
isa = XCRemoteSwiftPackageReference;
839-
repositoryURL = "https://github.com/onevcat/Kingfisher.git";
856+
repositoryURL = "https://github.com/tatsuz0u/Kingfisher.git";
840857
requirement = {
841-
branch = "fix/xcode-13";
858+
branch = "masterFix/xcode-13";
842859
kind = branch;
843860
};
844861
};
@@ -858,14 +875,19 @@
858875
package = AB018DD0268756D000EB0EA9 /* XCRemoteSwiftPackageReference "Kanna" */;
859876
productName = Kanna;
860877
};
878+
AB0F68AE26A6D92F00AC3A54 /* DeprecatedAPI */ = {
879+
isa = XCSwiftPackageProductDependency;
880+
package = AB0F68AD26A6D92F00AC3A54 /* XCRemoteSwiftPackageReference "DeprecatedAPI" */;
881+
productName = DeprecatedAPI;
882+
};
861883
AB19D618266E5C6700BA752A /* TTProgressHUD */ = {
862884
isa = XCSwiftPackageProductDependency;
863885
package = AB19D617266E5C6700BA752A /* XCRemoteSwiftPackageReference "TTProgressHUD" */;
864886
productName = TTProgressHUD;
865887
};
866-
AB370E7B26A03B0300A1402D /* Kingfisher */ = {
888+
AB9A7E3926A6AF2500779319 /* Kingfisher */ = {
867889
isa = XCSwiftPackageProductDependency;
868-
package = AB370E7A26A03B0300A1402D /* XCRemoteSwiftPackageReference "Kingfisher" */;
890+
package = AB9A7E3826A6AF2500779319 /* XCRemoteSwiftPackageReference "Kingfisher" */;
869891
productName = Kingfisher;
870892
};
871893
ABE1867E26A18DD000689FDC /* SwiftyBeaver */ = {
@@ -879,9 +901,10 @@
879901
ABC681F126898D46007BBD69 /* Model.xcdatamodeld */ = {
880902
isa = XCVersionGroup;
881903
children = (
904+
AB86149B26A9C91E003A1F5A /* Model 2.xcdatamodel */,
882905
ABC681F226898D46007BBD69 /* Model.xcdatamodel */,
883906
);
884-
currentVersion = ABC681F226898D46007BBD69 /* Model.xcdatamodel */;
907+
currentVersion = AB86149B26A9C91E003A1F5A /* Model 2.xcdatamodel */;
885908
path = Model.xcdatamodeld;
886909
sourceTree = "<group>";
887910
versionGroupType = wrapper.xcdatamodel;

EhPanda.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EhPanda/App/Defaults.swift

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ struct Defaults {
3131
static let avatarH: CGFloat = 100
3232
static let headerW: CGFloat = headerH * headerScale
3333
static let headerH: CGFloat = 150
34-
static let previewW: CGFloat = previewH * previewScale
35-
static let previewH: CGFloat = 200
34+
static let previewMinW: CGFloat = isPadWidth ? 180 : 100
35+
static let previewMaxW: CGFloat = isPadWidth ? 220 : 120
36+
static let previewAvgW: CGFloat = (previewMinW + previewMaxW) / 2
3637
}
3738
struct Cookie {
3839
static let null = "null"
@@ -52,6 +53,11 @@ struct Defaults {
5253
static let logs = "logs"
5354
static let ehpandaLog = "EhPanda.log"
5455
}
56+
struct PreviewIdentifier {
57+
static let width = "?ehpandaWidth="
58+
static let height = "&ehpandaHeight="
59+
static let offset = "&ehpandaOffset="
60+
}
5561
struct Response {
5662
static let hathClientNotFound = "You must have a H@H client assigned to your account to use this feature."
5763
static let hathClientNotOnline = "Your H@H client appears to be offline. Turn it on, then try again."
@@ -236,7 +242,7 @@ extension Defaults.URL {
236242
}
237243

238244
// Misc
239-
static func contentPage(url: String, pageNum: Int) -> String {
245+
static func detailPage(url: String, pageNum: Int) -> String {
240246
merge(urls: [url, contentPage + "\(pageNum)"])
241247
}
242248
static func magnet(hash: String) -> String {
@@ -254,6 +260,15 @@ extension Defaults.URL {
254260
static func ehMyTags() -> String {
255261
host + mytags
256262
}
263+
static func normalPreview(
264+
plainURL: Substring, width: Substring,
265+
height: Substring, offset: Substring
266+
) -> String {
267+
plainURL
268+
+ Defaults.PreviewIdentifier.width + width
269+
+ Defaults.PreviewIdentifier.height + height
270+
+ Defaults.PreviewIdentifier.offset + offset
271+
}
257272
}
258273

259274
// MARK: Filter

EhPanda/App/EhPandaApp.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ private extension EhPandaApp {
118118
func configureDomainFronting() {
119119
if setting.bypassSNIFiltering {
120120
URLProtocol.registerClass(DFURLProtocol.self)
121-
URLProtocol.registerWebview(scheme: "https")
122121
}
123122
}
124123
func configureIgnoreOffensive() {

EhPanda/App/Extensions.swift

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ extension String {
8585
) ?? ""
8686
}
8787

88-
func urlDecoded() -> String {
89-
(removingPercentEncoding ?? "")
90-
.replacingOccurrences(of: "%3F", with: "?")
91-
}
92-
9388
var withComma: String? {
9489
Int(self)?.formatted(.number)
9590
}
@@ -102,7 +97,7 @@ extension String {
10297
var title = self
10398

10499
if let range = title.range(of: "|") {
105-
title = String(title.prefix(upTo: range.lowerBound))
100+
title = String(title[..<range.lowerBound])
106101
}
107102

108103
return title
@@ -122,16 +117,10 @@ extension String {
122117
var result = self
123118

124119
while let rangeA = result.range(of: subString1),
125-
let rangeB = result.range(of: subString2)
120+
let rangeB = result.range(of: subString2)
126121
{
127-
let unwanted = String(
128-
result.suffix(from: rangeA.lowerBound)
129-
.prefix(upTo: rangeB.upperBound)
130-
)
131-
result = result.replacingOccurrences(
132-
of: unwanted,
133-
with: replacement
134-
)
122+
let unwanted = result[rangeA.lowerBound..<rangeB.upperBound]
123+
result = result.replacingOccurrences(of: unwanted, with: replacement)
135124
}
136125

137126
return result
@@ -159,7 +148,7 @@ extension String {
159148
)
160149
) {
161150
return match.range.length
162-
== self.utf16.count
151+
== self.utf16.count
163152
} else {
164153
return false
165154
}
@@ -184,9 +173,9 @@ extension View {
184173
extension Bundle {
185174
var icon: UIImage? {
186175
if let icons = infoDictionary?["CFBundleIcons"] as? [String: Any],
187-
let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any],
188-
let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String],
189-
let lastIcon = iconFiles.last {
176+
let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any],
177+
let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String],
178+
let lastIcon = iconFiles.last {
190179
return UIImage(named: lastIcon)
191180
}
192181
return nil
@@ -231,6 +220,12 @@ extension UIImage {
231220
orientation: imageOrientation
232221
)
233222
}
223+
224+
func cropping(size: CGSize, offset: CGFloat) -> UIImage? {
225+
let origin = CGPoint(x: offset, y: 0)
226+
let rect = CGRect(origin: origin, size: size)
227+
return cropping(to: rect)
228+
}
234229
}
235230

236231
extension Optional {
@@ -263,3 +258,31 @@ extension URLRequest {
263258
)
264259
}
265260
}
261+
262+
extension UIImage {
263+
func withRoundedCorners(radius: CGFloat) -> UIImage? {
264+
let maxRadius = min(size.width, size.height) / 2
265+
266+
let cornerRadius: CGFloat
267+
if radius > 0 && radius <= maxRadius {
268+
cornerRadius = radius
269+
} else {
270+
cornerRadius = maxRadius
271+
}
272+
273+
UIGraphicsBeginImageContextWithOptions(size, false, scale)
274+
275+
let rect = CGRect(
276+
origin: .zero, size: size
277+
)
278+
UIBezierPath(
279+
roundedRect: rect,
280+
cornerRadius: cornerRadius
281+
).addClip()
282+
draw(in: rect)
283+
284+
let image = UIGraphicsGetImageFromCurrentImageContext()
285+
UIGraphicsEndImageContext()
286+
return image
287+
}
288+
}

0 commit comments

Comments
 (0)