Skip to content

Commit 2cb472f

Browse files
NMC 2611 - Theming customisation changes
1 parent c3a79c7 commit 2cb472f

45 files changed

Lines changed: 361 additions & 98 deletions

Some content is hidden

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

Brand/NCBrand.swift

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
// SPDX-FileCopyrightText: Nextcloud GmbH
2-
// SPDX-FileCopyrightText: 2017 Marino Faggiana
3-
// SPDX-License-Identifier: GPL-3.0-or-later
1+
//
2+
// NCBrandColor.swift
3+
// Nextcloud
4+
//
5+
// Created by Marino Faggiana on 24/04/17.
6+
// Copyright (c) 2017 Marino Faggiana. All rights reserved.
7+
//
8+
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
9+
//
10+
// This program is free software: you can redistribute it and/or modify
11+
// it under the terms of the GNU General Public License as published by
12+
// the Free Software Foundation, either version 3 of the License, or
13+
// (at your option) any later version.
14+
//
15+
// This program is distributed in the hope that it will be useful,
16+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
// GNU General Public License for more details.
19+
//
20+
// You should have received a copy of the GNU General Public License
21+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
//
423

524
import UIKit
6-
import NextcloudKit
725

826
let userAgent: String = {
927
let appVersion: String = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
@@ -21,6 +39,7 @@ let userAgent: String = {
2139

2240
//final class NCBrandOptions: @unchecked Sendable {
2341
// static let shared = NCBrandOptions()
42+
2443
@objc class NCBrandOptions: NSObject, @unchecked Sendable {
2544
@objc static let shared: NCBrandOptions = {
2645
let instance = NCBrandOptions()
@@ -31,6 +50,7 @@ let userAgent: String = {
3150
@objc public var textCopyrightNextcloudiOS: String = "MagentaCLOUD for iOS %@"
3251
@objc public var textCopyrightNextcloudServer: String = "MagentaCLOUD Server %@"
3352
@objc public var loginBaseUrl: String = "https://magentacloud.de"
53+
3454
@objc public var pushNotificationServerProxy: String = "https://push-notifications.nextcloud.com"
3555
@objc public var linkLoginHost: String = "https://nextcloud.com/install"
3656
@objc public var linkloginPreferredProviders: String = "https://nextcloud.com/signup-ios"
@@ -47,19 +67,26 @@ let userAgent: String = {
4767
// Auto Upload default folder
4868
@objc public var folderDefaultAutoUpload: String = Locale.current.languageCode == "de" ? "Kamera-Medien" : "Camera-Media"
4969

50-
// Capabilities Group
51-
@objc public var capabilitiesGroup: String = "group.de.telekom.Mediencenter"
52-
@objc public var capabilitiesGroupApps: String = "group.de.telekom.Mediencenter"
70+
// Options
5371

72+
//#if DEBUG
73+
// QA :
74+
@objc public var capabilitiesGroup: String = "group.com.t-systems.pu-ds.magentacloud.qa"
75+
@objc public var capabilitiesGroupApps: String = "group.com.t-systems.pu-ds.magentacloud.qa"
76+
//#else
77+
// // PROD :
78+
// @objc public var capabilitiesGroup: String = "group.de.telekom.Mediencenter"
79+
// @objc public var capabilitiesGroupApps: String = "group.de.telekom.Mediencenter"
80+
//#endif
81+
5482
// BRAND ONLY
5583
// Set use_login_web_personalized to true for prod and false for configurable path
5684
@objc public var use_login_web_personalized: Bool = true // Don't touch me !!
5785
@objc public var use_AppConfig: Bool = false // Don't touch me !!
5886
@objc public var use_GroupApps: Bool = true // Don't touch me !!
5987

60-
// Options
61-
// Use server theming color
6288
@objc public var use_default_auto_upload: Bool = false
89+
// Use server theming color
6390
@objc public var use_themingColor: Bool = false
6491
@objc public var use_themingLogo: Bool = false
6592
@objc public var use_storeLocalAutoUploadAll: Bool = false
@@ -81,16 +108,16 @@ let userAgent: String = {
81108
@objc var use_in_app_browser_for_login = false
82109
var enforce_privacyScreenEnabled = false
83110

84-
// Example: (name: "Name 1", url: "https://cloud.nextcloud.com"),(name: "Name 2", url: "https://cloud.nextcloud.com")
111+
// (name: "Name 1", url: "https://cloud.nextcloud.com"),(name: "Name 2", url: "https://cloud.nextcloud.com")
85112
var enforce_servers: [(name: String, url: String)] = []
86113

87114
// Internal option behaviour
88115
@objc var cleanUpDay: Int = 0 // Set default "Delete all cached files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365
89116

90117
// Max request/download/upload concurrent
91-
let httpMaximumConnectionsPerHost: Int = 8
92-
let httpMaximumConnectionsPerHostInDownload: Int = 8
93-
let httpMaximumConnectionsPerHostInUpload: Int = 8
118+
let httpMaximumConnectionsPerHost: Int = 6
119+
let httpMaximumConnectionsPerHostInDownload: Int = 6
120+
let httpMaximumConnectionsPerHostInUpload: Int = 6
94121

95122
// Max request/download/upload process
96123
let numMaximumProcess: Int = 50
@@ -104,7 +131,7 @@ let userAgent: String = {
104131
case activity, sharing
105132
}
106133

107-
init() {
134+
override init() {
108135
// wrapper AppConfig
109136
if let configurationManaged = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"), use_AppConfig {
110137
if let str = configurationManaged[NCGlobal.shared.configuration_brand] as? String {
@@ -150,13 +177,12 @@ let userAgent: String = {
150177
}
151178

152179
class NCBrandColor: NSObject, @unchecked Sendable {
153-
static let shared: NCBrandColor = {
180+
@objc static let shared: NCBrandColor = {
154181
let instance = NCBrandColor()
155182
return instance
156183
}()
157184

158-
/// This is rewrited from customet theme, default is Nextcloud color
159-
///
185+
// Color
160186
@objc let customer: UIColor = UIColor(red: 226.0/255.0, green: 0.0/255.0, blue: 116.0/255.0, alpha: 1.0)
161187
@objc var customerText: UIColor = .white
162188

@@ -420,4 +446,20 @@ class NCBrandColor: NSObject, @unchecked Sendable {
420446
@objc public var seperatorRename: UIColor = UIColor(red: 235.0/255.0, green: 235.0/255.0, blue: 235.0/255.0, alpha: 1.0)
421447
@objc public let gray: UIColor = UIColor(red: 104.0/255.0, green: 104.0/255.0, blue: 104.0/255.0, alpha: 1.0)
422448
@objc public var nmcIconSharedWithMe: UIColor = UIColor(displayP3Red: 0.0/255.0, green: 153.0/255.0, blue: 255.0/255.0, alpha: 1.0)
449+
450+
var shareBlueColor: UIColor{
451+
if UITraitCollection.current.userInterfaceStyle == .dark {
452+
return UIColor(hex: "#7d94f9")!
453+
}else {
454+
return UIColor(hex: "#2238df")!
455+
}
456+
}
457+
458+
var shareBlackColor: UIColor{
459+
if UITraitCollection.current.userInterfaceStyle == .dark {
460+
return UIColor.white
461+
}else {
462+
return UIColor.black
463+
}
464+
}
423465
}

iOSClient/Extensions/UIImage+Extension.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Foundation
2525
import UIKit
2626
import Accelerate
2727

28-
extension UIImage {
28+
extension UIImage: @unchecked Sendable {
2929
func resizeImage(size: CGSize, isAspectRation: Bool = true) -> UIImage? {
3030
let originRatio = self.size.width / self.size.height
3131
let newRatio = size.width / size.height
@@ -171,6 +171,7 @@ extension UIImage {
171171
/// - pointSize: The target point size
172172
/// - scale: The point to pixel scale (Pixeld per point)
173173
/// - Returns: The downsampled image, if successful
174+
@MainActor
174175
static func downsample(imageAt imageURL: URL, to pointSize: CGSize, scale: CGFloat = UIScreen.main.scale) -> UIImage? {
175176

176177
// Create an CGImageSource that represent an image
@@ -218,13 +219,14 @@ extension UIImage {
218219
return newImage
219220
}
220221

221-
func colorizeFolder(metadata: tableMetadata, tblDirectory: tableDirectory? = nil) -> UIImage {
222+
func colorizeFolder(metadata: tableMetadata, tableDirectory: tableDirectory? = nil) -> UIImage {
223+
let serverUrl = metadata.serverUrl + "/" + metadata.fileName
222224
var image = self
223-
if let tblDirectory {
224-
if let hex = tblDirectory.colorFolder, let color = UIColor(hex: hex) {
225+
if let tableDirectory = tableDirectory {
226+
if let hex = tableDirectory.colorFolder, let color = UIColor(hex: hex) {
225227
image = self.withTintColor(color, renderingMode: .alwaysOriginal)
226228
}
227-
} else if let tblDirectory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, metadata.serverUrlFileName)), let hex = tblDirectory.colorFolder, let color = UIColor(hex: hex) {
229+
} else if let tableDirectory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, serverUrl)), let hex = tableDirectory.colorFolder, let color = UIColor(hex: hex) {
228230
image = self.withTintColor(color, renderingMode: .alwaysOriginal)
229231
}
230232
return image
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "calenderNew.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "calenderNew@2x.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "calenderNew@3x.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
512 Bytes
Loading
600 Bytes
Loading
1.23 KB
Loading

iOSClient/Images.xcassets/contact.imageset/Contents.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
{
22
"images" : [
33
{
4-
"filename" : "contact.svg",
5-
"idiom" : "universal"
4+
"filename" : "contact.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "contact@2x.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "contact@3x.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
617
}
718
],
819
"info" : {
328 Bytes
Loading
517 Bytes
Loading
865 Bytes
Loading

0 commit comments

Comments
 (0)