Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GiniBankSDK): #759

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,26 @@ public final class DocumentPickerCoordinator: NSObject {
/// A UIDocumentPickerViewController that sets navigation bar buttons' tint color to a correct one, instead of using the accent color specified by app
private class GiniDocumentPickerViewController: UIDocumentPickerViewController {
var initialTintColor: UIColor? = navBarInstance.tintColor
var initialButtonTintColor: UIColor? = barButtonInstance.tintColor

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
Self.navBarInstance.tintColor = .GiniCapture.accent1
Self.barButtonInstance.tintColor = .GiniCapture.accent1
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// make sure to revert the tint color, otherwise it will affect document pickers/browsers from the host app
Self.navBarInstance.tintColor = initialTintColor
Self.navBarInstance.tintColor = initialTintColor ?? UINavigationBar.appearance().tintColor
Self.barButtonInstance.tintColor = initialButtonTintColor ?? UIBarButtonItem.appearance().tintColor
}
static var navBarInstance: UINavigationBar {
UINavigationBar.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self])
}

static var barButtonInstance: UIBarButtonItem {
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self])
}
}

fileprivate extension DocumentPickerCoordinator {
Expand Down