diff --git a/Swiftgram/SGPayWall/Sources/SGPayWall.swift b/Swiftgram/SGPayWall/Sources/SGPayWall.swift index 251a9d3424..d3958f9415 100644 --- a/Swiftgram/SGPayWall/Sources/SGPayWall.swift +++ b/Swiftgram/SGPayWall/Sources/SGPayWall.swift @@ -519,10 +519,10 @@ struct FeatureRow: View { } Spacer() - - Image(systemName: "chevron.right") - .font(.system(size: 12, weight: .semibold)) - .foregroundColor(.secondary) + // TODO(swiftgram): uncomment +// Image(systemName: "chevron.right") +// .font(.system(size: 12, weight: .semibold)) +// .foregroundColor(.secondary) } .padding() .background( diff --git a/Swiftgram/SGStrings/Strings/en.lproj/SGLocalizable.strings b/Swiftgram/SGStrings/Strings/en.lproj/SGLocalizable.strings index 29f6eec0aa..c4ec243b99 100644 --- a/Swiftgram/SGStrings/Strings/en.lproj/SGLocalizable.strings +++ b/Swiftgram/SGStrings/Strings/en.lproj/SGLocalizable.strings @@ -170,7 +170,7 @@ "SessionBackup.DeleteSingle.Text" = "%@ session will be removed from Keychain.\n\nAccount will not be logged out from Swiftgram."; "SessionBackup.RemoveFromApp.Title" = "Remove account from App?"; "SessionBackup.RemoveFromApp.Text" = "%@ session WILL BE REMOVED from Swiftgram! Session will remain active, so you can restore it later."; -"SessionBackup.Notice" = "Sessions are encrypted and stored in the device Keychain. Sessions never leave your device. NB: Sessions may still be revoked by Telegram or from another device."; +"SessionBackup.Notice" = "Sessions are encrypted and stored in the device Keychain. Sessions never leave your device.\n\nIMPORTANT: To restore sessions on a new device or after an OS reset, you MUST enable encrypted backups, otherwise Keychain won't be transfered.\n\nNOTE: Sessions may still be revoked by Telegram or from another device."; "MessageFilter.Title" = "Message Filter"; "MessageFilter.SubTitle" = "Remove distractions and reduce visibility of messages containing keywords below.\nKeywords are case-sensitive."; diff --git a/Swiftgram/SGWebSettingsScheme/Sources/File.swift b/Swiftgram/SGWebSettingsScheme/Sources/File.swift index b4842d2368..5f61cf945c 100644 --- a/Swiftgram/SGWebSettingsScheme/Sources/File.swift +++ b/Swiftgram/SGWebSettingsScheme/Sources/File.swift @@ -5,7 +5,7 @@ public struct SGWebSettings: Codable, Equatable { public let user: SGUserSettings public static var defaultValue: SGWebSettings { - return SGWebSettings(global: SGGlobalSettings(ytPip: true, qrLogin: true, storiesAvailable: false, canViewMessages: true, canEditSettings: false, canShowTelescope: false, announcementsData: nil, regdateFormat: "full", botMonkeys: [], forceReasons: [], unforceReasons: [], paymentsEnabled: true, duckyAppIconAvailable: true), user: SGUserSettings(contentReasons: [], canSendTelescope: false)) + return SGWebSettings(global: SGGlobalSettings(ytPip: true, qrLogin: true, storiesAvailable: false, canViewMessages: true, canEditSettings: false, canShowTelescope: false, announcementsData: nil, regdateFormat: "full", botMonkeys: [], forceReasons: [], unforceReasons: [], paymentsEnabled: true, duckyAppIconAvailable: true, canGrant: false), user: SGUserSettings(contentReasons: [], canSendTelescope: false)) } } @@ -23,6 +23,7 @@ public struct SGGlobalSettings: Codable, Equatable { public let unforceReasons: [Int64] public let paymentsEnabled: Bool public let duckyAppIconAvailable: Bool + public let canGrant: Bool } public struct SGBotMonkeys: Codable, Equatable { diff --git a/submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift index 44906797f0..476410c1eb 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift @@ -730,8 +730,8 @@ final class GiftOptionsScreenComponent: Component { let optionSpacing: CGFloat = 10.0 let optionWidth = (availableSize.width - sideInset * 2.0 - optionSpacing * 2.0) / 3.0 - - if isSelfGift || isChannelGift { + // MARK: Swiftgram + if isSelfGift || isChannelGift || { return true }() { contentHeight += 6.0 } else { if let premiumProducts = state.premiumProducts { diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index c1e0090601..44b113bf73 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -961,7 +961,8 @@ private func settingsItems(showProfileId: Bool, data: PeerInfoScreenData?, conte } - if context.currentAppConfiguration.with({ $0 }).sgWebSettings.global.paymentsEnabled || context.sharedContext.immediateSGStatus.status > 1 { + let sgWebSettings = context.currentAppConfiguration.with({ $0 }).sgWebSettings + if sgWebSettings.global.paymentsEnabled || context.sharedContext.immediateSGStatus.status > 1 { items[.swiftgram]!.append(PeerInfoScreenDisclosureItem(id: 0, label: .titleBadge(presentationData.strings.Settings_New, presentationData.theme.list.itemAccentColor), text: "Swiftgram Pro", icon: PresentationResourcesSettings.swiftgramPro, action: { interaction.openSettings(.swiftgramPro) })) @@ -1067,11 +1068,11 @@ private func settingsItems(showProfileId: Bool, data: PeerInfoScreenData?, conte interaction.openSettings(.businessSetup) })) // MARK: Swiftgram - /* - items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 104, label: .text(""), text: presentationData.strings.Settings_SendGift, icon: PresentationResourcesSettings.premiumGift, action: { - interaction.openSettings(.premiumGift) - })) - */ + if sgWebSettings.global.canGrant { + items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 104, label: .text(""), text: "Telegram Gifts", icon: PresentationResourcesSettings.premiumGift, action: { + interaction.openSettings(.premiumGift) + })) + } } if let settings = data.globalSettings { @@ -6529,8 +6530,8 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro } // MARK: Swiftgram - if ({ return false }()) && strongSelf.peerId.namespace == Namespaces.Peer.CloudUser, !user.isDeleted && user.botInfo == nil && !user.flags.contains(.isSupport) { - items.append(.action(ContextMenuActionItem(text: presentationData.strings.Profile_SendGift, icon: { theme in + if strongSelf.context.currentAppConfiguration.with({ $0 }).sgWebSettings.global.canGrant && strongSelf.peerId.namespace == Namespaces.Peer.CloudUser, !user.isDeleted && user.botInfo == nil && !user.flags.contains(.isSupport) { + items.append(.action(ContextMenuActionItem(text: "Telegram Gifts", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Gift"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.dismissWithoutContent) @@ -6689,8 +6690,8 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro } } else if let channel = peer as? TelegramChannel { if let cachedData = strongSelf.data?.cachedData as? CachedChannelData { - if case .broadcast = channel.info, cachedData.flags.contains(.starGiftsAvailable) { - items.append(.action(ContextMenuActionItem(text: presentationData.strings.Profile_SendGift, badge: nil, icon: { theme in + if case .broadcast = channel.info, cachedData.flags.contains(.starGiftsAvailable), strongSelf.context.currentAppConfiguration.with({ $0 }).sgWebSettings.global.canGrant { + items.append(.action(ContextMenuActionItem(text: "Telegram Gifts", badge: nil, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Gift"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.dismissWithoutContent) diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift index 60232b1e43..3302a58069 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift @@ -372,6 +372,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr self.panelButton = panelButton panelButton.title = self.peerId == self.context.account.peerId ? params.presentationData.strings.PeerInfo_Gifts_Send : params.presentationData.strings.PeerInfo_Gifts_SendGift + panelButton.title = "Telegram Gifts" panelButton.pressed = { [weak self] in self?.buttonPressed()