Skip to content

Commit

Permalink
fix(ui): compatibility with navigation controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mhamann committed Aug 5, 2022
1 parent f63c890 commit 1dfecb6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
8 changes: 4 additions & 4 deletions RowndFramework.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 34CNMPW6U9;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -667,7 +667,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = io.rownd.framework;
PRODUCT_NAME = Rownd;
SKIP_INSTALL = YES;
Expand All @@ -683,7 +683,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 34CNMPW6U9;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -697,7 +697,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = io.rownd.framework;
PRODUCT_NAME = Rownd;
SKIP_INSTALL = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<key>RowndFrameworkTestApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>44</integer>
<integer>5</integer>
</dict>
<key>RowndSDK.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>43</integer>
<integer>4</integer>
</dict>
<key>RowndTests.xcscheme_^#shared#^_</key>
<dict>
Expand Down
5 changes: 2 additions & 3 deletions Sources/Rownd/Rownd.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ public class Rownd: NSObject {
// But, we can't replace it yet (2022) since there are too many devices running iOS 14.
let bottomSheetController = BottomSheetController()
bottomSheetController.controller = viewController

rootViewController?.addChild(bottomSheetController)
rootViewController?.view.addSubview(bottomSheetController.view)
bottomSheetController.modalPresentationStyle = .overFullScreen
rootViewController?.present(bottomSheetController, animated: true, completion: nil)
}

}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Rownd/Views/BottomSheetController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ class BottomSheetController: UIViewController {
var sheetController: LBBottomSheet.BottomSheetController?

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
guard let controller = controller else {
return
}

if var hubViewController = controller as? HubViewProtocol {
hubViewController.hostController = self
}

var behavior: LBBottomSheet.BottomSheetController.Behavior = .init(swipeMode: .full)
behavior.heightMode = .specific(values: [.screenRatio(value: 0.5), .screenRatio(value: 0.9)], heightLimit: .statusBar)
Expand All @@ -25,6 +30,7 @@ class BottomSheetController: UIViewController {
theme.grabber?.topMargin = CGFloat(10.0)

sheetController = presentAsBottomSheet(controller, theme: theme, behavior: behavior)

}

override func viewDidLoad() {
Expand Down
11 changes: 11 additions & 0 deletions Sources/Rownd/Views/HubViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import UIKit

protocol HubViewProtocol {
var targetPage: HubPageSelector { get set }
var hostController: UIViewController? { get set }

func setLoading(_ isLoading: Bool)
func show()
func hide()
Expand All @@ -21,6 +23,7 @@ public class HubViewController: UIViewController, HubViewProtocol {
var activityIndicator = UIActivityIndicatorView(style: .large)
var hubWebController = HubWebViewController()
var targetPage = HubPageSelector.unknown
var hostController: UIViewController?

public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
Expand Down Expand Up @@ -66,6 +69,14 @@ public class HubViewController: UIViewController, HubViewProtocol {
self.overrideUserInterfaceStyle = .dark
}
}

public override func viewWillDisappear(_ animated: Bool) {
guard let hostController = hostController else {
return
}

hostController.dismiss(animated: true)
}

func setLoading(_ isLoading: Bool) {
if (isLoading) {
Expand Down

0 comments on commit 1dfecb6

Please sign in to comment.