diff --git a/Kiwix-iOS/Controller/Main/Buttons.swift b/Kiwix-iOS/Controller/Main/Buttons.swift index 51f6fdc7..1ccf982a 100644 --- a/Kiwix-iOS/Controller/Main/Buttons.swift +++ b/Kiwix-iOS/Controller/Main/Buttons.swift @@ -26,11 +26,13 @@ class Buttons { private(set) lazy var cancel: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(tapped(button:))) let space = UIBarButtonItem(barButtonSystemItem: .flexibleSpace) + + let testB = BarButton() var delegate: ButtonDelegates? var toolbar: [UIBarButtonItem] { get { - return [back, space, forward, space, toc, space, bookmark, space, library, space, setting] + return [testB, space, toc, space, bookmark, space, library, space, setting] } } @@ -116,9 +118,10 @@ class GrayBarButtonItem: UIBarButtonItem { class BarButton: UIBarButtonItem { private(set) var type = BarButtonType.blank convenience init(type: BarButtonType) { - let button = UIButton() - button.setImage(<#T##image: UIImage?##UIImage?#>, for: <#T##UIControlState#>) - self.init(customView: button) + let imageView = UIImageView(image: UIImage(named: "Bookmark")) + imageView.frame = CGRect(x: 0, y: 0, width: 26, height: 26) + self.init(customView: imageView) +// self.init(image: nil, style: .plain, target: nil, action: nil) self.type = type } } diff --git a/Kiwix-iOS/Controller/Main/MainController.swift b/Kiwix-iOS/Controller/Main/MainController.swift index fa41804b..d5ea5337 100644 --- a/Kiwix-iOS/Controller/Main/MainController.swift +++ b/Kiwix-iOS/Controller/Main/MainController.swift @@ -33,28 +33,28 @@ class MainController: UIViewController { buttons.addLongTapGestureRecognizer() } - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - guard traitCollection.horizontalSizeClass != previousTraitCollection?.horizontalSizeClass || - traitCollection.verticalSizeClass != previousTraitCollection?.verticalSizeClass else {return} - switch traitCollection.horizontalSizeClass { - case .compact: - navigationController?.setToolbarHidden(false, animated: false) - navigationItem.leftBarButtonItems = nil - navigationItem.rightBarButtonItems = nil - if searchBar.isFirstResponder { - navigationItem.rightBarButtonItem = buttons.cancel - } - toolbarItems = buttons.toolbar - case .regular: - navigationController?.setToolbarHidden(true, animated: false) - toolbarItems = nil - navigationItem.leftBarButtonItems = buttons.navLeft - navigationItem.rightBarButtonItems = buttons.navRight - default: - return - } - } +// override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { +// super.traitCollectionDidChange(previousTraitCollection) +// guard traitCollection.horizontalSizeClass != previousTraitCollection?.horizontalSizeClass || +// traitCollection.verticalSizeClass != previousTraitCollection?.verticalSizeClass else {return} +// switch traitCollection.horizontalSizeClass { +// case .compact: +// navigationController?.setToolbarHidden(false, animated: false) +// navigationItem.leftBarButtonItems = nil +// navigationItem.rightBarButtonItems = nil +// if searchBar.isFirstResponder { +// navigationItem.rightBarButtonItem = buttons.cancel +// } +// toolbarItems = buttons.toolbar +// case .regular: +// navigationController?.setToolbarHidden(true, animated: false) +// toolbarItems = nil +// navigationItem.leftBarButtonItems = buttons.navLeft +// navigationItem.rightBarButtonItems = buttons.navRight +// default: +// return +// } +// } } class WebView: UIWebView { @@ -102,3 +102,23 @@ class WebView: UIWebView { forwardList.removeAll() } } + +class TestStackView: UIStackView { + var topBorder = CALayer() + + override func awakeFromNib() { + super.awakeFromNib() + topBorder.backgroundColor = UIColor.lightGray.withAlphaComponent(0.9).cgColor + layer.addSublayer(topBorder) + } + + override func draw(_ rect: CGRect) { + super.draw(rect) + topBorder.frame = CGRect(x: 0, y: 0, width: rect.width, height: 0.5) + } + + override func layoutSubviews() { + super.layoutSubviews() + setNeedsDisplay() + } +} diff --git a/Kiwix-iOS/Controller/Main/MainDelegates.swift b/Kiwix-iOS/Controller/Main/MainDelegates.swift index d4599bcd..c16390cd 100644 --- a/Kiwix-iOS/Controller/Main/MainDelegates.swift +++ b/Kiwix-iOS/Controller/Main/MainDelegates.swift @@ -181,7 +181,7 @@ extension MainController { let controller = controllers.welcome controller.view.translatesAutoresizingMaskIntoConstraints = false addChildViewController(controller) - view.addSubview(controller.view) + view.insertSubview(controller.view, aboveSubview: webView) let views = ["view": controller.view] view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[view]|", options: .alignAllTop, metrics: nil, views: views)) view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[view]|", options: .alignAllLeft, metrics: nil, views: views)) diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist index 97418a86..bf6841c9 100644 --- a/Kiwix-iOS/Info.plist +++ b/Kiwix-iOS/Info.plist @@ -49,7 +49,7 @@ CFBundleVersion - 1.8.3101 + 1.8.3132 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Kiwix-iOS/Storyboard/Main.storyboard b/Kiwix-iOS/Storyboard/Main.storyboard index 6bfc8a7a..b16d4a01 100644 --- a/Kiwix-iOS/Storyboard/Main.storyboard +++ b/Kiwix-iOS/Storyboard/Main.storyboard @@ -36,7 +36,7 @@ - + @@ -103,11 +103,11 @@ - + @@ -514,5 +524,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Kiwix-iOSWidgets/Bookmarks/Info.plist b/Kiwix-iOSWidgets/Bookmarks/Info.plist index 00499442..a11e1601 100644 --- a/Kiwix-iOSWidgets/Bookmarks/Info.plist +++ b/Kiwix-iOSWidgets/Bookmarks/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.8.3101 + 1.8.3132 NSExtension NSExtensionMainStoryboard