mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-08-08 06:56:10 +00:00
fix: stop EnvironmentObject crash in the people sheet (#1567)
* fix: re-inject environment objects into the people sheet Sheets hosting a NavigationStack can drop inherited EnvironmentObjects on some iOS versions, crashing ContentPeopleListView / MessageListView (#1558). Co-authored-by: Cursor <cursoragent@cursor.com> * test: note people-sheet environment contract in smoke mount Make the #1558 regression visible next to the ContentView / people-sheet smoke mounts so a future env-object trim is harder to miss. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: jack <212554440+jackjackbits@users.noreply.github.com>
This commit is contained in:
parent
f269617004
commit
3a75567f5c
@ -92,6 +92,9 @@ struct ContentView: View {
|
||||
@EnvironmentObject private var conversationUIModel: ConversationUIModel
|
||||
@EnvironmentObject private var locationChannelsModel: LocationChannelsModel
|
||||
@EnvironmentObject private var sharedContentImportModel: SharedContentImportModel
|
||||
@EnvironmentObject private var peerListModel: PeerListModel
|
||||
@EnvironmentObject private var publicChatModel: PublicChatModel
|
||||
@EnvironmentObject private var privateInboxModel: PrivateInboxModel
|
||||
|
||||
@StateObject private var voiceRecordingVM = VoiceRecordingViewModel()
|
||||
@State private var messageText = ""
|
||||
@ -297,6 +300,17 @@ struct ContentView: View {
|
||||
showImagePicker: $showImagePicker,
|
||||
imagePickerSourceType: $imagePickerSourceType
|
||||
)
|
||||
// Sheets + NavigationStack can drop inherited EnvironmentObjects on
|
||||
// some iOS versions (#1558). Re-inject every model the sheet tree
|
||||
// reads so ContentPeopleListView / MessageListView never crash.
|
||||
.environmentObject(appChromeModel)
|
||||
.environmentObject(privateConversationModel)
|
||||
.environmentObject(verificationModel)
|
||||
.environmentObject(conversationUIModel)
|
||||
.environmentObject(locationChannelsModel)
|
||||
.environmentObject(peerListModel)
|
||||
.environmentObject(publicChatModel)
|
||||
.environmentObject(privateInboxModel)
|
||||
#else
|
||||
ContentPeopleSheetView(
|
||||
showSidebar: $showSidebar,
|
||||
@ -314,6 +328,14 @@ struct ContentView: View {
|
||||
onSendMessage: sendMessage,
|
||||
showMacImagePicker: $showMacImagePicker
|
||||
)
|
||||
.environmentObject(appChromeModel)
|
||||
.environmentObject(privateConversationModel)
|
||||
.environmentObject(verificationModel)
|
||||
.environmentObject(conversationUIModel)
|
||||
.environmentObject(locationChannelsModel)
|
||||
.environmentObject(peerListModel)
|
||||
.environmentObject(publicChatModel)
|
||||
.environmentObject(privateInboxModel)
|
||||
#endif
|
||||
}
|
||||
.sheet(isPresented: $appChromeModel.isAppInfoPresented) {
|
||||
|
||||
@ -542,6 +542,9 @@ struct ViewSmokeTests {
|
||||
])
|
||||
try? await Task.sleep(nanoseconds: 50_000_000)
|
||||
|
||||
// ContentView + people sheet must mount with the full feature-model
|
||||
// set (peerList / publicChat / privateInbox included). Missing any of
|
||||
// those crashes the NavigationStack sheet on some iOS versions (#1558).
|
||||
_ = mount(installSmokeEnvironment(ContentView(), featureModels: featureModels))
|
||||
_ = mount(installSmokeEnvironment(ContentPeopleSheetHarness(), featureModels: featureModels))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user