Files
GLEGram-iOS/submodules/TelegramUI/Sources/ApplicationShortcutItem.swift
T
Leeksov 4647310322 GLEGram 12.5 — Initial public release
Based on Swiftgram 12.5 (Telegram iOS 12.5).
All GLEGram features ported and organized in GLEGram/ folder.

Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass,
Font Replacement, Fake Profile, Chat Export, Plugin System, and more.

See CHANGELOG_12.5.md for full details.
2026-04-06 09:48:12 +03:00

60 lines
2.4 KiB
Swift

import Foundation
import UIKit
import TelegramPresentationData
import DeviceAccess
enum ApplicationShortcutItemType: String {
case search
case compose
case camera
case savedMessages
case account
case appIcon
}
struct ApplicationShortcutItem: Equatable {
let type: ApplicationShortcutItemType
let title: String
let subtitle: String?
}
@available(iOS 9.1, *)
extension ApplicationShortcutItem {
func shortcutItem() -> UIApplicationShortcutItem {
let icon: UIApplicationShortcutIcon
switch self.type {
case .search:
icon = UIApplicationShortcutIcon(type: .search)
case .compose:
icon = UIApplicationShortcutIcon(type: .compose)
case .camera:
icon = UIApplicationShortcutIcon(templateImageName: "Shortcuts/Camera")
case .savedMessages:
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)
}
}
func applicationShortcutItems(strings: PresentationStrings, otherAccountName: String?) -> [ApplicationShortcutItem] {
if let otherAccountName = otherAccountName {
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: .account, title: strings.Shortcut_SwitchAccount, subtitle: otherAccountName)
]
} 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: .appIcon, title: strings.Shortcut_AppIcon, subtitle: nil)
]
}
}