File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
Sources/StreamChatSwiftUI/ChatChannel/Composer Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,17 @@ public struct AttachmentPickerView<Factory: ViewFactory>: View {
3838 if selectedPickerState == . photos {
3939 if let assets = photoLibraryAssets,
4040 let collection = PHFetchResultCollection ( fetchResult: assets) {
41- viewFactory. makePhotoAttachmentPickerView (
42- assets: collection,
43- onAssetTap: onAssetTap,
44- isAssetSelected: isAssetSelected
45- )
41+ if !collection. isEmpty {
42+ viewFactory. makePhotoAttachmentPickerView (
43+ assets: collection,
44+ onAssetTap: onAssetTap,
45+ isAssetSelected: isAssetSelected
46+ )
47+ } else {
48+ viewFactory. makeAssetsAccessPermissionView ( )
49+ }
4650 } else {
47- viewFactory . makeAssetsAccessPermissionView ( )
51+ LoadingView ( )
4852 }
4953
5054 } else if selectedPickerState == . files {
Original file line number Diff line number Diff line change @@ -383,12 +383,15 @@ open class MessageComposerViewModel: ObservableObject {
383383 log. debug ( " Access to photos granted. " )
384384 let fetchOptions = PHFetchOptions ( )
385385 fetchOptions. sortDescriptors = [ NSSortDescriptor ( key: " creationDate " , ascending: false ) ]
386- DispatchQueue . main. async { [ unowned self] in
387- self . imageAssets = PHAsset . fetchAssets ( with: fetchOptions)
386+ let assets = PHAsset . fetchAssets ( with: fetchOptions)
387+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.25 ) { [ weak self] in
388+ self ? . imageAssets = assets
388389 }
389390 case . denied, . restricted:
391+ self . imageAssets = PHFetchResult < PHAsset > ( )
390392 log. debug ( " Access to photos is denied, showing the no permissions screen. " )
391393 case . notDetermined:
394+ self . imageAssets = PHFetchResult < PHAsset > ( )
392395 log. debug ( " Access to photos is still not determined. " )
393396 @unknown default :
394397 log. debug ( " Unknown authorization status. " )
You can’t perform that action at this time.
0 commit comments