Skip to content

Commit

Permalink
Merge pull request #1135 from TortugaPower/develop
Browse files Browse the repository at this point in the history
Release v5.2.8
  • Loading branch information
GianniCarlo authored Apr 28, 2024
2 parents bf5c76d + 47649dd commit 373a850
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 28 deletions.
44 changes: 26 additions & 18 deletions BookPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@
63C6C3122B54F16800FFE0D8 /* LibraryItemSyncOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63C6C30F2B54F14800FFE0D8 /* LibraryItemSyncOperation.swift */; };
63C6C3192B5E102200FFE0D8 /* SyncTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63C6C3172B5E0FE700FFE0D8 /* SyncTask.swift */; };
63C6C31A2B5E102200FFE0D8 /* SyncTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63C6C3172B5E0FE700FFE0D8 /* SyncTask.swift */; };
63F1C7892BB91260006B164C /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 63F1C7882BB91259006B164C /* PrivacyInfo.xcprivacy */; };
63F1C78B2BB91E21006B164C /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 63F1C78A2BB91E1B006B164C /* PrivacyInfo.xcprivacy */; };
63F828572AED56FA00B5CE0C /* CornerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63F828562AED56FA00B5CE0C /* CornerView.swift */; };
6906A55021720FDF00A9E0B2 /* BookSortServiceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6906A54F21720FDF00A9E0B2 /* BookSortServiceTest.swift */; };
6906A553217211C600A9E0B2 /* StubFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6906A552217211C600A9E0B2 /* StubFactory.swift */; };
Expand Down Expand Up @@ -1127,6 +1129,8 @@
63C6C30B2B538B7A00FFE0D8 /* SyncTasksStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncTasksStorage.swift; sourceTree = "<group>"; };
63C6C30F2B54F14800FFE0D8 /* LibraryItemSyncOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibraryItemSyncOperation.swift; sourceTree = "<group>"; };
63C6C3172B5E0FE700FFE0D8 /* SyncTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncTask.swift; sourceTree = "<group>"; };
63F1C7882BB91259006B164C /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
63F1C78A2BB91E1B006B164C /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
63F828562AED56FA00B5CE0C /* CornerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerView.swift; sourceTree = "<group>"; };
6906A54F21720FDF00A9E0B2 /* BookSortServiceTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookSortServiceTest.swift; sourceTree = "<group>"; };
6906A552217211C600A9E0B2 /* StubFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubFactory.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1587,6 +1591,7 @@
416A29CE256A442200605395 /* BookPlayerWidgets.entitlements */,
416A29AB2569658300605395 /* Assets.xcassets */,
416A29AD2569658300605395 /* Info.plist */,
63F1C78A2BB91E1B006B164C /* PrivacyInfo.xcprivacy */,
63005A442AE7FD8100A4CA2C /* Watch-Info.plist */,
);
path = BookPlayerWidgets;
Expand Down Expand Up @@ -1657,6 +1662,7 @@
419196341D47CC4E007A3AF3 /* BookPlayer.entitlements */,
416BF8A526537A4C00239166 /* BookPlayer-NoCarPlay.entitlements */,
418B6D091D2707F800F974FB /* Info.plist */,
63F1C7882BB91259006B164C /* PrivacyInfo.xcprivacy */,
41640A3624416EE8004FB97B /* Intents.intentdefinition */,
C37A6872209F0F830063AEAC /* Credits.html */,
4160A09423F2DE130039166B /* Localizable.stringsdict */,
Expand Down Expand Up @@ -3010,6 +3016,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63F1C78B2BB91E21006B164C /* PrivacyInfo.xcprivacy in Resources */,
416A29AC2569658300605395 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -3048,6 +3055,7 @@
4111FBEB25EDEFDD0096954F /* [email protected] in Resources */,
41AD3D9E221C750E00DC41E1 /* Icons.json in Resources */,
41E79BF526C6255C00EA9FFF /* PlayPauseIconView.xib in Resources */,
63F1C7892BB91260006B164C /* PrivacyInfo.xcprivacy in Resources */,
41E562ED2239531E00C06BC9 /* [email protected] in Resources */,
41E562E222394FB900C06BC9 /* [email protected] in Resources */,
C30B66AE20E2D8CF00FC0030 /* ArtworkControl.xib in Resources */,
Expand Down Expand Up @@ -3967,7 +3975,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerIntents";
Expand Down Expand Up @@ -4001,7 +4009,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerIntents";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4033,7 +4041,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerIntents";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4069,7 +4077,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).watchkitapp";
Expand Down Expand Up @@ -4110,7 +4118,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).watchkitapp";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4148,7 +4156,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).watchkitapp";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4317,7 +4325,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerWidgetUI";
Expand Down Expand Up @@ -4355,7 +4363,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerWidgetUI";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4391,7 +4399,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerWidgetUI";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4544,7 +4552,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER)";
PRODUCT_NAME = BookPlayer;
PROVISIONING_PROFILE_SPECIFIER = "$(BP_PROVISIONING_MAIN)";
Expand Down Expand Up @@ -4582,7 +4590,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER)";
PRODUCT_NAME = BookPlayer;
PROVISIONING_PROFILE_SPECIFIER = "$(BP_PROVISIONING_MAIN)";
Expand Down Expand Up @@ -4804,7 +4812,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).watchkitapp.widgets";
Expand Down Expand Up @@ -4842,7 +4850,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).watchkitapp.widgets";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4878,7 +4886,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).watchkitapp.widgets";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4917,7 +4925,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerShareExtension";
Expand Down Expand Up @@ -4957,7 +4965,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerShareExtension";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -4995,7 +5003,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER).BookPlayerShareExtension";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -5087,7 +5095,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 5.2.7;
MARKETING_VERSION = 5.2.8;
PRODUCT_BUNDLE_IDENTIFIER = "$(BP_BUNDLE_IDENTIFIER)";
PRODUCT_NAME = BookPlayer;
PROVISIONING_PROFILE_SPECIFIER = "$(BP_PROVISIONING_MAIN)";
Expand Down
2 changes: 1 addition & 1 deletion BookPlayer/Coordinators/DataInitializerCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class DataInitializerCoordinator: BPLogger {
private func getLibraryFiles() -> [URL] {
let enumerator = FileManager.default.enumerator(
at: DataManager.getProcessedFolderURL(),
includingPropertiesForKeys: [.creationDateKey, .isDirectoryKey],
includingPropertiesForKeys: [.isDirectoryKey],
options: [.skipsHiddenFiles, .skipsSubdirectoryDescendants], errorHandler: { (url, error) -> Bool in
print("directoryEnumerator error at \(url): ", error)
return true
Expand Down
14 changes: 13 additions & 1 deletion BookPlayer/Coordinators/LibraryListCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,20 @@ class LibraryListCoordinator: ItemListCoordinator, UINavigationControllerDelegat
}

func processFiles(urls: [URL]) {
let temporaryDirectoryPath = FileManager.default.temporaryDirectory.absoluteString
let documentsFolder = DataManager.getDocumentsFolderURL()

for url in urls {
self.importManager.process(url)
/// At some point (iOS 17?), the OS stopped sending the picked files to the Documents/Inbox folder, instead
/// it's now sent to a temp folder that can't be relied on to keep the file existing until the import is finished
if url.absoluteString.contains(temporaryDirectoryPath) {
let destinationURL = documentsFolder.appendingPathComponent(url.lastPathComponent)
if !FileManager.default.fileExists(atPath: destinationURL.path) {
try! FileManager.default.copyItem(at: url, to: destinationURL)
}
} else {
importManager.process(url)
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions BookPlayer/Import/Models/ImportOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public class ImportOperation: Operation {

let enumerator = FileManager.default.enumerator(
at: tempDirectoryURL,
includingPropertiesForKeys: [.creationDateKey, .isDirectoryKey],
includingPropertiesForKeys: [.isDirectoryKey],
options: [.skipsHiddenFiles, .skipsSubdirectoryDescendants], errorHandler: { (url, error) -> Bool in
print("directoryEnumerator error at \(url): ", error)
return true
Expand Down Expand Up @@ -204,7 +204,7 @@ public class ImportOperation: Operation {

NotificationCenter.default.post(name: .processingFile, object: nil, userInfo: ["filename": currentFile.lastPathComponent])

guard currentFile.pathExtension != "zip" else {
if shouldUnzip(currentFile) {
self.handleZip(file: currentFile, remainingFiles: mutableFiles)
return
}
Expand All @@ -231,4 +231,8 @@ public class ImportOperation: Operation {
self.processedFiles.append(destinationURL)
self.processFile(from: mutableFiles)
}

func shouldUnzip(_ file: URL) -> Bool {
return file.pathExtension == "zip" || file.pathExtension == "lpf"
}
}
22 changes: 22 additions & 0 deletions BookPlayer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.pkware.lpf-zip-archive</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.mime-type</key>
<array>
<string>application/lpf+zip</string>
</array>
<key>public.filename-extension</key>
<array>
<string>lpf</string>
</array>
</dict>
</dict>
</array>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>$(BP_BUNDLE_IDENTIFIER).background</string>
Expand Down
14 changes: 13 additions & 1 deletion BookPlayer/Library/ItemList Screen/ItemListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,20 @@ class ItemListViewModel: ViewModelProtocol {
// MARK: - Import related functions
extension ItemListViewModel {
func handleNewFiles(_ urls: [URL]) {
let temporaryDirectoryPath = FileManager.default.temporaryDirectory.absoluteString
let documentsFolder = DataManager.getDocumentsFolderURL()

for url in urls {
importManager.process(url)
/// At some point (iOS 17?), the OS stopped sending the picked files to the Documents/Inbox folder, instead
/// it's now sent to a temp folder that can't be relied on to keep the file existing until the import is finished
if url.absoluteString.contains(temporaryDirectoryPath) {
let destinationURL = documentsFolder.appendingPathComponent(url.lastPathComponent)
if !FileManager.default.fileExists(atPath: destinationURL.path) {
try! FileManager.default.copyItem(at: url, to: destinationURL)
}
} else {
importManager.process(url)
}
}
}

Expand Down
12 changes: 10 additions & 2 deletions BookPlayer/Player/PlayerManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ final class PlayerManager: NSObject, PlayerManagerProtocol {
if currentItem.isBoundBook {
currentTime += currentItem.currentChapter.start
} else if currentTime >= currentItem.currentChapter.end || currentTime < currentItem.currentChapter.start,
let newChapter = currentItem.getChapter(at: currentTime) {
let newChapter = currentItem.getChapter(at: currentTime),
newChapter != currentItem.currentChapter {
/// Avoid setting the same chapter, as it would publish an update event
currentItem.currentChapter = newChapter
}

Expand Down Expand Up @@ -552,7 +554,13 @@ final class PlayerManager: NSObject, PlayerManagerProtocol {
guard let currentItem = self.currentItem else { return }

self.nowPlayingInfo[MPMediaItemPropertyTitle] = chapter.title
self.nowPlayingInfo[MPMediaItemPropertyArtist] = currentItem.title

/// If the chapter title is the same as the current item, show the author instead
if chapter.title == currentItem.title {
self.nowPlayingInfo[MPMediaItemPropertyArtist] = currentItem.author
} else {
self.nowPlayingInfo[MPMediaItemPropertyArtist] = currentItem.title
}
self.nowPlayingInfo[MPMediaItemPropertyAlbumTitle] = currentItem.author
}

Expand Down
33 changes: 33 additions & 0 deletions BookPlayer/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>3B52.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>85F4.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>1C8F.1</string>
</array>
</dict>
</array>
</dict>
</plist>
2 changes: 1 addition & 1 deletion BookPlayer/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"download_from_url_title" = "Scarica dall'URL";
"done_title" = "Fatto";
"select_title" = "Selezionare";
"sort_button_title" = "Sorta";
"sort_button_title" = "Ordina";
"search_title" = "Ricerca";
"books_title" = "Libri";
"folders_title" = "Cartelle";
Expand Down
Loading

0 comments on commit 373a850

Please sign in to comment.