Skip to content

Commit 81e9dea

Browse files
NMC 2611 - Branding customisation changes
1 parent 3cc1053 commit 81e9dea

File tree

312 files changed

+2744
-141
lines changed

Some content is hidden

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

312 files changed

+2744
-141
lines changed

Brand/NCBrand.swift

Lines changed: 60 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ import UIKit
77
let userAgent: String = {
88
let appVersion: String = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
99
// Original Nextcloud useragent "Mozilla/5.0 (iOS) Nextcloud-iOS/\(appVersion)"
10-
return "Mozilla/5.0 (iOS) Nextcloud-iOS/\(appVersion)"
10+
return "Mozilla/5.0 (iOS) Magenta-iOS/\(appVersion)"
1111
}()
1212

13-
final class NCBrandOptions: @unchecked Sendable {
14-
static let shared = NCBrandOptions()
13+
@objc class NCBrandOptions: NSObject, @unchecked Sendable {
14+
@objc static let shared: NCBrandOptions = {
15+
let instance = NCBrandOptions()
16+
return instance
17+
}()
18+
19+
@objc public var brand: String = "MagentaCLOUD"
20+
@objc public var textCopyrightNextcloudiOS: String = "MagentaCLOUD for iOS %@"
21+
@objc public var textCopyrightNextcloudServer: String = "MagentaCLOUD Server %@"
22+
@objc public var loginBaseUrl: String = "https://magentacloud.de"
1523

16-
@objc public var brand: String = "Nextcloud"
17-
@objc public var textCopyrightNextcloudiOS: String = "Nextcloud Hydrogen for iOS %@ © 2025"
18-
@objc public var textCopyrightNextcloudServer: String = "Nextcloud Server %@"
19-
@objc public var loginBaseUrl: String = "https://cloud.nextcloud.com"
2024
@objc public var pushNotificationServerProxy: String = "https://push-notifications.nextcloud.com"
2125
@objc public var linkLoginHost: String = "https://nextcloud.com/install"
2226
@objc public var linkloginPreferredProviders: String = "https://nextcloud.com/signup-ios"
@@ -34,41 +38,51 @@ final class NCBrandOptions: @unchecked Sendable {
3438
@objc public var folderDefaultAutoUpload: String = Locale.current.languageCode == "de" ? "Kamera-Medien" : "Camera-Media"
3539

3640
// Capabilities Group
37-
var capabilitiesGroup: String = "group.it.twsweb.Crypto-Cloud"
38-
var capabilitiesGroupApps: String = "group.com.nextcloud.apps"
41+
@objc public var capabilitiesGroup: String = "group.de.telekom.Mediencenter"
42+
@objc public var capabilitiesGroupApps: String = "group.de.telekom.Mediencenter"
3943

4044
// BRAND ONLY
41-
var use_AppConfig: Bool = false // Don't touch me !!
45+
// Set use_login_web_personalized to true for prod and false for configurable path
46+
@objc public var use_login_web_personalized: Bool = true // Don't touch me !!
47+
@objc public var use_AppConfig: Bool = false // Don't touch me !!
48+
@objc public var use_GroupApps: Bool = true // Don't touch me !!
4249

50+
// Options
4351
// Use server theming color
44-
var use_themingColor: Bool = true
45-
46-
var disable_intro: Bool = false
47-
var disable_request_login_url: Bool = false
48-
var disable_multiaccount: Bool = false
49-
var disable_more_external_site: Bool = false
50-
var disable_openin_file: Bool = false // Don't touch me !!
51-
var disable_crash_service: Bool = false
52-
var disable_log: Bool = false
53-
var disable_mobileconfig: Bool = false
54-
var disable_show_more_nextcloud_apps_in_settings: Bool = false
55-
var doNotAskPasscodeAtStartup: Bool = false
56-
var disable_source_code_in_settings: Bool = false
57-
var enforce_passcode_lock = false
52+
@objc public var use_default_auto_upload: Bool = false
53+
@objc public var use_themingColor: Bool = false
54+
@objc public var use_themingLogo: Bool = false
55+
@objc public var use_storeLocalAutoUploadAll: Bool = false
56+
@objc public var use_loginflowv2: Bool = false
57+
58+
@objc var disable_intro: Bool = false//true
59+
@objc var disable_request_login_url: Bool = false//true
60+
@objc public var disable_multiaccount: Bool = true
61+
@objc public var disable_manage_account: Bool = false
62+
@objc var disable_more_external_site: Bool = false
63+
@objc var disable_openin_file: Bool = false // Don't touch me !!
64+
@objc var disable_crash_service: Bool = true
65+
@objc var disable_log: Bool = false
66+
@objc var disable_mobileconfig: Bool = false
67+
@objc var disable_show_more_nextcloud_apps_in_settings: Bool = true
68+
@objc var doNotAskPasscodeAtStartup: Bool = false
69+
@objc var disable_source_code_in_settings: Bool = false
70+
@objc var enforce_passcode_lock = false
71+
@objc var use_in_app_browser_for_login = false
5872

5973
// Example: (name: "Name 1", url: "https://cloud.nextcloud.com"),(name: "Name 2", url: "https://cloud.nextcloud.com")
6074
var enforce_servers: [(name: String, url: String)] = []
6175

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

6579
// Max request/download/upload concurrent
6680
let httpMaximumConnectionsPerHost: Int = 6
6781
let httpMaximumConnectionsPerHostInDownload: Int = 6
6882
let httpMaximumConnectionsPerHostInUpload: Int = 6
6983

7084
// Number of failed attempts after reset app
71-
let resetAppPasscodeAttempts: Int = 10
85+
@objc let resetAppPasscodeAttempts: Int = 10
7286
let passcodeSecondsFail: Int = 60
7387

7488
// Info Paging
@@ -94,6 +108,9 @@ final class NCBrandOptions: @unchecked Sendable {
94108
if let str = configurationManaged[NCGlobal.shared.configuration_disable_log] as? String {
95109
disable_log = (str as NSString).boolValue
96110
}
111+
if let str = configurationManaged[NCGlobal.shared.configuration_disable_manage_account] as? String {
112+
disable_manage_account = (str as NSString).boolValue
113+
}
97114
if let str = configurationManaged[NCGlobal.shared.configuration_disable_more_external_site] as? String {
98115
disable_more_external_site = (str as NSString).boolValue
99116
}
@@ -115,13 +132,20 @@ final class NCBrandOptions: @unchecked Sendable {
115132
}
116133
}
117134

118-
final class NCBrandColor: @unchecked Sendable {
119-
static let shared = NCBrandColor()
135+
class NCBrandColor: NSObject, @unchecked Sendable {
136+
static let shared: NCBrandColor = {
137+
let instance = NCBrandColor()
138+
return instance
139+
}()
120140

121141
/// This is rewrited from customet theme, default is Nextcloud color
122142
///
123-
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
124-
var customerText: UIColor = .white
143+
@objc let customer: UIColor = UIColor(red: 226.0/255.0, green: 0.0/255.0, blue: 116.0/255.0, alpha: 1.0)
144+
@objc var customerText: UIColor = .white
145+
146+
@objc var brand: UIColor // don't touch me
147+
@objc var brandElement: UIColor // don't touch me
148+
@objc var brandText: UIColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)
125149

126150
// INTERNAL DEFINE COLORS
127151
private var themingColor = ThreadSafeDictionary<String, UIColor>()
@@ -137,7 +161,7 @@ final class NCBrandColor: @unchecked Sendable {
137161
let textColor: UIColor = .label
138162
let textColor2: UIColor = .secondaryLabel
139163

140-
var systemMint: UIColor {
164+
@objc var systemMint: UIColor {
141165
get {
142166
return UIColor(red: 0.0 / 255.0, green: 199.0 / 255.0, blue: 190.0 / 255.0, alpha: 1.0)
143167
}
@@ -161,7 +185,11 @@ final class NCBrandColor: @unchecked Sendable {
161185
}
162186
}
163187

164-
init() { }
188+
override init() {
189+
brand = customer
190+
brandElement = customer
191+
brandText = customerText
192+
}
165193

166194
/**
167195
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
@@ -273,3 +273,58 @@ extension CGImagePropertyOrientation {
273273
}
274274
}
275275
}
276+
277+
// https://stackoverflow.com/questions/16278463/darken-an-uiimage
278+
public extension UIImage {
279+
280+
private enum BlendMode {
281+
case multiply // This results in colors that are at least as dark as either of the two contributing sample colors
282+
case screen // This results in colors that are at least as light as either of the two contributing sample colors
283+
}
284+
285+
// A level of zero yeilds the original image, a level of 1 results in black
286+
func darken(level: CGFloat = 0.5) -> UIImage? {
287+
return blend(mode: .multiply, level: level)
288+
}
289+
290+
// A level of zero yeilds the original image, a level of 1 results in white
291+
func lighten(level: CGFloat = 0.5) -> UIImage? {
292+
return blend(mode: .screen, level: level)
293+
}
294+
295+
private func blend(mode: BlendMode, level: CGFloat) -> UIImage? {
296+
let context = CIContext(options: nil)
297+
298+
var level = level
299+
if level < 0 {
300+
level = 0
301+
} else if level > 1 {
302+
level = 1
303+
}
304+
305+
let filterName: String
306+
switch mode {
307+
case .multiply: // As the level increases we get less white
308+
level = abs(level - 1.0)
309+
filterName = "CIMultiplyBlendMode"
310+
case .screen: // As the level increases we get more white
311+
filterName = "CIScreenBlendMode"
312+
}
313+
314+
let blender = CIFilter(name: filterName)!
315+
let backgroundColor = CIColor(color: UIColor(white: level, alpha: 1))
316+
317+
guard let inputImage = CIImage(image: self) else { return nil }
318+
blender.setValue(inputImage, forKey: kCIInputImageKey)
319+
320+
guard let backgroundImageGenerator = CIFilter(name: "CIConstantColorGenerator") else { return nil }
321+
backgroundImageGenerator.setValue(backgroundColor, forKey: kCIInputColorKey)
322+
guard let backgroundImage = backgroundImageGenerator.outputImage?.cropped(to: CGRect(origin: CGPoint.zero, size: self.size)) else { return nil }
323+
blender.setValue(backgroundImage, forKey: kCIInputBackgroundImageKey)
324+
325+
guard let blendedImage = blender.outputImage else { return nil }
326+
327+
guard let cgImage = context.createCGImage(blendedImage, from: blendedImage.extent) else { return nil }
328+
return UIImage(cgImage: cgImage)
329+
}
330+
}
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)