Skip to content

Commit 574ab7e

Browse files
Version 6.0.0 (#3122)
Signed-off-by: Nextcloud bot <[email protected]> Signed-off-by: Marino Faggiana <[email protected]> Signed-off-by: Milen Pivchev <[email protected]> Signed-off-by: rakekniven <[email protected]>
1 parent 64ab8f4 commit 574ab7e

File tree

420 files changed

+17021
-8767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

420 files changed

+17021
-8767
lines changed

Brand/Database.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ import Foundation
2626
// Database Realm
2727
//
2828
let databaseName = "nextcloud.realm"
29-
let databaseSchemaVersion: UInt64 = 354
29+
let databaseSchemaVersion: UInt64 = 365

Brand/File_Provider_Extension.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
<string>group.it.twsweb.Crypto-Cloud</string>
3232
<key>NSExtensionFileProviderSupportsEnumeration</key>
3333
<true/>
34+
<key>NSExtensionFileProviderSupportsPickingFolders</key>
35+
<true/>
3436
<key>NSExtensionPointIdentifier</key>
3537
<string>com.apple.fileprovider-nonui</string>
3638
<key>NSExtensionPrincipalClass</key>

Brand/Intro/NCIntroViewController.swift

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import UIKit
2727

2828
class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
29-
3029
@IBOutlet weak var buttonLogin: UIButton!
3130
@IBOutlet weak var buttonSignUp: UIButton!
3231
@IBOutlet weak var buttonHost: UIButton!
@@ -99,18 +98,23 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
9998
view.backgroundColor = NCBrandColor.shared.customer
10099
timerAutoScroll = Timer.scheduledTimer(timeInterval: 5, target: self, selector: (#selector(NCIntroViewController.autoScroll)), userInfo: nil, repeats: true)
101100

102-
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeUser), object: nil, queue: nil) { _ in
103-
let window = UIApplication.shared.firstWindow
104-
if window?.rootViewController is NCMainTabBarController {
105-
self.dismiss(animated: true)
106-
} else {
107-
if let mainTabBarController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as? NCMainTabBarController {
108-
mainTabBarController.modalPresentationStyle = .fullScreen
109-
mainTabBarController.view.alpha = 0
110-
window?.rootViewController = mainTabBarController
111-
window?.makeKeyAndVisible()
112-
UIView.animate(withDuration: 0.5) {
113-
mainTabBarController.view.alpha = 1
101+
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeUser), object: nil, queue: nil) { notification in
102+
if let userInfo = notification.userInfo,
103+
let account = userInfo["account"] as? String {
104+
let window = UIApplication.shared.firstWindow
105+
if let controller = window?.rootViewController as? NCMainTabBarController {
106+
controller.account = account
107+
self.dismiss(animated: true)
108+
} else {
109+
if let controller = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as? NCMainTabBarController {
110+
controller.account = account
111+
controller.modalPresentationStyle = .fullScreen
112+
controller.view.alpha = 0
113+
window?.rootViewController = controller
114+
window?.makeKeyAndVisible()
115+
UIView.animate(withDuration: 0.5) {
116+
controller.view.alpha = 1
117+
}
114118
}
115119
}
116120
}
@@ -179,11 +183,11 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
179183
}
180184

181185
@IBAction func login(_ sender: Any) {
182-
appDelegate.openLogin(selector: NCGlobal.shared.introLogin, openLoginWeb: false)
186+
appDelegate.openLogin(selector: NCGlobal.shared.introLogin)
183187
}
184188

185189
@IBAction func signup(_ sender: Any) {
186-
appDelegate.openLogin(selector: NCGlobal.shared.introSignup, openLoginWeb: false)
190+
appDelegate.openLogin(selector: NCGlobal.shared.introSignup)
187191
}
188192

189193
@IBAction func host(_ sender: Any) {

Brand/NCBrand.swift

Lines changed: 121 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let userAgent: String = {
5858
// BRAND ONLY
5959
@objc public var use_AppConfig: Bool = false // Don't touch me !!
6060

61-
// Options
61+
// Use server theming color
6262
@objc public var use_themingColor: Bool = true
6363

6464
var disable_intro: Bool = false
@@ -71,6 +71,10 @@ let userAgent: String = {
7171
var disable_mobileconfig: Bool = false
7272
var disable_show_more_nextcloud_apps_in_settings: Bool = false
7373
var doNotAskPasscodeAtStartup: Bool = false
74+
var disable_source_code_in_settings: Bool = false
75+
76+
// (name: "Name 1", url: "https://cloud.nextcloud.com"),(name: "Name 2", url: "https://cloud.nextcloud.com")
77+
var enforce_servers: [(name: String, url: String)] = []
7478

7579
// Internal option behaviour
7680
var cleanUpDay: Int = 0 // Set default "Delete, in the cache, all files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365
@@ -127,26 +131,22 @@ class NCBrandColor: NSObject {
127131
return instance
128132
}()
129133

130-
// Color
134+
/// This is rewrited from customet theme, default is Nextcloud color
135+
///
131136
let customer: UIColor = UIColor(red: 0.0 / 255.0, green: 130.0 / 255.0, blue: 201.0 / 255.0, alpha: 1.0) // BLU NC : #0082c9
132137
var customerText: UIColor = .white
133138

134-
var brand: UIColor // don't touch me
135-
var brandElement: UIColor // don't touch me
136-
var brandText: UIColor // don't touch me
139+
// INTERNAL DEFINE COLORS
140+
private var themingColor = ThreadSafeDictionary<String, UIColor>()
141+
private var themingColorElement = ThreadSafeDictionary<String, UIColor>()
142+
private var themingColorText = ThreadSafeDictionary<String, UIColor>()
137143

144+
var userColors: [CGColor] = []
138145
let nextcloud: UIColor = UIColor(red: 0.0 / 255.0, green: 130.0 / 255.0, blue: 201.0 / 255.0, alpha: 1.0)
139146
let yellowFavorite: UIColor = UIColor(red: 248.0 / 255.0, green: 205.0 / 255.0, blue: 70.0 / 255.0, alpha: 1.0)
140-
141-
var userColors: [CGColor] = []
142-
var themingColor: String = ""
143-
var themingColorElement: String = ""
144-
var themingColorText: String = ""
145-
146147
let iconImageColor: UIColor = .label
147148
let iconImageColor2: UIColor = .secondaryLabel
148149
let iconImageMultiColors: [UIColor] = [.secondaryLabel, .label]
149-
150150
let textColor: UIColor = .label
151151
let textColor2: UIColor = .secondaryLabel
152152

@@ -174,126 +174,162 @@ class NCBrandColor: NSObject {
174174
}
175175
}
176176

177-
override init() {
178-
brand = customer
179-
brandElement = customer
180-
brandText = customerText
181-
}
177+
override init() { }
182178

179+
/**
180+
Generate colors from the official nextcloud color.
181+
You can provide how many colors you want (multiplied by 3).
182+
if `step` = 6,
183+
3 colors \* 6 will result in 18 generated colors
184+
*/
183185
func createUserColors() {
186+
func generateColors(steps: Int = 6) -> [CGColor] {
187+
func stepCalc(steps: Int, color1: CGColor, color2: CGColor) -> [CGFloat] {
188+
var step = [CGFloat](repeating: 0, count: 3)
189+
190+
step[0] = (color2.components![0] - color1.components![0]) / CGFloat(steps)
191+
step[1] = (color2.components![1] - color1.components![1]) / CGFloat(steps)
192+
step[2] = (color2.components![2] - color1.components![2]) / CGFloat(steps)
193+
return step
194+
}
195+
196+
func mixPalette(steps: Int, color1: CGColor, color2: CGColor) -> [CGColor] {
197+
var palette = [color1]
198+
let step = stepCalc(steps: steps, color1: color1, color2: color2)
199+
let c1Components = color1.components!
200+
201+
for i in 1 ..< steps {
202+
let r = c1Components[0] + step[0] * CGFloat(i)
203+
let g = c1Components[1] + step[1] * CGFloat(i)
204+
let b = c1Components[2] + step[2] * CGFloat(i)
205+
206+
palette.append(UIColor(red: r, green: g, blue: b, alpha: 1).cgColor)
207+
}
208+
return palette
209+
}
210+
211+
let red = UIColor(red: 182 / 255, green: 70 / 255, blue: 157 / 255, alpha: 1).cgColor
212+
let yellow = UIColor(red: 221 / 255, green: 203 / 255, blue: 85 / 255, alpha: 1).cgColor
213+
let blue = UIColor(red: 0 / 255, green: 130 / 255, blue: 201 / 255, alpha: 1).cgColor
214+
215+
let palette1 = mixPalette(steps: steps, color1: red, color2: yellow)
216+
let palette2 = mixPalette(steps: steps, color1: yellow, color2: blue)
217+
let palette3 = mixPalette(steps: steps, color1: blue, color2: red)
218+
219+
return palette1 + palette2 + palette3
220+
}
221+
184222
userColors = generateColors()
185223
}
186224

187-
func settingThemingColor(account: String) {
225+
@discardableResult
226+
func settingThemingColor(account: String) -> Bool {
188227
let darker: CGFloat = 30 // %
189228
let lighter: CGFloat = 30 // %
229+
var colorThemingColor: UIColor?
230+
var colorThemingColorElement: UIColor?
231+
var colorThemingColorText: UIColor?
190232

191233
if NCBrandOptions.shared.use_themingColor {
192-
self.themingColor = NCGlobal.shared.capabilityThemingColor
193-
self.themingColorElement = NCGlobal.shared.capabilityThemingColorElement
194-
self.themingColorText = NCGlobal.shared.capabilityThemingColorText
234+
let themingColor = NCCapabilities.shared.getCapabilities(account: account).capabilityThemingColor
235+
let themingColorElement = NCCapabilities.shared.getCapabilities(account: account).capabilityThemingColorElement
236+
let themingColorText = NCCapabilities.shared.getCapabilities(account: account).capabilityThemingColorText
195237

196-
// COLOR
238+
// THEMING COLOR
197239
if themingColor.first == "#" {
198240
if let color = UIColor(hex: themingColor) {
199-
brand = color
200-
} else {
201-
brand = customer
202-
}
203-
} else {
204-
brand = customer
205-
}
206-
207-
// COLOR TEXT
208-
if themingColorText.first == "#" {
209-
if let color = UIColor(hex: themingColorText) {
210-
brandText = color
241+
colorThemingColor = color
211242
} else {
212-
brandText = customerText
243+
colorThemingColor = customer
213244
}
214245
} else {
215-
brandText = customerText
246+
colorThemingColor = customer
216247
}
217248

218-
// COLOR ELEMENT
249+
// THEMING COLOR ELEMENT (control isTooLight / isTooDark)
219250
if themingColorElement.first == "#" {
220251
if let color = UIColor(hex: themingColorElement) {
221-
brandElement = color
252+
if color.isTooLight() {
253+
if let color = color.darker(by: darker) {
254+
colorThemingColorElement = color
255+
}
256+
} else if color.isTooDark() {
257+
if let color = color.lighter(by: lighter) {
258+
colorThemingColorElement = color
259+
}
260+
} else {
261+
colorThemingColorElement = color
262+
}
222263
} else {
223-
brandElement = brand
264+
colorThemingColorElement = customer
224265
}
225266
} else {
226-
brandElement = brand
267+
colorThemingColorElement = customer
227268
}
228269

229-
if brandElement.isTooLight() {
230-
if let color = brandElement.darker(by: darker) {
231-
brandElement = color
232-
}
233-
} else if brandElement.isTooDark() {
234-
if let color = brandElement.lighter(by: lighter) {
235-
brandElement = color
270+
// THEMING COLOR TEXT
271+
if themingColorText.first == "#" {
272+
if let color = UIColor(hex: themingColorText) {
273+
colorThemingColorText = color
274+
} else {
275+
colorThemingColorText = .white
236276
}
277+
} else {
278+
colorThemingColorText = .white
237279
}
238280

239281
} else {
240282

283+
// THEMING COLOR
284+
colorThemingColor = customer
285+
286+
// THEMING COLOR ELEMENT (control isTooLight / isTooDark)
241287
if self.customer.isTooLight() {
242288
if let color = customer.darker(by: darker) {
243-
brandElement = color
289+
colorThemingColorElement = color
244290
}
245291
} else if customer.isTooDark() {
246292
if let color = customer.lighter(by: lighter) {
247-
brandElement = color
293+
colorThemingColorElement = color
248294
}
249295
} else {
250-
brandElement = customer
296+
colorThemingColorElement = customer
251297
}
252298

253-
brand = customer
254-
brandText = customerText
299+
// THEMING COLOR TEXT
300+
colorThemingColorText = customerText
255301
}
256-
}
257302

258-
private func stepCalc(steps: Int, color1: CGColor, color2: CGColor) -> [CGFloat] {
259-
var step = [CGFloat](repeating: 0, count: 3)
303+
if self.themingColor[account] != colorThemingColor || self.themingColorElement[account] != colorThemingColorElement || self.themingColorText[account] != colorThemingColorText {
260304

261-
step[0] = (color2.components![0] - color1.components![0]) / CGFloat(steps)
262-
step[1] = (color2.components![1] - color1.components![1]) / CGFloat(steps)
263-
step[2] = (color2.components![2] - color1.components![2]) / CGFloat(steps)
264-
return step
265-
}
305+
self.themingColor[account] = colorThemingColor
306+
self.themingColorElement[account] = colorThemingColorElement
307+
self.themingColorText[account] = colorThemingColorText
266308

267-
private func mixPalette(steps: Int, color1: CGColor, color2: CGColor) -> [CGColor] {
268-
var palette = [color1]
269-
let step = stepCalc(steps: steps, color1: color1, color2: color2)
270-
let c1Components = color1.components!
309+
return true
310+
}
271311

272-
for i in 1 ..< steps {
273-
let r = c1Components[0] + step[0] * CGFloat(i)
274-
let g = c1Components[1] + step[1] * CGFloat(i)
275-
let b = c1Components[2] + step[2] * CGFloat(i)
312+
return false
313+
}
276314

277-
palette.append(UIColor(red: r, green: g, blue: b, alpha: 1).cgColor)
315+
public func getTheming(account: String?) -> UIColor {
316+
if let account, let color = self.themingColor[account] {
317+
return color
278318
}
279-
return palette
319+
return customer
280320
}
281321

282-
/**
283-
Generate colors from the official nextcloud color.
284-
You can provide how many colors you want (multiplied by 3).
285-
if `step` = 6,
286-
3 colors \* 6 will result in 18 generated colors
287-
*/
288-
func generateColors(steps: Int = 6) -> [CGColor] {
289-
let red = UIColor(red: 182 / 255, green: 70 / 255, blue: 157 / 255, alpha: 1).cgColor
290-
let yellow = UIColor(red: 221 / 255, green: 203 / 255, blue: 85 / 255, alpha: 1).cgColor
291-
let blue = UIColor(red: 0 / 255, green: 130 / 255, blue: 201 / 255, alpha: 1).cgColor
292-
293-
let palette1 = mixPalette(steps: steps, color1: red, color2: yellow)
294-
let palette2 = mixPalette(steps: steps, color1: yellow, color2: blue)
295-
let palette3 = mixPalette(steps: steps, color1: blue, color2: red)
322+
public func getElement(account: String?) -> UIColor {
323+
if let account, let color = self.themingColorElement[account] {
324+
return color
325+
}
326+
return customer
327+
}
296328

297-
return palette1 + palette2 + palette3
329+
public func getText(account: String?) -> UIColor {
330+
if let account, let color = self.themingColorText[account] {
331+
return color
332+
}
333+
return .white
298334
}
299335
}

Brand/iOSClient.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
</array>
1010
<key>CFBundleAllowMixedLocalizations</key>
1111
<true/>
12+
<key>LSMinimumSystemVersion</key>
13+
<string>12.3</string>
1214
<key>CFBundleDevelopmentRegion</key>
1315
<string>en</string>
1416
<key>CFBundleDisplayName</key>

Cartfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

Cartfile.resolved

Lines changed: 0 additions & 2 deletions
This file was deleted.

ExternalResources/NCApplicationHandle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class NCApplicationHandle: NSObject {
5353

5454
// class: NCCollectionViewCommon (+Menu)
5555
// func: toggleMenu(metadata: tableMetadata, imageIcon: UIImage?)
56-
func addCollectionViewCommonMenu(metadata: tableMetadata, imageIcon: UIImage?, actions: inout [NCMenuAction]) {
56+
func addCollectionViewCommonMenu(metadata: tableMetadata, image: UIImage?, actions: inout [NCMenuAction]) {
5757
}
5858

5959
// class: NCMore

0 commit comments

Comments
 (0)