From fbd4099019eca9ac40332bf6428e2350b7bfba50 Mon Sep 17 00:00:00 2001
From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com>
Date: Wed, 1 Nov 2023 15:13:42 +0530
Subject: [PATCH 1/4] NMC 2237 - More option tab customisation changes
---
Tests/NextcloudUnitTests/MoreTests.swift | 37 +++++
iOSClient/More/Cells/BaseNCMoreCell.swift | 16 --
iOSClient/More/Cells/NCMoreUserCell.xib | 76 ++++++++++
iOSClient/More/NCMore.storyboard | 171 ++++++++++++----------
iOSClient/More/NCMore.swift | 150 +++++++++++++------
5 files changed, 318 insertions(+), 132 deletions(-)
create mode 100644 Tests/NextcloudUnitTests/MoreTests.swift
create mode 100755 iOSClient/More/Cells/NCMoreUserCell.xib
diff --git a/Tests/NextcloudUnitTests/MoreTests.swift b/Tests/NextcloudUnitTests/MoreTests.swift
new file mode 100644
index 0000000000..0a96912994
--- /dev/null
+++ b/Tests/NextcloudUnitTests/MoreTests.swift
@@ -0,0 +1,37 @@
+//
+// MoreTests.swift
+// NextcloudTests
+//
+// Created by A200020526 on 09/06/23.
+// Copyright © 2023 Marino Faggiana. All rights reserved.
+//
+
+@testable import Nextcloud
+import XCTest
+
+final class MoreTests: XCTestCase {
+
+ override func setUpWithError() throws {
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+ }
+
+ override func tearDownWithError() throws {
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ }
+
+ func testExample() throws {
+ // This is an example of a functional test case.
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
+ // Any test you write for XCTest can be annotated as throws and async.
+ // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
+ // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
+ }
+
+ func testPerformanceExample() throws {
+ // This is an example of a performance test case.
+ self.measure {
+ // Put the code you want to measure the time of here.
+ }
+ }
+
+}
diff --git a/iOSClient/More/Cells/BaseNCMoreCell.swift b/iOSClient/More/Cells/BaseNCMoreCell.swift
index 9b5b705cd1..c0d41bc513 100644
--- a/iOSClient/More/Cells/BaseNCMoreCell.swift
+++ b/iOSClient/More/Cells/BaseNCMoreCell.swift
@@ -28,22 +28,6 @@ class BaseNCMoreCell: UITableViewCell {
let selectionColor: UIView = UIView()
let defaultCornerRadius: CGFloat = 10.0
- override var frame: CGRect {
- get {
- return super.frame
- }
- set (newFrame) {
- var frame = newFrame
- let newWidth = frame.width * 0.90
- let space = (frame.width - newWidth) / 2
- frame.size.width = newWidth
- frame.origin.x += space
- super.frame = frame
- }
- }
-
- open func setupCell(account: String, controller: NCMainTabBarController?) {}
-
override func awakeFromNib() {
super.awakeFromNib()
diff --git a/iOSClient/More/Cells/NCMoreUserCell.xib b/iOSClient/More/Cells/NCMoreUserCell.xib
new file mode 100755
index 0000000000..477fe2539e
--- /dev/null
+++ b/iOSClient/More/Cells/NCMoreUserCell.xib
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/iOSClient/More/NCMore.storyboard b/iOSClient/More/NCMore.storyboard
index 57caeedfce..794b3d16a6 100644
--- a/iOSClient/More/NCMore.storyboard
+++ b/iOSClient/More/NCMore.storyboard
@@ -1,102 +1,114 @@
-
+
-
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
@@ -105,45 +117,54 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
diff --git a/iOSClient/More/NCMore.swift b/iOSClient/More/NCMore.swift
index 43301a4fd4..15d9fced96 100644
--- a/iOSClient/More/NCMore.swift
+++ b/iOSClient/More/NCMore.swift
@@ -24,15 +24,16 @@
import UIKit
import NextcloudKit
import SafariServices
-import SwiftUI
-import Foundation
class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
+
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var labelQuota: UILabel!
@IBOutlet weak var labelQuotaExternalSite: UILabel!
@IBOutlet weak var progressQuota: UIProgressView!
@IBOutlet weak var viewQuota: UIView!
+ @IBOutlet weak var quotaLabel1: UILabel!
+ @IBOutlet weak var quotalabel2: UILabel!
private var functionMenu: [NKExternalSite] = []
private var externalSiteMenu: [NKExternalSite] = []
@@ -48,10 +49,12 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
var type: SectionType
enum SectionType {
+ case account
case moreApps
case regular
}
}
+
private var sections: [Section] = []
@MainActor
@@ -79,6 +82,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = .systemGroupedBackground
+ tableView.register(NCMoreUserCell.fromNib(), forCellReuseIdentifier: NCMoreUserCell.reuseIdentifier)
tableView.register(NCMoreAppSuggestionsCell.fromNib(), forCellReuseIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier)
// create tap gesture recognizer
@@ -96,10 +100,21 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
loadItems()
+ changeTheming()
tableView.reloadData()
}
// MARK: -
+
+ @objc func changeTheming() {
+ viewQuota.backgroundColor = NCBrandColor.shared.memoryConsuptionBackground
+ quotaLabel1.textColor = NCBrandColor.shared.label
+ quotalabel2.textColor = NCBrandColor.shared.label
+ labelQuota.textColor = NCBrandColor.shared.label
+ labelQuotaExternalSite.textColor = NCBrandColor.shared.label
+ progressQuota.progressTintColor = NCBrandColor.shared.brandElement
+ progressQuota.trackTintColor = NCBrandColor.shared.commonViewInfoText
+ }
func loadItems() {
guard let tableAccount = self.database.getTableAccount(predicate: NSPredicate(format: "account == %@", session.account)),
@@ -118,13 +133,29 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
labelQuotaExternalSite.text = ""
progressQuota.progressTintColor = NCBrandColor.shared.getElement(account: session.account)
+ // ITEM : Transfer
+ item = NKExternalSite()
+ item.name = "_transfers_"
+ item.icon = "arrow.left.arrow.right.circle"
+ item.url = "segueTransfers"
+ item.order = 10
+// functionMenu.append(item)
+
// ITEM : Recent
item = NKExternalSite()
item.name = "_recent_"
- item.icon = "clock.arrow.circlepath"
+ item.icon = "recent"
item.url = "segueRecent"
item.order = 20
functionMenu.append(item)
+
+ // ITEM : Notification
+ item = NKExternalSite()
+ item.name = "_notifications_"
+ item.icon = "notification"
+ item.url = "segueNotification"
+ item.order = 30
+ functionMenu.append(item)
/*
if capabilities.capabilityActivityEnabled {
@@ -145,14 +176,14 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
item.icon = "sparkles"
item.url = "openAssistant"
item.order = 40
- functionMenu.append(item)
+// functionMenu.append(item)
}
// ITEM : Shares
if capabilities.fileSharingApiEnabled {
item = NKExternalSite()
item.name = "_list_shares_"
- item.icon = "person.badge.plus"
+ item.icon = "shareFill"
item.url = "segueShares"
item.order = 50
functionMenu.append(item)
@@ -161,7 +192,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
// ITEM : Offline
item = NKExternalSite()
item.name = "_manage_file_offline_"
- item.icon = "icloud.and.arrow.down"
+ item.icon = "offlineMenu"
item.url = "segueOffline"
item.order = 60
functionMenu.append(item)
@@ -173,16 +204,15 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
item.icon = "person.2"
item.url = "segueGroupfolders"
item.order = 61
- functionMenu.append(item)
+// functionMenu.append(item)
}
-
// ITEM : Scan
item = NKExternalSite()
item.name = "_scanned_images_"
item.icon = "doc.text.viewfinder"
item.url = "openStoryboardNCScan"
item.order = 70
- functionMenu.append(item)
+// functionMenu.append(item)
// ITEM : Trash
item = NKExternalSite()
@@ -201,8 +231,8 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
// ITEM : Settings
item = NKExternalSite()
item.name = "_settings_"
- item.icon = "gear"
- item.url = "openSettings"
+ item.icon = "settings"
+ item.url = "segueSettings"
settingsMenu.append(item)
if !quotaMenu.isEmpty {
@@ -211,6 +241,8 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
// Display Name user & Quota
+
+
if tableAccount.quotaRelative > 0 {
progressQuota.progress = Float(tableAccount.quotaRelative) / 100
} else {
@@ -248,14 +280,33 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
}
}
- }
+
+ switch tableAccount.quotaTotal {
+ case -1:
+ quota = "0"
+ case -2:
+ quota = NSLocalizedString("_quota_space_unknown_", comment: "")
+ case -3:
+ quota = NSLocalizedString("_quota_space_unlimited_", comment: "")
+ default:
+ quota = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
+ }
+
+ let quotaUsed: String = utilityFileSystem.transformedSize(tableAccount.quotaUsed)
+ let quota2: String = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
+ let percentageUsedFormatted = "\(Int(progressQuota.progress * 100))%"
+
+ labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_percentage_", comment: ""), percentageUsedFormatted)
+
+ quotaLabel1.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed)
+ quotalabel2.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_of_", comment: ""), quota2)
loadSections()
}
private func loadSections() {
- if !NCBrandOptions.shared.disable_show_more_nextcloud_apps_in_settings {
- sections.append(Section(items: [NKExternalSite()], type: .moreApps))
+ if tabAccount != nil {
+ sections.append(Section(items: [NKExternalSite()], type: .account))
}
if !functionMenu.isEmpty {
@@ -273,7 +324,8 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
// MARK: - Action
- @objc func tapLabelQuotaExternalSite(_ sender: Any?) {
+ @objc func tapLabelQuotaExternalSite() {
+
if !quotaMenu.isEmpty {
let item = quotaMenu[0]
if let browserWebVC = UIStoryboard(name: "NCBrowserWeb", bundle: nil).instantiateInitialViewController() as? NCBrowserWeb {
@@ -286,10 +338,21 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
}
+ @objc func tapImageLogoManageAccount() {
+
+ let controller = CCManageAccount()
+
+ self.navigationController?.pushViewController(controller, animated: true)
+ }
+
// MARK: -
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- return 50
+ if sections[indexPath.section].type == .account {
+ return 100
+ } else {
+ return NCGlobal.shared.heightCellSettings
+ }
}
func numberOfSections(in tableView: UITableView) -> Int {
@@ -299,7 +362,9 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForHeaderInSection index: Int) -> CGFloat {
let section = sections[index]
- if section.type == .moreApps || (index > 0 && sections[index - 1].type == .moreApps) {
+ if section.type == .account {
+ return 10
+ } else if section.type == .moreApps || sections[index - 1].type == .moreApps {
return 1
} else {
return 20
@@ -313,7 +378,30 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let section = sections[indexPath.section]
- if section.type == .moreApps {
+ if section.type == .account {
+
+ guard let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreUserCell.reuseIdentifier, for: indexPath) as? NCMoreUserCell else { return UITableViewCell() }
+
+ cell.avatar.image = nil
+ cell.icon.image = nil
+ cell.status.text = ""
+ cell.displayName.text = ""
+
+ if let account = tabAccount {
+ cell.avatar.image = UIImage.init(named: "user_settings")?.image(color: NCBrandColor.shared.iconColor, size: 25)
+
+ if account.alias.isEmpty {
+ cell.displayName?.text = account.displayName
+ } else {
+ cell.displayName?.text = account.displayName + " (" + account.alias + ")"
+ }
+ cell.displayName.textColor = .label
+ }
+ cell.removeCornerRadius()
+ cell.icon.isHidden = true
+ return cell
+
+ } else if section.type == .moreApps {
guard let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier, for: indexPath) as? NCMoreAppSuggestionsCell else { return UITableViewCell() }
cell.setupCell(account: session.account, controller: controller)
return cell
@@ -324,32 +412,11 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
let item = sections[indexPath.section].items[indexPath.row]
- cell.imageIcon?.image = utility.loadImage(named: item.icon, colors: [NCBrandColor.shared.iconImageColor])
+ cell.imageIcon?.image = utility.loadImage(named: item.icon).image(color: NCBrandColor.shared.iconColor, size: 25)
cell.imageIcon?.contentMode = .scaleAspectFit
cell.labelText?.text = NSLocalizedString(item.name, comment: "")
- cell.labelText.textColor = NCBrandColor.shared.textColor
-
- cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
-
- cell.separator.backgroundColor = .separator
- cell.separatorHeigth.constant = 0.4
-
+ cell.labelText.textColor = .label
cell.removeCornerRadius()
- let rows = tableView.numberOfRows(inSection: indexPath.section)
-
- if indexPath.row == 0 {
- cell.applyCornerRadius()
- if indexPath.row == rows - 1 {
- cell.separator.backgroundColor = .clear
- cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner]
- } else {
- cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner]
- }
- } else if indexPath.row == rows - 1 {
- cell.applyCornerRadius()
- cell.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner]
- cell.separator.backgroundColor = .clear
- }
return cell
}
@@ -381,6 +448,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
} else if item.url == "logout" {
let alertController = UIAlertController(title: "", message: NSLocalizedString("_want_delete_", comment: ""), preferredStyle: .alert)
+
let actionYes = UIAlertAction(title: NSLocalizedString("_yes_delete_", comment: ""), style: .default) { (_: UIAlertAction) in
if NCBrandOptions.shared.disable_intro {
if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin {
From 5eece29f526d6e464afaa29994ccc79d976c3a8e Mon Sep 17 00:00:00 2001
From: harshada-15-tsys
Date: Thu, 10 Apr 2025 13:41:04 +0530
Subject: [PATCH 2/4] NMC 2237 - More option tab customisation and UI changes
---
Nextcloud.xcodeproj/project.pbxproj | 17 ++++++++
iOSClient/More/Cells/NCMoreUserCell.swift | 44 +++++++++++++++++++
iOSClient/More/NCMore.storyboard | 8 ++--
iOSClient/More/NCMore.swift | 53 +++++++++++++----------
4 files changed, 95 insertions(+), 27 deletions(-)
create mode 100644 iOSClient/More/Cells/NCMoreUserCell.swift
diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj
index 8dd4c5545f..312eda58e5 100644
--- a/Nextcloud.xcodeproj/project.pbxproj
+++ b/Nextcloud.xcodeproj/project.pbxproj
@@ -85,6 +85,12 @@
AFCE353527E4ED5900FEA6C2 /* DateFormatter+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */; };
AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */; };
AFCE353927E5DE0500FEA6C2 /* Shareable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* Shareable.swift */; };
+ AFCE353927E5DE0500FEA6C2 /* NCShare+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */; };
+ B568C2B12DA7AA5F0072FCB4 /* MoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B568C2B02DA7AA5F0072FCB4 /* MoreTests.swift */; };
+ B568C2B32DA7AAAE0072FCB4 /* NCMoreUserCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = B568C2B22DA7AAAE0072FCB4 /* NCMoreUserCell.xib */; };
+ B568C2B52DA7AADD0072FCB4 /* NCMoreUserCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B568C2B42DA7AADD0072FCB4 /* NCMoreUserCell.swift */; };
+ C04E2F232A17BB4D001BAD85 /* FilesIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04E2F222A17BB4D001BAD85 /* FilesIntegrationTests.swift */; };
+ D575039F27146F93008DC9DC /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extension.swift */; };
D5B6AA7827200C7200D49C24 /* NCActivityTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */; };
F310B1EF2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F310B1EE2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift */; };
F321DA8A2B71205A00DDA0E6 /* NCTrashSelectTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321DA892B71205A00DDA0E6 /* NCTrashSelectTabBar.swift */; };
@@ -1221,6 +1227,10 @@
AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+Extension.swift"; sourceTree = ""; };
AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCells.swift; sourceTree = ""; };
AFCE353827E5DE0400FEA6C2 /* Shareable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shareable.swift; sourceTree = ""; };
+ AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Helper.swift"; sourceTree = ""; };
+ B568C2B02DA7AA5F0072FCB4 /* MoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreTests.swift; sourceTree = ""; };
+ B568C2B22DA7AAAE0072FCB4 /* NCMoreUserCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCMoreUserCell.xib; sourceTree = ""; };
+ B568C2B42DA7AADD0072FCB4 /* NCMoreUserCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMoreUserCell.swift; sourceTree = ""; };
C0046CDA2A17B98400D87C9D /* NextcloudUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C04E2F202A17BB4D001BAD85 /* NextcloudIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = ""; };
@@ -2024,6 +2034,8 @@
isa = PBXGroup;
children = (
AA52EB452D42AC5A0089C348 /* Placeholder.swift */,
+ B568C2B02DA7AA5F0072FCB4 /* MoreTests.swift */,
+ AF8ED1FB2757821000B8DBC4 /* NextcloudUnitTests.swift */,
);
path = NextcloudUnitTests;
sourceTree = "";
@@ -2165,6 +2177,8 @@
F3BB46502A39EC2D00461F6E /* Cells */ = {
isa = PBXGroup;
children = (
+ B568C2B42DA7AADD0072FCB4 /* NCMoreUserCell.swift */,
+ B568C2B22DA7AAAE0072FCB4 /* NCMoreUserCell.xib */,
F3BB464C2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib */,
F3BB46512A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift */,
F3BB46532A3A1E9D00461F6E /* CCCellMore.swift */,
@@ -3949,6 +3963,8 @@
F7381EE5218218C9000B1560 /* NCOffline.storyboard in Resources */,
F768822D2C0DD1E7001CF441 /* Acknowledgements.rtf in Resources */,
F76D3CF32428B94E005DFA87 /* NCViewerPDFSearchCell.xib in Resources */,
+ B568C2B32DA7AAAE0072FCB4 /* NCMoreUserCell.xib in Resources */,
+ F7CA212E25F1333300826ABB /* NCAccountRequest.storyboard in Resources */,
F717402D24F699A5000C87D5 /* NCFavorite.storyboard in Resources */,
F723B3DD22FC6D1D00301EFE /* NCShareCommentsCell.xib in Resources */,
F78ACD4B21903F850088454D /* NCTrashListCell.xib in Resources */,
@@ -4569,6 +4585,7 @@
F7816EF22C2C3E1F00A52517 /* NCPushNotification.swift in Sources */,
F76882342C0DD1E7001CF441 /* NCDisplayView.swift in Sources */,
F7C30DF6291BC0CA0017149B /* NCNetworkingE2EEUpload.swift in Sources */,
+ B568C2B52DA7AADD0072FCB4 /* NCMoreUserCell.swift in Sources */,
F7501C332212E57500FB1415 /* NCMedia.swift in Sources */,
F7411C552D7B26D700F57358 /* NCNetworking+ServerError.swift in Sources */,
F72944F22A84246400246839 /* NCEndToEndMetadataV20.swift in Sources */,
diff --git a/iOSClient/More/Cells/NCMoreUserCell.swift b/iOSClient/More/Cells/NCMoreUserCell.swift
new file mode 100644
index 0000000000..1d6e30cece
--- /dev/null
+++ b/iOSClient/More/Cells/NCMoreUserCell.swift
@@ -0,0 +1,44 @@
+//
+// NCMoreUserCell.swift
+// Nextcloud
+//
+// Created by Milen on 14.06.23.
+// Copyright © 2023 Marino Faggiana. All rights reserved.
+//
+// Author Marino Faggiana
+//
+// 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 .
+//
+
+import Foundation
+import MarqueeLabel
+
+class NCMoreUserCell: BaseNCMoreCell {
+ @IBOutlet weak var displayName: UILabel!
+ @IBOutlet weak var avatar: UIImageView!
+ @IBOutlet weak var icon: UIImageView!
+ @IBOutlet weak var status: MarqueeLabel!
+
+ static let reuseIdentifier = "NCMoreUserCell"
+
+ static func fromNib() -> UINib {
+ return UINib(nibName: "NCMoreUserCell", bundle: nil)
+ }
+
+ override func awakeFromNib() {
+ super.awakeFromNib()
+
+ icon.makeCircularBackground(withColor: .systemBackground)
+ }
+}
diff --git a/iOSClient/More/NCMore.storyboard b/iOSClient/More/NCMore.storyboard
index 794b3d16a6..754b283038 100644
--- a/iOSClient/More/NCMore.storyboard
+++ b/iOSClient/More/NCMore.storyboard
@@ -34,11 +34,11 @@
-
-
+
+
-
-
+
+
diff --git a/iOSClient/More/NCMore.swift b/iOSClient/More/NCMore.swift
index 15d9fced96..7a33d0ca29 100644
--- a/iOSClient/More/NCMore.swift
+++ b/iOSClient/More/NCMore.swift
@@ -24,6 +24,7 @@
import UIKit
import NextcloudKit
import SafariServices
+import SwiftUI
class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
@@ -43,6 +44,8 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
private let utilityFileSystem = NCUtilityFileSystem()
private let utility = NCUtility()
private let database = NCManageDatabase.shared
+ private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
+ private var tabAccount: tableAccount?
private struct Section {
var items: [NKExternalSite]
@@ -280,7 +283,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
}
}
-
+
switch tableAccount.quotaTotal {
case -1:
quota = "0"
@@ -291,15 +294,34 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
default:
quota = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
}
-
+
let quotaUsed: String = utilityFileSystem.transformedSize(tableAccount.quotaUsed)
let quota2: String = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
let percentageUsedFormatted = "\(Int(progressQuota.progress * 100))%"
-
+
labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_percentage_", comment: ""), percentageUsedFormatted)
quotaLabel1.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed)
quotalabel2.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_of_", comment: ""), quota2)
+ }
+
+ // ITEM : External
+ if NCBrandOptions.shared.disable_more_external_site == false {
+ if let externalSites = NCManageDatabase.shared.getAllExternalSites(account: session.account) {
+ for externalSite in externalSites {
+ if !externalSite.name.isEmpty, !externalSite.url.isEmpty, let urlEncoded = externalSite.url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
+ item = NKExternalSite()
+ item.name = externalSite.name
+ item.url = urlEncoded
+ item.icon = "network"
+ if externalSite.type == "settings" {
+ item.icon = "gear"
+ }
+ externalSiteMenu.append(item)
+ }
+ }
+ }
+ }
loadSections()
}
@@ -403,13 +425,11 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
} else if section.type == .moreApps {
guard let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier, for: indexPath) as? NCMoreAppSuggestionsCell else { return UITableViewCell() }
- cell.setupCell(account: session.account, controller: controller)
+ cell.controller = self.controller
return cell
} else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: CCCellMore.reuseIdentifier, for: indexPath) as? CCCellMore else { return UITableViewCell() }
-
- cell.setupCell(account: session.account, controller: controller)
-
+
let item = sections[indexPath.section].items[indexPath.row]
cell.imageIcon?.image = utility.loadImage(named: item.icon).image(color: NCBrandColor.shared.iconColor, size: 25)
@@ -450,22 +470,9 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
let alertController = UIAlertController(title: "", message: NSLocalizedString("_want_delete_", comment: ""), preferredStyle: .alert)
let actionYes = UIAlertAction(title: NSLocalizedString("_yes_delete_", comment: ""), style: .default) { (_: UIAlertAction) in
- if NCBrandOptions.shared.disable_intro {
- if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin {
- viewController.controller = self.controller
- let navigationController = UINavigationController(rootViewController: viewController)
- navigationController.modalPresentationStyle = .fullScreen
- self.present(navigationController, animated: true)
- }
- } else {
- if let navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController {
- if let viewController = navigationController.topViewController as? NCIntroViewController {
- viewController.controller = self.controller
- }
- navigationController.modalPresentationStyle = .fullScreen
- self.present(navigationController, animated: true)
- }
- }
+ let manageAccount = CCManageAccount()
+ manageAccount.delete(self.session.account)
+ self.appDelegate.openLogin(viewController: self, selector: NCGlobal.shared.introLogin, openLoginWeb: false)
}
let actionNo = UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (_: UIAlertAction) in
From cdc9441dcbedb9c78807045629c2ae537aaf921c Mon Sep 17 00:00:00 2001
From: harshada-15-tsys
Date: Wed, 1 Oct 2025 13:56:52 +0530
Subject: [PATCH 3/4] NMC 2237 - More option tab customisation changes
---
.../More/Cells/NCMoreAppSuggestionsCell.swift | 17 ++-
iOSClient/More/NCMore.storyboard | 132 +++++++++---------
iOSClient/More/NCMore.swift | 89 ++++++------
.../More/NCMoreNavigationController.swift | 73 +++++++---
4 files changed, 178 insertions(+), 133 deletions(-)
diff --git a/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
index 52dfb9e3f7..868430cf0c 100644
--- a/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
+++ b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
@@ -25,7 +25,6 @@ import Foundation
import UIKit
import SafariServices
import SwiftUI
-import NextcloudKit
class NCMoreAppSuggestionsCell: BaseNCMoreCell {
@IBOutlet weak var assistantView: UIStackView!
@@ -44,10 +43,10 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
super.awakeFromNib()
backgroundColor = .clear
- assistantView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(assistantTapped(_:))))
- talkView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(talkTapped(_:))))
- notesView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(notesTapped(_:))))
- moreAppsView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(moreAppsTapped(_:))))
+ assistantView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(assistantTapped)))
+ talkView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(talkTapped)))
+ notesView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(notesTapped)))
+ moreAppsView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(moreAppsTapped)))
}
override func setupCell(account: String, controller: NCMainTabBarController?) {
@@ -59,7 +58,7 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
self.controller = controller
}
- @objc func assistantTapped(_ sender: Any?) {
+ @objc func assistantTapped() {
if let viewController = self.window?.rootViewController {
let assistant = NCAssistant()
.environmentObject(NCAssistantModel(controller: self.controller))
@@ -68,7 +67,7 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
}
}
- @objc func talkTapped(_ sender: Any?) {
+ @objc func talkTapped() {
guard let url = URL(string: NCGlobal.shared.talkSchemeUrl) else { return }
if UIApplication.shared.canOpenURL(url) {
@@ -79,7 +78,7 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
}
}
- @objc func notesTapped(_ sender: Any?) {
+ @objc func notesTapped() {
guard let url = URL(string: NCGlobal.shared.notesSchemeUrl) else { return }
if UIApplication.shared.canOpenURL(url) {
@@ -90,7 +89,7 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
}
}
- @objc func moreAppsTapped(_ sender: Any?) {
+ @objc func moreAppsTapped() {
guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return }
UIApplication.shared.open(url)
}
diff --git a/iOSClient/More/NCMore.storyboard b/iOSClient/More/NCMore.storyboard
index 754b283038..f3d0709672 100644
--- a/iOSClient/More/NCMore.storyboard
+++ b/iOSClient/More/NCMore.storyboard
@@ -1,47 +1,47 @@
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
@@ -49,66 +49,66 @@
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -117,48 +117,48 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
diff --git a/iOSClient/More/NCMore.swift b/iOSClient/More/NCMore.swift
index 7a33d0ca29..b98e5f44b4 100644
--- a/iOSClient/More/NCMore.swift
+++ b/iOSClient/More/NCMore.swift
@@ -41,11 +41,11 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
private var settingsMenu: [NKExternalSite] = []
private var quotaMenu: [NKExternalSite] = []
private let applicationHandle = NCApplicationHandle()
- private let utilityFileSystem = NCUtilityFileSystem()
- private let utility = NCUtility()
+ private var tabAccount: tableAccount?
+ let utilityFileSystem = NCUtilityFileSystem()
+ let utility = NCUtility()
private let database = NCManageDatabase.shared
private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
- private var tabAccount: tableAccount?
private struct Section {
var items: [NKExternalSite]
@@ -60,7 +60,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
private var sections: [Section] = []
- @MainActor
private var session: NCSession.Session {
NCSession.shared.getSession(controller: tabBarController)
}
@@ -69,10 +68,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
self.tabBarController as? NCMainTabBarController
}
- var mainNavigationController: NCMainNavigationController? {
- self.navigationController as? NCMainNavigationController
- }
-
// MARK: - View Life Cycle
override func viewDidLoad() {
@@ -89,7 +84,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
tableView.register(NCMoreAppSuggestionsCell.fromNib(), forCellReuseIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier)
// create tap gesture recognizer
- let tapQuota = UITapGestureRecognizer(target: self, action: #selector(tapLabelQuotaExternalSite(_:)))
+ let tapQuota = UITapGestureRecognizer(target: self, action: #selector(tapLabelQuotaExternalSite))
labelQuotaExternalSite.isUserInteractionEnabled = true
labelQuotaExternalSite.addGestureRecognizer(tapQuota)
}
@@ -120,12 +115,13 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
func loadItems() {
- guard let tableAccount = self.database.getTableAccount(predicate: NSPredicate(format: "account == %@", session.account)),
- let capabilities = NCNetworking.shared.capabilities[tableAccount.account] else {
+
+ guard let tableAccount = self.database.getTableAccount(predicate: NSPredicate(format: "account == %@", session.account)) else {
return
}
var item = NKExternalSite()
var quota: String = ""
+ let capabilities = NCCapabilities.shared.getCapabilities(account: tableAccount.account)
// Clear
functionMenu.removeAll()
@@ -160,30 +156,16 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
item.order = 30
functionMenu.append(item)
- /*
- if capabilities.capabilityActivityEnabled {
- // ITEM : Activity
- item = NKExternalSite()
- item.name = "_activity_"
- item.icon = "bolt"
- item.url = "segueActivity"
- item.order = 30
- functionMenu.append(item)
- }
- */
-
- if capabilities.assistantEnabled, NCBrandOptions.shared.disable_show_more_nextcloud_apps_in_settings {
- // ITEM : Assistant
- item = NKExternalSite()
- item.name = "_assistant_"
- item.icon = "sparkles"
- item.url = "openAssistant"
- item.order = 40
-// functionMenu.append(item)
- }
+ // ITEM : Activity
+ item = NKExternalSite()
+ item.name = "_activity_"
+ item.icon = "bolt"
+ item.url = "segueActivity"
+ item.order = 40
+// functionMenu.append(item)
// ITEM : Shares
- if capabilities.fileSharingApiEnabled {
+ if capabilities.capabilityFileSharingApiEnabled {
item = NKExternalSite()
item.name = "_list_shares_"
item.icon = "shareFill"
@@ -201,7 +183,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
functionMenu.append(item)
// ITEM : Groupfolders
- if capabilities.groupfoldersEnabled {
+ if capabilities.capabilityGroupfoldersEnabled {
item = NKExternalSite()
item.name = "_group_folders_"
item.icon = "person.2"
@@ -235,7 +217,9 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
item = NKExternalSite()
item.name = "_settings_"
item.icon = "settings"
- item.url = "segueSettings"
+// item.url = "segueSettings"
+ item.url = "openSettings"
+
settingsMenu.append(item)
if !quotaMenu.isEmpty {
@@ -283,6 +267,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
}
}
+
switch tableAccount.quotaTotal {
case -1:
@@ -294,17 +279,18 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
default:
quota = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
}
-
- let quotaUsed: String = utilityFileSystem.transformedSize(tableAccount.quotaUsed)
- let quota2: String = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
+
+ let quotaUsed: String = utilityFileSystem.transformedSize(activeAccount.quotaUsed)
+ let quota2: String = utilityFileSystem.transformedSize(activeAccount.quotaTotal)
let percentageUsedFormatted = "\(Int(progressQuota.progress * 100))%"
-
+
labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_percentage_", comment: ""), percentageUsedFormatted)
quotaLabel1.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed)
quotalabel2.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_of_", comment: ""), quota2)
+
}
-
+
// ITEM : External
if NCBrandOptions.shared.disable_more_external_site == false {
if let externalSites = NCManageDatabase.shared.getAllExternalSites(account: session.account) {
@@ -322,6 +308,26 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
}
}
+
+ switch tableAccount.quotaTotal {
+ case -1:
+ quota = "0"
+ case -2:
+ quota = NSLocalizedString("_quota_space_unknown_", comment: "")
+ case -3:
+ quota = NSLocalizedString("_quota_space_unlimited_", comment: "")
+ default:
+ quota = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
+ }
+
+ let quotaUsed: String = utilityFileSystem.transformedSize(tableAccount.quotaUsed)
+ let quota2: String = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
+ let percentageUsedFormatted = "\(Int(progressQuota.progress * 100))%"
+
+ labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_percentage_", comment: ""), percentageUsedFormatted)
+
+ quotaLabel1.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed)
+ quotalabel2.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_of_", comment: ""), quota2)
loadSections()
}
@@ -425,6 +431,8 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
} else if section.type == .moreApps {
guard let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier, for: indexPath) as? NCMoreAppSuggestionsCell else { return UITableViewCell() }
+
+// cell.setupCell(account: session.account)
cell.controller = self.controller
return cell
} else {
@@ -490,7 +498,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
} else if item.url == "openSettings" {
let settingsView = NCSettingsView(model: NCSettingsModel(controller: self.controller))
let settingsController = UIHostingController(rootView: settingsView)
- settingsController.title = NSLocalizedString("_settings_", comment: "")
navigationController?.pushViewController(settingsController, animated: true)
} else {
applicationHandle.didSelectItem(item, viewController: self)
diff --git a/iOSClient/More/NCMoreNavigationController.swift b/iOSClient/More/NCMoreNavigationController.swift
index 89d9fe6629..4dbf9a0450 100644
--- a/iOSClient/More/NCMoreNavigationController.swift
+++ b/iOSClient/More/NCMoreNavigationController.swift
@@ -7,32 +7,71 @@ import SwiftUI
class NCMoreNavigationController: NCMainNavigationController {
override func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
- super.navigationController(navigationController, willShow: viewController, animated: animated)
-
- guard viewController is NCCollectionViewCommon || viewController is NCActivity || viewController is NCTrash else {
- setNavigationBarAppearance(backgroundColor: .systemGray6)
- return
+ if viewController is NCCollectionViewCommon || viewController is NCActivity || viewController is NCTrash {
+ setNavigationBarAppearance()
+ } else {
+ setGroupAppearance()
}
}
// MARK: - Right
- override func createRightMenu() async -> UIMenu? {
- if collectionViewCommon?.layoutKey == global.layoutViewRecent, let items = await self.createRightMenuActions() {
+ override func createRightMenu() -> UIMenu? {
+ guard let items = self.createRightMenuActions(),
+ let collectionViewCommon
+ else {
+ return nil
+ }
+
+ if collectionViewCommon.layoutKey == global.layoutViewRecent {
return UIMenu(children: [items.select, items.viewStyleSubmenu])
- } else if collectionViewCommon?.layoutKey == global.layoutViewOffline, let items = await self.createRightMenuActions() {
- return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu])
- } else if collectionViewCommon?.layoutKey == global.layoutViewShares, let items = await self.createRightMenuActions() {
+ } else if collectionViewCommon.layoutKey == global.layoutViewOffline {
return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu])
- } else if collectionViewCommon?.layoutKey == global.layoutViewGroupfolders, let items = await self.createRightMenuActions() {
+ } else if collectionViewCommon.layoutKey == global.layoutViewShares {
return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu])
- } else if collectionViewCommon?.layoutKey == global.layoutViewFiles, let items = await self.createRightMenuActions() {
- let additionalSettings = UIMenu(title: "", options: .displayInline, children: [items.showDescription])
- return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu, additionalSettings])
- } else if trashViewController != nil, let items = await self.createTrashRightMenuActions() {
- return UIMenu(children: items)
+ } else {
+ let additionalSubmenu = UIMenu(title: "", options: .displayInline, children: [items.personalFilesOnlyAction, items.showDescription])
+ return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu, additionalSubmenu])
+ }
+ }
+
+ override func setNavigationRightItems() {
+ guard let collectionViewCommon else {
+ return
+ }
+
+ if collectionViewCommon.isEditMode {
+ collectionViewCommon.tabBarSelect?.update(fileSelect: collectionViewCommon.fileSelect, metadatas: collectionViewCommon.getSelectedMetadatas(), userId: session.userId)
+ collectionViewCommon.tabBarSelect?.show()
+
+ let select = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .done) {
+ collectionViewCommon.setEditMode(false)
+ collectionViewCommon.collectionView.reloadData()
+ }
+
+ self.collectionViewCommon?.navigationItem.rightBarButtonItems = [select]
+
+ } else if self.collectionViewCommon?.navigationItem.rightBarButtonItems == nil || (!collectionViewCommon.isEditMode && !(collectionViewCommon.tabBarSelect?.isHidden() ?? true)) {
+ collectionViewCommon.tabBarSelect?.hide()
+
+ let menuButton = UIBarButtonItem(image: utility.loadImage(named: "ellipsis.circle"), menu: createRightMenu())
+ menuButton.tag = menuButtonTag
+ menuButton.tintColor = NCBrandColor.shared.iconImageColor
+
+ self.collectionViewCommon?.navigationItem.rightBarButtonItems = [menuButton]
+
+ } else {
+
+ if let rightBarButtonItems = self.collectionViewCommon?.navigationItem.rightBarButtonItems,
+ let menuBarButtonItem = rightBarButtonItems.first(where: { $0.tag == menuButtonTag }) {
+ menuBarButtonItem.menu = createRightMenu()
+ }
}
- return nil
+ // fix, if the tabbar was hidden before the update, set it in hidden
+ if self.tabBarController?.tabBar.isHidden ?? true,
+ collectionViewCommon.tabBarSelect?.isHidden() ?? true {
+ self.tabBarController?.tabBar.isHidden = true
+ }
}
}
From 4fb8517868a30ab077a70e4ff2681fb2e28e1676 Mon Sep 17 00:00:00 2001
From: harshada-15-tsys
Date: Mon, 15 Dec 2025 17:52:13 +0530
Subject: [PATCH 4/4] NMC 2237 - More option tab customisation changes
---
iOSClient/More/Cells/BaseNCMoreCell.swift | 16 +
.../More/Cells/NCMoreAppSuggestionsCell.swift | 17 +-
iOSClient/More/NCMore.storyboard | 171 +++++-----
iOSClient/More/NCMore.swift | 293 +++++++-----------
.../More/NCMoreNavigationController.swift | 73 +----
5 files changed, 236 insertions(+), 334 deletions(-)
diff --git a/iOSClient/More/Cells/BaseNCMoreCell.swift b/iOSClient/More/Cells/BaseNCMoreCell.swift
index c0d41bc513..9b5b705cd1 100644
--- a/iOSClient/More/Cells/BaseNCMoreCell.swift
+++ b/iOSClient/More/Cells/BaseNCMoreCell.swift
@@ -28,6 +28,22 @@ class BaseNCMoreCell: UITableViewCell {
let selectionColor: UIView = UIView()
let defaultCornerRadius: CGFloat = 10.0
+ override var frame: CGRect {
+ get {
+ return super.frame
+ }
+ set (newFrame) {
+ var frame = newFrame
+ let newWidth = frame.width * 0.90
+ let space = (frame.width - newWidth) / 2
+ frame.size.width = newWidth
+ frame.origin.x += space
+ super.frame = frame
+ }
+ }
+
+ open func setupCell(account: String, controller: NCMainTabBarController?) {}
+
override func awakeFromNib() {
super.awakeFromNib()
diff --git a/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
index 868430cf0c..52dfb9e3f7 100644
--- a/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
+++ b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
@@ -25,6 +25,7 @@ import Foundation
import UIKit
import SafariServices
import SwiftUI
+import NextcloudKit
class NCMoreAppSuggestionsCell: BaseNCMoreCell {
@IBOutlet weak var assistantView: UIStackView!
@@ -43,10 +44,10 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
super.awakeFromNib()
backgroundColor = .clear
- assistantView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(assistantTapped)))
- talkView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(talkTapped)))
- notesView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(notesTapped)))
- moreAppsView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(moreAppsTapped)))
+ assistantView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(assistantTapped(_:))))
+ talkView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(talkTapped(_:))))
+ notesView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(notesTapped(_:))))
+ moreAppsView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(moreAppsTapped(_:))))
}
override func setupCell(account: String, controller: NCMainTabBarController?) {
@@ -58,7 +59,7 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
self.controller = controller
}
- @objc func assistantTapped() {
+ @objc func assistantTapped(_ sender: Any?) {
if let viewController = self.window?.rootViewController {
let assistant = NCAssistant()
.environmentObject(NCAssistantModel(controller: self.controller))
@@ -67,7 +68,7 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
}
}
- @objc func talkTapped() {
+ @objc func talkTapped(_ sender: Any?) {
guard let url = URL(string: NCGlobal.shared.talkSchemeUrl) else { return }
if UIApplication.shared.canOpenURL(url) {
@@ -78,7 +79,7 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
}
}
- @objc func notesTapped() {
+ @objc func notesTapped(_ sender: Any?) {
guard let url = URL(string: NCGlobal.shared.notesSchemeUrl) else { return }
if UIApplication.shared.canOpenURL(url) {
@@ -89,7 +90,7 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
}
}
- @objc func moreAppsTapped() {
+ @objc func moreAppsTapped(_ sender: Any?) {
guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return }
UIApplication.shared.open(url)
}
diff --git a/iOSClient/More/NCMore.storyboard b/iOSClient/More/NCMore.storyboard
index f3d0709672..57caeedfce 100644
--- a/iOSClient/More/NCMore.storyboard
+++ b/iOSClient/More/NCMore.storyboard
@@ -1,114 +1,102 @@
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
@@ -117,54 +105,45 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
-
+
-
diff --git a/iOSClient/More/NCMore.swift b/iOSClient/More/NCMore.swift
index b98e5f44b4..11b04a1ea4 100644
--- a/iOSClient/More/NCMore.swift
+++ b/iOSClient/More/NCMore.swift
@@ -25,41 +25,37 @@ import UIKit
import NextcloudKit
import SafariServices
import SwiftUI
+import Foundation
class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
-
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var labelQuota: UILabel!
@IBOutlet weak var labelQuotaExternalSite: UILabel!
@IBOutlet weak var progressQuota: UIProgressView!
@IBOutlet weak var viewQuota: UIView!
- @IBOutlet weak var quotaLabel1: UILabel!
- @IBOutlet weak var quotalabel2: UILabel!
+ private var userMenu: [NKExternalSite] = []
private var functionMenu: [NKExternalSite] = []
private var externalSiteMenu: [NKExternalSite] = []
private var settingsMenu: [NKExternalSite] = []
private var quotaMenu: [NKExternalSite] = []
private let applicationHandle = NCApplicationHandle()
- private var tabAccount: tableAccount?
- let utilityFileSystem = NCUtilityFileSystem()
- let utility = NCUtility()
+ private let utilityFileSystem = NCUtilityFileSystem()
+ private let utility = NCUtility()
private let database = NCManageDatabase.shared
- private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
private struct Section {
var items: [NKExternalSite]
var type: SectionType
enum SectionType {
- case account
case moreApps
case regular
}
}
-
private var sections: [Section] = []
+ @MainActor
private var session: NCSession.Session {
NCSession.shared.getSession(controller: tabBarController)
}
@@ -68,6 +64,10 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
self.tabBarController as? NCMainTabBarController
}
+ var mainNavigationController: NCMainNavigationController? {
+ self.navigationController as? NCMainNavigationController
+ }
+
// MARK: - View Life Cycle
override func viewDidLoad() {
@@ -80,11 +80,10 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = .systemGroupedBackground
- tableView.register(NCMoreUserCell.fromNib(), forCellReuseIdentifier: NCMoreUserCell.reuseIdentifier)
tableView.register(NCMoreAppSuggestionsCell.fromNib(), forCellReuseIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier)
// create tap gesture recognizer
- let tapQuota = UITapGestureRecognizer(target: self, action: #selector(tapLabelQuotaExternalSite))
+ let tapQuota = UITapGestureRecognizer(target: self, action: #selector(tapLabelQuotaExternalSite(_:)))
labelQuotaExternalSite.isUserInteractionEnabled = true
labelQuotaExternalSite.addGestureRecognizer(tapQuota)
}
@@ -98,32 +97,21 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
loadItems()
- changeTheming()
tableView.reloadData()
}
// MARK: -
-
- @objc func changeTheming() {
- viewQuota.backgroundColor = NCBrandColor.shared.memoryConsuptionBackground
- quotaLabel1.textColor = NCBrandColor.shared.label
- quotalabel2.textColor = NCBrandColor.shared.label
- labelQuota.textColor = NCBrandColor.shared.label
- labelQuotaExternalSite.textColor = NCBrandColor.shared.label
- progressQuota.progressTintColor = NCBrandColor.shared.brandElement
- progressQuota.trackTintColor = NCBrandColor.shared.commonViewInfoText
- }
func loadItems() {
-
- guard let tableAccount = self.database.getTableAccount(predicate: NSPredicate(format: "account == %@", session.account)) else {
+ guard let tableAccount = self.database.getTableAccount(predicate: NSPredicate(format: "account == %@", session.account)),
+ let capabilities = NCNetworking.shared.capabilities[tableAccount.account] else {
return
}
var item = NKExternalSite()
var quota: String = ""
- let capabilities = NCCapabilities.shared.getCapabilities(account: tableAccount.account)
// Clear
+ userMenu.removeAll()
functionMenu.removeAll()
externalSiteMenu.removeAll()
settingsMenu.removeAll()
@@ -132,43 +120,56 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
labelQuotaExternalSite.text = ""
progressQuota.progressTintColor = NCBrandColor.shared.getElement(account: session.account)
- // ITEM : Transfer
+ // ITEM : User
item = NKExternalSite()
- item.name = "_transfers_"
- item.icon = "arrow.left.arrow.right.circle"
- item.url = "segueTransfers"
- item.order = 10
-// functionMenu.append(item)
-
+// item.name = tableAccount.email
+ if !tableAccount.email.isEmpty {
+ item.name = tableAccount.email
+ } else if tableAccount.email.isEmpty {//}|| tableAccount.alias.isEmpty {
+ item.name = tableAccount.displayName
+ } else {
+ item.name = tableAccount.alias
+ }
+ item.icon = "user"//utility.loadUserImage(for: tableAccount.user, displayName: tableAccount.displayName, urlBase: tableAccount.urlBase)
+// item.url = "segueRecent"
+// item.order = 10
+ userMenu.append(item)
+
// ITEM : Recent
item = NKExternalSite()
item.name = "_recent_"
- item.icon = "recent"
+ item.icon = "History" //"clock.arrow.circlepath"
item.url = "segueRecent"
item.order = 20
functionMenu.append(item)
-
- // ITEM : Notification
- item = NKExternalSite()
- item.name = "_notifications_"
- item.icon = "notification"
- item.url = "segueNotification"
- item.order = 30
- functionMenu.append(item)
- // ITEM : Activity
- item = NKExternalSite()
- item.name = "_activity_"
- item.icon = "bolt"
- item.url = "segueActivity"
- item.order = 40
-// functionMenu.append(item)
+ /*
+ if capabilities.capabilityActivityEnabled {
+ // ITEM : Activity
+ item = NKExternalSite()
+ item.name = "_activity_"
+ item.icon = "bolt"
+ item.url = "segueActivity"
+ item.order = 30
+ functionMenu.append(item)
+ }
+ */
+
+ if capabilities.assistantEnabled, NCBrandOptions.shared.disable_show_more_nextcloud_apps_in_settings {
+ // ITEM : Assistant
+ item = NKExternalSite()
+ item.name = "_assistant_"
+ item.icon = "sparkles"
+ item.url = "openAssistant"
+ item.order = 40
+ functionMenu.append(item)
+ }
// ITEM : Shares
- if capabilities.capabilityFileSharingApiEnabled {
+ if capabilities.fileSharingApiEnabled {
item = NKExternalSite()
item.name = "_list_shares_"
- item.icon = "shareFill"
+ item.icon = "share" //"person.badge.plus"
item.url = "segueShares"
item.order = 50
functionMenu.append(item)
@@ -177,32 +178,33 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
// ITEM : Offline
item = NKExternalSite()
item.name = "_manage_file_offline_"
- item.icon = "offlineMenu"
+ item.icon = "cloudDownload"
item.url = "segueOffline"
item.order = 60
functionMenu.append(item)
// ITEM : Groupfolders
- if capabilities.capabilityGroupfoldersEnabled {
+ if capabilities.groupfoldersEnabled {
item = NKExternalSite()
item.name = "_group_folders_"
item.icon = "person.2"
item.url = "segueGroupfolders"
item.order = 61
-// functionMenu.append(item)
+ functionMenu.append(item)
}
+
// ITEM : Scan
item = NKExternalSite()
item.name = "_scanned_images_"
- item.icon = "doc.text.viewfinder"
+ item.icon = "scan" //"doc.text.viewfinder"
item.url = "openStoryboardNCScan"
item.order = 70
-// functionMenu.append(item)
+ functionMenu.append(item)
// ITEM : Trash
item = NKExternalSite()
item.name = "_trash_view_"
- item.icon = "trash"
+ item.icon = "trashIcon"
item.url = "segueTrash"
item.order = 80
functionMenu.append(item)
@@ -217,9 +219,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
item = NKExternalSite()
item.name = "_settings_"
item.icon = "settings"
-// item.url = "segueSettings"
item.url = "openSettings"
-
settingsMenu.append(item)
if !quotaMenu.isEmpty {
@@ -228,8 +228,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
// Display Name user & Quota
-
-
if tableAccount.quotaRelative > 0 {
progressQuota.progress = Float(tableAccount.quotaRelative) / 100
} else {
@@ -261,80 +259,24 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
item.url = urlEncoded
item.icon = "network"
if externalSite.type == "settings" {
- item.icon = "gear"
- }
- externalSiteMenu.append(item)
- }
- }
- }
-
-
- switch tableAccount.quotaTotal {
- case -1:
- quota = "0"
- case -2:
- quota = NSLocalizedString("_quota_space_unknown_", comment: "")
- case -3:
- quota = NSLocalizedString("_quota_space_unlimited_", comment: "")
- default:
- quota = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
- }
-
- let quotaUsed: String = utilityFileSystem.transformedSize(activeAccount.quotaUsed)
- let quota2: String = utilityFileSystem.transformedSize(activeAccount.quotaTotal)
- let percentageUsedFormatted = "\(Int(progressQuota.progress * 100))%"
-
- labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_percentage_", comment: ""), percentageUsedFormatted)
-
- quotaLabel1.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed)
- quotalabel2.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_of_", comment: ""), quota2)
-
- }
-
- // ITEM : External
- if NCBrandOptions.shared.disable_more_external_site == false {
- if let externalSites = NCManageDatabase.shared.getAllExternalSites(account: session.account) {
- for externalSite in externalSites {
- if !externalSite.name.isEmpty, !externalSite.url.isEmpty, let urlEncoded = externalSite.url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
- item = NKExternalSite()
- item.name = externalSite.name
- item.url = urlEncoded
- item.icon = "network"
- if externalSite.type == "settings" {
- item.icon = "gear"
+ item.icon = "settings"
}
externalSiteMenu.append(item)
}
}
}
}
-
- switch tableAccount.quotaTotal {
- case -1:
- quota = "0"
- case -2:
- quota = NSLocalizedString("_quota_space_unknown_", comment: "")
- case -3:
- quota = NSLocalizedString("_quota_space_unlimited_", comment: "")
- default:
- quota = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
- }
-
- let quotaUsed: String = utilityFileSystem.transformedSize(tableAccount.quotaUsed)
- let quota2: String = utilityFileSystem.transformedSize(tableAccount.quotaTotal)
- let percentageUsedFormatted = "\(Int(progressQuota.progress * 100))%"
-
- labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_percentage_", comment: ""), percentageUsedFormatted)
-
- quotaLabel1.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed)
- quotalabel2.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_of_", comment: ""), quota2)
loadSections()
}
private func loadSections() {
- if tabAccount != nil {
- sections.append(Section(items: [NKExternalSite()], type: .account))
+ if !NCBrandOptions.shared.disable_show_more_nextcloud_apps_in_settings {
+ sections.append(Section(items: [NKExternalSite()], type: .moreApps))
+ }
+
+ if !userMenu.isEmpty {
+ sections.append(Section(items: userMenu, type: .regular))
}
if !functionMenu.isEmpty {
@@ -352,8 +294,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
// MARK: - Action
- @objc func tapLabelQuotaExternalSite() {
-
+ @objc func tapLabelQuotaExternalSite(_ sender: Any?) {
if !quotaMenu.isEmpty {
let item = quotaMenu[0]
if let browserWebVC = UIStoryboard(name: "NCBrowserWeb", bundle: nil).instantiateInitialViewController() as? NCBrowserWeb {
@@ -366,21 +307,10 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
}
- @objc func tapImageLogoManageAccount() {
-
- let controller = CCManageAccount()
-
- self.navigationController?.pushViewController(controller, animated: true)
- }
-
// MARK: -
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- if sections[indexPath.section].type == .account {
- return 100
- } else {
- return NCGlobal.shared.heightCellSettings
- }
+ return 50
}
func numberOfSections(in tableView: UITableView) -> Int {
@@ -390,9 +320,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForHeaderInSection index: Int) -> CGFloat {
let section = sections[index]
- if section.type == .account {
- return 10
- } else if section.type == .moreApps || sections[index - 1].type == .moreApps {
+ if section.type == .moreApps || (index > 0 && sections[index - 1].type == .moreApps) {
return 1
} else {
return 20
@@ -406,45 +334,49 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let section = sections[indexPath.section]
- if section.type == .account {
-
- guard let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreUserCell.reuseIdentifier, for: indexPath) as? NCMoreUserCell else { return UITableViewCell() }
-
- cell.avatar.image = nil
- cell.icon.image = nil
- cell.status.text = ""
- cell.displayName.text = ""
-
- if let account = tabAccount {
- cell.avatar.image = UIImage.init(named: "user_settings")?.image(color: NCBrandColor.shared.iconColor, size: 25)
-
- if account.alias.isEmpty {
- cell.displayName?.text = account.displayName
- } else {
- cell.displayName?.text = account.displayName + " (" + account.alias + ")"
- }
- cell.displayName.textColor = .label
- }
- cell.removeCornerRadius()
- cell.icon.isHidden = true
- return cell
-
- } else if section.type == .moreApps {
+ if section.type == .moreApps {
guard let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier, for: indexPath) as? NCMoreAppSuggestionsCell else { return UITableViewCell() }
-
-// cell.setupCell(account: session.account)
- cell.controller = self.controller
+ cell.setupCell(account: session.account, controller: controller)
return cell
} else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: CCCellMore.reuseIdentifier, for: indexPath) as? CCCellMore else { return UITableViewCell() }
-
+
+ cell.setupCell(account: session.account, controller: controller)
+
let item = sections[indexPath.section].items[indexPath.row]
- cell.imageIcon?.image = utility.loadImage(named: item.icon).image(color: NCBrandColor.shared.iconColor, size: 25)
+ cell.imageIcon?.image = utility.loadImage(named: item.icon, colors: [NCBrandColor.shared.iconImageColor], size: 24).withTintColor(NCBrandColor.shared.iconImageColor)
cell.imageIcon?.contentMode = .scaleAspectFit
cell.labelText?.text = NSLocalizedString(item.name, comment: "")
- cell.labelText.textColor = .label
+ cell.labelText.textColor = NCBrandColor.shared.textColor
+
+ if indexPath.section == 0 {
+ if indexPath.row == 0 {
+ cell.accessoryType = UITableViewCell.AccessoryType.none
+ }
+ }
+ else {
+ cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
+ }
+ cell.separator.backgroundColor = .separator
+ cell.separatorHeigth.constant = 0.4
+
cell.removeCornerRadius()
+ let rows = tableView.numberOfRows(inSection: indexPath.section)
+
+ if indexPath.row == 0 {
+ cell.applyCornerRadius()
+ if indexPath.row == rows - 1 {
+ cell.separator.backgroundColor = .clear
+ cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner]
+ } else {
+ cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner]
+ }
+ } else if indexPath.row == rows - 1 {
+ cell.applyCornerRadius()
+ cell.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner]
+ cell.separator.backgroundColor = .clear
+ }
return cell
}
@@ -476,11 +408,23 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
}
} else if item.url == "logout" {
let alertController = UIAlertController(title: "", message: NSLocalizedString("_want_delete_", comment: ""), preferredStyle: .alert)
-
let actionYes = UIAlertAction(title: NSLocalizedString("_yes_delete_", comment: ""), style: .default) { (_: UIAlertAction) in
- let manageAccount = CCManageAccount()
- manageAccount.delete(self.session.account)
- self.appDelegate.openLogin(viewController: self, selector: NCGlobal.shared.introLogin, openLoginWeb: false)
+ if NCBrandOptions.shared.disable_intro {
+ if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin {
+ viewController.controller = self.controller
+ let navigationController = UINavigationController(rootViewController: viewController)
+ navigationController.modalPresentationStyle = .fullScreen
+ self.present(navigationController, animated: true)
+ }
+ } else {
+ if let navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController {
+ if let viewController = navigationController.topViewController as? NCIntroViewController {
+ viewController.controller = self.controller
+ }
+ navigationController.modalPresentationStyle = .fullScreen
+ self.present(navigationController, animated: true)
+ }
+ }
}
let actionNo = UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (_: UIAlertAction) in
@@ -498,6 +442,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
} else if item.url == "openSettings" {
let settingsView = NCSettingsView(model: NCSettingsModel(controller: self.controller))
let settingsController = UIHostingController(rootView: settingsView)
+ settingsController.title = NSLocalizedString("_settings_", comment: "")
navigationController?.pushViewController(settingsController, animated: true)
} else {
applicationHandle.didSelectItem(item, viewController: self)
diff --git a/iOSClient/More/NCMoreNavigationController.swift b/iOSClient/More/NCMoreNavigationController.swift
index 4dbf9a0450..89d9fe6629 100644
--- a/iOSClient/More/NCMoreNavigationController.swift
+++ b/iOSClient/More/NCMoreNavigationController.swift
@@ -7,71 +7,32 @@ import SwiftUI
class NCMoreNavigationController: NCMainNavigationController {
override func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
- if viewController is NCCollectionViewCommon || viewController is NCActivity || viewController is NCTrash {
- setNavigationBarAppearance()
- } else {
- setGroupAppearance()
+ super.navigationController(navigationController, willShow: viewController, animated: animated)
+
+ guard viewController is NCCollectionViewCommon || viewController is NCActivity || viewController is NCTrash else {
+ setNavigationBarAppearance(backgroundColor: .systemGray6)
+ return
}
}
// MARK: - Right
- override func createRightMenu() -> UIMenu? {
- guard let items = self.createRightMenuActions(),
- let collectionViewCommon
- else {
- return nil
- }
-
- if collectionViewCommon.layoutKey == global.layoutViewRecent {
+ override func createRightMenu() async -> UIMenu? {
+ if collectionViewCommon?.layoutKey == global.layoutViewRecent, let items = await self.createRightMenuActions() {
return UIMenu(children: [items.select, items.viewStyleSubmenu])
- } else if collectionViewCommon.layoutKey == global.layoutViewOffline {
+ } else if collectionViewCommon?.layoutKey == global.layoutViewOffline, let items = await self.createRightMenuActions() {
return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu])
- } else if collectionViewCommon.layoutKey == global.layoutViewShares {
+ } else if collectionViewCommon?.layoutKey == global.layoutViewShares, let items = await self.createRightMenuActions() {
return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu])
- } else {
- let additionalSubmenu = UIMenu(title: "", options: .displayInline, children: [items.personalFilesOnlyAction, items.showDescription])
- return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu, additionalSubmenu])
- }
- }
-
- override func setNavigationRightItems() {
- guard let collectionViewCommon else {
- return
- }
-
- if collectionViewCommon.isEditMode {
- collectionViewCommon.tabBarSelect?.update(fileSelect: collectionViewCommon.fileSelect, metadatas: collectionViewCommon.getSelectedMetadatas(), userId: session.userId)
- collectionViewCommon.tabBarSelect?.show()
-
- let select = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .done) {
- collectionViewCommon.setEditMode(false)
- collectionViewCommon.collectionView.reloadData()
- }
-
- self.collectionViewCommon?.navigationItem.rightBarButtonItems = [select]
-
- } else if self.collectionViewCommon?.navigationItem.rightBarButtonItems == nil || (!collectionViewCommon.isEditMode && !(collectionViewCommon.tabBarSelect?.isHidden() ?? true)) {
- collectionViewCommon.tabBarSelect?.hide()
-
- let menuButton = UIBarButtonItem(image: utility.loadImage(named: "ellipsis.circle"), menu: createRightMenu())
- menuButton.tag = menuButtonTag
- menuButton.tintColor = NCBrandColor.shared.iconImageColor
-
- self.collectionViewCommon?.navigationItem.rightBarButtonItems = [menuButton]
-
- } else {
-
- if let rightBarButtonItems = self.collectionViewCommon?.navigationItem.rightBarButtonItems,
- let menuBarButtonItem = rightBarButtonItems.first(where: { $0.tag == menuButtonTag }) {
- menuBarButtonItem.menu = createRightMenu()
- }
+ } else if collectionViewCommon?.layoutKey == global.layoutViewGroupfolders, let items = await self.createRightMenuActions() {
+ return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu])
+ } else if collectionViewCommon?.layoutKey == global.layoutViewFiles, let items = await self.createRightMenuActions() {
+ let additionalSettings = UIMenu(title: "", options: .displayInline, children: [items.showDescription])
+ return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu, additionalSettings])
+ } else if trashViewController != nil, let items = await self.createTrashRightMenuActions() {
+ return UIMenu(children: items)
}
- // fix, if the tabbar was hidden before the update, set it in hidden
- if self.tabBarController?.tabBar.isHidden ?? true,
- collectionViewCommon.tabBarSelect?.isHidden() ?? true {
- self.tabBarController?.tabBar.isHidden = true
- }
+ return nil
}
}