Quick fix dark mode issue
This commit is contained in:
parent
efb23a5cb3
commit
cc2e43821f
|
@ -729,7 +729,7 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func requestLibraryPermissionIfNeeded(handler: @escaping () -> Void) {
|
func requestLibraryPermissionIfNeeded(onAuthorized: @escaping () -> Void) {
|
||||||
let authorizationStatus: PHAuthorizationStatus
|
let authorizationStatus: PHAuthorizationStatus
|
||||||
if #available(iOS 14, *) {
|
if #available(iOS 14, *) {
|
||||||
authorizationStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)
|
authorizationStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)
|
||||||
|
@ -743,12 +743,18 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
|
||||||
// this way. So we add a flag (isRequestingPermission) to prevent the ScreenLockUI
|
// this way. So we add a flag (isRequestingPermission) to prevent the ScreenLockUI
|
||||||
// from showing when we request the photo library permission.
|
// from showing when we request the photo library permission.
|
||||||
Environment.shared.isRequestingPermission = true
|
Environment.shared.isRequestingPermission = true
|
||||||
SNAppearance.switchToImagePickerAppearance()
|
let appMode = AppModeManager.shared.currentAppMode
|
||||||
|
// FIXME: Rather than setting the app mode to light and then to dark again once we're done,
|
||||||
|
// it'd be better to just customize the appearance of the image picker. There doesn't currently
|
||||||
|
// appear to be a good way to do so though...
|
||||||
|
AppModeManager.shared.setCurrentAppMode(to: .light)
|
||||||
PHPhotoLibrary.requestAuthorization(for: .readWrite) { status in
|
PHPhotoLibrary.requestAuthorization(for: .readWrite) { status in
|
||||||
SNAppearance.switchToSessionAppearance()
|
DispatchQueue.main.async {
|
||||||
|
AppModeManager.shared.setCurrentAppMode(to: appMode)
|
||||||
|
}
|
||||||
Environment.shared.isRequestingPermission = false
|
Environment.shared.isRequestingPermission = false
|
||||||
if [ PHAuthorizationStatus.authorized, PHAuthorizationStatus.limited ].contains(status) {
|
if [ PHAuthorizationStatus.authorized, PHAuthorizationStatus.limited ].contains(status) {
|
||||||
handler()
|
onAuthorized()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -757,14 +763,14 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
|
||||||
if authorizationStatus == .notDetermined {
|
if authorizationStatus == .notDetermined {
|
||||||
PHPhotoLibrary.requestAuthorization { status in
|
PHPhotoLibrary.requestAuthorization { status in
|
||||||
if status == .authorized {
|
if status == .authorized {
|
||||||
handler()
|
onAuthorized()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch authorizationStatus {
|
switch authorizationStatus {
|
||||||
case .authorized, .limited:
|
case .authorized, .limited:
|
||||||
handler()
|
onAuthorized()
|
||||||
case .denied, .restricted:
|
case .denied, .restricted:
|
||||||
let modal = PermissionMissingModal(permission: "library") { }
|
let modal = PermissionMissingModal(permission: "library") { }
|
||||||
modal.modalPresentationStyle = .overFullScreen
|
modal.modalPresentationStyle = .overFullScreen
|
||||||
|
|
Loading…
Reference in New Issue