mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Fix state machine crashes & background tasks (#343)
* Fix `UIApplication.shared` after moving to SwiftUI app * Do not autoplay videos on background * Move app state changes into the app coordinator * Add application background task, move into the suspended state more accurately * Add changelog * Fix most of the linter errors * Strip suspended state from state machine * Fix build * Clear audio session warning * Update AppCoordinator.swift * Update AppCoordinator.swift * Swift format
This commit is contained in:
@@ -20,7 +20,7 @@ struct ActivityCoordinator: CoordinatorProtocol {
|
||||
let items: [Any]
|
||||
|
||||
func toPresentable() -> AnyView {
|
||||
return AnyView(UIActivityViewControllerWrapper(activityItems: items)
|
||||
AnyView(UIActivityViewControllerWrapper(activityItems: items)
|
||||
.presentationDetents([.medium])
|
||||
.ignoresSafeArea())
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ final class VideoPlayerCoordinator: CoordinatorProtocol {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = VideoPlayerViewModel(videoURL: parameters.videoURL,
|
||||
autoplay: UIApplication.shared.applicationState == .active,
|
||||
isModallyPresented: parameters.isModallyPresented)
|
||||
}
|
||||
|
||||
@@ -67,8 +68,7 @@ final class VideoPlayerCoordinator: CoordinatorProtocol {
|
||||
private func configureAudioSession(_ session: AVAudioSession) {
|
||||
do {
|
||||
try session.setCategory(.playback,
|
||||
mode: .default,
|
||||
options: [.allowBluetooth, .allowBluetoothA2DP])
|
||||
mode: .default)
|
||||
try session.setActive(true)
|
||||
} catch {
|
||||
MXLog.debug("Configure audio session failed: \(error)")
|
||||
|
||||
Reference in New Issue
Block a user