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