2020-12-06 04:10:27 +01:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import Combine
|
|
|
|
import ServiceLayer
|
|
|
|
import UIKit
|
|
|
|
import ViewModels
|
|
|
|
|
|
|
|
@objc(ShareExtensionNavigationViewController)
|
|
|
|
class ShareExtensionNavigationViewController: UINavigationController {
|
2020-12-10 03:44:06 +01:00
|
|
|
private let viewModel = ShareExtensionNavigationViewModel(
|
|
|
|
environment: .live(
|
|
|
|
userNotificationCenter: .current(),
|
|
|
|
reduceMotion: { UIAccessibility.isReduceMotionEnabled }))
|
2020-12-06 04:10:27 +01:00
|
|
|
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
|
|
|
|
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
|
|
|
|
2020-12-10 03:44:06 +01:00
|
|
|
let newStatusViewModel: NewStatusViewModel
|
2020-12-06 04:10:27 +01:00
|
|
|
|
|
|
|
do {
|
2020-12-10 03:44:06 +01:00
|
|
|
newStatusViewModel = try viewModel.newStatusViewModel()
|
2020-12-06 04:10:27 +01:00
|
|
|
} catch {
|
|
|
|
setViewControllers([ShareErrorViewController(error: error)], animated: false)
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-12-10 03:44:06 +01:00
|
|
|
setViewControllers(
|
|
|
|
[NewStatusViewController(viewModel: newStatusViewModel, isShareExtension: true)],
|
|
|
|
animated: false)
|
2020-12-06 04:10:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@available(*, unavailable)
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
}
|
|
|
|
}
|