mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Add app icon shortcut
This commit is contained in:
@@ -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)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user