NCBrand.swift 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. //
  23. import UIKit
  24. //MARK: - Configuration
  25. @objc class NCBrandConfiguration: NSObject {
  26. @objc static let sharedInstance: NCBrandConfiguration = {
  27. let instance = NCBrandConfiguration()
  28. return instance
  29. }()
  30. @objc public let configuration_bundleId: String = "it.twsweb.Nextcloud"
  31. @objc public let configuration_serverUrl: String = "serverUrl"
  32. @objc public let configuration_username: String = "username"
  33. @objc public let configuration_password: String = "password"
  34. }
  35. //MARK: - Options
  36. @objc class NCBrandOptions: NSObject {
  37. @objc static let sharedInstance: NCBrandOptions = {
  38. let instance = NCBrandOptions()
  39. return instance
  40. }()
  41. @objc public var brand: String = "Nextcloud"
  42. @objc public var mailMe: String = "ios@nextcloud.com"
  43. @objc public var textCopyrightNextcloudiOS: String = "Nextcloud for iOS %@ © 2020"
  44. @objc public var textCopyrightNextcloudServer: String = "Nextcloud Server %@"
  45. @objc public var loginBaseUrl: String = "https://cloud.nextcloud.com"
  46. @objc public var pushNotificationServerProxy: String = "https://push-notifications.nextcloud.com"
  47. @objc public var linkLoginHost: String = "https://nextcloud.com/install"
  48. @objc public var linkloginPreferredProviders: String = "https://nextcloud.com/signup";
  49. @objc public var middlewarePingUrl: String = ""
  50. @objc public var webLoginAutenticationProtocol: String = "nc://" // example "abc://"
  51. // Personalized
  52. @objc public var webCloseViewProtocolPersonalized: String = "" // example "abc://change/plan" Don't touch me !!
  53. @objc public var folderBrandAutoUpload: String = "" // example "_auto_upload_folder_" Don't touch me !!
  54. // Auto Upload default folder
  55. @objc public var folderDefaultAutoUpload: String = "Photos"
  56. // Capabilities Group
  57. @objc public var capabilitiesGroups: String = "group.it.twsweb.Crypto-Cloud"
  58. // User Agent
  59. @objc public var userAgent: String = "Nextcloud-iOS" // Don't touch me !!
  60. // Options
  61. @objc public var use_login_web_personalized: Bool = false // Don't touch me !!
  62. @objc public var use_default_auto_upload: Bool = false
  63. @objc public var use_themingColor: Bool = true
  64. //@objc public var use_themingBackground: Bool = true // Deprecated
  65. @objc public var use_themingLogo: Bool = false
  66. @objc public var use_middlewarePing: Bool = false
  67. @objc public var use_storeLocalAutoUploadAll: Bool = false
  68. @objc public var use_configuration: Bool = false // Don't touch me !!
  69. @objc public var use_loginflowv2: Bool = false // Don't touch me !!
  70. @objc public var disable_intro: Bool = false
  71. @objc public var disable_request_login_url: Bool = false
  72. @objc public var disable_multiaccount: Bool = false
  73. @objc public var disable_manage_account: Bool = false
  74. @objc public var disable_more_external_site: Bool = false
  75. @objc public var disable_openin_file: Bool = false // Don't touch me !!
  76. @objc public var disable_crash_service: Bool = false
  77. override init() {
  78. if folderBrandAutoUpload != "" {
  79. folderDefaultAutoUpload = folderBrandAutoUpload
  80. }
  81. }
  82. }
  83. //MARK: - Color
  84. class NCBrandColor: NSObject {
  85. @objc static let sharedInstance: NCBrandColor = {
  86. let instance = NCBrandColor()
  87. instance.setDarkMode()
  88. return instance
  89. }()
  90. // Color
  91. @objc public 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
  92. @objc public var customerText: UIColor = .white
  93. @objc public var brand: UIColor // don't touch me
  94. @objc public var brandElement: UIColor // don't touch me
  95. @objc public var brandText: UIColor // don't touch me
  96. @objc public var connectionNo: UIColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0)
  97. @objc public var encrypted: UIColor = .red
  98. @objc public var backgroundView: UIColor = .white
  99. @objc public var backgroundCell: UIColor = .white
  100. @objc public var backgroundForm: UIColor = UIColor(red: 244.0/255.0, green: 244.0/255.0, blue: 244.0/255.0, alpha: 1.0)
  101. @objc public var textView: UIColor = .black
  102. @objc public var separator: UIColor = UIColor(red: 235.0/255.0, green: 235.0/255.0, blue: 235.0/255.0, alpha: 1.0)
  103. @objc public var tabBar: UIColor = .white
  104. @objc public let nextcloud: UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)
  105. @objc public let nextcloudSoft: UIColor = UIColor(red: 90.0/255.0, green: 160.0/255.0, blue: 210.0/255.0, alpha: 1.0)
  106. @objc public let icon: UIColor = UIColor(red: 104.0/255.0, green: 104.0/255.0, blue: 104.0/255.0, alpha: 1.0)
  107. @objc public let optionItem: UIColor = UIColor(red: 178.0/255.0, green: 178.0/255.0, blue: 178.0/255.0, alpha: 1.0)
  108. @objc public let graySoft: UIColor = UIColor(red: 162.0/255.0, green: 162.0/255.0, blue: 162.0/255.0, alpha: 0.5)
  109. @objc public let yellowFavorite: UIColor = UIColor(red: 248.0/255.0, green: 205.0/255.0, blue: 70.0/255.0, alpha: 1.0)
  110. @objc public let textInfo: UIColor = UIColor(red: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 1.0)
  111. @objc public var select: UIColor = .white
  112. override init() {
  113. self.brand = self.customer
  114. self.brandElement = self.customer
  115. self.brandText = self.customerText
  116. }
  117. @objc public func setDarkMode() {
  118. let darkMode = CCUtility.getDarkMode()
  119. if darkMode {
  120. tabBar = UIColor(red: 25.0/255.0, green: 25.0/255.0, blue: 25.0/255.0, alpha: 1.0)
  121. backgroundView = .black
  122. backgroundCell = UIColor(red: 25.0/255.0, green: 25.0/255.0, blue: 25.0/255.0, alpha: 1.0)
  123. backgroundForm = .black
  124. textView = .white
  125. separator = UIColor(red: 60.0/255.0, green: 60.0/255.0, blue: 60.0/255.0, alpha: 1.0)
  126. select = UIColor.white.withAlphaComponent(0.2)
  127. } else {
  128. tabBar = .white
  129. backgroundView = .white
  130. backgroundCell = .white
  131. backgroundForm = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0)
  132. textView = .black
  133. separator = UIColor(red: 235.0/255.0, green: 235.0/255.0, blue: 235.0/255.0, alpha: 1.0)
  134. select = self.brand.withAlphaComponent(0.1)
  135. }
  136. }
  137. }