Improvements

This commit is contained in:
Kylmakalle 2025-03-03 23:19:17 +02:00
parent 14bd45a2ea
commit 83082cfe72
6 changed files with 21 additions and 18 deletions

View File

@ -519,10 +519,10 @@ struct FeatureRow<IconContent: View>: 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(

View File

@ -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.";

View File

@ -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 {

View File

@ -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 {

View File

@ -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: {
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)

View File

@ -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()