Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Swiftgram/SGSettingsUI/Sources/SGSettingsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private enum SGBoolSetting: String {
case disableSnapDeletionEffect
case stickerTimestamp
case hideRecordingButton
case hidePremiumBadge
case hideTabBar
case showDC
case showCreationDate
Expand Down Expand Up @@ -312,6 +313,7 @@ private func SGControllerEntries(presentationData: PresentationData, callListSet
entries.append(.toggle(id: id.count, section: .other, settingName: .secondsInMessages, value: SGSimpleSettings.shared.secondsInMessages, text: i18n("Settings.secondsInMessages", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .messageDoubleTapActionOutgoingEdit, value: SGSimpleSettings.shared.messageDoubleTapActionOutgoing == SGSimpleSettings.MessageDoubleTapAction.edit.rawValue, text: i18n("Settings.messageDoubleTapActionOutgoingEdit", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .hideRecordingButton, value: !SGSimpleSettings.shared.hideRecordingButton, text: i18n("Settings.RecordingButton", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .hidePremiumBadge, value: !SGSimpleSettings.shared.hidePremiumBadge, text: i18n("Settings.PremiumBadge", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableSnapDeletionEffect, value: !SGSimpleSettings.shared.disableSnapDeletionEffect, text: i18n("Settings.SnapDeletionEffect", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableSendAsButton, value: !SGSimpleSettings.shared.disableSendAsButton, text: i18n("Settings.SendAsButton", lang, strings.Conversation_SendMesageAs), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableGalleryCamera, value: !SGSimpleSettings.shared.disableGalleryCamera, text: i18n("Settings.GalleryCamera", lang), enabled: true))
Expand Down Expand Up @@ -466,6 +468,9 @@ public func sgSettingsController(context: AccountContext/*, focusOnItemTag: Int?
SGSimpleSettings.shared.contextShowJson = value
case .hideRecordingButton:
SGSimpleSettings.shared.hideRecordingButton = !value
case .hidePremiumBadge:
SGSimpleSettings.shared.hidePremiumBadge = !value
askForRestart?()
case .hideTabBar:
SGSimpleSettings.shared.hideTabBar = value
simplePromise.set(true) // Trigger update for 'enabled' field of other toggles
Expand Down
5 changes: 5 additions & 0 deletions Swiftgram/SGSimpleSettings/Sources/SimpleSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public class SGSimpleSettings {
case stickerSize
case stickerTimestamp
case hideRecordingButton
case hidePremiumBadge
case hideTabBar
case showDC
case showCreationDate
Expand Down Expand Up @@ -293,6 +294,7 @@ public class SGSimpleSettings {
Keys.stickerSize.rawValue: 100,
Keys.stickerTimestamp.rawValue: true,
Keys.hideRecordingButton.rawValue: false,
Keys.hidePremiumBadge.rawValue: false,
Keys.hideTabBar.rawValue: false,
Keys.showDC.rawValue: false,
Keys.showCreationDate.rawValue: true,
Expand Down Expand Up @@ -475,6 +477,9 @@ public class SGSimpleSettings {

@UserDefault(key: Keys.hideRecordingButton.rawValue)
public var hideRecordingButton: Bool

@UserDefault(key: Keys.hidePremiumBadge.rawValue)
public var hidePremiumBadge: Bool

@UserDefault(key: Keys.hideTabBar.rawValue)
public var hideTabBar: Bool
Expand Down
1 change: 1 addition & 0 deletions Swiftgram/SGStrings/Strings/en.lproj/SGLocalizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"Settings.Stickers.Timestamp" = "Show Timestamp";

"Settings.RecordingButton" = "Voice Recording Button";
"Settings.PremiumBadge" = "Premium Badge";

"Settings.DefaultEmojisFirst" = "Standard emojis first";
"Settings.DefaultEmojisFirst.Notice" = "Show standard emojis before premium in emoji keyboard";
Expand Down
1 change: 1 addition & 0 deletions submodules/CallListUI/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ swift_library(
"//submodules/TelegramUI/Components/EdgeEffect",
"//submodules/ComponentFlow",
"//submodules/Components/ComponentDisplayAdapters",
"//Swiftgram/SGSimpleSettings:SGSimpleSettings",
],
visibility = [
"//visibility:public",
Expand Down
3 changes: 2 additions & 1 deletion submodules/CallListUI/Sources/CallListCallItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AsyncDisplayKit
import Display
import SwiftSignalKit
import TelegramCore
import SGSimpleSettings
import TelegramPresentationData
import ItemListUI
import PresentationDataUtils
Expand Down Expand Up @@ -539,7 +540,7 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
currentCredibilityIconImage = PresentationResourcesChatList.fakeIcon(item.presentationData.theme, strings: item.presentationData.strings, type: .regular)
} else if peer.isVerified {
currentCredibilityIconImage = PresentationResourcesChatList.verifiedIcon(item.presentationData.theme)
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled {
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled && !SGSimpleSettings.shared.hidePremiumBadge {
currentCredibilityIconImage = PresentationResourcesChatList.premiumIcon(item.presentationData.theme)
}
}
Expand Down
4 changes: 2 additions & 2 deletions submodules/ChatListUI/Sources/ChatListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6912,9 +6912,9 @@ private final class ChatListLocationContext {
guard case let .user(user) = peer else {
return nil
}
if let emojiStatus = user.emojiStatus {
if let emojiStatus = user.emojiStatus, !SGSimpleSettings.shared.hidePremiumBadge {
return .emoji(emojiStatus)
} else if user.isPremium {
} else if user.isPremium && !SGSimpleSettings.shared.hidePremiumBadge {
return .premium
} else {
return nil
Expand Down
8 changes: 4 additions & 4 deletions submodules/ChatListUI/Sources/Node/ChatListItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3570,12 +3570,12 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
} else if peer.isFake {
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
} else if let emojiStatus = peer.emojiStatus {
} else if let emojiStatus = peer.emojiStatus, !SGSimpleSettings.shared.hidePremiumBadge {
currentStatusIconContent = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
if let color = emojiStatus.color {
currentStatusIconParticleColor = UIColor(rgb: UInt32(bitPattern: color))
}
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled {
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled && !SGSimpleSettings.shared.hidePremiumBadge {
currentCredibilityIconContent = .premium(color: item.presentationData.theme.list.itemAccentColor)
}

Expand All @@ -3601,12 +3601,12 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
} else if peer.isFake {
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
} else if let emojiStatus = peer.emojiStatus {
} else if let emojiStatus = peer.emojiStatus, !SGSimpleSettings.shared.hidePremiumBadge {
currentStatusIconContent = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
if let color = emojiStatus.color {
currentStatusIconParticleColor = UIColor(rgb: UInt32(bitPattern: color))
}
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled {
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled && !SGSimpleSettings.shared.hidePremiumBadge {
currentCredibilityIconContent = .premium(color: item.presentationData.theme.list.itemAccentColor)
}

Expand Down
1 change: 1 addition & 0 deletions submodules/Components/ReactionListContextMenuContent/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ swift_library(
"//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
"//submodules/TelegramUI/Components/EmojiStatusComponent:EmojiStatusComponent",
"//submodules/TextFormat:TextFormat",
"//Swiftgram/SGSimpleSettings:SGSimpleSettings",
],
visibility = [
"//visibility:public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Display
import ComponentFlow
import MultilineTextComponent
import SwiftSignalKit
import SGSimpleSettings
import TelegramCore
import AccountContext
import TelegramPresentationData
Expand Down Expand Up @@ -639,11 +640,11 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
currentCredibilityIcon = .text(color: presentationData.theme.chat.message.incoming.scamColor, string: presentationData.strings.Message_ScamAccount.uppercased())
} else if item.peer.isFake {
currentCredibilityIcon = .text(color: presentationData.theme.chat.message.incoming.scamColor, string: presentationData.strings.Message_FakeAccount.uppercased())
} else if let emojiStatus = item.peer.emojiStatus {
} else if let emojiStatus = item.peer.emojiStatus, !SGSimpleSettings.shared.hidePremiumBadge {
currentCredibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: UIColor(white: 0.0, alpha: 0.1), themeColor: presentationData.theme.list.itemAccentColor, loopMode: .count(2))
} else if item.peer.isVerified {
currentCredibilityIcon = .verified(fillColor: presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
} else if item.peer.isPremium && !premiumConfiguration.isPremiumDisabled {
} else if item.peer.isPremium && !premiumConfiguration.isPremiumDisabled && !SGSimpleSettings.shared.hidePremiumBadge {
currentCredibilityIcon = .premium(color: presentationData.theme.list.itemCheckColors.fillColor)
}

Expand Down
1 change: 1 addition & 0 deletions submodules/ContactsPeerItem/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ swift_library(
"//submodules/MoreButtonNode",
"//submodules/TextFormat",
"//submodules/TelegramUI/Components/TextNodeWithEntities",
"//Swiftgram/SGSimpleSettings:SGSimpleSettings",
],
visibility = [
"//visibility:public",
Expand Down
5 changes: 3 additions & 2 deletions submodules/ContactsPeerItem/Sources/ContactsPeerItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AsyncDisplayKit
import Display
import SwiftSignalKit
import TelegramCore
import SGSimpleSettings
import TelegramPresentationData
import TelegramUIPreferences
import ItemListUI
Expand Down Expand Up @@ -867,12 +868,12 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
credibilityStatusIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
} else if peer.isFake {
credibilityStatusIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
} else if let emojiStatus = peer.emojiStatus, !item.isAd {
} else if let emojiStatus = peer.emojiStatus, !item.isAd, !SGSimpleSettings.shared.hidePremiumBadge {
emojiStatusIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
if let color = emojiStatus.color {
emojiStatusParticleColor = UIColor(rgb: UInt32(bitPattern: color))
}
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled {
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled && !SGSimpleSettings.shared.hidePremiumBadge {
credibilityStatusIcon = .premium(color: item.presentationData.theme.list.itemAccentColor)
}

Expand Down
1 change: 1 addition & 0 deletions submodules/ItemListAvatarAndNameInfoItem/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ swift_library(
"//submodules/PhoneNumberFormat:PhoneNumberFormat",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramUI/Components/ListItemComponentAdaptor",
"//Swiftgram/SGSimpleSettings:SGSimpleSettings",
],
visibility = [
"//visibility:public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Display
import AsyncDisplayKit
import TelegramCore
import SwiftSignalKit
import SGSimpleSettings
import TelegramPresentationData
import ItemListUI
import PresentationDataUtils
Expand Down Expand Up @@ -441,7 +442,7 @@ public class ItemListAvatarAndNameInfoItemNode: ListViewItemNode, ItemListItemNo
credibilityIconOffset = 2.0
} else if peer.isVerified {
credibilityIconImage = PresentationResourcesItemList.verifiedPeerIcon(item.presentationData.theme)
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled {
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled && !SGSimpleSettings.shared.hidePremiumBadge {
credibilityIconImage = PresentationResourcesChatList.premiumIcon(item.presentationData.theme)
}
}
Expand Down
1 change: 1 addition & 0 deletions submodules/ItemListPeerItem/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ swift_library(
"//submodules/TelegramUI/Components/AnimationCache",
"//submodules/TelegramUI/Components/MultiAnimationRenderer",
"//submodules/TelegramUI/Components/TextNodeWithEntities",
"//Swiftgram/SGSimpleSettings:SGSimpleSettings",
],
visibility = [
"//visibility:public",
Expand Down
5 changes: 3 additions & 2 deletions submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Display
import AsyncDisplayKit
import SwiftSignalKit
import TelegramCore
import SGSimpleSettings
import TelegramPresentationData
import TelegramUIPreferences
import ItemListUI
Expand Down Expand Up @@ -938,12 +939,12 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
} else if item.peer.isFake {
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
} else if let emojiStatus = item.peer.emojiStatus {
} else if let emojiStatus = item.peer.emojiStatus, !SGSimpleSettings.shared.hidePremiumBadge {
credibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
if let color = emojiStatus.color {
credibilityParticleColor = UIColor(rgb: UInt32(bitPattern: color))
}
} else if item.peer.isPremium && !item.context.isPremiumDisabled {
} else if item.peer.isPremium && !item.context.isPremiumDisabled && !SGSimpleSettings.shared.hidePremiumBadge {
credibilityIcon = .premium(color: item.presentationData.theme.list.itemAccentColor)
}

Expand Down
3 changes: 2 additions & 1 deletion submodules/TelegramCallsUI/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ apple_resource_bundle(
)

sgdeps = [
"//Swiftgram/SGAppGroupIdentifier:SGAppGroupIdentifier"
"//Swiftgram/SGAppGroupIdentifier:SGAppGroupIdentifier",
"//Swiftgram/SGSimpleSettings:SGSimpleSettings",
]

swift_library(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Display
import AsyncDisplayKit
import SwiftSignalKit
import TelegramCore
import SGSimpleSettings
import TelegramPresentationData
import TelegramUIPreferences
import ItemListUI
Expand Down Expand Up @@ -840,11 +841,11 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode {
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
} else if item.peer.isFake {
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
} else if let emojiStatus = item.peer.emojiStatus {
} else if let emojiStatus = item.peer.emojiStatus, !SGSimpleSettings.shared.hidePremiumBadge {
credibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
} else if item.peer.isVerified {
credibilityIcon = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
} else if item.peer.isPremium && !premiumConfiguration.isPremiumDisabled {
} else if item.peer.isPremium && !premiumConfiguration.isPremiumDisabled && !SGSimpleSettings.shared.hidePremiumBadge {
credibilityIcon = .premium(color: item.presentationData.theme.list.itemAccentColor)
}

Expand Down
Loading