mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various fixes
This commit is contained in:
@@ -346,7 +346,7 @@ public func incomingMessagePrivacyScreen(context: AccountContext, value: GlobalP
|
||||
updateState { state in
|
||||
var updatedState = state
|
||||
updatedState.disableFor = updatedPeerIds
|
||||
return state
|
||||
return updatedState
|
||||
}
|
||||
let settings: SelectivePrivacySettings = .enableContacts(enableFor: updatedPeerIds, disableFor: [:], enableForPremium: false, enableForBots: false)
|
||||
let _ = context.engine.privacy.updateSelectiveAccountPrivacySettings(type: .noPaidMessages, settings: settings).start()
|
||||
|
||||
@@ -432,7 +432,11 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
|
||||
})
|
||||
case let .messagePrivacy(theme, value, hasPremium):
|
||||
let label: String
|
||||
switch value {
|
||||
var effectiveValue = value
|
||||
if !hasPremium {
|
||||
effectiveValue = .everybody
|
||||
}
|
||||
switch effectiveValue {
|
||||
case .everybody:
|
||||
label = presentationData.strings.Settings_Privacy_Messages_ValueEveryone
|
||||
case .requirePremium:
|
||||
@@ -669,7 +673,7 @@ private func privacyAndSecurityControllerEntries(
|
||||
entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.forwards)))
|
||||
entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.voiceCalls)))
|
||||
if !isPremiumDisabled || isPremium {
|
||||
entries.append(.voiceMessagePrivacy(presentationData.theme, presentationData.strings.Privacy_VoiceMessages, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.voiceMessages), isPremium))
|
||||
entries.append(.voiceMessagePrivacy(presentationData.theme, presentationData.strings.Privacy_VoiceMessages, stringForSelectiveSettings(strings: presentationData.strings, settings: isPremium ? privacySettings.voiceMessages : .enableEveryone(disableFor: [:])), isPremium))
|
||||
entries.append(.messagePrivacy(presentationData.theme, privacySettings.globalSettings.nonContactChatsPrivacy, isPremium))
|
||||
}
|
||||
entries.append(.groupPrivacy(presentationData.theme, presentationData.strings.PrivacySettings_InviteItem, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.groupInvitations)))
|
||||
|
||||
@@ -253,7 +253,7 @@ public final class StarsImageComponent: Component {
|
||||
case media([AnyMediaReference])
|
||||
case extendedMedia([TelegramExtendedMedia])
|
||||
case transactionPeer(StarsContext.State.Transaction.Peer)
|
||||
case gift(Int64)
|
||||
case gift(Int32)
|
||||
case color(UIColor)
|
||||
|
||||
public static func == (lhs: StarsImageComponent.Subject, rhs: StarsImageComponent.Subject) -> Bool {
|
||||
@@ -850,14 +850,7 @@ public final class StarsImageComponent: Component {
|
||||
if let current = self.animationNode {
|
||||
animationNode = current
|
||||
} else {
|
||||
let stickerName: String
|
||||
if count <= 1000 {
|
||||
stickerName = "Gift3"
|
||||
} else if count < 2500 {
|
||||
stickerName = "Gift6"
|
||||
} else {
|
||||
stickerName = "Gift12"
|
||||
}
|
||||
let stickerName: String = "Gift\(count)"
|
||||
animationNode = DefaultAnimatedStickerNodeImpl()
|
||||
animationNode.autoplay = true
|
||||
animationNode.setup(source: AnimatedStickerNodeLocalFileSource(name: stickerName), width: 384, height: 384, playbackMode: .still(.end), mode: .direct(cachePathPrefix: nil))
|
||||
|
||||
@@ -243,6 +243,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
|
||||
var giftAvailability: StarGift.Gift.Availability?
|
||||
var isRefProgram = false
|
||||
var isPaidMessage = false
|
||||
var premiumGiftMonths: Int32?
|
||||
|
||||
var delayedCloseOnOpenPeer = true
|
||||
switch subject {
|
||||
@@ -456,6 +457,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
|
||||
switch transaction.peer {
|
||||
case let .peer(peer):
|
||||
if let months = transaction.premiumGiftMonths {
|
||||
premiumGiftMonths = months
|
||||
titleText = strings.Stars_Transaction_TelegramPremium(months)
|
||||
} else if transaction.flags.contains(.isPaidMessage) {
|
||||
isPaidMessage = true
|
||||
@@ -679,8 +681,18 @@ private final class StarsTransactionSheetContent: CombinedComponent {
|
||||
|
||||
let imageSubject: StarsImageComponent.Subject
|
||||
var imageIcon: StarsImageComponent.Icon?
|
||||
if isGift {
|
||||
imageSubject = .gift(count.value)
|
||||
if let premiumGiftMonths {
|
||||
imageSubject = .gift(premiumGiftMonths)
|
||||
} else if isGift {
|
||||
var value: Int32 = 3
|
||||
if count.value <= 1000 {
|
||||
value = 3
|
||||
} else if count.value < 2500 {
|
||||
value = 6
|
||||
} else {
|
||||
value = 12
|
||||
}
|
||||
imageSubject = .gift(value)
|
||||
} else if !media.isEmpty {
|
||||
imageSubject = .media(media)
|
||||
} else if let photo {
|
||||
@@ -1852,13 +1864,16 @@ public class StarsTransactionScreen: ViewControllerComponentContainer {
|
||||
guard let self, let navigationController = self.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
self.dismissAnimated()
|
||||
let _ = (context.engine.privacy.requestAccountPrivacySettings()
|
||||
|> deliverOnMainQueue).start(next: { [weak navigationController] privacySettings in
|
||||
|> deliverOnMainQueue).start(next: { [weak self, weak navigationController] privacySettings in
|
||||
let controller = context.sharedContext.makeIncomingMessagePrivacyScreen(context: context, value: privacySettings.globalSettings.nonContactChatsPrivacy, exceptions: privacySettings.noPaidMessages, update: { settingValue in
|
||||
let _ = context.engine.privacy.updateNonContactChatsPrivacy(value: settingValue).start()
|
||||
})
|
||||
navigationController?.pushViewController(controller)
|
||||
|
||||
Queue.mainQueue().after(0.6) {
|
||||
self?.dismissAnimated()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user