mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-14 12:31:00 +00:00
36 lines
1.1 KiB
Swift
36 lines
1.1 KiB
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import AVKit
|
|
import Combine
|
|
import ServiceLayer
|
|
import SwiftUI
|
|
import ViewModels
|
|
|
|
@objc(ShareExtensionNavigationViewController)
|
|
class ShareExtensionNavigationViewController: UINavigationController {
|
|
private let environment = AppEnvironment.live(
|
|
userNotificationCenter: .current(),
|
|
reduceMotion: { UIAccessibility.isReduceMotionEnabled })
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
try? AVAudioSession.sharedInstance().setCategory(.ambient, mode: .default)
|
|
try? ImageCacheConfiguration(environment: environment).configure()
|
|
|
|
let viewModel = ShareExtensionNavigationViewModel(environment: environment)
|
|
let newStatusViewModel: NewStatusViewModel
|
|
|
|
do {
|
|
newStatusViewModel = try viewModel.newStatusViewModel(extensionContext: extensionContext)
|
|
} catch {
|
|
setViewControllers([ShareErrorViewController(error: error)], animated: false)
|
|
|
|
return
|
|
}
|
|
|
|
setViewControllers(
|
|
[NewStatusViewController(viewModel: newStatusViewModel)],
|
|
animated: false)
|
|
}
|
|
}
|