Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarino Faggiana <marino@marinofaggiana.com>2022-11-02 13:10:58 +0300
committerMarino Faggiana <marino@marinofaggiana.com>2022-11-02 13:10:58 +0300
commitc48ebe5d38a4a20650e86b5ebb86b66d1f0328c1 (patch)
tree6a26b5f26aa8fb770d0914e9b4274eebd0d75d25
parent546adfb5013b3c1b5fe6f34e7e77e13dc33a9bcc (diff)
#2149
Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
-rw-r--r--Nextcloud.xcodeproj/project.pbxproj32
-rw-r--r--iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift2
-rw-r--r--iOSClient/Main/NCFunctionCenter.swift4
-rw-r--r--iOSClient/Networking/NCNetworkingProcessUpload.swift2
-rw-r--r--iOSClient/Supporting Files/en.lproj/Localizable.strings1
-rw-r--r--iOSClient/Transfers/NCTransfers.swift2
-rw-r--r--iOSClient/Utility/NCUtility.swift27
-rw-r--r--iOSClient/Utility/ParallelWorker.swift2
-rw-r--r--iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift2
9 files changed, 63 insertions, 11 deletions
diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj
index ef19d249f..cd951134d 100644
--- a/Nextcloud.xcodeproj/project.pbxproj
+++ b/Nextcloud.xcodeproj/project.pbxproj
@@ -361,6 +361,10 @@
F78ACD52219046DC0088454D /* NCSectionHeaderFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78ACD51219046DC0088454D /* NCSectionHeaderFooter.swift */; };
F78ACD54219047D40088454D /* NCSectionFooter.xib in Resources */ = {isa = PBXBuildFile; fileRef = F78ACD53219047D40088454D /* NCSectionFooter.xib */; };
F78ACD58219048040088454D /* NCSectionHeaderMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = F78ACD57219048040088454D /* NCSectionHeaderMenu.xib */; };
+ F78D0C7F2912722100D706AB /* JGProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = F78D0C7E2912722100D706AB /* JGProgressHUD */; };
+ F78D0C812912723900D706AB /* JGProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = F78D0C802912723900D706AB /* JGProgressHUD */; };
+ F78D0C832912724F00D706AB /* JGProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = F78D0C822912724F00D706AB /* JGProgressHUD */; };
+ F78D0C852912725600D706AB /* JGProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = F78D0C842912725600D706AB /* JGProgressHUD */; };
F78F74342163757000C2ADAD /* NCTrash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F78F74332163757000C2ADAD /* NCTrash.storyboard */; };
F78F74362163781100C2ADAD /* NCTrash.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78F74352163781100C2ADAD /* NCTrash.swift */; };
F790110E21415BF600D7B136 /* NCViewerRichdocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F790110D21415BF600D7B136 /* NCViewerRichdocument.swift */; };
@@ -1139,6 +1143,7 @@
F710FC88277B7D3F00AA9FBF /* RealmSwift in Frameworks */,
F710FC86277B7D3F00AA9FBF /* Realm in Frameworks */,
F7EBCDD3277B821700A4EF67 /* UICKeyChainStore in Frameworks */,
+ F78D0C852912725600D706AB /* JGProgressHUD in Frameworks */,
F75E57C325BF0ED2002B72C2 /* SVGKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1177,6 +1182,7 @@
F7346E2728B0FFF2006CE2D2 /* Realm in Frameworks */,
F7346E2928B0FFF2006CE2D2 /* RealmSwift in Frameworks */,
F783030D28B4C59A00B84583 /* SwiftEntryKit in Frameworks */,
+ F78D0C832912724F00D706AB /* JGProgressHUD in Frameworks */,
F7346E1228B0EF5B006CE2D2 /* WidgetKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1186,6 +1192,7 @@
buildActionMask = 2147483647;
files = (
F7EBCDD1277B820D00A4EF67 /* UICKeyChainStore in Frameworks */,
+ F78D0C7F2912722100D706AB /* JGProgressHUD in Frameworks */,
F75E57C125BF0ECD002B72C2 /* SVGKit in Frameworks */,
F73ADD2426554FE20069EA0D /* SwiftEntryKit in Frameworks */,
F710FC82277B7D3500AA9FBF /* Realm in Frameworks */,
@@ -1232,6 +1239,7 @@
F7A8D72828F17728008BBE1C /* RealmSwift in Frameworks */,
F7A8D72E28F17764008BBE1C /* UICKeyChainStore in Frameworks */,
F7A8D72C28F17742008BBE1C /* SwiftEntryKit in Frameworks */,
+ F78D0C812912723900D706AB /* JGProgressHUD in Frameworks */,
F7A8D72628F17728008BBE1C /* Realm in Frameworks */,
F7A8D72428F1771B008BBE1C /* NextcloudKit in Frameworks */,
F7C9739228F17131002C43E2 /* Intents.framework in Frameworks */,
@@ -2245,6 +2253,7 @@
F710FC87277B7D3F00AA9FBF /* RealmSwift */,
F7EBCDD2277B821700A4EF67 /* UICKeyChainStore */,
F72AD71028C24BBB006CB92D /* NextcloudKit */,
+ F78D0C842912725600D706AB /* JGProgressHUD */,
);
productName = "Notification Service Extension";
productReference = 2C33C47F23E2C475005F963B /* Notification Service Extension.appex */;
@@ -2315,6 +2324,7 @@
F783030428B4C50600B84583 /* SVGKit */,
F783030C28B4C59A00B84583 /* SwiftEntryKit */,
F783034328B5142B00B84583 /* NextcloudKit */,
+ F78D0C822912724F00D706AB /* JGProgressHUD */,
);
productName = DashboardWidgetExtension;
productReference = F7346E1028B0EF5B006CE2D2 /* Widget.appex */;
@@ -2340,6 +2350,7 @@
F710FC83277B7D3500AA9FBF /* RealmSwift */,
F7EBCDD0277B820D00A4EF67 /* UICKeyChainStore */,
F72AD71228C24BCC006CB92D /* NextcloudKit */,
+ F78D0C7E2912722100D706AB /* JGProgressHUD */,
);
productName = "File Provider Extension";
productReference = F771E3D020E2392D00AFB62D /* File Provider Extension.appex */;
@@ -2411,6 +2422,7 @@
F7A8D72928F17733008BBE1C /* SVGKit */,
F7A8D72B28F17742008BBE1C /* SwiftEntryKit */,
F7A8D72D28F17764008BBE1C /* UICKeyChainStore */,
+ F78D0C802912723900D706AB /* JGProgressHUD */,
);
productName = WidgetDashboardIntentHandler;
productReference = F7C9739028F17131002C43E2 /* WidgetDashboardIntentHandler.appex */;
@@ -4125,6 +4137,26 @@
package = F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */;
productName = MarkdownKit;
};
+ F78D0C7E2912722100D706AB /* JGProgressHUD */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = F72CD01027A7E92400E59476 /* XCRemoteSwiftPackageReference "JGProgressHUD" */;
+ productName = JGProgressHUD;
+ };
+ F78D0C802912723900D706AB /* JGProgressHUD */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = F72CD01027A7E92400E59476 /* XCRemoteSwiftPackageReference "JGProgressHUD" */;
+ productName = JGProgressHUD;
+ };
+ F78D0C822912724F00D706AB /* JGProgressHUD */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = F72CD01027A7E92400E59476 /* XCRemoteSwiftPackageReference "JGProgressHUD" */;
+ productName = JGProgressHUD;
+ };
+ F78D0C842912725600D706AB /* JGProgressHUD */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = F72CD01027A7E92400E59476 /* XCRemoteSwiftPackageReference "JGProgressHUD" */;
+ productName = JGProgressHUD;
+ };
F7A8D72328F1771B008BBE1C /* NextcloudKit */ = {
isa = XCSwiftPackageProductDependency;
package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */;
diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift
index d0de8936f..deaa59225 100644
--- a/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift
+++ b/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift
@@ -390,7 +390,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
} else {
// PREVIEW
- NCUtility.shared.extractImageVideoFromAssetLocalIdentifier(metadata: metadataNewFile, modifyMetadataForUpload: false) { metadata, fileNamePath, error in
+ NCUtility.shared.extractImageVideoFromAssetLocalIdentifier(metadata: metadataNewFile, modifyMetadataForUpload: false, viewController: self) { metadata, fileNamePath, error in
if !error {
self.fileNamesPath[metadataNewFile.fileNameView] = fileNamePath!
do {
diff --git a/iOSClient/Main/NCFunctionCenter.swift b/iOSClient/Main/NCFunctionCenter.swift
index c8fd1c6f1..68701e76c 100644
--- a/iOSClient/Main/NCFunctionCenter.swift
+++ b/iOSClient/Main/NCFunctionCenter.swift
@@ -352,9 +352,9 @@ import Photos
if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView {
indicatorView.ringWidth = 1.5
}
- hud.show(in: (appDelegate.window?.rootViewController?.view)!)
hud.textLabel.text = NSLocalizedString("_saving_", comment: "")
-
+ hud.show(in: (appDelegate.window?.rootViewController?.view)!)
+
NCLivePhoto.generate(from: fileNameImage, videoURL: fileNameMov, progress: { progress in
hud.progress = Float(progress)
diff --git a/iOSClient/Networking/NCNetworkingProcessUpload.swift b/iOSClient/Networking/NCNetworkingProcessUpload.swift
index 7b46cd440..8a556fc36 100644
--- a/iOSClient/Networking/NCNetworkingProcessUpload.swift
+++ b/iOSClient/Networking/NCNetworkingProcessUpload.swift
@@ -112,7 +112,7 @@ class NCNetworkingProcessUpload: NSObject {
}
let semaphore = DispatchSemaphore(value: 0)
- NCUtility.shared.extractFiles(from: metadata) { metadatas in
+ NCUtility.shared.extractFiles(from: metadata, viewController: appDelegate.window?.rootViewController) { metadatas in
if metadatas.isEmpty {
NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
}
diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings
index 0f6d8c6c2..7406a1906 100644
--- a/iOSClient/Supporting Files/en.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings
@@ -897,6 +897,7 @@
"_description_lockscreenwidget_" = "Keep an eye on available space and recent activity";
"_no_items_" = "No items";
"_check_back_late_" = "Check back late";
+"_exporting_video_" = "Exporting video … Tap to cancel …";
// Video
"_select_trace_" = "Select the trace";
diff --git a/iOSClient/Transfers/NCTransfers.swift b/iOSClient/Transfers/NCTransfers.swift
index f2b603144..e6c6e5a12 100644
--- a/iOSClient/Transfers/NCTransfers.swift
+++ b/iOSClient/Transfers/NCTransfers.swift
@@ -135,7 +135,7 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate {
guard let metadata = metadataTemp else { return }
guard appDelegate.account == metadata.account else { return }
- NCUtility.shared.extractFiles(from: metadata) { metadatas in
+ NCUtility.shared.extractFiles(from: metadata, viewController: self) { metadatas in
for metadata in metadatas {
if let metadata = NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusInUpload) {
NCNetworking.shared.upload(metadata: metadata)
diff --git a/iOSClient/Utility/NCUtility.swift b/iOSClient/Utility/NCUtility.swift
index e15a14179..05eab434a 100644
--- a/iOSClient/Utility/NCUtility.swift
+++ b/iOSClient/Utility/NCUtility.swift
@@ -30,6 +30,7 @@ import Accelerate
import CoreMedia
import Queuer
import Photos
+import JGProgressHUD
class NCUtility: NSObject {
@objc static let shared: NCUtility = {
@@ -379,7 +380,7 @@ class NCUtility: NSObject {
// MARK: -
- func extractFiles(from metadata: tableMetadata, completition: @escaping (_ metadatas: [tableMetadata]) -> Void) {
+ func extractFiles(from metadata: tableMetadata, viewController: UIViewController? ,completition: @escaping (_ metadatas: [tableMetadata]) -> Void) {
let chunckSize = CCUtility.getChunkSize() * 1000000
var metadatas: [tableMetadata] = []
@@ -408,7 +409,7 @@ class NCUtility: NSObject {
return completition(metadatas)
}
- extractImageVideoFromAssetLocalIdentifier(metadata: metadataSource, modifyMetadataForUpload: true) { metadata, fileNamePath, returnError in
+ extractImageVideoFromAssetLocalIdentifier(metadata: metadataSource, modifyMetadataForUpload: true, viewController: viewController) { metadata, fileNamePath, returnError in
if let metadata = metadata, let fileNamePath = fileNamePath, !returnError {
metadatas.append(metadata)
let toPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
@@ -430,12 +431,13 @@ class NCUtility: NSObject {
}
}
- func extractImageVideoFromAssetLocalIdentifier(metadata: tableMetadata, modifyMetadataForUpload: Bool, completion: @escaping (_ metadata: tableMetadata?, _ fileNamePath: String?, _ error: Bool) -> ()) {
+ func extractImageVideoFromAssetLocalIdentifier(metadata: tableMetadata, modifyMetadataForUpload: Bool, viewController: UIViewController?, completion: @escaping (_ metadata: tableMetadata?, _ fileNamePath: String?, _ error: Bool) -> ()) {
var fileNamePath: String?
let metadata = tableMetadata.init(value: metadata)
let chunckSize = CCUtility.getChunkSize() * 1000000
var compatibilityFormat: Bool = false
+ let hud = JGProgressHUD()
func callCompletion(error: Bool) {
if error {
@@ -538,11 +540,25 @@ class NCUtility: NSObject {
} catch {
return callCompletion(error: true)
}
- } else if let asset = asset as? AVComposition, asset.tracks.count > 1, let exporter = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetPassthrough) {
+ } else if let asset = asset as? AVComposition, asset.tracks.count > 1, let exporter = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetHighestQuality) {
+ if let viewController = viewController {
+ DispatchQueue.main.async {
+ hud.indicatorView = JGProgressHUDRingIndicatorView()
+ if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView {
+ indicatorView.ringWidth = 1.5
+ }
+ hud.textLabel.text = NSLocalizedString("_exporting_video_", comment: "")
+ hud.show(in: viewController.view)
+ hud.tapOnHUDViewBlock = { hud in
+ exporter.cancelExport()
+ }
+ }
+ }
exporter.outputURL = URL(fileURLWithPath: fileNamePath)
exporter.outputFileType = AVFileType.mp4
exporter.shouldOptimizeForNetworkUse = true
exporter.exportAsynchronously {
+ DispatchQueue.main.async { hud.dismiss() }
if exporter.status == .completed {
metadata.creationDate = creationDate as NSDate
metadata.date = modificationDate as NSDate
@@ -552,6 +568,9 @@ class NCUtility: NSObject {
return callCompletion(error: true)
}
}
+ while exporter.status == AVAssetExportSession.Status.exporting || exporter.status == AVAssetExportSession.Status.waiting {
+ hud.progress = exporter.progress
+ }
} else {
return callCompletion(error: true)
}
diff --git a/iOSClient/Utility/ParallelWorker.swift b/iOSClient/Utility/ParallelWorker.swift
index 3fc51c5c7..9787345e8 100644
--- a/iOSClient/Utility/ParallelWorker.swift
+++ b/iOSClient/Utility/ParallelWorker.swift
@@ -51,9 +51,9 @@ class ParallelWorker {
DispatchQueue.main.async {
let hud = JGProgressHUD()
- hud.show(in: hudView)
hud.textLabel.text = NSLocalizedString(self.titleKey, comment: "")
hud.detailTextLabel.text = NSLocalizedString("_tap_to_cancel_", comment: "")
+ hud.show(in: hudView)
hud.tapOnHUDViewBlock = { hud in
self.isCancelled = true
// Cancel all download / upload
diff --git a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift
index fce146909..2a214d50f 100644
--- a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift
+++ b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift
@@ -428,9 +428,9 @@ class NCPlayer: NSObject {
if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView {
indicatorView.ringWidth = 1.5
}
- hud.show(in: view)
hud.textLabel.text = NSLocalizedString(metadata.fileNameView, comment: "")
hud.detailTextLabel.text = NSLocalizedString("_tap_to_cancel_", comment: "")
+ hud.show(in: view)
hud.tapOnHUDViewBlock = { hud in
downloadRequest?.cancel()
}