diff --git a/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/Contents.json b/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/Contents.json new file mode 100644 index 0000000000..133d7727aa --- /dev/null +++ b/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/Contents.json @@ -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" + } +} diff --git a/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/appicon.png b/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/appicon.png new file mode 100644 index 0000000000..03845a2899 Binary files /dev/null and b/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/AppIcon.imageset/appicon.png differ diff --git a/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Camera.imageset/Contents.json b/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Camera.imageset/Contents.json deleted file mode 100644 index 868e9f5048..0000000000 --- a/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Camera.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "ic_camera.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Camera.imageset/ic_camera.pdf b/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Camera.imageset/ic_camera.pdf deleted file mode 100644 index a5e2d3c939..0000000000 Binary files a/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Camera.imageset/ic_camera.pdf and /dev/null differ diff --git a/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Contents.json b/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Contents.json index 38f0c81fc2..6e965652df 100644 --- a/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Contents.json +++ b/Telegram/Telegram-iOS/Icons.xcassets/Shortcuts/Contents.json @@ -1,9 +1,9 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 }, "properties" : { "provides-namespace" : true } -} \ No newline at end of file +} diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index a86291a5fe..3e7fffed41 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -12102,3 +12102,5 @@ Sorry for the inconvenience."; "Channel.AdminLog.MessageManyDeleted.Messages_any" = "%@ messages"; "Channel.AdminLog.MessageManyDeleted.ShowAll" = "show all"; "Channel.AdminLog.MessageManyDeleted.HideAll" = "hide all"; + +"Shortcut.AppIcon" = "Edit App Icon"; diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift index cdc6600918..3928a01f9d 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift @@ -338,7 +338,7 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry { 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 arguments.selectAppIcon(icon) - }) + }, tag: ThemeSettingsEntryTag.icon) case .powerSaving: return ItemListDisclosureItem(presentationData: presentationData, icon: nil, title: presentationData.strings.AppearanceSettings_Animations, label: "", labelStyle: .text, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: { arguments.openPowerSavingSettings() diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageActionBubbleContentNode/Sources/ChatMessageActionBubbleContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageActionBubbleContentNode/Sources/ChatMessageActionBubbleContentNode.swift index a0767c21fb..d0066f268f 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageActionBubbleContentNode/Sources/ChatMessageActionBubbleContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageActionBubbleContentNode/Sources/ChatMessageActionBubbleContentNode.swift @@ -366,7 +366,6 @@ public class ChatMessageActionBubbleContentNode: ChatMessageBubbleContentNode { let baseBackgroundFrame = labelFrame.offsetBy(dx: 0.0, dy: -11.0) - 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) let highlightNode: LinkHighlightingNode diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index aa12034a1d..df1e5706d5 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -2379,6 +2379,8 @@ private func extractAccountManagerState(records: AccountRecordsView take(1) diff --git a/submodules/TelegramUI/Sources/ApplicationShortcutItem.swift b/submodules/TelegramUI/Sources/ApplicationShortcutItem.swift index 6579fe691b..cbaac75d10 100644 --- a/submodules/TelegramUI/Sources/ApplicationShortcutItem.swift +++ b/submodules/TelegramUI/Sources/ApplicationShortcutItem.swift @@ -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) ] } } diff --git a/submodules/TelegramUI/Sources/TelegramRootController.swift b/submodules/TelegramUI/Sources/TelegramRootController.swift index 53b8936def..e7c20c4b00 100644 --- a/submodules/TelegramUI/Sources/TelegramRootController.swift +++ b/submodules/TelegramUI/Sources/TelegramRootController.swift @@ -273,6 +273,23 @@ public final class TelegramRootController: NavigationController, TelegramRootCon 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 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 {