Skip to content

Commit 2f0f9b6

Browse files
NMC 2611 - Branding customisation changes
1 parent 1c218d7 commit 2f0f9b6

312 files changed

Lines changed: 2769 additions & 138 deletions

File tree

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: 62 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import NextcloudKit
88
let userAgent: String = {
99
let appVersion: String = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
1010
// Original Nextcloud useragent "Mozilla/5.0 (iOS) Nextcloud-iOS/\(appVersion)"
11-
return "Mozilla/5.0 (iOS) Nextcloud-iOS/\(appVersion)"
11+
return "Mozilla/5.0 (iOS) Magenta-iOS/\(appVersion)"
1212
}()
1313

1414
/*
@@ -19,13 +19,18 @@ let userAgent: String = {
1919
The codename embodies the concept of dynamic, living matter — reflecting our vision of a platform that is not only powerful and reliable, but also capable of continuous transformation and intelligent adaptation.
2020
*/
2121

22-
final class NCBrandOptions: @unchecked Sendable {
23-
static let shared = NCBrandOptions()
24-
25-
@objc public var brand: String = "Nextcloud"
26-
@objc public var textCopyrightNextcloudiOS: String = "Nextcloud Matheria for iOS %@ © 2025" //"Nextcloud Hydrogen for iOS %@ © 2025"
27-
@objc public var textCopyrightNextcloudServer: String = "Nextcloud Server %@"
28-
@objc public var loginBaseUrl: String = "https://cloud.nextcloud.com"
22+
//final class NCBrandOptions: @unchecked Sendable {
23+
// static let shared = NCBrandOptions()
24+
@objc class NCBrandOptions: NSObject, @unchecked Sendable {
25+
@objc static let shared: NCBrandOptions = {
26+
let instance = NCBrandOptions()
27+
return instance
28+
}()
29+
30+
@objc public var brand: String = "MagentaCLOUD"
31+
@objc public var textCopyrightNextcloudiOS: String = "MagentaCLOUD for iOS %@"
32+
@objc public var textCopyrightNextcloudServer: String = "MagentaCLOUD Server %@"
33+
@objc public var loginBaseUrl: String = "https://magentacloud.de"
2934
@objc public var pushNotificationServerProxy: String = "https://push-notifications.nextcloud.com"
3035
@objc public var linkLoginHost: String = "https://nextcloud.com/install"
3136
@objc public var linkloginPreferredProviders: String = "https://nextcloud.com/signup-ios"
@@ -43,42 +48,52 @@ final class NCBrandOptions: @unchecked Sendable {
4348
@objc public var folderDefaultAutoUpload: String = Locale.current.languageCode == "de" ? "Kamera-Medien" : "Camera-Media"
4449

4550
// Capabilities Group
46-
var capabilitiesGroup: String = "group.it.twsweb.Crypto-Cloud"
47-
var capabilitiesGroupApps: String = "group.com.nextcloud.apps"
51+
@objc public var capabilitiesGroup: String = "group.de.telekom.Mediencenter"
52+
@objc public var capabilitiesGroupApps: String = "group.de.telekom.Mediencenter"
4853

4954
// BRAND ONLY
50-
var use_AppConfig: Bool = false // Don't touch me !!
55+
// Set use_login_web_personalized to true for prod and false for configurable path
56+
@objc public var use_login_web_personalized: Bool = true // Don't touch me !!
57+
@objc public var use_AppConfig: Bool = false // Don't touch me !!
58+
@objc public var use_GroupApps: Bool = true // Don't touch me !!
5159

60+
// Options
5261
// Use server theming color
53-
var use_themingColor: Bool = true
54-
55-
var disable_intro: Bool = false
56-
var disable_request_login_url: Bool = false
57-
var disable_multiaccount: Bool = false
58-
var disable_more_external_site: Bool = false
59-
var disable_openin_file: Bool = false // Don't touch me !!
60-
var disable_crash_service: Bool = false
61-
var disable_log: Bool = false
62-
var disable_mobileconfig: Bool = false
63-
var disable_show_more_nextcloud_apps_in_settings: Bool = false
64-
var doNotAskPasscodeAtStartup: Bool = false
65-
var disable_source_code_in_settings: Bool = false
66-
var enforce_passcode_lock = false
62+
@objc public var use_default_auto_upload: Bool = false
63+
@objc public var use_themingColor: Bool = false
64+
@objc public var use_themingLogo: Bool = false
65+
@objc public var use_storeLocalAutoUploadAll: Bool = false
66+
@objc public var use_loginflowv2: Bool = false
67+
68+
@objc var disable_intro: Bool = false//true
69+
@objc var disable_request_login_url: Bool = false//true
70+
@objc public var disable_multiaccount: Bool = true
71+
@objc public var disable_manage_account: Bool = false
72+
@objc var disable_more_external_site: Bool = false
73+
@objc var disable_openin_file: Bool = false // Don't touch me !!
74+
@objc var disable_crash_service: Bool = true
75+
@objc var disable_log: Bool = false
76+
@objc var disable_mobileconfig: Bool = false
77+
@objc var disable_show_more_nextcloud_apps_in_settings: Bool = true
78+
@objc var doNotAskPasscodeAtStartup: Bool = false
79+
@objc var disable_source_code_in_settings: Bool = false
80+
@objc var enforce_passcode_lock = false
81+
@objc var use_in_app_browser_for_login = false
6782
var enforce_privacyScreenEnabled = false
6883

6984
// Example: (name: "Name 1", url: "https://cloud.nextcloud.com"),(name: "Name 2", url: "https://cloud.nextcloud.com")
7085
var enforce_servers: [(name: String, url: String)] = []
7186

7287
// Internal option behaviour
73-
var cleanUpDay: Int = 0 // Set default "Delete all cached files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365
88+
@objc var cleanUpDay: Int = 0 // Set default "Delete all cached files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365
7489

7590
// Max request/download/upload concurrent
7691
let httpMaximumConnectionsPerHost: Int = 8
7792
let httpMaximumConnectionsPerHostInDownload: Int = 8
7893
let httpMaximumConnectionsPerHostInUpload: Int = 8
7994

8095
// Number of failed attempts after reset app
81-
let resetAppPasscodeAttempts: Int = 10
96+
@objc let resetAppPasscodeAttempts: Int = 10
8297
let passcodeSecondsFail: Int = 60
8398

8499
// Info Paging
@@ -104,6 +119,9 @@ final class NCBrandOptions: @unchecked Sendable {
104119
if let str = configurationManaged[NCGlobal.shared.configuration_disable_log] as? String {
105120
disable_log = (str as NSString).boolValue
106121
}
122+
if let str = configurationManaged[NCGlobal.shared.configuration_disable_manage_account] as? String {
123+
disable_manage_account = (str as NSString).boolValue
124+
}
107125
if let str = configurationManaged[NCGlobal.shared.configuration_disable_more_external_site] as? String {
108126
disable_more_external_site = (str as NSString).boolValue
109127
}
@@ -129,13 +147,20 @@ final class NCBrandOptions: @unchecked Sendable {
129147
}
130148
}
131149

132-
final class NCBrandColor: @unchecked Sendable {
133-
static let shared = NCBrandColor()
150+
class NCBrandColor: NSObject, @unchecked Sendable {
151+
static let shared: NCBrandColor = {
152+
let instance = NCBrandColor()
153+
return instance
154+
}()
134155

135156
/// This is rewrited from customet theme, default is Nextcloud color
136157
///
137-
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
138-
var customerText: UIColor = .white
158+
@objc let customer: UIColor = UIColor(red: 226.0/255.0, green: 0.0/255.0, blue: 116.0/255.0, alpha: 1.0)
159+
@objc var customerText: UIColor = .white
160+
161+
@objc var brand: UIColor // don't touch me
162+
@objc var brandElement: UIColor // don't touch me
163+
@objc var brandText: UIColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)
139164

140165
// INTERNAL DEFINE COLORS
141166
private var themingColor = ThreadSafeDictionary<String, UIColor>()
@@ -151,7 +176,7 @@ final class NCBrandColor: @unchecked Sendable {
151176
let textColor: UIColor = .label
152177
let textColor2: UIColor = .secondaryLabel
153178

154-
var systemMint: UIColor {
179+
@objc var systemMint: UIColor {
155180
get {
156181
return UIColor(red: 0.0 / 255.0, green: 199.0 / 255.0, blue: 190.0 / 255.0, alpha: 1.0)
157182
}
@@ -175,7 +200,11 @@ final class NCBrandColor: @unchecked Sendable {
175200
}
176201
}
177202

178-
init() { }
203+
override init() {
204+
brand = customer
205+
brandElement = customer
206+
brandText = customerText
207+
}
179208

180209
/**
181210
Generate colors from the official nextcloud color.

iOSClient/Extensions/UIImage+Extension.swift

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,58 @@ extension CGImagePropertyOrientation {
272272
}
273273
}
274274
}
275+
276+
// https://stackoverflow.com/questions/16278463/darken-an-uiimage
277+
public extension UIImage {
278+
279+
private enum BlendMode {
280+
case multiply // This results in colors that are at least as dark as either of the two contributing sample colors
281+
case screen // This results in colors that are at least as light as either of the two contributing sample colors
282+
}
283+
284+
// A level of zero yeilds the original image, a level of 1 results in black
285+
func darken(level: CGFloat = 0.5) -> UIImage? {
286+
return blend(mode: .multiply, level: level)
287+
}
288+
289+
// A level of zero yeilds the original image, a level of 1 results in white
290+
func lighten(level: CGFloat = 0.5) -> UIImage? {
291+
return blend(mode: .screen, level: level)
292+
}
293+
294+
private func blend(mode: BlendMode, level: CGFloat) -> UIImage? {
295+
let context = CIContext(options: nil)
296+
297+
var level = level
298+
if level < 0 {
299+
level = 0
300+
} else if level > 1 {
301+
level = 1
302+
}
303+
304+
let filterName: String
305+
switch mode {
306+
case .multiply: // As the level increases we get less white
307+
level = abs(level - 1.0)
308+
filterName = "CIMultiplyBlendMode"
309+
case .screen: // As the level increases we get more white
310+
filterName = "CIScreenBlendMode"
311+
}
312+
313+
let blender = CIFilter(name: filterName)!
314+
let backgroundColor = CIColor(color: UIColor(white: level, alpha: 1))
315+
316+
guard let inputImage = CIImage(image: self) else { return nil }
317+
blender.setValue(inputImage, forKey: kCIInputImageKey)
318+
319+
guard let backgroundImageGenerator = CIFilter(name: "CIConstantColorGenerator") else { return nil }
320+
backgroundImageGenerator.setValue(backgroundColor, forKey: kCIInputColorKey)
321+
guard let backgroundImage = backgroundImageGenerator.outputImage?.cropped(to: CGRect(origin: CGPoint.zero, size: self.size)) else { return nil }
322+
blender.setValue(backgroundImage, forKey: kCIInputBackgroundImageKey)
323+
324+
guard let blendedImage = blender.outputImage else { return nil }
325+
326+
guard let cgImage = context.createCGImage(blendedImage, from: blendedImage.extent) else { return nil }
327+
return UIImage(cgImage: cgImage)
328+
}
329+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"images" : [
3+
4+
],
5+
"info" : {
6+
"author" : "xcode",
7+
"version" : 1
8+
}
9+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "MenuGroupByAlphabetic.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "MenuGroupByAlphabetic@3x-1.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "MenuGroupByAlphabetic@3x.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
},
23+
"properties" : {
24+
"preserves-vector-representation" : true
25+
}
26+
}
542 Bytes
Loading
1.11 KB
Loading
1.66 KB
Loading
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "MenuGroupByDate.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "MenuGroupByDate@2x.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "MenuGroupByDate@3x.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
},
23+
"properties" : {
24+
"preserves-vector-representation" : true
25+
}
26+
}
319 Bytes
Loading
570 Bytes
Loading

0 commit comments

Comments
 (0)