1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-27 10:12:36 +01:00
metatext-app-ios-iphone-ipad/Share Extension/ShareExtensionNavigationViewController.swift
2021-03-05 18:25:18 -08:00

38 lines
1.2 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 },
autoplayVideos: { UIAccessibility.isVideoAutoplayEnabled })
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, rootViewModel: nil)],
animated: false)
}
}