Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix widgets init due to crash of availability check inside builder on iOS 16 #2931

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions Widgets/Widgets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,39 @@ struct Widgets: WidgetBundle {

@WidgetBundleBuilder
var body: some Widget {
SearchWidget()
PasswordsWidget()
FavoritesWidget()
makeWidgets()
}

if #available(iOSApplicationExtension 17.0, *) {
VPNStatusWidget()
private func makeWidgets() -> some Widget {
if #available(iOS 17, *) {
return WidgetBundleBuilder.buildBlock(SearchWidget(),
PasswordsWidget(),
FavoritesWidget(),
VPNStatusWidget(),
SearchLockScreenWidget(),
VoiceSearchLockScreenWidget(),
EmailProtectionLockScreenWidget(),
FireButtonLockScreenWidget(),
FavoritesLockScreenWidget(),
PasswordsLockScreenWidget())
}

if #available(iOSApplicationExtension 16.0, *) {
SearchLockScreenWidget()
VoiceSearchLockScreenWidget()
EmailProtectionLockScreenWidget()
FireButtonLockScreenWidget()
FavoritesLockScreenWidget()
PasswordsLockScreenWidget()
if #available(iOS 16.0, *) {
return WidgetBundleBuilder.buildBlock(SearchWidget(),
PasswordsWidget(),
FavoritesWidget(),
SearchLockScreenWidget(),
VoiceSearchLockScreenWidget(),
EmailProtectionLockScreenWidget(),
FireButtonLockScreenWidget(),
FavoritesLockScreenWidget(),
PasswordsLockScreenWidget())
} else {
return WidgetBundleBuilder.buildBlock(SearchWidget(),
PasswordsWidget(),
FavoritesWidget())
}

}

}

extension UIImage {
Expand Down
Loading