Skip to content

Commit

Permalink
chore: PR Feedback. (IKSnackBarAvoider/ShareViewController)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Aug 2, 2023
1 parent 60ac406 commit 86ca4ae
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Mail/Helpers/AppAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ enum ApplicationAssembly {
Factory(type: MatomoUtils.self) { _, _ in
MatomoUtils(siteId: Constants.matomoId, baseURL: URLConstants.matomo.url)
},
Factory(type: SnackBarAvoider.self) { _, _ in
SnackBarAvoider()
Factory(type: IKSnackBarAvoider.self) { _, _ in
IKSnackBarAvoider()
},
Factory(type: DraftManager.self) { _, _ in
DraftManager()
Expand Down
2 changes: 1 addition & 1 deletion Mail/Utils/SnackBarAwareModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import MailCore
import SwiftUI

struct SnackBarAwareModifier: ViewModifier {
@InjectService var avoider: SnackBarAvoider
@InjectService var avoider: IKSnackBarAvoider
var inset: CGFloat {
didSet {
avoider.addAvoider(inset: inset)
Expand Down
19 changes: 1 addition & 18 deletions MailCore/Utils/SnackBar/IKSnackBar+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,6 @@ public extension SnackBarStyle {
}
}

// TODO: delete
public final class SnackBarAvoider {
public var snackBarInset: CGFloat = 0

public init() { /* Needed to init */ }

public func addAvoider(inset: CGFloat) {
if inset != snackBarInset {
snackBarInset = inset
}
}

public func removeAvoider() {
snackBarInset = 0
}
}

public extension IKSnackBar {
@discardableResult
@MainActor
Expand All @@ -76,7 +59,7 @@ public extension IKSnackBar {
anchor _: CGFloat = 0,
contextView: UIView? = nil
) -> IKSnackBar? {
@LazyInjectService var avoider: SnackBarAvoider
@LazyInjectService var avoider: IKSnackBarAvoider

let snackbar: IKSnackBar?
if let contextView = contextView {
Expand Down
10 changes: 6 additions & 4 deletions MailShareExtension/ShareViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ final class ShareNavigationViewController: UIViewController {
}

// We need to go threw wrapping to use SwiftUI in an NSExtension.
let hostingController = UIHostingController(rootView: ComposeMessageWrapperView(dismissHandler: {
self.dismiss(animated: true)
},
itemProviders: itemProviders))
let rootView = ComposeMessageWrapperView(dismissHandler: {
self.dismiss(animated: true)
},
itemProviders: itemProviders)
.defaultAppStorage(.shared)
let hostingController = UIHostingController(rootView: rootView)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
addChild(hostingController)
view.addSubview(hostingController.view)
Expand Down

0 comments on commit 86ca4ae

Please sign in to comment.