diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aac73a6060..be1b92abd4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,4 +23,4 @@ jobs: - uses: actions/checkout@v3 - name: GitHub Action for SwiftLint - uses: norio-nomura/action-swiftlint@3.1.0 + uses: norio-nomura/action-swiftlint@3.2.1 diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 3de784411e..5529d797e0 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -117,6 +117,11 @@ F343A4C02A1E734600DDA874 /* Optional+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F343A4BA2A1E734600DDA874 /* Optional+Extension.swift */; }; F343A4C12A1E734600DDA874 /* Optional+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F343A4BA2A1E734600DDA874 /* Optional+Extension.swift */; }; F3A7AFC62A41AA82001FC89C /* BaseUIXCTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A7AFC52A41AA82001FC89C /* BaseUIXCTestCase.swift */; }; + F39298972A3B12CB00509762 /* BaseNCMoreCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39298962A3B12CB00509762 /* BaseNCMoreCell.swift */; }; + F3BB464D2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F3BB464C2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib */; }; + F3BB464F2A39EBE500461F6E /* NCMoreUserCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BB464E2A39EBE500461F6E /* NCMoreUserCell.swift */; }; + F3BB46522A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BB46512A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift */; }; + F3BB46542A3A1E9D00461F6E /* CCCellMore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BB46532A3A1E9D00461F6E /* CCCellMore.swift */; }; F700222C1EC479840080073F /* Custom.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F700222B1EC479840080073F /* Custom.xcassets */; }; F700222D1EC479840080073F /* Custom.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F700222B1EC479840080073F /* Custom.xcassets */; }; F700510122DF63AC003A3356 /* NCShare.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F700510022DF63AC003A3356 /* NCShare.storyboard */; }; @@ -811,6 +816,11 @@ F31F69602A2F907800162F76 /* __Snapshots__ */ = {isa = PBXFileReference; lastKnownFileType = folder; path = __Snapshots__; sourceTree = ""; }; F343A4B22A1E01FF00DDA874 /* PHAsset+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PHAsset+Extension.swift"; sourceTree = ""; }; F343A4BA2A1E734600DDA874 /* Optional+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Optional+Extension.swift"; sourceTree = ""; }; + F39298962A3B12CB00509762 /* BaseNCMoreCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseNCMoreCell.swift; sourceTree = ""; }; + F3BB464C2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCMoreAppSuggestionsCell.xib; sourceTree = ""; }; + F3BB464E2A39EBE500461F6E /* NCMoreUserCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMoreUserCell.swift; sourceTree = ""; }; + F3BB46512A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMoreAppSuggestionsCell.swift; sourceTree = ""; }; + F3BB46532A3A1E9D00461F6E /* CCCellMore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCCellMore.swift; sourceTree = ""; }; F3A7AFC52A41AA82001FC89C /* BaseUIXCTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseUIXCTestCase.swift; sourceTree = ""; }; F700222B1EC479840080073F /* Custom.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Custom.xcassets; sourceTree = ""; }; F700510022DF63AC003A3356 /* NCShare.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCShare.storyboard; sourceTree = ""; }; @@ -1529,6 +1539,19 @@ path = Advanced; sourceTree = ""; }; + F3BB46502A39EC2D00461F6E /* Cells */ = { + isa = PBXGroup; + children = ( + F3BB464C2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib */, + F3BB46512A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift */, + F7EFC0C5256BC77700461AAD /* NCMoreUserCell.xib */, + F3BB464E2A39EBE500461F6E /* NCMoreUserCell.swift */, + F3BB46532A3A1E9D00461F6E /* CCCellMore.swift */, + F39298962A3B12CB00509762 /* BaseNCMoreCell.swift */, + ); + path = Cells; + sourceTree = ""; + }; C0046CDB2A17B98400D87C9D /* NextcloudUITests */ = { isa = PBXGroup; children = ( @@ -2265,7 +2288,7 @@ F7CB68942541670D0050EC94 /* More */ = { isa = PBXGroup; children = ( - F7EFC0C5256BC77700461AAD /* NCMoreUserCell.xib */, + F3BB46502A39EC2D00461F6E /* Cells */, F7CB68992541676B0050EC94 /* NCMore.storyboard */, F73F537E1E929C8500F8678D /* NCMore.swift */, ); @@ -3102,6 +3125,7 @@ F7362A1F220C853A005101B5 /* LaunchScreen.storyboard in Resources */, F77444F622281649000D5EB0 /* NCGridMediaCell.xib in Resources */, F78ACD4421903CF20088454D /* NCListCell.xib in Resources */, + F3BB464D2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib in Resources */, F7F4F10727ECDBDB008676F9 /* Inconsolata-Black.ttf in Resources */, F761856D29E98543006EB3B0 /* NCIntroCollectionViewCell.xib in Resources */, F78ACD4621903D010088454D /* NCGridCell.xib in Resources */, @@ -3597,6 +3621,7 @@ F7B8CD91261AF3F7007C1359 /* NCNetworkingChunkedUpload.swift in Sources */, F757CC8D29E82D0500F31428 /* NCGroupfolders.swift in Sources */, F760329F252F0F8E0015A421 /* NCTransferCell.swift in Sources */, + F3BB46542A3A1E9D00461F6E /* CCCellMore.swift in Sources */, AF68326A27BE65A90010BF0B /* NCMenuAction.swift in Sources */, F7682FE023C36B0500983A04 /* NCMainTabBar.swift in Sources */, F7A0D1352591FBC5008F8A13 /* String+Extension.swift in Sources */, @@ -3606,6 +3631,7 @@ F70460522499061800BB98A7 /* NotificationCenter+MainThread.swift in Sources */, F78F74362163781100C2ADAD /* NCTrash.swift in Sources */, AF817EF1274BC781009ED85B /* NCUserBaseUrl.swift in Sources */, + F39298972A3B12CB00509762 /* BaseNCMoreCell.swift in Sources */, AF2D7C7C2742556F00ADF566 /* NCShareLinkCell.swift in Sources */, F7E41316294A19B300839300 /* UIView+Extension.swift in Sources */, F31F69502A2F707E00162F76 /* SwiftUIView+Extensions.swift in Sources */, @@ -3663,6 +3689,7 @@ F76D364628A4F8BF00214537 /* NCActivityIndicator.swift in Sources */, F7020FCE2233D7F700B7297D /* NCCreateFormUploadVoiceNote.swift in Sources */, F7134186259747BA00768D21 /* NCPushNotification.m in Sources */, + F3BB464F2A39EBE500461F6E /* NCMoreUserCell.swift in Sources */, F726EEEC1FED1C820030B9C8 /* NCEndToEndInitialize.swift in Sources */, F79A65C62191D95E00FF6DCC /* NCSelect.swift in Sources */, F75D19E325EFE09000D74598 /* NCTrash+Menu.swift in Sources */, @@ -3692,6 +3719,7 @@ F749B64A297B0CBB00087535 /* NCManageDatabase+Share.swift in Sources */, F7C9555521F0C5470024296E /* NCActivity.swift in Sources */, F7725A60251F33BB00D125E0 /* NCFiles.swift in Sources */, + F3BB46522A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift in Sources */, F704B5E52430AA8000632F5F /* NCCreateFormUploadConflict.swift in Sources */, F765608F23BF813600765969 /* NCContentPresenter.swift in Sources */, F343A4BB2A1E734600DDA874 /* Optional+Extension.swift in Sources */, diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift index b4f0725e4e..2692dc6db1 100644 --- a/iOSClient/AppDelegate.swift +++ b/iOSClient/AppDelegate.swift @@ -947,6 +947,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } } return true + + /* + Example: + nextcloud://open-and-switch-account?user=marinofaggiana&url=https://cloud.nextcloud.com + */ + + } else if !account.isEmpty && scheme == NCGlobal.shared.appScheme && action == "open-and-switch-account" { + guard let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return false } + let queryItems = urlComponents.queryItems + + guard let userScheme = CCUtility.value(forKey: "user", fromQueryItems: queryItems) else { return false } + guard let urlScheme = CCUtility.value(forKey: "url", fromQueryItems: queryItems) else { return false } + + // If the account doesn't exist, return false which will open the app without switching + if getMatchedAccount(userId: userScheme, url: urlScheme) == nil { + return false + } + + // Otherwise open the app and switch accounts + return true } else { let applicationHandle = NCApplicationHandle() let isHandled = applicationHandle.applicationOpenURL(url) diff --git a/iOSClient/Images.xcassets/more-apps-template.imageset/Contents.json b/iOSClient/Images.xcassets/more-apps-template.imageset/Contents.json new file mode 100644 index 0000000000..8a644052ac --- /dev/null +++ b/iOSClient/Images.xcassets/more-apps-template.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "more-apps.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" + } +} diff --git a/iOSClient/Images.xcassets/more-apps-template.imageset/more-apps.svg b/iOSClient/Images.xcassets/more-apps-template.imageset/more-apps.svg new file mode 100644 index 0000000000..ee5b522769 --- /dev/null +++ b/iOSClient/Images.xcassets/more-apps-template.imageset/more-apps.svg @@ -0,0 +1 @@ + diff --git a/iOSClient/Images.xcassets/notes-template.imageset/Contents.json b/iOSClient/Images.xcassets/notes-template.imageset/Contents.json new file mode 100644 index 0000000000..b70d5069c1 --- /dev/null +++ b/iOSClient/Images.xcassets/notes-template.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "notes.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" + } +} diff --git a/iOSClient/Images.xcassets/notes-template.imageset/notes.svg b/iOSClient/Images.xcassets/notes-template.imageset/notes.svg new file mode 100644 index 0000000000..11c43b6f20 --- /dev/null +++ b/iOSClient/Images.xcassets/notes-template.imageset/notes.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/iOSClient/Images.xcassets/talk-template.imageset/Contents.json b/iOSClient/Images.xcassets/talk-template.imageset/Contents.json new file mode 100644 index 0000000000..7ecaa63288 --- /dev/null +++ b/iOSClient/Images.xcassets/talk-template.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "talk.png", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" + } +} diff --git a/iOSClient/Images.xcassets/talk-template.imageset/talk.png b/iOSClient/Images.xcassets/talk-template.imageset/talk.png new file mode 100644 index 0000000000..c124efb15d Binary files /dev/null and b/iOSClient/Images.xcassets/talk-template.imageset/talk.png differ diff --git a/iOSClient/More/Cells/BaseNCMoreCell.swift b/iOSClient/More/Cells/BaseNCMoreCell.swift new file mode 100644 index 0000000000..ef72a5ed29 --- /dev/null +++ b/iOSClient/More/Cells/BaseNCMoreCell.swift @@ -0,0 +1,36 @@ +// +// BaseNCMoreCell.swift +// Nextcloud +// +// Created by Milen on 15.06.23. +// Copyright © 2023 Marino Faggiana. All rights reserved. +// + +import Foundation + +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 + } + } + + override func awakeFromNib() { + super.awakeFromNib() + + selectedBackgroundView = selectionColor + backgroundColor = .secondarySystemGroupedBackground + layer.cornerRadius = defaultCornerRadius + } +} diff --git a/iOSClient/More/Cells/CCCellMore.swift b/iOSClient/More/Cells/CCCellMore.swift new file mode 100644 index 0000000000..7926d436ff --- /dev/null +++ b/iOSClient/More/Cells/CCCellMore.swift @@ -0,0 +1,18 @@ +// +// CCCellMore.swift +// Nextcloud +// +// Created by Milen on 14.06.23. +// Copyright © 2023 Marino Faggiana. All rights reserved. +// + +import Foundation + +class CCCellMore: BaseNCMoreCell { + @IBOutlet weak var labelText: UILabel! + @IBOutlet weak var imageIcon: UIImageView! + @IBOutlet weak var separator: UIView! + @IBOutlet weak var separatorHeigth: NSLayoutConstraint! + + static let reuseIdentifier = "CCCellMore" +} diff --git a/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift new file mode 100644 index 0000000000..cdbe9ee993 --- /dev/null +++ b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift @@ -0,0 +1,57 @@ +// +// NCMoreAppSuggestionsCell.swift +// Nextcloud +// +// Created by Milen on 14.06.23. +// Copyright © 2023 Marino Faggiana. All rights reserved. +// + +import Foundation + +class NCMoreAppSuggestionsCell: BaseNCMoreCell { + @IBOutlet weak var talkView: UIStackView! + @IBOutlet weak var notesView: UIStackView! + @IBOutlet weak var moreAppsView: UIStackView! + + static let reuseIdentifier = "NCMoreAppSuggestionsCell" + + static func fromNib() -> UINib { + return UINib(nibName: "NCMoreAppSuggestionsCell", bundle: nil) + } + + override func awakeFromNib() { + super.awakeFromNib() + backgroundColor = .clear + + talkView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(talkTapped))) + notesView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(notesTapped))) + moreAppsView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(moreAppsTapped))) + } + + @objc func talkTapped() { + guard let url = URL(string: NCGlobal.shared.talkSchemeUrl) else { return } + + if UIApplication.shared.canOpenURL(url) { + UIApplication.shared.open(url) + } else { + guard let url = URL(string: NCGlobal.shared.talkAppStoreUrl) else { return } + UIApplication.shared.open(url) + } + } + + @objc func notesTapped() { + guard let url = URL(string: NCGlobal.shared.notesSchemeUrl) else { return } + + if UIApplication.shared.canOpenURL(url) { + UIApplication.shared.open(url) + } else { + guard let url = URL(string: NCGlobal.shared.notesAppStoreUrl) else { return } + UIApplication.shared.open(url) + } + } + + @objc func moreAppsTapped() { + guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return } + UIApplication.shared.open(url) + } +} diff --git a/iOSClient/More/Cells/NCMoreAppSuggestionsCell.xib b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.xib new file mode 100644 index 0000000000..b1e6a54531 --- /dev/null +++ b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.xib @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOSClient/More/Cells/NCMoreUserCell.swift b/iOSClient/More/Cells/NCMoreUserCell.swift new file mode 100644 index 0000000000..2b766ff103 --- /dev/null +++ b/iOSClient/More/Cells/NCMoreUserCell.swift @@ -0,0 +1,23 @@ +// +// NCMoreUserCell.swift +// Nextcloud +// +// Created by Milen on 14.06.23. +// Copyright © 2023 Marino Faggiana. All rights reserved. +// + +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) + } +} diff --git a/iOSClient/More/NCMoreUserCell.xib b/iOSClient/More/Cells/NCMoreUserCell.xib similarity index 96% rename from iOSClient/More/NCMoreUserCell.xib rename to iOSClient/More/Cells/NCMoreUserCell.xib index f8bf291db5..5cd96162bd 100755 --- a/iOSClient/More/NCMoreUserCell.xib +++ b/iOSClient/More/Cells/NCMoreUserCell.xib @@ -1,15 +1,15 @@ - + - + - + diff --git a/iOSClient/More/NCMore.swift b/iOSClient/More/NCMore.swift index 32caa536b1..18baf3bed3 100644 --- a/iOSClient/More/NCMore.swift +++ b/iOSClient/More/NCMore.swift @@ -23,7 +23,6 @@ import UIKit import NextcloudKit -import MarqueeLabel class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { @@ -33,13 +32,13 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var progressQuota: UIProgressView! @IBOutlet weak var viewQuota: UIView! + var moreAppsMenu: [NKExternalSite] = [] var functionMenu: [NKExternalSite] = [] var externalSiteMenu: [NKExternalSite] = [] var settingsMenu: [NKExternalSite] = [] var quotaMenu: [NKExternalSite] = [] let appDelegate = UIApplication.shared.delegate as! AppDelegate - let defaultCornerRadius: CGFloat = 10.0 let applicationHandle = NCApplicationHandle() var tabAccount: tableAccount? @@ -55,7 +54,8 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { tableView.delegate = self tableView.dataSource = self tableView.backgroundColor = .systemGroupedBackground - tableView.register(UINib(nibName: "NCMoreUserCell", bundle: nil), forCellReuseIdentifier: "userCell") + 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)) @@ -90,6 +90,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { var quota: String = "" // Clear + moreAppsMenu.removeAll() functionMenu.removeAll() externalSiteMenu.removeAll() settingsMenu.removeAll() @@ -97,6 +98,10 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { labelQuotaExternalSite.text = "" progressQuota.progressTintColor = NCBrandColor.shared.brandElement + // ITEM : More apps + item = NKExternalSite() + moreAppsMenu.append(item) + // ITEM : Transfer item = NKExternalSite() item.name = "_transfers_" @@ -265,65 +270,67 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } func numberOfSections(in tableView: UITableView) -> Int { + let defaultSections = 4 if externalSiteMenu.count == 0 { - return 3 + return defaultSections } else { - return 4 + return defaultSections + 1 } } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - if section == 0 { return 10 + } else if section == 1 || section == 2 { + return 1 } else { return 20 } } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - - var cont = 0 + var count = 0 if section == 0 { - cont = tabAccount == nil ? 0 : 1 + count = tabAccount == nil ? 0 : 1 } else if section == 1 { - // Menu Normal - cont = functionMenu.count + // Menu More apps + count = moreAppsMenu.count + } else if section == 2 { + // Menu function + count = functionMenu.count } else { switch numberOfSections(in: tableView) { case 3: // Menu Settings - if section == 2 { - cont = settingsMenu.count + if section == 3 { + count = settingsMenu.count } case 4: // Menu External Site - if section == 2 { - cont = externalSiteMenu.count + if section == 4 { + count = externalSiteMenu.count } // Menu Settings - if section == 3 { - cont = settingsMenu.count + if section == 5 { + count = settingsMenu.count } default: - cont = 0 + count = 0 } } - return cont + return count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var item = NKExternalSite() - // change color selection and disclosure indicator - let selectionColor: UIView = UIView() if indexPath.section == 0 { - let cell = tableView.dequeueReusableCell(withIdentifier: "userCell", for: indexPath) as! NCMoreUserCell + let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreUserCell.reuseIdentifier, for: indexPath) as! NCMoreUserCell cell.avatar.image = nil cell.icon.image = nil @@ -343,8 +350,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } cell.displayName.textColor = .label } - cell.selectedBackgroundView = selectionColor - cell.backgroundColor = .secondarySystemGroupedBackground cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator if NCGlobal.shared.capabilityUserStatusEnabled, let account = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", appDelegate.account)) { @@ -360,25 +365,33 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } } - cell.layer.cornerRadius = defaultCornerRadius cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner] return cell + } else if indexPath.section == 1 { + let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier, for: indexPath) as! NCMoreAppSuggestionsCell + + return cell } else { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! CCCellMore - // Menu Normal + // Menu More Apps if indexPath.section == 1 { + item = moreAppsMenu[indexPath.row] + } + + // Menu Function + if indexPath.section == 2 { item = functionMenu[indexPath.row] } // Menu External Site - if numberOfSections(in: tableView) == 4 && indexPath.section == 2 { + if numberOfSections(in: tableView) == 5 && indexPath.section == 3 { item = externalSiteMenu[indexPath.row] } // Menu Settings - if (numberOfSections(in: tableView) == 3 && indexPath.section == 2) || (numberOfSections(in: tableView) == 4 && indexPath.section == 3) { + if (numberOfSections(in: tableView) == 4 && indexPath.section == 3) || (numberOfSections(in: tableView) == 5 && indexPath.section == 4) { item = settingsMenu[indexPath.row] } @@ -387,18 +400,14 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { cell.labelText?.text = NSLocalizedString(item.name, comment: "") cell.labelText.textColor = .label - cell.selectedBackgroundView = selectionColor - cell.backgroundColor = .secondarySystemGroupedBackground cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator cell.separator.backgroundColor = .separator cell.separatorHeigth.constant = 0.4 - cell.layer.cornerRadius = 0 let rows = tableView.numberOfRows(inSection: indexPath.section) if indexPath.row == 0 { - cell.layer.cornerRadius = defaultCornerRadius if indexPath.row == rows - 1 { cell.separator.backgroundColor = .clear cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner] @@ -406,9 +415,10 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner] } } else if indexPath.row == rows - 1 { - cell.layer.cornerRadius = defaultCornerRadius cell.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner] cell.separator.backgroundColor = .clear + } else { + cell.layer.cornerRadius = 0 } return cell @@ -420,23 +430,29 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { var item = NKExternalSite() + // Menu Function if indexPath.section == 0 { tapImageLogoManageAccount() return } - // Menu Function + // Menu More Apps if indexPath.section == 1 { + item = moreAppsMenu[indexPath.row] + } + + // Menu Function + if indexPath.section == 2 { item = functionMenu[indexPath.row] } // Menu External Site - if numberOfSections(in: tableView) == 4 && indexPath.section == 2 { + if numberOfSections(in: tableView) == 5 && indexPath.section == 3 { item = externalSiteMenu[indexPath.row] } // Menu Settings - if (numberOfSections(in: tableView) == 3 && indexPath.section == 2) || (numberOfSections(in: tableView) == 4 && indexPath.section == 3) { + if (numberOfSections(in: tableView) == 4 && indexPath.section == 3) || (numberOfSections(in: tableView) == 5 && indexPath.section == 4) { item = settingsMenu[indexPath.row] } @@ -483,53 +499,8 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { alertController.addAction(actionYes) alertController.addAction(actionNo) self.present(alertController, animated: true, completion: nil) - } else { applicationHandle.didSelectItem(item, viewController: self) } } } - -class CCCellMore: UITableViewCell { - - @IBOutlet weak var labelText: UILabel! - @IBOutlet weak var imageIcon: UIImageView! - @IBOutlet weak var separator: UIView! - @IBOutlet weak var separatorHeigth: NSLayoutConstraint! - - 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 - } - } -} - -class NCMoreUserCell: UITableViewCell { - - @IBOutlet weak var displayName: UILabel! - @IBOutlet weak var avatar: UIImageView! - @IBOutlet weak var icon: UIImageView! - @IBOutlet weak var status: MarqueeLabel! - - 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 - } - } -} diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift index d920b1af0a..e6475472df 100644 --- a/iOSClient/NCGlobal.swift +++ b/iOSClient/NCGlobal.swift @@ -442,6 +442,13 @@ class NCGlobal: NSObject { var capabilityExternalSites: Bool = false var capabilityGroupfoldersEnabled: Bool = false // NC27 + // MORE APPS + let talkSchemeUrl = "nextcloudtalk://" + let notesSchemeUrl = "nextcloudnotes://" + let talkAppStoreUrl = "https://apps.apple.com/de/app/nextcloud-talk/id1296825574" + let notesAppStoreUrl = "https://apps.apple.com/de/app/nextcloud-notes/id813973264" + let moreAppsUrl = "https://www.apple.com/us/search/nextcloud?src=globalnav" + // SNAPSHOT PREVIEW - let defaultSnapshotConfiguration = "DefaultPreviewConfiguration" + let defaultSnapshotConfiguration = "DefaultPreviewConfiguration" }