Skip to content

Commit 43e4767

Browse files
NMC 2611 - Branding customisation changes
1 parent 2fe9c73 commit 43e4767

File tree

312 files changed

+2728
-153
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

+2728
-153
lines changed

Brand/NCBrand.swift

Lines changed: 60 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,20 @@ import UIKit
2626
let userAgent: String = {
2727
let appVersion: String = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
2828
// Original Nextcloud useragent "Mozilla/5.0 (iOS) Nextcloud-iOS/\(appVersion)"
29-
return "Mozilla/5.0 (iOS) Nextcloud-iOS/\(appVersion)"
29+
return "Mozilla/5.0 (iOS) Magenta-iOS/\(appVersion)"
3030
}()
3131

32-
final class NCBrandOptions: @unchecked Sendable {
33-
static let shared = NCBrandOptions()
32+
@objc class NCBrandOptions: NSObject, @unchecked Sendable {
33+
@objc static let shared: NCBrandOptions = {
34+
let instance = NCBrandOptions()
35+
return instance
36+
}()
37+
38+
@objc public var brand: String = "MagentaCLOUD"
39+
@objc public var textCopyrightNextcloudiOS: String = "MagentaCLOUD for iOS %@"
40+
@objc public var textCopyrightNextcloudServer: String = "MagentaCLOUD Server %@"
41+
@objc public var loginBaseUrl: String = "https://magentacloud.de"
3442

35-
@objc public var brand: String = "Nextcloud"
36-
@objc public var textCopyrightNextcloudiOS: String = "Nextcloud Hydrogen for iOS %@ © 2025"
37-
@objc public var textCopyrightNextcloudServer: String = "Nextcloud Server %@"
38-
@objc public var loginBaseUrl: String = "https://cloud.nextcloud.com"
3943
@objc public var pushNotificationServerProxy: String = "https://push-notifications.nextcloud.com"
4044
@objc public var linkLoginHost: String = "https://nextcloud.com/install"
4145
@objc public var linkloginPreferredProviders: String = "https://nextcloud.com/signup-ios"
@@ -53,41 +57,51 @@ final class NCBrandOptions: @unchecked Sendable {
5357
@objc public var folderDefaultAutoUpload: String = Locale.current.languageCode == "de" ? "Kamera-Medien" : "Camera-Media"
5458

5559
// Capabilities Group
56-
var capabilitiesGroup: String = "group.it.twsweb.Crypto-Cloud"
57-
var capabilitiesGroupApps: String = "group.com.nextcloud.apps"
60+
@objc public var capabilitiesGroup: String = "group.de.telekom.Mediencenter"
61+
@objc public var capabilitiesGroupApps: String = "group.de.telekom.Mediencenter"
5862

5963
// BRAND ONLY
60-
var use_AppConfig: Bool = false // Don't touch me !!
64+
// Set use_login_web_personalized to true for prod and false for configurable path
65+
@objc public var use_login_web_personalized: Bool = true // Don't touch me !!
66+
@objc public var use_AppConfig: Bool = false // Don't touch me !!
67+
@objc public var use_GroupApps: Bool = true // Don't touch me !!
6168

69+
// Options
6270
// Use server theming color
63-
var use_themingColor: Bool = true
64-
65-
var disable_intro: Bool = false
66-
var disable_request_login_url: Bool = false
67-
var disable_multiaccount: Bool = false
68-
var disable_more_external_site: Bool = false
69-
var disable_openin_file: Bool = false // Don't touch me !!
70-
var disable_crash_service: Bool = false
71-
var disable_log: Bool = false
72-
var disable_mobileconfig: Bool = false
73-
var disable_show_more_nextcloud_apps_in_settings: Bool = false
74-
var doNotAskPasscodeAtStartup: Bool = false
75-
var disable_source_code_in_settings: Bool = false
76-
var enforce_passcode_lock = false
71+
@objc public var use_default_auto_upload: Bool = false
72+
@objc public var use_themingColor: Bool = false
73+
@objc public var use_themingLogo: Bool = false
74+
@objc public var use_storeLocalAutoUploadAll: Bool = false
75+
@objc public var use_loginflowv2: Bool = false
76+
77+
@objc var disable_intro: Bool = false//true
78+
@objc var disable_request_login_url: Bool = false//true
79+
@objc public var disable_multiaccount: Bool = true
80+
@objc public var disable_manage_account: Bool = false
81+
@objc var disable_more_external_site: Bool = false
82+
@objc var disable_openin_file: Bool = false // Don't touch me !!
83+
@objc var disable_crash_service: Bool = true
84+
@objc var disable_log: Bool = false
85+
@objc var disable_mobileconfig: Bool = false
86+
@objc var disable_show_more_nextcloud_apps_in_settings: Bool = true
87+
@objc var doNotAskPasscodeAtStartup: Bool = false
88+
@objc var disable_source_code_in_settings: Bool = false
89+
@objc var enforce_passcode_lock = false
90+
@objc var use_in_app_browser_for_login = false
7791

7892
// (name: "Name 1", url: "https://cloud.nextcloud.com"),(name: "Name 2", url: "https://cloud.nextcloud.com")
7993
var enforce_servers: [(name: String, url: String)] = []
8094

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

8498
// Max request/download/upload concurrent
8599
let httpMaximumConnectionsPerHost: Int = 6
86100
let httpMaximumConnectionsPerHostInDownload: Int = 6
87101
let httpMaximumConnectionsPerHostInUpload: Int = 6
88102

89103
// Number of failed attempts after reset app
90-
let resetAppPasscodeAttempts: Int = 10
104+
@objc let resetAppPasscodeAttempts: Int = 10
91105
let passcodeSecondsFail: Int = 60
92106

93107
// Info Paging
@@ -113,6 +127,9 @@ final class NCBrandOptions: @unchecked Sendable {
113127
if let str = configurationManaged[NCGlobal.shared.configuration_disable_log] as? String {
114128
disable_log = (str as NSString).boolValue
115129
}
130+
if let str = configurationManaged[NCGlobal.shared.configuration_disable_manage_account] as? String {
131+
disable_manage_account = (str as NSString).boolValue
132+
}
116133
if let str = configurationManaged[NCGlobal.shared.configuration_disable_more_external_site] as? String {
117134
disable_more_external_site = (str as NSString).boolValue
118135
}
@@ -134,13 +151,20 @@ final class NCBrandOptions: @unchecked Sendable {
134151
}
135152
}
136153

137-
final class NCBrandColor: @unchecked Sendable {
138-
static let shared = NCBrandColor()
154+
class NCBrandColor: NSObject, @unchecked Sendable {
155+
static let shared: NCBrandColor = {
156+
let instance = NCBrandColor()
157+
return instance
158+
}()
139159

140160
/// This is rewrited from customet theme, default is Nextcloud color
141161
///
142-
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
143-
var customerText: UIColor = .white
162+
@objc let customer: UIColor = UIColor(red: 226.0/255.0, green: 0.0/255.0, blue: 116.0/255.0, alpha: 1.0)
163+
@objc var customerText: UIColor = .white
164+
165+
@objc var brand: UIColor // don't touch me
166+
@objc var brandElement: UIColor // don't touch me
167+
@objc var brandText: UIColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)
144168

145169
// INTERNAL DEFINE COLORS
146170
private var themingColor = ThreadSafeDictionary<String, UIColor>()
@@ -156,7 +180,7 @@ final class NCBrandColor: @unchecked Sendable {
156180
let textColor: UIColor = .label
157181
let textColor2: UIColor = .secondaryLabel
158182

159-
var systemMint: UIColor {
183+
@objc var systemMint: UIColor {
160184
get {
161185
return UIColor(red: 0.0 / 255.0, green: 199.0 / 255.0, blue: 190.0 / 255.0, alpha: 1.0)
162186
}
@@ -180,7 +204,11 @@ final class NCBrandColor: @unchecked Sendable {
180204
}
181205
}
182206

183-
init() { }
207+
override init() {
208+
brand = customer
209+
brandElement = customer
210+
brandText = customerText
211+
}
184212

185213
/**
186214
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)