123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503 |
- import UIKit
- @objc class NCBrandConfiguration: NSObject {
- @objc static let shared: NCBrandConfiguration = {
- let instance = NCBrandConfiguration()
- return instance
- }()
-
- @objc public let configuration_bundleId: String = "it.twsweb.Nextcloud"
- @objc public let configuration_serverUrl: String = "serverUrl"
- @objc public let configuration_username: String = "username"
- @objc public let configuration_password: String = "password"
- }
- @objc class NCBrandOptions: NSObject {
- @objc static let shared: NCBrandOptions = {
- let instance = NCBrandOptions()
- return instance
- }()
-
- @objc public var brand: String = "Nextcloud"
- @objc public var mailMe: String = "ios@nextcloud.com"
- @objc public var textCopyrightNextcloudiOS: String = "Nextcloud Coherence for iOS %@ © 2020"
- @objc public var textCopyrightNextcloudServer: String = "Nextcloud Server %@"
- @objc public var loginBaseUrl: String = "https://cloud.nextcloud.com"
- @objc public var pushNotificationServerProxy: String = "https://push-notifications.nextcloud.com"
- @objc public var linkLoginHost: String = "https://nextcloud.com/install"
- @objc public var linkloginPreferredProviders: String = "https://nextcloud.com/signup";
- @objc public var webLoginAutenticationProtocol: String = "nc://"
-
- @objc public var webCloseViewProtocolPersonalized: String = ""
- @objc public var folderBrandAutoUpload: String = ""
-
-
- @objc public var folderDefaultAutoUpload: String = "Photos"
-
-
- @objc public var capabilitiesGroups: String = "group.it.twsweb.Crypto-Cloud"
-
-
- @objc public var userAgent: String = "Nextcloud-iOS"
-
-
- @objc public var use_login_web_personalized: Bool = false
- @objc public var use_default_auto_upload: Bool = false
- @objc public var use_themingColor: Bool = true
-
- @objc public var use_themingLogo: Bool = false
- @objc public var use_storeLocalAutoUploadAll: Bool = false
- @objc public var use_configuration: Bool = false
- @objc public var use_loginflowv2: Bool = false
- @objc public var disable_intro: Bool = false
- @objc public var disable_request_login_url: Bool = false
- @objc public var disable_multiaccount: Bool = false
- @objc public var disable_manage_account: Bool = false
- @objc public var disable_more_external_site: Bool = false
- @objc public var disable_openin_file: Bool = false
- @objc public var disable_crash_service: Bool = false
-
- override init() {
-
- if folderBrandAutoUpload != "" {
- folderDefaultAutoUpload = folderBrandAutoUpload
- }
- }
- }
- class NCBrandColor: NSObject {
- @objc static let shared: NCBrandColor = {
- let instance = NCBrandColor()
- instance.setDarkMode()
- return instance
- }()
-
- @objc public let customer: UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)
- @objc public var customerText: UIColor = .white
-
- @objc public var brand: UIColor
- @objc public var brandElement: UIColor
- @objc public var brandText: UIColor
- @objc public var connectionNo: UIColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0)
- @objc public var encrypted: UIColor = .red
- @objc public var backgroundView: UIColor = .white
- @objc public var backgroundCell: UIColor = .white
- @objc public var backgroundForm: UIColor = UIColor(red: 244.0/255.0, green: 244.0/255.0, blue: 244.0/255.0, alpha: 1.0)
- @objc public var textView: UIColor = .black
- @objc public var separator: UIColor = UIColor(red: 235.0/255.0, green: 235.0/255.0, blue: 235.0/255.0, alpha: 1.0)
- @objc public var tabBar: UIColor = .white
- @objc public let nextcloud: UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)
- @objc public let nextcloudSoft: UIColor = UIColor(red: 90.0/255.0, green: 160.0/255.0, blue: 210.0/255.0, alpha: 1.0)
- @objc public let icon: UIColor = UIColor(red: 104.0/255.0, green: 104.0/255.0, blue: 104.0/255.0, alpha: 1.0)
- @objc public let optionItem: UIColor = UIColor(red: 178.0/255.0, green: 178.0/255.0, blue: 178.0/255.0, alpha: 1.0)
- @objc public let graySoft: UIColor = UIColor(red: 162.0/255.0, green: 162.0/255.0, blue: 162.0/255.0, alpha: 0.5)
- @objc public let yellowFavorite: UIColor = UIColor(red: 248.0/255.0, green: 205.0/255.0, blue: 70.0/255.0, alpha: 1.0)
- @objc public let textInfo: UIColor = UIColor(red: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 1.0)
- @objc public var select: UIColor = .white
- @objc public var avatarBorder: UIColor = .white
- override init() {
- self.brand = self.customer
- self.brandElement = self.customer
- self.brandText = self.customerText
- }
-
- @objc public func setDarkMode() {
- let darkMode = CCUtility.getDarkMode()
- if darkMode {
- tabBar = UIColor(red: 25.0/255.0, green: 25.0/255.0, blue: 25.0/255.0, alpha: 1.0)
- backgroundView = .black
- backgroundCell = UIColor(red: 25.0/255.0, green: 25.0/255.0, blue: 25.0/255.0, alpha: 1.0)
- backgroundForm = .black
- textView = .white
- separator = UIColor(red: 60.0/255.0, green: 60.0/255.0, blue: 60.0/255.0, alpha: 1.0)
- select = UIColor.white.withAlphaComponent(0.2)
- avatarBorder = .black
- } else {
- tabBar = .white
- backgroundView = .white
- backgroundCell = .white
- backgroundForm = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0)
- textView = .black
- separator = UIColor(red: 235.0/255.0, green: 235.0/255.0, blue: 235.0/255.0, alpha: 1.0)
- select = self.brandElement.withAlphaComponent(0.1)
- avatarBorder = .white
- }
- }
-
- #if !EXTENSION
- @objc public func settingThemingColor(account: String) {
-
- let darker: CGFloat = 30
- let lighter: CGFloat = 30
- if NCBrandOptions.shared.use_themingColor {
-
- let themingColor = NCManageDatabase.shared.getCapabilitiesServerString(account: account, elements: NCElementsJSON.shared.capabilitiesThemingColor)
-
- let themingColorElement = NCManageDatabase.shared.getCapabilitiesServerString(account: account, elements: NCElementsJSON.shared.capabilitiesThemingColorElement)
-
- let themingColorText = NCManageDatabase.shared.getCapabilitiesServerString(account: account, elements: NCElementsJSON.shared.capabilitiesThemingColorText)
-
- settingBrandColor(themingColor, themingColorElement: themingColorElement, themingColorText: themingColorText)
-
- if NCBrandColor.shared.brandElement.isTooLight() {
- if let color = NCBrandColor.shared.brandElement.darker(by: darker) {
- NCBrandColor.shared.brandElement = color
- }
- } else if NCBrandColor.shared.brandElement.isTooDark() {
- if let color = NCBrandColor.shared.brandElement.lighter(by: lighter) {
- NCBrandColor.shared.brandElement = color
- }
- }
-
- } else {
-
- if NCBrandColor.shared.customer.isTooLight() {
- if let color = NCBrandColor.shared.customer.darker(by: darker) {
- NCBrandColor.shared.brandElement = color
- }
- } else if NCBrandColor.shared.customer.isTooDark() {
- if let color = NCBrandColor.shared.customer.lighter(by: lighter) {
- NCBrandColor.shared.brandElement = color
- }
- } else {
- NCBrandColor.shared.brandElement = NCBrandColor.shared.customer
- }
-
- NCBrandColor.shared.brand = NCBrandColor.shared.customer
- NCBrandColor.shared.brandText = NCBrandColor.shared.customerText
- }
-
- setDarkMode()
-
- DispatchQueue.main.async {
- NCCollectionCommon.shared.createImagesThemingColor()
- NotificationCenter.default.postOnMainThread(name: NCBrandGlobal.shared.notificationCenterChangeTheming)
- }
- }
- #endif
-
- @objc func settingBrandColor(_ themingColor: String?, themingColorElement: String?, themingColorText: String?) {
-
-
- if themingColor?.first == "#" {
- if let color = UIColor(hex: themingColor!) {
- NCBrandColor.shared.brand = color
- } else {
- NCBrandColor.shared.brand = NCBrandColor.shared.customer
- }
- } else {
- NCBrandColor.shared.brand = NCBrandColor.shared.customer
- }
-
-
- if themingColorText?.first == "#" {
- if let color = UIColor(hex: themingColorText!) {
- NCBrandColor.shared.brandText = color
- } else {
- NCBrandColor.shared.brandText = NCBrandColor.shared.customerText
- }
- } else {
- NCBrandColor.shared.brandText = NCBrandColor.shared.customerText
- }
-
-
- if themingColorElement?.first == "#" {
- if let color = UIColor(hex: themingColorElement!) {
- NCBrandColor.shared.brandElement = color
- } else {
- NCBrandColor.shared.brandElement = NCBrandColor.shared.brand
- }
- } else {
- NCBrandColor.shared.brandElement = NCBrandColor.shared.brand
- }
- }
- }
- @objc class NCBrandGlobal: NSObject {
- @objc static let shared: NCBrandGlobal = {
- let instance = NCBrandGlobal()
- return instance
- }()
-
- @objc let appDatabaseNextcloud = "Library/Application Support/Nextcloud"
- @objc let appApplicationSupport = "Library/Application Support"
- @objc let appUserData = "Library/Application Support/UserData"
- @objc let appCertificates = "Library/Application Support/Certificates"
- @objc let appScan = "Library/Application Support/Scan"
- @objc let directoryProviderStorage = "File Provider Storage"
-
- @objc let serviceShareKeyChain = "Crypto Cloud"
- @objc let metadataKeyedUnarchiver = "it.twsweb.nextcloud.metadata"
-
- @objc let nextcloudVersion12: Int = 12
- let nextcloudVersion15: Int = 15
- let nextcloudVersion17: Int = 17
- let nextcloudVersion18: Int = 18
- let nextcloudVersion20: Int = 20
-
- let databaseDefault = "nextcloud.realm"
- let databaseSchemaVersion: UInt64 = 161
-
-
- @objc let introLogin: Int = 0
- @objc let introSignup: Int = 1
-
-
- let avatarSize: CGFloat = 512
- @objc let sizePreview: CGFloat = 1024
- @objc let sizeIcon: CGFloat = 512
-
-
- let e2eeMaxFileSize: UInt64 = 524288000
- let e2eePassphraseTest = "more over television factory tendency independence international intellectual impress interest sentence pony"
- @objc let e2eeVersion = "1.1"
-
-
- let uploadMaxFileSize: UInt64 = 524288000
-
-
- let maxHTTPCache: Int64 = 10737418240
-
-
- let indexPageActivity: Int = 0
- let indexPageComments: Int = 1
- let indexPageSharing: Int = 2
-
-
- let maxAutoDownload: UInt64 = 104857600
- let maxAutoDownloadCellular: UInt64 = 10485760
-
- let nextcloud_unsupported_version: Int = 13
-
-
- let layoutList = "typeLayoutList"
- let layoutGrid = "typeLayoutGrid"
-
- let layoutViewMove = "LayoutMove"
- let layoutViewTrash = "LayoutTrash"
- let layoutViewOffline = "LayoutOffline"
- let layoutViewFavorite = "LayoutFavorite"
- let layoutViewFiles = "LayoutFiles"
- let layoutViewViewInFolder = "ViewInFolder"
- let layoutViewTransfers = "LayoutTransfers"
- let layoutViewRecent = "LayoutRecent"
- let layoutViewShares = "LayoutShares"
-
-
- let buttonMoreMore = "more"
- let buttonMoreStop = "stop"
-
-
- let editorText = "text"
- let editorOnlyoffice = "onlyoffice"
- let editorCollabora = "collabora"
- let onlyofficeDocx = "onlyoffice_docx"
- let onlyofficeXlsx = "onlyoffice_xlsx"
- let onlyofficePptx = "onlyoffice_pptx"
-
- let templateDocument = "document"
- let templateSpreadsheet = "spreadsheet"
- let templatePresentation = "presentation"
-
-
- let fileNameRichWorkspace = "Readme.md"
-
- @objc let dismissAfterSecond: TimeInterval = 4
- @objc let dismissAfterSecondLong: TimeInterval = 10
-
-
- @objc let ErrorBadRequest: Int = 400
- @objc let ErrorResourceNotFound: Int = 404
- @objc let ErrorConflict: Int = 409
- @objc let ErrorBadServerResponse: Int = -1011
- @objc let ErrorInternalError: Int = -99999
- @objc let ErrorFileNotSaved: Int = -99998
- @objc let ErrorDecodeMetadata: Int = -99997
- @objc let ErrorE2EENotEnabled: Int = -99996
- @objc let ErrorOffline: Int = -99994
- @objc let ErrorCharactersForbidden: Int = -99993
- @objc let ErrorCreationFile: Int = -99992
-
-
- @objc let permissionShared = "S"
- @objc let permissionCanShare = "R"
- @objc let permissionMounted = "M"
- @objc let permissionFileCanWrite = "W"
- @objc let permissionCanCreateFile = "C"
- @objc let permissionCanCreateFolder = "K"
- @objc let permissionCanDelete = "D"
- @objc let permissionCanRename = "N"
- @objc let permissionCanMove = "V"
-
-
-
- @objc let permissionReadShare: Int = 1
- @objc let permissionUpdateShare: Int = 2
- @objc let permissionCreateShare: Int = 4
- @objc let permissionDeleteShare: Int = 8
- @objc let permissionShareShare: Int = 16
-
- @objc let permissionMinFileShare: Int = 1
- @objc let permissionMaxFileShare: Int = 19
- @objc let permissionMinFolderShare: Int = 1
- @objc let permissionMaxFolderShare: Int = 31
- @objc let permissionDefaultFileRemoteShareNoSupportShareOption: Int = 3
- @objc let permissionDefaultFolderRemoteShareNoSupportShareOption: Int = 15
-
-
- @objc let metadataTypeFileAudio = "audio"
- @objc let metadataTypeFileCompress = "compress"
- @objc let metadataTypeFileDirectory = "directory"
- @objc let metadataTypeFileDocument = "document"
- @objc let metadataTypeFileImage = "image"
- @objc let metadataTypeFileUnknown = "unknow"
- @objc let metadataTypeFileVideo = "video"
- @objc let metadataTypeFileImagemeter = "imagemeter"
-
-
- @objc let keyFileNameMask = "fileNameMask"
- @objc let keyFileNameType = "fileNameType"
- @objc let keyFileNameAutoUploadMask = "fileNameAutoUploadMask"
- @objc let keyFileNameAutoUploadType = "fileNameAutoUploadType"
- @objc let keyFileNameOriginal = "fileNameOriginal"
- @objc let keyFileNameOriginalAutoUpload = "fileNameOriginalAutoUpload"
-
- @objc let selectorDownloadFile = "downloadFile"
- @objc let selectorDownloadAllFile = "downloadAllFile"
- @objc let selectorReadFile = "readFile"
- @objc let selectorListingFavorite = "listingFavorite"
- @objc let selectorLoadFileView = "loadFileView"
- @objc let selectorLoadFileQuickLook = "loadFileQuickLook"
- @objc let selectorLoadCopy = "loadCopy"
- @objc let selectorLoadOffline = "loadOffline"
- @objc let selectorOpenIn = "openIn"
- @objc let selectorUploadAutoUpload = "uploadAutoUpload"
- @objc let selectorUploadAutoUploadAll = "uploadAutoUploadAll"
- @objc let selectorUploadFile = "uploadFile"
- @objc let selectorSaveAlbum = "saveAlbum"
- @objc let selectorSaveAlbumLivePhotoIMG = "saveAlbumLivePhotoIMG"
- @objc let selectorSaveAlbumLivePhotoMOV = "saveAlbumLivePhotoMOV"
-
-
-
-
-
-
-
- @objc let metadataStatusNormal: Int = 0
- @objc let metadataStatustypeDownload: Int = 1
- @objc let metadataStatusWaitDownload: Int = 2
- @objc let metadataStatusInDownload: Int = 3
- @objc let metadataStatusDownloading: Int = 4
- @objc let metadataStatusDownloadError: Int = 5
- @objc let metadataStatusTypeUpload: Int = 6
- @objc let metadataStatusWaitUpload: Int = 7
- @objc let metadataStatusInUpload: Int = 8
- @objc let metadataStatusUploading: Int = 9
- @objc let metadataStatusUploadError: Int = 10
- @objc let metadataStatusUploadForcedStart: Int = 11
-
-
- @objc let notificationCenterApplicationDidEnterBackground = "applicationDidEnterBackground"
- @objc let notificationCenterApplicationWillEnterForeground = "applicationWillEnterForeground"
- @objc let notificationCenterInitializeMain = "initializeMain"
- @objc let notificationCenterChangeTheming = "changeTheming"
- @objc let notificationCenterChangeUserProfile = "changeUserProfile"
- @objc let notificationCenterRichdocumentGrabFocus = "richdocumentGrabFocus"
- @objc let notificationCenterReloadDataNCShare = "reloadDataNCShare"
- @objc let notificationCenterCloseRichWorkspaceWebView = "closeRichWorkspaceWebView"
- @objc let notificationCenterReloadDataSource = "reloadDataSource"
- @objc let notificationCenterReloadDataSourceNetworkForced = "reloadDataSourceNetworkForced"
- @objc let notificationCenterChangeStatusFolderE2EE = "changeStatusFolderE2EE"
- @objc let notificationCenterDownloadStartFile = "downloadStartFile"
- @objc let notificationCenterDownloadedFile = "downloadedFile"
- @objc let notificationCenterDownloadCancelFile = "downloadCancelFile"
- @objc let notificationCenterUploadStartFile = "uploadStartFile"
- @objc let notificationCenterUploadedFile = "uploadedFile"
- @objc let notificationCenterUploadCancelFile = "uploadCancelFile"
- @objc let notificationCenterProgressTask = "progressTask"
-
- @objc let notificationCenterCreateFolder = "createFolder"
- @objc let notificationCenterDeleteFile = "deleteFile"
- @objc let notificationCenterRenameFile = "renameFile"
- @objc let notificationCenterMoveFile = "moveFile"
- @objc let notificationCenterCopyFile = "copyFile"
- @objc let notificationCenterFavoriteFile = "favoriteFile"
- @objc let notificationCenterMenuSearchTextPDF = "menuSearchTextPDF"
- @objc let notificationCenterMenuDetailClose = "menuDetailClose"
-
- @objc let notificationCenterChangedLocation = "changedLocation"
- @objc let notificationStatusAuthorizationChangedLocation = "statusAuthorizationChangedLocation"
- }
|