Skip to content

Commit

Permalink
Merge pull request #946 from Jeepston/796--sort-file-on-storage-screen
Browse files Browse the repository at this point in the history
#796: Add a button to sort files on "Manage your files" screen
  • Loading branch information
GianniCarlo committed Jul 3, 2023
2 parents 281a313 + 45978d2 commit a848cdf
Show file tree
Hide file tree
Showing 13 changed files with 685 additions and 647 deletions.
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ disabled_rules:
- switch_case_alignment
- identifier_name
- trailing_comma
- trailing_newline
- trailing_whitespace
- private_over_fileprivate
- force_try
- type_body_length
Expand Down
16 changes: 8 additions & 8 deletions BookPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
41188D2826ED4D5C0017124E /* ItemListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41188D2726ED4D5C0017124E /* ItemListViewController.swift */; };
41188D2A26ED4D8E0017124E /* ItemListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41188D2926ED4D8E0017124E /* ItemListViewModel.swift */; };
4122991D24442E7800CDB416 /* BookPlayerKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41A1B0D2226E9BC400EA0400 /* BookPlayerKit.framework */; };
4124121A26CF287600B099DB /* StorageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4124121926CF287600B099DB /* StorageViewController.swift */; };
4124122626D1640000B099DB /* StorageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4124122526D1640000B099DB /* StorageTableViewCell.swift */; };
4124122826D19A8700B099DB /* StorageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4124122726D19A8600B099DB /* StorageViewModel.swift */; };
4124122A26D19B9100B099DB /* StorageItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4124122926D19B9100B099DB /* StorageItem.swift */; };
4124AB1725DFE07E0007C839 /* DataMigrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4124AB1625DFE07E0007C839 /* DataMigrationManager.swift */; };
Expand Down Expand Up @@ -522,6 +520,8 @@
C3FA301E20E0024900393DDA /* BPArtworkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FA301D20E0024900393DDA /* BPArtworkView.swift */; };
C3FE3F8220A090880055B9C6 /* limitPanAngle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FE3F8120A090880055B9C6 /* limitPanAngle.swift */; };
C3FE94792080086800BCEA37 /* BookCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FE94782080086800BCEA37 /* BookCellView.swift */; };
D6BA8F162A4CA94800C2BD9A /* StorageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BA8F152A4CA94800C2BD9A /* StorageRowView.swift */; };
D6BA8F182A4D66CD00C2BD9A /* StorageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BA8F172A4D66CD00C2BD9A /* StorageView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -690,8 +690,6 @@
41188D2726ED4D5C0017124E /* ItemListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemListViewController.swift; sourceTree = "<group>"; };
41188D2926ED4D8E0017124E /* ItemListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemListViewModel.swift; sourceTree = "<group>"; };
41188D3026ED715D0017124E /* SimpleLibraryItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleLibraryItem.swift; sourceTree = "<group>"; };
4124121926CF287600B099DB /* StorageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageViewController.swift; sourceTree = "<group>"; };
4124122526D1640000B099DB /* StorageTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageTableViewCell.swift; sourceTree = "<group>"; };
4124122726D19A8600B099DB /* StorageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageViewModel.swift; sourceTree = "<group>"; };
4124122926D19B9100B099DB /* StorageItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageItem.swift; sourceTree = "<group>"; };
412451821D489204008AC0E5 /* Crashlytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Crashlytics.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1162,6 +1160,8 @@
C3FE3F8120A090880055B9C6 /* limitPanAngle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = limitPanAngle.swift; sourceTree = "<group>"; };
C3FE94782080086800BCEA37 /* BookCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookCellView.swift; sourceTree = "<group>"; };
D367F7671FA2A6F000FEDB37 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
D6BA8F152A4CA94800C2BD9A /* StorageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageRowView.swift; sourceTree = "<group>"; };
D6BA8F172A4D66CD00C2BD9A /* StorageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -1300,10 +1300,10 @@
4124121B26CF289B00B099DB /* Storage */ = {
isa = PBXGroup;
children = (
4124121926CF287600B099DB /* StorageViewController.swift */,
4124122926D19B9100B099DB /* StorageItem.swift */,
4124122526D1640000B099DB /* StorageTableViewCell.swift */,
4124122726D19A8600B099DB /* StorageViewModel.swift */,
D6BA8F152A4CA94800C2BD9A /* StorageRowView.swift */,
D6BA8F172A4D66CD00C2BD9A /* StorageView.swift */,
);
path = Storage;
sourceTree = "<group>";
Expand Down Expand Up @@ -3027,7 +3027,6 @@
9F2DC9DB2A008B28006CDF1F /* PricingRowView.swift in Sources */,
C3FE3F8220A090880055B9C6 /* limitPanAngle.swift in Sources */,
9F1804B827A4AEC500FEDFE5 /* AccessibleSliderView.swift in Sources */,
4124122626D1640000B099DB /* StorageTableViewCell.swift in Sources */,
9FB20EB929A479FB0021663B /* BPAlertContent.swift in Sources */,
41B68FFF2705477D00F657C3 /* StorageCoordinator.swift in Sources */,
4138CE1926E5B3FB0014F11E /* BookmarksViewController.swift in Sources */,
Expand Down Expand Up @@ -3080,6 +3079,7 @@
C318D3AD208CF624000666F8 /* PlayerJumpIcon.swift in Sources */,
4138CE2326E66E420014F11E /* BookmarkTableViewCell.swift in Sources */,
C37A6875209F13120063AEAC /* CreditsViewController.swift in Sources */,
D6BA8F162A4CA94800C2BD9A /* StorageRowView.swift in Sources */,
9F3C436A284181690066D99A /* DataInitializerCoordinator.swift in Sources */,
9F3C436B284181C70066D99A /* AlertPresenter.swift in Sources */,
9F00A6212950F44B005EA316 /* ImagePicker.swift in Sources */,
Expand Down Expand Up @@ -3160,13 +3160,13 @@
41E79BEB26C60DC600EA9FFF /* PlayerViewModel.swift in Sources */,
9F5FBB0A293EE0C2009F4B0E /* ItemDetailsViewModel.swift in Sources */,
9FC1A29F28C0D8CC00F25906 /* BookmarksActivityItemProvider.swift in Sources */,
D6BA8F182A4D66CD00C2BD9A /* StorageView.swift in Sources */,
9F64C6212793C31600B2493C /* PlayerControlsCoordinator.swift in Sources */,
9F7B647A2804773D00895ECC /* ThemesViewModel.swift in Sources */,
41C3395225E040FB003ED2B0 /* MappingModel_v2_to_v3.xcmappingmodel in Sources */,
C3EC372E206EE0650094B4E8 /* SleepTimer.swift in Sources */,
4124122A26D19B9100B099DB /* StorageItem.swift in Sources */,
41A1B12F226FE0F900EA0400 /* Notification+BookPlayer.swift in Sources */,
4124121A26CF287600B099DB /* StorageViewController.swift in Sources */,
9F4691FA2800F8D600A8F0E8 /* AccountCoordinator.swift in Sources */,
412AB70E2701463100969618 /* LoadingViewModel.swift in Sources */,
9F22DE42288DD20100056FCD /* AccountCardView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "416A29A22569658100605395"
BuildableName = "BookPlayerWidgetUIExtension.appex"
BlueprintName = "BookPlayerWidgetUIExtension"
ReferencedContainer = "container:BookPlayer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "418B6CF71D2707F800F974FB"
BuildableName = "BookPlayer.app"
BlueprintName = "BookPlayer"
ReferencedContainer = "container:BookPlayer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
askForAppToLaunch = "Yes"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "418B6CF71D2707F800F974FB"
BuildableName = "BookPlayer.app"
BlueprintName = "BookPlayer"
ReferencedContainer = "container:BookPlayer.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "_XCWidgetKind"
value = ""
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "_XCWidgetDefaultView"
value = "timeline"
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "_XCWidgetFamily"
value = "medium"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "418B6CF71D2707F800F974FB"
BuildableName = "BookPlayer.app"
BlueprintName = "BookPlayer"
ReferencedContainer = "container:BookPlayer.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
24 changes: 11 additions & 13 deletions BookPlayer/Coordinators/StorageCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

import Foundation
import BookPlayerKit
import SwiftUI

class StorageCoordinator: Coordinator {
let libraryService: LibraryServiceProtocol
final class StorageCoordinator: Coordinator {
private let libraryService: LibraryServiceProtocol

init(
libraryService: LibraryServiceProtocol,
Expand All @@ -26,22 +27,19 @@ class StorageCoordinator: Coordinator {
}

override func start() {
let vc = StorageViewController.instantiate(from: .Settings)

let viewModel = StorageViewModel(libraryService: self.libraryService,
let viewModel = StorageViewModel(libraryService: libraryService,
folderURL: DataManager.getProcessedFolderURL())
viewModel.coordinator = self
vc.viewModel = viewModel
vc.navigationItem.largeTitleDisplayMode = .never

self.navigationController.viewControllers = [vc]
self.navigationController.presentationController?.delegate = self
self.presentingViewController?.present(self.navigationController, animated: true, completion: nil)
let vc = UIHostingController(rootView: StorageView(viewModel: viewModel))
// vc.navigationItem.largeTitleDisplayMode = .never

navigationController.viewControllers = [vc]
navigationController.presentationController?.delegate = self
presentingViewController?.present(navigationController, animated: true)
}

override func interactiveDidFinish(vc: UIViewController) {
guard let vc = vc as? StorageViewController else { return }

vc.viewModel.coordinator.detach()
detach()
}
}
Loading

0 comments on commit a848cdf

Please sign in to comment.