Add app icon shortcut

This commit is contained in:
Ilya Laktyushin
2024-04-20 22:20:01 +04:00
parent e32b2d3d09
commit 4956d1a79a
12 changed files with 58 additions and 25 deletions

View File

@@ -9,6 +9,7 @@ enum ApplicationShortcutItemType: String {
case camera
case savedMessages
case account
case appIcon
}
struct ApplicationShortcutItem: Equatable {
@@ -32,6 +33,8 @@ extension ApplicationShortcutItem {
icon = UIApplicationShortcutIcon(templateImageName: "Shortcuts/SavedMessages")
case .account:
icon = UIApplicationShortcutIcon(templateImageName: "Shortcuts/Account")
case .appIcon:
icon = UIApplicationShortcutIcon(templateImageName: "Shortcuts/AppIcon")
}
return UIApplicationShortcutItem(type: self.type.rawValue, localizedTitle: self.title, localizedSubtitle: self.subtitle, icon: icon, userInfo: nil)
}
@@ -45,18 +48,12 @@ func applicationShortcutItems(strings: PresentationStrings, otherAccountName: St
ApplicationShortcutItem(type: .savedMessages, title: strings.Conversation_SavedMessages, subtitle: nil),
ApplicationShortcutItem(type: .account, title: strings.Shortcut_SwitchAccount, subtitle: otherAccountName)
]
} else if DeviceAccess.isCameraAccessAuthorized() {
return [
ApplicationShortcutItem(type: .search, title: strings.Common_Search, subtitle: nil),
ApplicationShortcutItem(type: .compose, title: strings.Compose_NewMessage, subtitle: nil),
ApplicationShortcutItem(type: .camera, title: strings.Camera_Title, subtitle: nil),
ApplicationShortcutItem(type: .savedMessages, title: strings.Conversation_SavedMessages, subtitle: nil)
]
} else {
return [
ApplicationShortcutItem(type: .search, title: strings.Common_Search, subtitle: nil),
ApplicationShortcutItem(type: .compose, title: strings.Compose_NewMessage, subtitle: nil),
ApplicationShortcutItem(type: .savedMessages, title: strings.Conversation_SavedMessages, subtitle: nil)
ApplicationShortcutItem(type: .savedMessages, title: strings.Conversation_SavedMessages, subtitle: nil),
ApplicationShortcutItem(type: .appIcon, title: strings.Shortcut_AppIcon, subtitle: nil)
]
}
}