~handlerug/TelegramSwift

74c14c048d96e31c3d143aa876e8c2c529d56f50 — handlerug 3 years ago 42528cf
New menu bar items: Application, Chat, Help
M Telegram-Mac/AppDelegate.swift => Telegram-Mac/AppDelegate.swift +49 -0
@@ 1003,6 1003,55 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD
        NSApp.keyWindow?.close()
    }
    
    @IBAction func newGroupAction(_ sender: Any) {
        if let accountContext = self.contextValue?.context {
            accountContext.composeCreateGroup()
        }
    }
    
    @IBAction func newChannelAction(_ sender: Any) {
        if let accountContext = self.contextValue?.context {
            accountContext.composeCreateChannel()
        }
    }
    
    @IBAction func newSecretChatAction(_ sender: Any) {
        if let accountContext = self.contextValue?.context {
            accountContext.composeCreateSecretChat()
        }
    }
    
    @IBAction func telegramFAQAction(_ sender: Any) {
        if let accountContext = self.contextValue?.context {
            openFaq(context: accountContext)
        }
    }
    
    @IBAction func askQuestionAction(_ sender: Any) {
        confirm(for: self.window, information: L10n.accountConfirmAskQuestion, thridTitle: L10n.accountConfirmGoToFaq, successHandler: { result in
            guard let accountContext = self.contextValue?.context else {
                return
            }
            
            switch result {
            case .basic:
                _ = showModalProgress(signal: supportPeerId(account: accountContext.account), for: self.window).start(next: { peerId in
                    if let peerId = peerId {
                        let controller = ChatController(context: accountContext, chatLocation: .peer(peerId))
                        _ = self.sharedContextOnce.start(next: { appContext in
                            let navigation = appContext.sharedContext.bindings.rootNavigation()
                            let singleLayout = appContext.sharedContext.layout
                            navigation.removeExceptMajor()
                            navigation.push(controller, singleLayout == .single)
                        })
                    }
                })
            case .thrid:
                openFaq(context: accountContext)
            }
        })
    }
    
    func application(_ application: NSApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([NSUserActivityRestoring]) -> Void) -> Bool {
        if userActivity.activityType == CSSearchableItemActionType {
            if let uniqueIdentifier = userActivity.userInfo?[CSSearchableItemActivityIdentifier] as? String {

M Telegram-Mac/Base.lproj/MainMenu.xib => Telegram-Mac/Base.lproj/MainMenu.xib +59 -10
@@ 35,25 35,24 @@
                                    <action selector="aboutAction:" target="Voe-Tx-rLC" id="ZhI-1O-HA0"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="sE9-sf-sdU"/>
                            <menuItem title="Preferences…" keyEquivalent="," identifier="BOF-NM-1cW" id="BOF-NM-1cW" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <connections>
                                    <action selector="preferencesAction:" target="Voe-Tx-rLC" id="7BZ-fj-knq"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
                            <menuItem title="Check for Updates" tag="1000" identifier="1000" id="xey-M7-XVy" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="checkForUpdates:" target="Voe-Tx-rLC" id="Ang-sr-P90"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
                            <menuItem title="Quick Switcher" keyEquivalent="k" identifier="sZh-ct-GQS" id="sZh-ct-GQS" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                            <menuItem isSeparatorItem="YES" id="sE9-sf-sdU"/>
                            <menuItem title="Preferences…" keyEquivalent="," identifier="BOF-NM-1cW" id="BOF-NM-1cW" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <connections>
                                    <action selector="showQuickSwitcher:" target="Voe-Tx-rLC" id="OFA-D5-XK6"/>
                                    <action selector="preferencesAction:" target="Voe-Tx-rLC" id="7BZ-fj-knq"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="qsg-Hw-5di"/>
                            <menuItem title="Services" id="cJY-Fc-9g1">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Services" systemMenu="services" id="src-MG-htW"/>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
                            <menuItem title="Hide" keyEquivalent="w" identifier="Olw-nP-bQN" id="Olw-nP-bQN" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <connections>
                                    <action selector="closeWindow:" target="Voe-Tx-rLC" id="IKs-t5-kxH"/>


@@ 86,6 85,37 @@
                        <accessibility identifier="uQy-DD-JDr"/>
                    </menu>
                </menuItem>
                <menuItem title="Chat" identifier="asi-sJ-wWF" id="asi-sJ-wWF" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Chat" identifier="tQp-Is-geS" id="tQp-Is-geS" customClass="MMMenu" customModule="Telegram" customModuleProvider="target">
                        <items>
                            <menuItem title="New Group" identifier="02b-8u-jC4" id="02b-8u-jC4" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="newGroupAction:" target="Voe-Tx-rLC" id="oIK-pA-XHy"/>
                                </connections>
                            </menuItem>
                            <menuItem title="New Channel" identifier="eXm-XO-luB" id="eXm-XO-luB" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="newChannelAction:" target="Voe-Tx-rLC" id="te0-2U-m37"/>
                                </connections>
                            </menuItem>
                            <menuItem title="New Secret Chat" identifier="vzZ-ec-CpT" id="vzZ-ec-CpT" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="newSecretChatAction:" target="Voe-Tx-rLC" id="uuL-Pm-gsL"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="qdo-j5-zgE"/>
                            <menuItem title="Quick Switcher" keyEquivalent="k" identifier="sZh-ct-GQS" id="sZh-ct-GQS" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <connections>
                                    <action selector="showQuickSwitcher:" target="Voe-Tx-rLC" id="OFA-D5-XK6"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="Edit" identifier="5QF-Oa-p0T" id="5QF-Oa-p0T" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Edit" identifier="W48-6f-4Dl" id="W48-6f-4Dl" customClass="MMMenu" customModule="Telegram" customModuleProvider="target">


@@ 300,6 330,25 @@
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="Help" identifier="Ru7-9M-Yv3" id="Ru7-9M-Yv3" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Help" systemMenu="help" identifier="b2k-Xh-NB3" id="b2k-Xh-NB3" customClass="MMMenu" customModule="Telegram" customModuleProvider="target">
                        <items>
                            <menuItem title="Telegram FAQ" identifier="gKN-YR-cEZ" id="gKN-YR-cEZ" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="telegramFAQAction:" target="Voe-Tx-rLC" id="bC3-v3-ccd"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Ask a Question" identifier="GqB-2I-6ff" id="GqB-2I-6ff" customClass="MMMenuItem" customModule="Telegram" customModuleProvider="target">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="askQuestionAction:" target="Voe-Tx-rLC" id="YCe-yo-I9U"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
            </items>
            <point key="canvasLocation" x="139" y="-225"/>
        </menu>

M Telegram-Mac/en.lproj/Localizable.strings => Telegram-Mac/en.lproj/Localizable.strings +0 -0