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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
30 changes: 29 additions & 1 deletion Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -811,6 +816,11 @@
F31F69602A2F907800162F76 /* __Snapshots__ */ = {isa = PBXFileReference; lastKnownFileType = folder; path = __Snapshots__; sourceTree = "<group>"; };
F343A4B22A1E01FF00DDA874 /* PHAsset+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PHAsset+Extension.swift"; sourceTree = "<group>"; };
F343A4BA2A1E734600DDA874 /* Optional+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Optional+Extension.swift"; sourceTree = "<group>"; };
F39298962A3B12CB00509762 /* BaseNCMoreCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseNCMoreCell.swift; sourceTree = "<group>"; };
F3BB464C2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCMoreAppSuggestionsCell.xib; sourceTree = "<group>"; };
F3BB464E2A39EBE500461F6E /* NCMoreUserCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMoreUserCell.swift; sourceTree = "<group>"; };
F3BB46512A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMoreAppSuggestionsCell.swift; sourceTree = "<group>"; };
F3BB46532A3A1E9D00461F6E /* CCCellMore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCCellMore.swift; sourceTree = "<group>"; };
F3A7AFC52A41AA82001FC89C /* BaseUIXCTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseUIXCTestCase.swift; sourceTree = "<group>"; };
F700222B1EC479840080073F /* Custom.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Custom.xcassets; sourceTree = "<group>"; };
F700510022DF63AC003A3356 /* NCShare.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCShare.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1529,6 +1539,19 @@
path = Advanced;
sourceTree = "<group>";
};
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 = "<group>";
};
C0046CDB2A17B98400D87C9D /* NextcloudUITests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2265,7 +2288,7 @@
F7CB68942541670D0050EC94 /* More */ = {
isa = PBXGroup;
children = (
F7EFC0C5256BC77700461AAD /* NCMoreUserCell.xib */,
F3BB46502A39EC2D00461F6E /* Cells */,
F7CB68992541676B0050EC94 /* NCMore.storyboard */,
F73F537E1E929C8500F8678D /* NCMore.swift */,
);
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand All @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down
20 changes: 20 additions & 0 deletions iOSClient/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "more-apps.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions iOSClient/Images.xcassets/notes-template.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "notes.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions iOSClient/Images.xcassets/talk-template.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "talk.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions iOSClient/More/Cells/BaseNCMoreCell.swift
Original file line number Diff line number Diff line change
@@ -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
}
Comment on lines +11 to +35
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was used for every cell, so I made a base class instead.

}
18 changes: 18 additions & 0 deletions iOSClient/More/Cells/CCCellMore.swift
Original file line number Diff line number Diff line change
@@ -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"
}
57 changes: 57 additions & 0 deletions iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
Loading