mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Add app icon shortcut
This commit is contained in:
parent
e32b2d3d09
commit
4956d1a79a
24
Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/Contents.json
vendored
Normal file
24
Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "appicon.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
},
|
||||||
|
"properties" : {
|
||||||
|
"template-rendering-intent" : "template"
|
||||||
|
}
|
||||||
|
}
|
BIN
Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/appicon.png
vendored
Normal file
BIN
Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/appicon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "ic_camera.pdf"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"author" : "xcode",
|
||||||
"author" : "xcode"
|
"version" : 1
|
||||||
},
|
},
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"provides-namespace" : true
|
"provides-namespace" : true
|
||||||
|
@ -12102,3 +12102,5 @@ Sorry for the inconvenience.";
|
|||||||
"Channel.AdminLog.MessageManyDeleted.Messages_any" = "%@ messages";
|
"Channel.AdminLog.MessageManyDeleted.Messages_any" = "%@ messages";
|
||||||
"Channel.AdminLog.MessageManyDeleted.ShowAll" = "show all";
|
"Channel.AdminLog.MessageManyDeleted.ShowAll" = "show all";
|
||||||
"Channel.AdminLog.MessageManyDeleted.HideAll" = "hide all";
|
"Channel.AdminLog.MessageManyDeleted.HideAll" = "hide all";
|
||||||
|
|
||||||
|
"Shortcut.AppIcon" = "Edit App Icon";
|
||||||
|
@ -338,7 +338,7 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
|||||||
case let .iconItem(theme, strings, icons, isPremium, value):
|
case let .iconItem(theme, strings, icons, isPremium, value):
|
||||||
return ThemeSettingsAppIconItem(theme: theme, strings: strings, sectionId: self.section, icons: icons, isPremium: isPremium, currentIconName: value, updated: { icon in
|
return ThemeSettingsAppIconItem(theme: theme, strings: strings, sectionId: self.section, icons: icons, isPremium: isPremium, currentIconName: value, updated: { icon in
|
||||||
arguments.selectAppIcon(icon)
|
arguments.selectAppIcon(icon)
|
||||||
})
|
}, tag: ThemeSettingsEntryTag.icon)
|
||||||
case .powerSaving:
|
case .powerSaving:
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, icon: nil, title: presentationData.strings.AppearanceSettings_Animations, label: "", labelStyle: .text, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, icon: nil, title: presentationData.strings.AppearanceSettings_Animations, label: "", labelStyle: .text, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
|
||||||
arguments.openPowerSavingSettings()
|
arguments.openPowerSavingSettings()
|
||||||
|
@ -366,7 +366,6 @@ public class ChatMessageActionBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
|
|
||||||
let baseBackgroundFrame = labelFrame.offsetBy(dx: 0.0, dy: -11.0)
|
let baseBackgroundFrame = labelFrame.offsetBy(dx: 0.0, dy: -11.0)
|
||||||
|
|
||||||
|
|
||||||
if var rect = strongSelf.labelNode.textNode.cachedLayout?.allAttributeRects(name: TelegramTextAttributes.Button).first?.1 {
|
if var rect = strongSelf.labelNode.textNode.cachedLayout?.allAttributeRects(name: TelegramTextAttributes.Button).first?.1 {
|
||||||
rect = rect.insetBy(dx: -2.0, dy: 2.0).offsetBy(dx: 0.0, dy: 1.0 - UIScreenPixel)
|
rect = rect.insetBy(dx: -2.0, dy: 2.0).offsetBy(dx: 0.0, dy: 1.0 - UIScreenPixel)
|
||||||
let highlightNode: LinkHighlightingNode
|
let highlightNode: LinkHighlightingNode
|
||||||
|
@ -2379,6 +2379,8 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
|||||||
self.openChatWhenReady(accountId: nil, peerId: context.context.account.peerId, threadId: nil, storyId: nil)
|
self.openChatWhenReady(accountId: nil, peerId: context.context.account.peerId, threadId: nil, storyId: nil)
|
||||||
case .account:
|
case .account:
|
||||||
context.switchAccount()
|
context.switchAccount()
|
||||||
|
case .appIcon:
|
||||||
|
context.openAppIcon()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -947,6 +947,10 @@ final class AuthorizedApplicationContext {
|
|||||||
self.rootController.openRootCamera()
|
self.rootController.openRootCamera()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func openAppIcon() {
|
||||||
|
self.rootController.openAppIcon()
|
||||||
|
}
|
||||||
|
|
||||||
func switchAccount() {
|
func switchAccount() {
|
||||||
let _ = (activeAccountsAndPeers(context: self.context)
|
let _ = (activeAccountsAndPeers(context: self.context)
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|
@ -9,6 +9,7 @@ enum ApplicationShortcutItemType: String {
|
|||||||
case camera
|
case camera
|
||||||
case savedMessages
|
case savedMessages
|
||||||
case account
|
case account
|
||||||
|
case appIcon
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ApplicationShortcutItem: Equatable {
|
struct ApplicationShortcutItem: Equatable {
|
||||||
@ -32,6 +33,8 @@ extension ApplicationShortcutItem {
|
|||||||
icon = UIApplicationShortcutIcon(templateImageName: "Shortcuts/SavedMessages")
|
icon = UIApplicationShortcutIcon(templateImageName: "Shortcuts/SavedMessages")
|
||||||
case .account:
|
case .account:
|
||||||
icon = UIApplicationShortcutIcon(templateImageName: "Shortcuts/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)
|
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: .savedMessages, title: strings.Conversation_SavedMessages, subtitle: nil),
|
||||||
ApplicationShortcutItem(type: .account, title: strings.Shortcut_SwitchAccount, subtitle: otherAccountName)
|
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 {
|
} else {
|
||||||
return [
|
return [
|
||||||
ApplicationShortcutItem(type: .search, title: strings.Common_Search, subtitle: nil),
|
ApplicationShortcutItem(type: .search, title: strings.Common_Search, subtitle: nil),
|
||||||
ApplicationShortcutItem(type: .compose, title: strings.Compose_NewMessage, 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)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,6 +273,23 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
|
|||||||
presentedLegacyShortcutCamera(context: self.context, saveCapturedMedia: false, saveEditedPhotos: false, mediaGrouping: true, parentController: controller)
|
presentedLegacyShortcutCamera(context: self.context, saveCapturedMedia: false, saveEditedPhotos: false, mediaGrouping: true, parentController: controller)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func openAppIcon() {
|
||||||
|
guard let rootTabController = self.rootTabController else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.popToRoot(animated: false)
|
||||||
|
|
||||||
|
if let index = rootTabController.controllers.firstIndex(where: { $0 is PeerInfoScreenImpl }) {
|
||||||
|
rootTabController.selectedIndex = index
|
||||||
|
}
|
||||||
|
|
||||||
|
let themeController = themeSettingsController(context: self.context, focusOnItemTag: .icon)
|
||||||
|
var controllers: [UIViewController] = Array(self.viewControllers.prefix(1))
|
||||||
|
controllers.append(themeController)
|
||||||
|
self.setViewControllers(controllers, animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public func openStoryCamera(customTarget: EnginePeer.Id?, transitionIn: StoryCameraTransitionIn?, transitionedIn: @escaping () -> Void, transitionOut: @escaping (Stories.PendingTarget?, Bool) -> StoryCameraTransitionOut?) -> StoryCameraTransitionInCoordinator? {
|
public func openStoryCamera(customTarget: EnginePeer.Id?, transitionIn: StoryCameraTransitionIn?, transitionedIn: @escaping () -> Void, transitionOut: @escaping (Stories.PendingTarget?, Bool) -> StoryCameraTransitionOut?) -> StoryCameraTransitionInCoordinator? {
|
||||||
guard let controller = self.viewControllers.last as? ViewController else {
|
guard let controller = self.viewControllers.last as? ViewController else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user