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:
authormarinofaggiana <marino@marinofaggiana.com>2021-01-16 17:54:57 +0300
committermarinofaggiana <marino@marinofaggiana.com>2021-01-16 17:54:57 +0300
commitfbb0dda674b02a91cfc34c369673db4fcd16282b (patch)
tree833e7cb3a04cdb6e3f99be864dd98edf909f7138 /iOSClient
parent1c9557337b321d90f47c6d335a92c43351118c52 (diff)
fix
Diffstat (limited to 'iOSClient')
-rw-r--r--iOSClient/Main/Menu/NCViewer+Menu.swift116
1 files changed, 58 insertions, 58 deletions
diff --git a/iOSClient/Main/Menu/NCViewer+Menu.swift b/iOSClient/Main/Menu/NCViewer+Menu.swift
index 59a208d85..5bb447675 100644
--- a/iOSClient/Main/Menu/NCViewer+Menu.swift
+++ b/iOSClient/Main/Menu/NCViewer+Menu.swift
@@ -97,21 +97,6 @@ extension NCViewer {
}
//
- // OPEN IN
- //
- if metadata.session == "" && !webView {
- actions.append(
- NCMenuAction(
- title: NSLocalizedString("_open_in_", comment: ""),
- icon: UIImage(named: "openFile")!.image(color: NCBrandColor.shared.icon, size: 50),
- action: { menuAction in
- NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: NCBrandGlobal.shared.selectorOpenIn)
- }
- )
- )
- }
-
- //
// RENAME
//
if !webView {
@@ -175,26 +160,6 @@ extension NCViewer {
}
//
- // OFFLINE
- //
- if metadata.session == "" && !webView {
- actions.append(
- NCMenuAction(
- title: titleOffline,
- icon: UIImage(named: "offline")!.image(color: NCBrandColor.shared.icon, size: 50),
- action: { menuAction in
- if ((localFile == nil || !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView)) && metadata.session == "") {
-
- NCNetworking.shared.download(metadata: metadata, selector: NCBrandGlobal.shared.selectorLoadOffline) { (_) in }
- } else {
- NCManageDatabase.shared.setLocalFile(ocId: metadata.ocId, offline: !localFile!.offline)
- }
- }
- )
- )
- }
-
- //
// VIEW IN FOLDER
//
if !webView {
@@ -212,44 +177,35 @@ extension NCViewer {
}
//
- // DELETE
+ // OFFLINE
//
- if !webView {
+ if metadata.session == "" && !webView {
actions.append(
NCMenuAction(
- title: titleDelete,
- icon: UIImage(named: "trash")!.image(color: NCBrandColor.shared.icon, size: 50),
+ title: titleOffline,
+ icon: UIImage(named: "offline")!.image(color: NCBrandColor.shared.icon, size: 50),
action: { menuAction in
-
- let alertController = UIAlertController(title: "", message: NSLocalizedString("_want_delete_", comment: ""), preferredStyle: .alert)
-
- alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_delete_", comment: ""), style: .default) { (action:UIAlertAction) in
+ if ((localFile == nil || !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView)) && metadata.session == "") {
- NCNetworking.shared.deleteMetadata(metadata, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase, onlyLocal: false) { (errorCode, errorDescription) in
- if errorCode != 0 {
- NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCBrandGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
- }
- }
- })
-
- alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (action:UIAlertAction) in })
-
- viewController.present(alertController, animated: true, completion:nil)
+ NCNetworking.shared.download(metadata: metadata, selector: NCBrandGlobal.shared.selectorLoadOffline) { (_) in }
+ } else {
+ NCManageDatabase.shared.setLocalFile(ocId: metadata.ocId, offline: !localFile!.offline)
+ }
}
)
)
}
//
- // PDF
+ // OPEN IN
//
- if (metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileDocument && metadata.contentType == "application/pdf" ) {
+ if metadata.session == "" && !webView {
actions.append(
NCMenuAction(
- title: NSLocalizedString("_search_", comment: ""),
- icon: UIImage(named: "search")!.image(color: NCBrandColor.shared.icon, size: 50),
+ title: NSLocalizedString("_open_in_", comment: ""),
+ icon: UIImage(named: "openFile")!.image(color: NCBrandColor.shared.icon, size: 50),
action: { menuAction in
- NotificationCenter.default.postOnMainThread(name: NCBrandGlobal.shared.notificationCenterMenuSearchTextPDF)
+ NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: NCBrandGlobal.shared.selectorOpenIn)
}
)
)
@@ -300,6 +256,50 @@ extension NCViewer {
)
}
+ //
+ // PDF
+ //
+ if (metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileDocument && metadata.contentType == "application/pdf" ) {
+ actions.append(
+ NCMenuAction(
+ title: NSLocalizedString("_search_", comment: ""),
+ icon: UIImage(named: "search")!.image(color: NCBrandColor.shared.icon, size: 50),
+ action: { menuAction in
+ NotificationCenter.default.postOnMainThread(name: NCBrandGlobal.shared.notificationCenterMenuSearchTextPDF)
+ }
+ )
+ )
+ }
+
+ //
+ // DELETE
+ //
+ if !webView {
+ actions.append(
+ NCMenuAction(
+ title: titleDelete,
+ icon: UIImage(named: "trash")!.image(color: NCBrandColor.shared.icon, size: 50),
+ action: { menuAction in
+
+ let alertController = UIAlertController(title: "", message: NSLocalizedString("_want_delete_", comment: ""), preferredStyle: .alert)
+
+ alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_delete_", comment: ""), style: .default) { (action:UIAlertAction) in
+
+ NCNetworking.shared.deleteMetadata(metadata, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase, onlyLocal: false) { (errorCode, errorDescription) in
+ if errorCode != 0 {
+ NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCBrandGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
+ }
+ }
+ })
+
+ alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (action:UIAlertAction) in })
+
+ viewController.present(alertController, animated: true, completion:nil)
+ }
+ )
+ )
+ }
+
return actions
}
}