- Fix iOS WebViewState initialization on non-main thread - Fix iOS SecureStore background access failures in auth/env setup - Fix Android TrackPlayer ForegroundService crash with AppState check - Fix Android TabBar event handler null reference crashes - Fix iOS BackgroundTask handler registration timing - Fix Android VideoView state management during fullscreen - Fix DatabaseSource stream state before enqueue operation Addresses 8 critical Crashlytics issues across iOS and Android: - iOS WebView main thread: 22 users - iOS SecureStore background: 18 users - Android ForegroundService: 26 users - Android TabPress null ref: 12 users - Android VideoView not found: 6 users - Stream enqueue race: 7 users - iOS BackgroundTask handler: 2 users + improvements to error handling and recovery paths Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
45 lines
949 B
Swift
45 lines
949 B
Swift
//
|
|
// WebViewState.swift
|
|
// FollowNative
|
|
//
|
|
// Created by Innei on 2025/1/31.
|
|
//
|
|
|
|
import Combine
|
|
import UIKit
|
|
|
|
struct ImagePreviewEvent {
|
|
let imageUrls: [String]
|
|
let index: Int
|
|
}
|
|
|
|
struct AudioSeekEvent {
|
|
let time: Double
|
|
}
|
|
|
|
final class WebViewState: ObservableObject {
|
|
@Published public var contentHeight: CGFloat
|
|
@Published public var imagePreviewEvent: ImagePreviewEvent?
|
|
@Published public var audioSeekEvent: AudioSeekEvent?
|
|
|
|
public init() {
|
|
if Thread.isMainThread {
|
|
self.contentHeight = UIScreen.main.bounds.height
|
|
} else {
|
|
var height: CGFloat = 0
|
|
DispatchQueue.main.sync {
|
|
height = UIScreen.main.bounds.height
|
|
}
|
|
self.contentHeight = height
|
|
}
|
|
}
|
|
|
|
public func previewImages(urls: [String], index: Int) {
|
|
imagePreviewEvent = ImagePreviewEvent(imageUrls: urls, index: index)
|
|
}
|
|
|
|
public func seekAudio(time: Double) {
|
|
audioSeekEvent = AudioSeekEvent(time: time)
|
|
}
|
|
}
|