Merge branch 'mbruce/bugfixes' into 'develop'

bugfixes

See merge request BPHV_MIPS/vds_ios!133
This commit is contained in:
Bruce, Matt R 2024-01-24 22:52:32 +00:00
commit c81fb5140b
5 changed files with 42 additions and 19 deletions

View File

@ -1233,7 +1233,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 50;
CURRENT_PROJECT_VERSION = 51;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
@ -1270,7 +1270,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 50;
CURRENT_PROJECT_VERSION = 51;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -60,6 +60,10 @@ public final class SelfSizingCollectionView: UICollectionView {
// MARK: - Private Methods
//--------------------------------------------------
private func setupContentSizeObservation() {
//ensure autoLayout uses intrinsic height
setContentHuggingPriority(.required, for: .vertical)
setContentCompressionResistancePriority(.required, for: .vertical)
// Observing the value of contentSize seems to be the only reliable way to get the contentSize after the collection view lays out its subviews.
self.contentSizeObservation = self.observe(\.contentSize, options: [.old, .new]) { [weak self] _, change in
// If we don't specify `options: [.old, .new]`, the change.oldValue and .newValue will always be `nil`.

View File

@ -52,7 +52,7 @@ open class Loader: View {
}
/// The natural size for the receiving view, considering only properties of the view itself.
open override var intrinsicContentSize: CGSize { .init(width: size, height: size) }
open override var intrinsicContentSize: CGSize { isActive ? .init(width: size, height: size) : .zero }
//--------------------------------------------------
// MARK: - Overrides
@ -85,6 +85,7 @@ open class Loader: View {
} else {
stopAnimating()
}
invalidateIntrinsicContentSize()
}
open override func updateAccessibility() {
@ -96,7 +97,9 @@ open class Loader: View {
private let rotationLayerName = "rotationAnimation"
private func startAnimating() {
accessibilityLabel = "Loading"
isAccessibilityElement = true
icon.isHidden = false
icon.layer.remove(layerName: rotationLayerName)
let rotation : CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
rotation.fromValue = 0
@ -115,6 +118,8 @@ open class Loader: View {
}
private func stopAnimating() {
isAccessibilityElement = false
icon.isHidden = true
icon.layer.removeAnimation(forKey: rotationLayerName)
loadingTimer?.invalidate()
loadingTimer = nil

View File

@ -10,26 +10,36 @@ import UIKit
extension UIApplication {
/// Helper method to find the top most viewcontroller in the app
/// - Parameter controller: UIViewController to test against
/// - Returns: Found top most UIViewController
public class func topViewController(controller: UIViewController? = UIApplication.shared.windows.first?.rootViewController) -> UIViewController? {
if let nav = controller as? UINavigationController {
return topViewController(controller: nav.visibleViewController)
/// Synchronously finds the top most viewcontroller in the app
/// - Parameter controller: Optional UIViewController to start from. If nil, starts from the root view controller.
/// - Returns: The found top most UIViewController
public class func topViewController(controller: UIViewController? = nil) -> UIViewController? {
// Ensure we're on the main thread
guard Thread.isMainThread else {
fatalError("topViewController must be called from the main thread")
}
if let tab = controller as? UITabBarController {
if let selected = tab.selectedViewController {
return topViewController(controller: selected)
var rootController = controller
if rootController == nil {
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let rootVC = windowScene.windows.first(where: { $0.isKeyWindow })?.rootViewController {
rootController = rootVC
}
}
if let presented = controller?.presentedViewController {
// Proceed with the logic to find the top view controller
if let nav = rootController as? UINavigationController {
return topViewController(controller: nav.visibleViewController)
} else if let tab = rootController as? UITabBarController, let selected = tab.selectedViewController {
return topViewController(controller: selected)
} else if let presented = rootController?.presentedViewController {
return topViewController(controller: presented)
}
return controller
return rootController
}
}

View File

@ -1,3 +1,7 @@
1.0.51
----------------
- ONEAPP-6239 - Loader is still showing when inactive.
1.0.50
----------------
- ONEAPP-6239 - Loader doesn't cancel 60 second timer on deallocation.