Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions iOSClient/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
if isUiTestingEnabled {
deleteAllAccounts()
}
UINavigationBar.appearance().tintColor = NCBrandColor.shared.customer
UIToolbar.appearance().tintColor = NCBrandColor.shared.customer
let utilityFileSystem = NCUtilityFileSystem()
let utility = NCUtility()

Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Main/NCMainTabBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class NCMainTabBar: UITabBar {
// Media
if let item = items?[3] {
item.title = NSLocalizedString("_media_", comment: "")
item.image = UIImage(named: "media")?.image(color: NCBrandColor.shared.brandElement, size: 25)
item.image = UIImage(named: "mediaSelected")?.image(color: NCBrandColor.shared.brandElement, size: 25)
item.selectedImage = item.image
}

Expand Down
5 changes: 3 additions & 2 deletions iOSClient/Main/NCPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ class customPhotoPickerViewController: TLPhotosPickerViewController {
override func makeUI() {
super.makeUI()

self.customNavItem.leftBarButtonItem?.tintColor = .systemBlue
self.customNavItem.rightBarButtonItem?.tintColor = .systemBlue
self.customNavItem.leftBarButtonItem?.tintColor = NCBrandColor.shared.customer
self.customNavItem.rightBarButtonItem?.tintColor = NCBrandColor.shared.customer
self.albumPopView.tintColor = NCBrandColor.shared.customer
}
}

Expand Down
203 changes: 203 additions & 0 deletions iOSClient/Menu/NCMedia+Menu.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
//
// NCMedia+Menu.swift
// Nextcloud
//
// Created by Marino Faggiana on 03/03/2021.
// Copyright © 2021 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

import UIKit
import FloatingPanel
import NextcloudKit

extension NCMedia {
func tapSelect() {
self.isEditMode = false
self.selectOcId.removeAll()
self.selectIndexPath.removeAll()
self.collectionView?.reloadData()
}

func toggleMenu() {

var actions: [NCMenuAction] = []

defer { presentMenu(with: actions) }

if !isEditMode {
if let metadatas = self.metadatas, !metadatas.isEmpty {
actions.append(
NCMenuAction(
title: NSLocalizedString("_select_", comment: ""),
icon: utility.loadImage(named: "selectFull", color: NCBrandColor.shared.iconColor),
action: { _ in
self.isEditMode = true
}
)
)
}

actions.append(.seperator(order: 0))

actions.append(
NCMenuAction(
title: NSLocalizedString("_media_viewimage_show_", comment: ""),
icon: utility.loadImage(named: showOnlyImages ? "nocamera" : "file_photo_menu",color: NCBrandColor.shared.iconColor),
selected: showOnlyImages,
on: true,
action: { _ in
self.showOnlyImages = true
self.showOnlyVideos = false
self.reloadDataSource()
}
)
)

actions.append(
NCMenuAction(
title: NSLocalizedString("_media_viewvideo_show_", comment: ""),
icon: utility.loadImage(named: showOnlyVideos ? "videono" : "videoyes",color: NCBrandColor.shared.iconColor),
selected: showOnlyVideos,
on: true,
action: { _ in
self.showOnlyImages = false
self.showOnlyVideos = true
self.reloadDataSource()
}
)
)

actions.append(
NCMenuAction(
title: NSLocalizedString("_media_show_all_", comment: ""),
icon: utility.loadImage(named: "photo.on.rectangle.angled", color: NCBrandColor.shared.iconColor),
selected: !showOnlyImages && !showOnlyVideos,
on: true,
action: { _ in
self.showOnlyImages = false
self.showOnlyVideos = false
self.reloadDataSource()
}
)
)

actions.append(.seperator(order: 0))

actions.append(
NCMenuAction(
title: NSLocalizedString("_select_media_folder_", comment: ""),
icon: utility.loadImage(named: "folder", color: NCBrandColor.shared.iconColor),
action: { _ in
if let navigationController = UIStoryboard(name: "NCSelect", bundle: nil).instantiateInitialViewController() as? UINavigationController,
let viewController = navigationController.topViewController as? NCSelect {

viewController.delegate = self
viewController.typeOfCommandView = .select
viewController.type = "mediaFolder"
viewController.selectIndexPath = self.selectIndexPath

self.present(navigationController, animated: true, completion: nil)
}
}
)
)

actions.append(
NCMenuAction(
title: NSLocalizedString("_media_by_modified_date_", comment: ""),
icon: utility.loadImage(named: "sortFileNameAZ", color: NCBrandColor.shared.iconColor),
selected: NCKeychain().mediaSortDate == "date",
on: true,
action: { _ in
NCKeychain().mediaSortDate = "date"
self.reloadDataSource()
}
)
)

actions.append(
NCMenuAction(
title: NSLocalizedString("_media_by_created_date_", comment: ""),
icon: utility.loadImage(named: "sortFileNameAZ", color: NCBrandColor.shared.iconColor),
selected: NCKeychain().mediaSortDate == "creationDate",
on: true,
action: { _ in
NCKeychain().mediaSortDate = "creationDate"
self.reloadDataSource()
}
)
)

actions.append(
NCMenuAction(
title: NSLocalizedString("_media_by_upload_date_", comment: ""),
icon: utility.loadImage(named: "sortFileNameAZ", color: NCBrandColor.shared.iconColor),
selected: NCKeychain().mediaSortDate == "uploadDate",
on: true,
action: { _ in
NCKeychain().mediaSortDate = "uploadDate"
self.reloadDataSource()
}
)
)

} else {

//
// CANCEL
//
actions.append(
NCMenuAction(
title: NSLocalizedString("_cancel_", comment: ""),
icon: utility.loadImage(named: "xmark", color: NCBrandColor.shared.iconColor),
action: { _ in self.tapSelect() }
)
)

guard !selectOcId.isEmpty else { return }
let selectedMetadatas = selectOcId.compactMap(NCManageDatabase.shared.getMetadataFromOcId)

//
// OPEN IN
//
actions.append(.openInAction(selectedMetadatas: selectedMetadatas, viewController: self, completion: tapSelect))

//
// SAVE TO PHOTO GALLERY
//
actions.append(.saveMediaAction(selectedMediaMetadatas: selectedMetadatas, completion: tapSelect))

//
// COPY - MOVE
//
actions.append(.moveOrCopyAction(selectedMetadatas: selectedMetadatas, indexPath: selectIndexPath, completion: tapSelect))

//
// COPY
//
actions.append(.copyAction(selectOcId: selectOcId, completion: tapSelect))

//
// DELETE
// can't delete from cache because is needed for NCMedia view, and if locked can't delete from server either.
if !selectedMetadatas.contains(where: { $0.lock && $0.lockOwner != appDelegate.userId }) {
actions.append(.deleteAction(selectedMetadatas: selectedMetadatas, indexPath: selectIndexPath, metadataFolder: nil, viewController: self, completion: tapSelect))
}
}
}
}
15 changes: 0 additions & 15 deletions iOSClient/Menu/NCViewer+Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@ extension NCViewer {
let localFile = NCManageDatabase.shared.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
let isOffline = localFile?.offline == true

//
// DETAIL
//
if !appDelegate.disableSharesView {
actions.append(
NCMenuAction(
title: NSLocalizedString("_details_", comment: ""),
icon: utility.loadImage(named: "info.circle"),
action: { _ in
NCActionCenter.shared.openShare(viewController: viewController, metadata: metadata, page: .activity)
}
)
)
}

//
// VIEW IN FOLDER
//
Expand Down
13 changes: 12 additions & 1 deletion iOSClient/NCImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,18 @@ import RealmSwift
guard let tableAccount = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", account)) else { return nil }
let startServerUrl = NCUtilityFileSystem().getHomeServer(urlBase: tableAccount.urlBase, userId: tableAccount.userId) + tableAccount.mediaPath
let predicateBoth = NSPredicate(format: showBothPredicateMediaString, account, startServerUrl)
return NCManageDatabase.shared.getMediaMetadatas(predicate: predicate ?? predicateBoth)

switch NCKeychain().mediaSortDate {
case "date":
return NCManageDatabase.shared.getResultsMetadatas(predicate: predicate ?? predicateBoth, sorted: "date")
case "creationDate":
return NCManageDatabase.shared.getResultsMetadatas(predicate: predicate ?? predicateBoth, sorted: "creationDate")
case "uploadDate":
return NCManageDatabase.shared.getResultsMetadatas(predicate: predicate ?? predicateBoth, sorted: "uploadDate")
default:
break
}
return NCManageDatabase.shared.getResultsMetadatas(predicate: predicate ?? predicateBoth, sorted: "date")
}

// MARK: -
Expand Down
15 changes: 14 additions & 1 deletion iOSClient/Settings/NCKeychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,20 @@ import KeychainAccess
keychain["mediaTypeLayout"] = String(newValue)
}
}


var mediaSortDate: String {
get {
migrate(key: "mediaSortDate")
if let value = try? keychain.get("mediaSortDate") {
return value
}
return "date"
}
set {
keychain["mediaSortDate"] = newValue
}
}

var textRecognitionStatus: Bool {
get {
migrate(key: "textRecognitionStatus")
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class NCViewerMedia: UIViewController {
// TIP
var preferences = EasyTipView.Preferences()
preferences.drawing.foregroundColor = .white
preferences.drawing.backgroundColor = NCBrandColor.shared.nextcloud
preferences.drawing.backgroundColor = NCBrandColor.shared.customer
preferences.drawing.textAlignment = .left
preferences.drawing.arrowPosition = .bottom
preferences.drawing.cornerRadius = 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ class NCViewerMediaDetailView: UIView {
}

if metadata.isImage && !utilityFileSystem.fileProviderStorageExists(metadata) && metadata.session.isEmpty {
downloadImageButton.tintColor = NCBrandColor.shared.brand
downloadImageButton.setTitle(NSLocalizedString("_try_download_full_resolution_", comment: ""), for: .normal)
downloadImageLabel.text = NSLocalizedString("_full_resolution_image_info_", comment: "")
downloadImageButtonContainer.isHidden = false
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {

var preferences = EasyTipView.Preferences()
preferences.drawing.foregroundColor = .white
preferences.drawing.backgroundColor = NCBrandColor.shared.nextcloud
preferences.drawing.backgroundColor = NCBrandColor.shared.customer
preferences.drawing.textAlignment = .left
preferences.drawing.arrowPosition = .right
preferences.drawing.cornerRadius = 10
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private var hasChangesQuickLook: Bool = false
toolbarConfig.optionButtonFontSize = 16
toolbarConfig.optionButtonFontSizeForPad = 21
toolbarConfig.backgroundColor = .systemGray6
toolbarConfig.foregroundColor = .systemBlue
toolbarConfig.foregroundColor = NCBrandColor.shared.customer

var viewConfig = CropViewConfig()
viewConfig.cropMaskVisualEffectType = .none
Expand Down