Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions Kanzen/Views/Reader/WebToon/webToonViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,26 @@ struct WebtoonView: UIViewRepresentable {
}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
print("LoadingNext is \(loadingNext)")
print("LoadingPrev is \(loadingPrevious)")
if let collectionView = scrollView as? UICollectionView {
let visibleIndexPaths = collectionView.indexPathsForVisibleItems
if !loadingPrevious {
if visibleIndexPaths.contains(IndexPath(item:0, section:0))
{
print("First cell is VISIBLE adding prev chapters")

if reader_manager.prevChapter.count == 0 {
loadingPrevious = true
self.reader_manager.fetchTask(bool: false){
print("completion handler called")

self.prependChapter(collectionView: collectionView)

}
}
else {
print("nextChap is not empty")
prependChapter(collectionView: collectionView)
}

Expand All @@ -170,18 +177,23 @@ struct WebtoonView: UIViewRepresentable {
if !loadingNext {

if bottomPath == nil || bottomPath?.section == chapters.count - 1 && bottomPath?.item == chapters[chapters.count - 1].count - 1 {
print("bottom path (section, idx) is (\(bottomPath?.section),\(bottomPath?.item)")
if reader_manager.nextChapter.count == 0 {
loadingNext = true
self.reader_manager.fetchTask(bool: true){
print("completion handler called")

self.appendChapter(collectionView: collectionView)

}
}
else {
print("nextChap is not empty")
appendChapter(collectionView: collectionView)
}
}
}

}
}
//get height
Expand Down Expand Up @@ -243,7 +255,11 @@ struct WebtoonView: UIViewRepresentable {
// 2. Then update the UI
collectionView.performBatchUpdates({
collectionView.deleteSections(IndexSet(integersIn: lastSectionStart..<lastSectionStart + 2))
}, completion: { _ in
}, completion: { completed in
if completed {
print("First section removed successfully")

}
self.loadingPrevious = false
UIView.setAnimationsEnabled(true)
CATransaction.commit()
Expand Down Expand Up @@ -275,7 +291,7 @@ struct WebtoonView: UIViewRepresentable {

// Store current offset and content size
let oldOffset = collectionView.contentOffset
let _ = collectionView.collectionViewLayout.collectionViewContentSize
let oldContentSize = collectionView.collectionViewLayout.collectionViewContentSize
let removedSectionHeight = getHeightForSection(0, collectionView: collectionView)
if chapters.count >= 3 {
// Sliding window: replace first chapter with new one
Expand Down Expand Up @@ -598,8 +614,8 @@ class ChapterCollectionViewCell: UICollectionViewCell {

// Handle the special case where image loaded but task was cancelled
if case .imageSettingError(let reason) = error,
case .notCurrentSourceTask(let result, _, _) = reason,
let retrieveResult = result {
case .notCurrentSourceTask(let result) = reason,
let retrieveResult = result.result {
// Image actually loaded successfully, we can still use the size info
let imageSize = retrieveResult.image.size
if let collectionView = self.findCollectionView() {
Expand Down
27 changes: 18 additions & 9 deletions Kanzen/Views/Util/contentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import SwiftUI
import Foundation
import Kingfisher
import WrappingHStack

#if !os(tvOS)
struct contentView: View {
Expand Down Expand Up @@ -62,15 +63,19 @@ struct contentView: View {
if let authorArtist = contentData["authorArtist"] as? [String]
{
HStack{
ForEach(Array(authorArtist.enumerated()),id: \.offset)
WrappingHStack(authorArtist,id: \.self)
{
idx,item in
item in
Text(item).font(.caption)


.padding(.leading,3)
.padding(.trailing,3)
.background(Color.accentColor)

.cornerRadius(3)
.padding(.bottom,3)


}
}

Expand All @@ -80,15 +85,19 @@ struct contentView: View {
if let tags = contentData["tags"] as? [String]
{
HStack{
ForEach(Array(tags.enumerated()),id: \.offset)
WrappingHStack(tags,id: \.self)
{
idx,item in
item in
Text(item).font(.caption)
.padding(.leading,3)
.padding(.trailing,3)
.background(Color.accentColor)

.cornerRadius(3)
.padding(.leading,3)
.padding(.trailing,3)
.background(Color.accentColor)
.cornerRadius(3)
.padding(.bottom,3)



}
}

Expand Down
46 changes: 39 additions & 7 deletions Luna.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
13F5B5922E73090000565E75 /* HomeSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13F5B5912E73090000565E75 /* HomeSection.swift */; };
13F5B5952E730CB200565E75 /* TMDBContentFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13F5B5942E730CB200565E75 /* TMDBContentFilter.swift */; };
13F5B5972E730CDB00565E75 /* TMDBFiltersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13F5B5962E730CDB00565E75 /* TMDBFiltersView.swift */; };
384E7AE12F13319C00FAA291 /* WrappingHStack in Frameworks */ = {isa = PBXBuildFile; productRef = 384E7AE02F13319C00FAA291 /* WrappingHStack */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -251,7 +252,8 @@
12E7AF5E2EB7FDB7003B7664 /* FakeWebKit in Frameworks */,
13A46D032EF5945700423BC6 /* SoraCore in Frameworks */,
13A46CFD2EF5943400423BC6 /* FakeWebKit in Frameworks */,
136C25C62EFE950300E37A6E /* MPVKit-GPL in Frameworks */,
384E7AE12F13319C00FAA291 /* WrappingHStack in Frameworks */,
13A46D062EF595DD00423BC6 /* MPVKit-GPL in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -771,7 +773,8 @@
13A46CFC2EF5943400423BC6 /* FakeWebKit */,
13A46CFF2EF5944C00423BC6 /* Kingfisher */,
13A46D022EF5945700423BC6 /* SoraCore */,
136C25C52EFE950300E37A6E /* MPVKit-GPL */,
13A46D052EF595DD00423BC6 /* MPVKit-GPL */,
384E7AE02F13319C00FAA291 /* WrappingHStack */,
);
productName = Sora;
productReference = 13F0725B2E4B2D3300EF90EB /* Luna.app */;
Expand Down Expand Up @@ -805,7 +808,8 @@
13A46CFB2EF5943400423BC6 /* XCRemoteSwiftPackageReference "FakeWebKit" */,
13A46CFE2EF5944C00423BC6 /* XCRemoteSwiftPackageReference "Kingfisher" */,
13A46D012EF5945700423BC6 /* XCRemoteSwiftPackageReference "SoraCore" */,
136C25C42EFE950300E37A6E /* XCRemoteSwiftPackageReference "MPVKit" */,
13A46D042EF595DD00423BC6 /* XCRemoteSwiftPackageReference "MPVKit" */,
384E7ADF2F13319C00FAA291 /* XCRemoteSwiftPackageReference "WrappingHStack" */,
);
productRefGroup = 13F0725C2E4B2D3300EF90EB /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1093,7 +1097,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "${DEVELOPMENT_TEAM}";
DEVELOPMENT_TEAM = C5TY8LKCH7;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = NO;
ENABLE_INCOMING_NETWORK_CONNECTIONS = NO;
Expand All @@ -1110,7 +1114,7 @@
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Luna/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "${APP_NAME}";
INFOPLIST_KEY_CFBundleDisplayName = Luna;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
Expand All @@ -1129,6 +1133,7 @@
MARKETING_VERSION = 1.0.0;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_IDENTIFIER}";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = dawudosman.sora;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator";
Expand All @@ -1149,7 +1154,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "${DEVELOPMENT_TEAM}";
DEVELOPMENT_TEAM = C5TY8LKCH7;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = NO;
ENABLE_INCOMING_NETWORK_CONNECTIONS = NO;
Expand All @@ -1166,7 +1171,7 @@
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Luna/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "${APP_NAME}";
INFOPLIST_KEY_CFBundleDisplayName = Luna;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
Expand All @@ -1185,6 +1190,7 @@
MARKETING_VERSION = 1.0.0;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_IDENTIFIER}";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = dawudosman.sora;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator";
Expand Down Expand Up @@ -1252,6 +1258,22 @@
kind = branch;
};
};
13A46D042EF595DD00423BC6 /* XCRemoteSwiftPackageReference "MPVKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mpvkit/MPVKit";
requirement = {
kind = exactVersion;
version = "0.40.0-xcode";
};
};
384E7ADF2F13319C00FAA291 /* XCRemoteSwiftPackageReference "WrappingHStack" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/dkk/WrappingHStack";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.2.11;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down Expand Up @@ -1279,6 +1301,16 @@
package = 13A46D012EF5945700423BC6 /* XCRemoteSwiftPackageReference "SoraCore" */;
productName = SoraCore;
};
13A46D052EF595DD00423BC6 /* MPVKit-GPL */ = {
isa = XCSwiftPackageProductDependency;
package = 13A46D042EF595DD00423BC6 /* XCRemoteSwiftPackageReference "MPVKit" */;
productName = "MPVKit-GPL";
};
384E7AE02F13319C00FAA291 /* WrappingHStack */ = {
isa = XCSwiftPackageProductDependency;
package = 384E7ADF2F13319C00FAA291 /* XCRemoteSwiftPackageReference "WrappingHStack" */;
productName = WrappingHStack;
};
/* End XCSwiftPackageProductDependency section */

/* Begin XCVersionGroup section */
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Luna.xcodeproj/xcshareddata/xcschemes/Luna.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2620"
LastUpgradeVersion = "2600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
15 changes: 1 addition & 14 deletions Luna/Luna.entitlements
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.aps-environment</key>
<string>development</string>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.me.cranci.sora</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudKit</string>
</array>
</dict>
<dict/>
</plist>