Skip to content

Commit

Permalink
- SDK update: fix duplicate/"ghost" activities visual issue
Browse files Browse the repository at this point in the history
- ClientActivityViewController: fix Xcode 14 warnings
- PopupButtonController: add themeing support
- NSObject+ThemeApplication: add proper support for UISearchTextField, fixing #118 text color issue
  • Loading branch information
felix-schwarz committed Oct 10, 2022
1 parent 315404b commit 6d0530b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ios-sdk
6 changes: 5 additions & 1 deletion ownCloud/Client/ClientActivityViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@ class ClientActivityViewController: UITableViewController, Themeable, MessageGro
}
}

deinit {
private func winddown() {
Theme.shared.unregister(client: self)
self.shouldPauseDisplaySleep = false
self.core = nil
}

deinit {
winddown()
}

@objc func handleActivityNotification(_ notification: Notification) {
if let activitiyUpdates = notification.userInfo?[OCActivityManagerNotificationUserInfoUpdatesKey] as? [ [ String : Any ] ] {
for activityUpdate in activitiyUpdates {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ open class PopupButtonChoice : NSObject {
}
}

open class PopupButtonController : NSObject {
open class PopupButtonController : NSObject, Themeable {
typealias TitleCustomizer = (_ choice: PopupButtonChoice, _ isSelected: Bool) -> String
typealias SelectionCustomizer = (_ choice: PopupButtonChoice, _ isSelected: Bool) -> Bool
typealias ChoiceHandler = (_ choice: PopupButtonChoice, _ wasSelected: Bool) -> Void
Expand Down Expand Up @@ -148,6 +148,8 @@ open class PopupButtonController : NSObject {
])

_updateTitleFromSelectedChoice()

Theme.shared.register(client: self, applyImmediately: true)
}

private func _updateTitleFromSelectedChoice() {
Expand Down Expand Up @@ -188,4 +190,8 @@ open class PopupButtonController : NSObject {
button.sizeToFit()
}
}

open func applyThemeCollection(theme: Theme, collection: ThemeCollection, event: ThemeEvent) {
button.applyThemeCollection(collection)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,20 @@ public extension NSObject {
}
}

if let textField = self as? UITextField {
if let searchTextField = self as? UISearchTextField {
searchTextField.tintColor = collection.searchBarColors.tintColor
searchTextField.textColor = collection.searchBarColors.labelColor
searchTextField.overrideUserInterfaceStyle = collection.interfaceStyle.userInterfaceStyle

if let glassIconView = searchTextField.leftView as? UIImageView {
glassIconView.image = glassIconView.image?.withRenderingMode(.alwaysTemplate)
glassIconView.tintColor = collection.searchBarColors.secondaryLabelColor
}
if let clearButton = searchTextField.value(forKey: "clearButton") as? UIButton {
clearButton.setImage(UIImage(systemName: "xmark.circle.fill"), for: .normal)
clearButton.tintColor = collection.searchBarColors.secondaryLabelColor
}
} else if let textField = self as? UITextField {
textField.textColor = collection.tableRowColors.labelColor
}

Expand Down

0 comments on commit 6d0530b

Please sign in to comment.