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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */; };
AFCE353927E5DE0500FEA6C2 /* Shareable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* Shareable.swift */; };
CB3666201AF7550816B5CD6A /* NCContextMenuComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8932E90EC4278026D86CCCC9 /* NCContextMenuComment.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 */; };
F31165022F9674A1009A1E37 /* AppIcon.icon in Resources */ = {isa = PBXBuildFile; fileRef = F31165012F9674A1009A1E37 /* AppIcon.icon */; };
Expand Down Expand Up @@ -1263,6 +1269,10 @@
AFCE353827E5DE0400FEA6C2 /* Shareable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shareable.swift; sourceTree = "<group>"; };
B4C7A5B36D1ED178FB6B76CB /* NCContextMenuPlayerTracks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuPlayerTracks.swift; sourceTree = "<group>"; };
BB7697C94BA14450A0867940 /* NCContextMenuProfile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuProfile.swift; sourceTree = "<group>"; };
AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Helper.swift"; sourceTree = "<group>"; };
B568C2B02DA7AA5F0072FCB4 /* MoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreTests.swift; sourceTree = "<group>"; };
B568C2B22DA7AAAE0072FCB4 /* NCMoreUserCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCMoreUserCell.xib; sourceTree = "<group>"; };
B568C2B42DA7AADD0072FCB4 /* NCMoreUserCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMoreUserCell.swift; sourceTree = "<group>"; };
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 = "<group>"; };
Expand Down Expand Up @@ -2087,6 +2097,8 @@
children = (
F34BDB3B2F574A58007A222C /* BidiSafeFilenameTests.swift */,
AA52EB452D42AC5A0089C348 /* Placeholder.swift */,
B568C2B02DA7AA5F0072FCB4 /* MoreTests.swift */,
AF8ED1FB2757821000B8DBC4 /* NextcloudUnitTests.swift */,
);
path = NextcloudUnitTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -4052,6 +4064,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 */,
Expand Down Expand Up @@ -4726,6 +4740,7 @@
F76882342C0DD1E7001CF441 /* NCDisplayView.swift in Sources */,
F7C30DF6291BC0CA0017149B /* NCNetworkingE2EEUpload.swift in Sources */,
F3DDFE232F1FB4C300A784C8 /* NCAssistantChatModel.swift in Sources */,
B568C2B52DA7AADD0072FCB4 /* NCMoreUserCell.swift in Sources */,
F7501C332212E57500FB1415 /* NCMedia.swift in Sources */,
F7411C552D7B26D700F57358 /* NCNetworking+ServerError.swift in Sources */,
F72944F22A84246400246839 /* NCEndToEndMetadataV2.swift in Sources */,
Expand Down
37 changes: 37 additions & 0 deletions Tests/NextcloudUnitTests/MoreTests.swift
Original file line number Diff line number Diff line change
@@ -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.
}
}

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

import Foundation
import UIKit

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()

selectedBackgroundView = selectionColor
backgroundColor = .secondarySystemGroupedBackground
applyCornerRadius()
}

func applyCornerRadius() {
layer.cornerRadius = defaultCornerRadius
}

func removeCornerRadius() {
layer.cornerRadius = 0
}
}
97 changes: 97 additions & 0 deletions iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//
// NCMoreAppSuggestionsCell.swift
// Nextcloud
//
// Created by Milen on 14.06.23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

import Foundation
import UIKit
import SafariServices
import SwiftUI
import NextcloudKit

class NCMoreAppSuggestionsCell: BaseNCMoreCell {
@IBOutlet weak var assistantView: UIStackView!
@IBOutlet weak var talkView: UIStackView!
@IBOutlet weak var notesView: UIStackView!
@IBOutlet weak var moreAppsView: UIStackView!

static let reuseIdentifier = "NCMoreAppSuggestionsCell"
var controller: NCMainTabBarController?

static func fromNib() -> UINib {
return UINib(nibName: "NCMoreAppSuggestionsCell", bundle: nil)
}

override func awakeFromNib() {
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(_:))))
}

override func setupCell(account: String, controller: NCMainTabBarController?) {
guard let capabilities = NCNetworking.shared.capabilities[account] else {
return
}

assistantView.isHidden = !capabilities.assistantEnabled
self.controller = controller
}

@objc func assistantTapped(_ sender: Any?) {
if let viewController = self.window?.rootViewController {
let assistant = NCAssistant()
.environmentObject(NCAssistantModel(controller: self.controller))
let hostingController = UIHostingController(rootView: assistant)
viewController.present(hostingController, animated: true, completion: nil)
}
}

@objc func talkTapped(_ sender: Any?) {
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(_ sender: Any?) {
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(_ sender: Any?) {
guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return }
UIApplication.shared.open(url)
}
}
44 changes: 44 additions & 0 deletions iOSClient/More/Cells/NCMoreUserCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// NCMoreUserCell.swift
// Nextcloud
//
// Created by Milen on 14.06.23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

import 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)
}
}
Loading
Loading