From 7dd774b57661551451834c23654dc78da6d93f4f Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Wed, 15 May 2024 12:06:20 +0200 Subject: [PATCH] - swiftlint: disable large_tuple warning - ios-sdk: use branch fix/warnings that fixes OpenSSL warnings - replace associated keys using structs or strings with static malloc results as suggested by Apple Engineer Quinn (https://forums.swift.org/t/handling-the-new-forming-unsaferawpointer-warning/65523/7) - remove unneeded/unused overrides - reformat spacing in parts of the code and remove superfluous spaces to remove SwiftLint warnings - replace calls to CLLocationManager.authorizationStatus() with CLLocationManager.authorizationStatus - remove deprecated OpenSSL ERR_load_* calls, since OpenSSL loads these automatically (https://www.openssl.org/docs/man3.3/man7/migration_guide.html) - LAContext+Extension: add cases for Optic ID - remove unused variables and calls - remove unused, non-existent "gear.png" image from asset catalog --- .swiftlint.yml | 1 + ios-sdk | 2 +- .../Actions+Extensions/UploadFileAction.swift | 6 ++---- .../Actions/EditDocumentViewController.swift | 4 ++-- .../PhotoAlbumTableViewController.swift | 4 ---- .../Viewer/PDF/PDFSearchViewController.swift | 5 ----- .../PDF/PDFTocTableViewController.swift | 4 ---- .../Viewer/PDF/PDFViewerViewController.swift | 4 ---- .../gear.imageset/Contents.json | 21 ------------------- .../BackgroundUploadsSettingsSection.swift | 2 +- .../INIFile+ShortcutResolution.swift | 2 +- ownCloud/Tasks/ScheduledTaskManager.swift | 6 +++--- .../Receipt/OCLicenseAppStoreReceipt.m | 2 -- .../Saved Searches/OCVault+SavedSearches.m | 1 - .../Sidebar Items/OCVault+SidebarItems.m | 1 - .../Controller/AccountController.swift | 4 ++-- .../Collection Views/Cells/ViewCell.swift | 8 +++---- .../CollectionViewCellConfiguration.swift | 8 +++---- .../ClientItemViewController.swift | 5 ----- .../UIKit Extension/LAContext+Extension.swift | 4 ++++ .../UIKit Extension/UIButton+Extension.swift | 8 +++---- .../UIKit Extension/UIView+OCDataItem.swift | 6 +++--- .../More/MoreStaticTableViewController.swift | 4 ---- .../AppStateActionGoToPersonalFolder.swift | 4 ---- .../Theme/CSS/NSObject+ThemeCSS.swift | 8 +++---- .../Theme/ThemeCollection.swift | 2 -- 26 files changed, 32 insertions(+), 94 deletions(-) delete mode 100644 ownCloud/Resources/Assets.xcassets/gear.imageset/Contents.json diff --git a/.swiftlint.yml b/.swiftlint.yml index 426244ae0..4ab296420 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -39,6 +39,7 @@ disabled_rules: - control_statement - nesting - comma + - large_tuple custom_rules: empty_line_after_guard_statement: included: ".*\\.swift" diff --git a/ios-sdk b/ios-sdk index d4caa6d87..7229c2019 160000 --- a/ios-sdk +++ b/ios-sdk @@ -1 +1 @@ -Subproject commit d4caa6d875879162172a4c34cb364a3310776fee +Subproject commit 7229c2019a8012c385cb4c151def94a2c5ea7964 diff --git a/ownCloud/Client/Actions/Actions+Extensions/UploadFileAction.swift b/ownCloud/Client/Actions/Actions+Extensions/UploadFileAction.swift index dc2d84a6e..527386f3f 100644 --- a/ownCloud/Client/Actions/Actions+Extensions/UploadFileAction.swift +++ b/ownCloud/Client/Actions/Actions+Extensions/UploadFileAction.swift @@ -30,9 +30,7 @@ class UploadFileAction: UploadBaseAction { override class var keyCommand : String? { return "+" } override class var keyModifierFlags: UIKeyModifierFlags? { return [.command] } - private struct AssociatedKeys { - static var actionKey = "action" - } + private static let associatedKeyAction = malloc(1)! // MARK: - Action implementation override func run() { @@ -47,7 +45,7 @@ class UploadFileAction: UploadBaseAction { documentPickerViewController.allowsMultipleSelection = true // The action is only held weakly as delegate. This makes sure the Action object sticks around as long as UIDocumentPickerViewController, so that UIDocumentPickerViewController can call the UIDocumentPickerDelegate method. - objc_setAssociatedObject(documentPickerViewController, &AssociatedKeys.actionKey, self, .OBJC_ASSOCIATION_RETAIN) + objc_setAssociatedObject(documentPickerViewController, UploadFileAction.associatedKeyAction, self, .OBJC_ASSOCIATION_RETAIN) viewController.present(documentPickerViewController, animated: true) } diff --git a/ownCloud/Client/Actions/EditDocumentViewController.swift b/ownCloud/Client/Actions/EditDocumentViewController.swift index a0f77fa37..7826607c6 100644 --- a/ownCloud/Client/Actions/EditDocumentViewController.swift +++ b/ownCloud/Client/Actions/EditDocumentViewController.swift @@ -154,7 +154,7 @@ class EditDocumentViewController: QLPreviewController, Themeable { } } } - + func disableEditingMode() { if #available(iOS 17.0, *) { if let rightBarButtonItems = self.navigationItem.rightBarButtonItems, rightBarButtonItems.count > 0 { @@ -171,7 +171,7 @@ class EditDocumentViewController: QLPreviewController, Themeable { @objc func dismissAnimated() { disableEditingMode() - + if savingMode == nil { requestsavingMode { (savingMode) in self.dismiss(animated: true) { diff --git a/ownCloud/Client/PhotoAlbumTableViewController.swift b/ownCloud/Client/PhotoAlbumTableViewController.swift index 704679006..5568e1706 100644 --- a/ownCloud/Client/PhotoAlbumTableViewController.swift +++ b/ownCloud/Client/PhotoAlbumTableViewController.swift @@ -93,10 +93,6 @@ class PhotoAlbumTableViewController : UITableViewController, Themeable { fetchAlbums() } - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - } - // MARK: - Theme support func applyThemeCollection(theme: Theme, collection: ThemeCollection, event: ThemeEvent) { diff --git a/ownCloud/Client/Viewer/PDF/PDFSearchViewController.swift b/ownCloud/Client/Viewer/PDF/PDFSearchViewController.swift index 61796369c..1a89f693d 100644 --- a/ownCloud/Client/Viewer/PDF/PDFSearchViewController.swift +++ b/ownCloud/Client/Viewer/PDF/PDFSearchViewController.swift @@ -78,11 +78,6 @@ class PDFSearchViewController: UITableViewController, PDFDocumentDelegate, Theme NotificationCenter.default.removeObserver(self) } - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } - @objc func dismissSearch() { typeDelayTimer?.invalidate() self.dismiss(animated: true) { diff --git a/ownCloud/Client/Viewer/PDF/PDFTocTableViewController.swift b/ownCloud/Client/Viewer/PDF/PDFTocTableViewController.swift index 79a0620fb..de736c82b 100644 --- a/ownCloud/Client/Viewer/PDF/PDFTocTableViewController.swift +++ b/ownCloud/Client/Viewer/PDF/PDFTocTableViewController.swift @@ -77,10 +77,6 @@ class PDFTocTableViewController: UITableViewController, Themeable { Theme.shared.unregister(client: self) } - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - } - override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() // These lines mitigates the issue with incorrect layout of child view controller diff --git a/ownCloud/Client/Viewer/PDF/PDFViewerViewController.swift b/ownCloud/Client/Viewer/PDF/PDFViewerViewController.swift index ea8f5db47..1fd27ec46 100644 --- a/ownCloud/Client/Viewer/PDF/PDFViewerViewController.swift +++ b/ownCloud/Client/Viewer/PDF/PDFViewerViewController.swift @@ -234,10 +234,6 @@ class PDFViewerViewController: DisplayViewController, DisplayExtension, UIPopove self.fullScreen.toggle() } - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - } - override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() pdfView.scaleFactor = pdfView.scaleFactorForSizeToFit diff --git a/ownCloud/Resources/Assets.xcassets/gear.imageset/Contents.json b/ownCloud/Resources/Assets.xcassets/gear.imageset/Contents.json deleted file mode 100644 index 35d5d770b..000000000 --- a/ownCloud/Resources/Assets.xcassets/gear.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "gear.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ownCloud/Settings/BackgroundUploadsSettingsSection.swift b/ownCloud/Settings/BackgroundUploadsSettingsSection.swift index 87426530d..85b523067 100644 --- a/ownCloud/Settings/BackgroundUploadsSettingsSection.swift +++ b/ownCloud/Settings/BackgroundUploadsSettingsSection.swift @@ -92,7 +92,7 @@ class BackgroundUploadsSettingsSection: SettingsSection { locationServicesRowSubtitle += " " locationServicesRowSubtitle += "Otherwise background media uploads using background refresh technology would depend on how frequently you use the app.".localized - let currentAuthStatus = CLLocationManager.authorizationStatus() == .authorizedAlways + let currentAuthStatus = CLLocationManager().authorizationStatus == .authorizedAlways backgroundLocationRow = StaticTableViewRow(switchWithAction: { (_, sender) in if let enableSwitch = sender as? UISwitch { if enableSwitch.isOn { diff --git a/ownCloud/Shortcut Files/INIFile+ShortcutResolution.swift b/ownCloud/Shortcut Files/INIFile+ShortcutResolution.swift index f434372cb..2e9a58698 100644 --- a/ownCloud/Shortcut Files/INIFile+ShortcutResolution.swift +++ b/ownCloud/Shortcut Files/INIFile+ShortcutResolution.swift @@ -46,7 +46,7 @@ public extension INIFile { } }) } else { - var effectiveError: Error? = nil + var effectiveError: Error? switch OpenShortcutFileAction.openShortcutMode { case .itemsOnly, .none: diff --git a/ownCloud/Tasks/ScheduledTaskManager.swift b/ownCloud/Tasks/ScheduledTaskManager.swift index bcbce554d..a545f7605 100644 --- a/ownCloud/Tasks/ScheduledTaskManager.swift +++ b/ownCloud/Tasks/ScheduledTaskManager.swift @@ -414,7 +414,7 @@ extension ScheduledTaskManager : CLLocationManagerDelegate { @discardableResult func startLocationMonitoringIfAuthorized() -> Bool { guard let userDefaults = OCAppIdentity.shared.userDefaults else { return false } - if CLLocationManager.authorizationStatus() == .authorizedAlways && userDefaults.backgroundMediaUploadsLocationUpdatesEnabled { + if locationManager.authorizationStatus == .authorizedAlways && userDefaults.backgroundMediaUploadsLocationUpdatesEnabled { Log.debug(tagged: ["TASK_MANAGER", "MEDIA_UPLOAD"], "Significant location monitoring has started") startLocationTracking() return true @@ -424,13 +424,13 @@ extension ScheduledTaskManager : CLLocationManagerDelegate { } func stopLocationMonitoring() { - if CLLocationManager.authorizationStatus() == .authorizedAlways || CLLocationManager.authorizationStatus() == .authorizedWhenInUse { + if locationManager.authorizationStatus == .authorizedAlways || locationManager.authorizationStatus == .authorizedWhenInUse { stopLocationTracking() } } func requestLocationAuthorization() -> Bool { - let currentStatus = CLLocationManager.authorizationStatus() + let currentStatus = locationManager.authorizationStatus switch currentStatus { case .notDetermined, .authorizedWhenInUse: self.locationManager.requestAlwaysAuthorization() diff --git a/ownCloudAppFramework/Licensing/Providers/App Store/Receipt/OCLicenseAppStoreReceipt.m b/ownCloudAppFramework/Licensing/Providers/App Store/Receipt/OCLicenseAppStoreReceipt.m index e9174ef2d..3a8b9caa9 100644 --- a/ownCloudAppFramework/Licensing/Providers/App Store/Receipt/OCLicenseAppStoreReceipt.m +++ b/ownCloudAppFramework/Licensing/Providers/App Store/Receipt/OCLicenseAppStoreReceipt.m @@ -115,8 +115,6 @@ - (OCLicenseAppStoreReceiptParseError)parse } // OpenSSL setup - ERR_load_X509_strings(); - ERR_load_PKCS7_strings(); OpenSSL_add_all_digests(); // Parse receipt diff --git a/ownCloudAppFramework/Search/Saved Searches/OCVault+SavedSearches.m b/ownCloudAppFramework/Search/Saved Searches/OCVault+SavedSearches.m index b4c253c57..42718f08d 100644 --- a/ownCloudAppFramework/Search/Saved Searches/OCVault+SavedSearches.m +++ b/ownCloudAppFramework/Search/Saved Searches/OCVault+SavedSearches.m @@ -58,7 +58,6 @@ - (void)updateSavedSearch:(OCSavedSearch *)savedSearch [self.keyValueStore updateObjectForKey:OCKeyValueStoreKeySavedSearches usingModifier:^id _Nullable(id _Nullable existingObject, BOOL * _Nonnull outDidModify) { NSMutableArray *savedSearches = OCTypedCast(existingObject, NSMutableArray); - NSUInteger countBefore; if (savedSearches != nil) { diff --git a/ownCloudAppFramework/Sidebar Items/OCVault+SidebarItems.m b/ownCloudAppFramework/Sidebar Items/OCVault+SidebarItems.m index 1612172c7..25322285c 100644 --- a/ownCloudAppFramework/Sidebar Items/OCVault+SidebarItems.m +++ b/ownCloudAppFramework/Sidebar Items/OCVault+SidebarItems.m @@ -58,7 +58,6 @@ - (void)updateSidebarItem:(OCSidebarItem *)sidebarItem [self.keyValueStore updateObjectForKey:OCKeyValueStoreKeySidebarItems usingModifier:^id _Nullable(id _Nullable existingObject, BOOL * _Nonnull outDidModify) { NSMutableArray *sidebarItems = OCTypedCast(existingObject, NSMutableArray); - NSUInteger countBefore; if (sidebarItems != nil) { diff --git a/ownCloudAppShared/Client/Account/Controller/AccountController.swift b/ownCloudAppShared/Client/Account/Controller/AccountController.swift index 668afda5d..0647f86e2 100644 --- a/ownCloudAppShared/Client/Account/Controller/AccountController.swift +++ b/ownCloudAppShared/Client/Account/Controller/AccountController.swift @@ -422,7 +422,7 @@ public class AccountController: NSObject, OCDataItem, OCDataItemVersioning, Acco // Other sidebar items var otherItems: [OCDataItem & OCDataItemVersioning] = [] - func addSidebarItem(_ itemID: SpecialItem, _ generate: ()->OCDataItem&OCDataItemVersioning) { + func addSidebarItem(_ itemID: SpecialItem, _ generate: () -> OCDataItem & OCDataItemVersioning) { var item = specialItems[itemID] if item == nil { @@ -649,7 +649,7 @@ extension AccountController: DataItemSelectionInteraction { if let personalSpaceDataItemRef = self.personalSpaceDataItemRef, let sectionID = section?.identifier, let personalFolderItemRef = section?.collectionViewController?.wrap(references: [personalSpaceDataItemRef], forSection: sectionID).first, - let /* spacesFolderItemRef */ _ = section?.collectionViewController?.wrap(references: [specialItemsDataReferences[.spacesFolder]!], forSection: sectionID).first { + section?.collectionViewController?.wrap(references: [specialItemsDataReferences[.spacesFolder]!], forSection: sectionID).first != nil { section?.collectionViewController?.addActions([ CollectionViewAction(kind: .select(animated: false, scrollPosition: .centeredVertically), itemReference: personalFolderItemRef) ]) diff --git a/ownCloudAppShared/Client/Collection Views/Cells/ViewCell.swift b/ownCloudAppShared/Client/Collection Views/Cells/ViewCell.swift index d3537fddd..2b0d1d24b 100644 --- a/ownCloudAppShared/Client/Collection Views/Cells/ViewCell.swift +++ b/ownCloudAppShared/Client/Collection Views/Cells/ViewCell.swift @@ -100,17 +100,15 @@ class SeparatorLayoutGuideCustomizer : NSObject { } extension UIView { - private struct AssociatedKeys { - static var separatorLayoutGuideCustomizerKey = "separatorLayoutGuideCustomizerKey" - } + private static let associatedKeySeparatorLayoutGuideCustomizer = malloc(1)! var separatorLayoutGuideCustomizer: SeparatorLayoutGuideCustomizer? { get { - return objc_getAssociatedObject(self, &AssociatedKeys.separatorLayoutGuideCustomizerKey) as? SeparatorLayoutGuideCustomizer + return objc_getAssociatedObject(self, UIView.associatedKeySeparatorLayoutGuideCustomizer) as? SeparatorLayoutGuideCustomizer } set { - objc_setAssociatedObject(self, &AssociatedKeys.separatorLayoutGuideCustomizerKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) + objc_setAssociatedObject(self, UIView.associatedKeySeparatorLayoutGuideCustomizer, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) } } } diff --git a/ownCloudAppShared/Client/Collection Views/CollectionViewCellConfiguration.swift b/ownCloudAppShared/Client/Collection Views/CollectionViewCellConfiguration.swift index e87de6950..97cc3319d 100644 --- a/ownCloudAppShared/Client/Collection Views/CollectionViewCellConfiguration.swift +++ b/ownCloudAppShared/Client/Collection Views/CollectionViewCellConfiguration.swift @@ -119,17 +119,15 @@ public class CollectionViewCellConfiguration: NSObject { } public extension NSObject { - private struct AssociatedKeys { - static var cellConfiguration = "cellConfiguration" - } + private static let associatedKeyCellConfiguration = malloc(1)! var ocCellConfiguration : CollectionViewCellConfiguration? { set { - objc_setAssociatedObject(self, &AssociatedKeys.cellConfiguration, newValue, .OBJC_ASSOCIATION_RETAIN) + objc_setAssociatedObject(self, NSObject.associatedKeyCellConfiguration, newValue, .OBJC_ASSOCIATION_RETAIN) } get { - return objc_getAssociatedObject(self, &AssociatedKeys.cellConfiguration) as? CollectionViewCellConfiguration + return objc_getAssociatedObject(self, NSObject.associatedKeyCellConfiguration) as? CollectionViewCellConfiguration } } } diff --git a/ownCloudAppShared/Client/View Controllers/ClientItemViewController.swift b/ownCloudAppShared/Client/View Controllers/ClientItemViewController.swift index dfa5f3841..a66de97c2 100644 --- a/ownCloudAppShared/Client/View Controllers/ClientItemViewController.swift +++ b/ownCloudAppShared/Client/View Controllers/ClientItemViewController.swift @@ -1315,11 +1315,6 @@ open class ClientItemViewController: CollectionViewController, SortBarDelegate, } } } - - // MARK: - Themeing - public override func applyThemeCollection(theme: Theme, collection: ThemeCollection, event: ThemeEvent) { - super.applyThemeCollection(theme: theme, collection: collection, event: event) - } } extension ThemeCSSSelector { diff --git a/ownCloudAppShared/UIKit Extension/LAContext+Extension.swift b/ownCloudAppShared/UIKit Extension/LAContext+Extension.swift index 3961e1d9d..2b307ac63 100644 --- a/ownCloudAppShared/UIKit Extension/LAContext+Extension.swift +++ b/ownCloudAppShared/UIKit Extension/LAContext+Extension.swift @@ -25,6 +25,7 @@ extension LAContext { switch self.biometryType { case .faceID : return "Face ID".localized case .touchID: return "Touch ID".localized + case .opticID: return "Optic ID".localized case .none: return nil @unknown default: return nil } @@ -41,6 +42,9 @@ extension LAContext { case .touchID: return UIImage(systemName: "touchid") + case .opticID: + return UIImage(systemName: "opticid") + case .none: return nil @unknown default: return nil } diff --git a/ownCloudAppShared/UIKit Extension/UIButton+Extension.swift b/ownCloudAppShared/UIKit Extension/UIButton+Extension.swift index 2ce07f389..3f9fb56a5 100644 --- a/ownCloudAppShared/UIKit Extension/UIButton+Extension.swift +++ b/ownCloudAppShared/UIKit Extension/UIButton+Extension.swift @@ -21,18 +21,16 @@ import UIKit import ownCloudSDK public extension UIButton { - private struct AssociatedKeys { - static var actionKey = "actionKey" - } + private static let associatedActionKey = malloc(1)! var actionIdentifier: OCExtensionIdentifier? { get { - return objc_getAssociatedObject(self, &AssociatedKeys.actionKey) as? OCExtensionIdentifier + return objc_getAssociatedObject(self, UIButton.associatedActionKey) as? OCExtensionIdentifier } set { if newValue != nil { - objc_setAssociatedObject(self, &AssociatedKeys.actionKey, newValue!, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) + objc_setAssociatedObject(self, UIButton.associatedActionKey, newValue!, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) } } } diff --git a/ownCloudAppShared/UIKit Extension/UIView+OCDataItem.swift b/ownCloudAppShared/UIKit Extension/UIView+OCDataItem.swift index e828c2596..697ad3dc2 100644 --- a/ownCloudAppShared/UIKit Extension/UIView+OCDataItem.swift +++ b/ownCloudAppShared/UIKit Extension/UIView+OCDataItem.swift @@ -20,18 +20,18 @@ import UIKit import ownCloudSDK extension UIView : OCDataItem, OCDataItemVersioning { - static var viewUUIDKey = "_ocViewUUIDKey" + private static let associatedKeyViewUUID = malloc(1)! public var dataItemType: OCDataItemType { return .view } public var dataItemReference: OCDataItemReference { - if let uuid = objc_getAssociatedObject(self, &UIView.viewUUIDKey) as? NSString { + if let uuid = objc_getAssociatedObject(self, UIView.associatedKeyViewUUID) as? NSString { return uuid } else { let uuid = UUID().uuidString as NSString - objc_setAssociatedObject(self, &UIView.viewUUIDKey, uuid, .OBJC_ASSOCIATION_RETAIN) + objc_setAssociatedObject(self, UIView.associatedKeyViewUUID, uuid, .OBJC_ASSOCIATION_RETAIN) return uuid } } diff --git a/ownCloudAppShared/User Interface/More/MoreStaticTableViewController.swift b/ownCloudAppShared/User Interface/More/MoreStaticTableViewController.swift index cc6c4292d..71cb0dda5 100644 --- a/ownCloudAppShared/User Interface/More/MoreStaticTableViewController.swift +++ b/ownCloudAppShared/User Interface/More/MoreStaticTableViewController.swift @@ -78,10 +78,6 @@ open class MoreStaticTableViewController: StaticTableViewController { open override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { return nil } - - open override func applyThemeCollection(theme: Theme, collection: ThemeCollection, event: ThemeEvent) { - super.applyThemeCollection(theme: theme, collection: collection, event: event) - } } open class MoreStaticTableViewSection : StaticTableViewSection { diff --git a/ownCloudAppShared/User Interface/State Restoration/Actions/AppStateActionGoToPersonalFolder.swift b/ownCloudAppShared/User Interface/State Restoration/Actions/AppStateActionGoToPersonalFolder.swift index 27d3665b2..65588a49d 100644 --- a/ownCloudAppShared/User Interface/State Restoration/Actions/AppStateActionGoToPersonalFolder.swift +++ b/ownCloudAppShared/User Interface/State Restoration/Actions/AppStateActionGoToPersonalFolder.swift @@ -32,10 +32,6 @@ public class AppStateActionGoToPersonalFolder: AppStateAction { super.init(coder: coder) } - override public func encode(with coder: NSCoder) { - super.encode(with: coder) - } - var drivesSubscription: OCDataSourceSubscription? override public func perform(in clientContext: ClientContext, completion: @escaping AppStateAction.Completion) { diff --git a/ownCloudAppShared/User Interface/Theme/CSS/NSObject+ThemeCSS.swift b/ownCloudAppShared/User Interface/Theme/CSS/NSObject+ThemeCSS.swift index 2edba24a9..b9486b142 100644 --- a/ownCloudAppShared/User Interface/Theme/CSS/NSObject+ThemeCSS.swift +++ b/ownCloudAppShared/User Interface/Theme/CSS/NSObject+ThemeCSS.swift @@ -28,9 +28,7 @@ public protocol ThemeCSSChangeObserver { } extension NSObject { - private struct AssociatedKeys { - static var cssSelectors = "_cssSelectors" - } + private static let associatedKeyCssSelectors = malloc(1)! public var activeThemeCSS: ThemeCSS { return Theme.shared.activeCollection.css @@ -42,7 +40,7 @@ extension NSObject { public var cssSelectors: [ThemeCSSSelector]? { set { - objc_setAssociatedObject(self, &AssociatedKeys.cssSelectors, newValue, .OBJC_ASSOCIATION_RETAIN) + objc_setAssociatedObject(self, NSObject.associatedKeyCssSelectors, newValue, .OBJC_ASSOCIATION_RETAIN) if let changeObserver = self as? ThemeCSSChangeObserver { changeObserver.cssSelectorsChanged() @@ -50,7 +48,7 @@ extension NSObject { } get { - var effectiveSelectors: [ThemeCSSSelector] = objc_getAssociatedObject(self, &AssociatedKeys.cssSelectors) as? [ThemeCSSSelector] ?? [] + var effectiveSelectors: [ThemeCSSSelector] = objc_getAssociatedObject(self, NSObject.associatedKeyCssSelectors) as? [ThemeCSSSelector] ?? [] if let autoSelector = self as? ThemeCSSAutoSelector { effectiveSelectors.insert(contentsOf: autoSelector.cssAutoSelectors, at: (effectiveSelectors.count > 0) ? (effectiveSelectors.count-1) : 0) diff --git a/ownCloudAppShared/User Interface/Theme/ThemeCollection.swift b/ownCloudAppShared/User Interface/Theme/ThemeCollection.swift index bb450748e..cd500b27a 100644 --- a/ownCloudAppShared/User Interface/Theme/ThemeCollection.swift +++ b/ownCloudAppShared/User Interface/Theme/ThemeCollection.swift @@ -327,8 +327,6 @@ public class ThemeCollection : NSObject { cellStateSet = ThemeColorStateSet.from(colorSet: cellSet, for: interfaceStyle) collectionBackgroundColor = darkBrandColor.darker(0.1) - cellSet.backgroundColor - groupedCellSet = ThemeColorSet.from(backgroundColor: darkBrandColor, tintColor: lightBrandColor, for: interfaceStyle) groupedCellStateSet = ThemeColorStateSet.from(colorSet: groupedCellSet, for: interfaceStyle) groupedCollectionBackgroundColor = useSystemColors ? .systemGroupedBackground.resolvedColor(with: styleTraitCollection) : navigationBarSet.backgroundColor.darker(0.3)