diff --git a/Kanzen/Views/Reader/WebToon/webToonViewController.swift b/Kanzen/Views/Reader/WebToon/webToonViewController.swift index 72c926b7..cba25f81 100644 --- a/Kanzen/Views/Reader/WebToon/webToonViewController.swift +++ b/Kanzen/Views/Reader/WebToon/webToonViewController.swift @@ -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) } @@ -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 @@ -243,7 +255,11 @@ struct WebtoonView: UIViewRepresentable { // 2. Then update the UI collectionView.performBatchUpdates({ collectionView.deleteSections(IndexSet(integersIn: lastSectionStart..= 3 { // Sliding window: replace first chapter with new one @@ -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() { diff --git a/Kanzen/Views/Util/contentView.swift b/Kanzen/Views/Util/contentView.swift index 5b075114..397fa240 100644 --- a/Kanzen/Views/Util/contentView.swift +++ b/Kanzen/Views/Util/contentView.swift @@ -8,6 +8,7 @@ import SwiftUI import Foundation import Kingfisher +import WrappingHStack #if !os(tvOS) struct contentView: View { @@ -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) + + } } @@ -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) + + + } } diff --git a/Luna.xcodeproj/project.pbxproj b/Luna.xcodeproj/project.pbxproj index 17eb02f7..4d121fe3 100644 --- a/Luna.xcodeproj/project.pbxproj +++ b/Luna.xcodeproj/project.pbxproj @@ -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 */ @@ -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; }; @@ -771,7 +773,8 @@ 13A46CFC2EF5943400423BC6 /* FakeWebKit */, 13A46CFF2EF5944C00423BC6 /* Kingfisher */, 13A46D022EF5945700423BC6 /* SoraCore */, - 136C25C52EFE950300E37A6E /* MPVKit-GPL */, + 13A46D052EF595DD00423BC6 /* MPVKit-GPL */, + 384E7AE02F13319C00FAA291 /* WrappingHStack */, ); productName = Sora; productReference = 13F0725B2E4B2D3300EF90EB /* Luna.app */; @@ -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 = ""; @@ -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; @@ -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; @@ -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"; @@ -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; @@ -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; @@ -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"; @@ -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 */ @@ -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 */ diff --git a/Luna.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Luna.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 7794f632..30cc53d7 100644 --- a/Luna.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Luna.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "4561a9088cc02d530cf0726a874107be63f44ab1ddffae049809036cedc44807", + "originHash" : "4af77fd9d0b22d3ede401304eb96d7bd60df69ca70c6a21d497092e39009d052", "pins" : [ { "identity" : "fakewebkit", @@ -36,6 +36,15 @@ "branch" : "main", "revision" : "50ddc160fd606e9708adefc1d9fc7003b574446b" } + }, + { + "identity" : "wrappinghstack", + "kind" : "remoteSourceControl", + "location" : "https://github.com/dkk/WrappingHStack", + "state" : { + "revision" : "425d9488ba55f58f0b34498c64c054c77fc2a44b", + "version" : "2.2.11" + } } ], "version" : 3 diff --git a/Luna.xcodeproj/xcshareddata/xcschemes/Luna.xcscheme b/Luna.xcodeproj/xcshareddata/xcschemes/Luna.xcscheme index 2f8eae7c..b2fdb6e9 100644 --- a/Luna.xcodeproj/xcshareddata/xcschemes/Luna.xcscheme +++ b/Luna.xcodeproj/xcshareddata/xcschemes/Luna.xcscheme @@ -1,6 +1,6 @@ - - aps-environment - development - com.apple.developer.aps-environment - development - com.apple.developer.icloud-container-identifiers - - iCloud.me.cranci.sora - - com.apple.developer.icloud-services - - CloudKit - - +