mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
03f46e711e
commit
7bc5068570
@ -758,10 +758,20 @@ public func legacyAssetPickerEnqueueMessages(context: AccountContext, account: A
|
||||
fileAttributes.append(.Animated)
|
||||
}
|
||||
}
|
||||
|
||||
if estimatedSize > 10 * 1024 * 1024 {
|
||||
fileAttributes.append(.hintFileIsLarge)
|
||||
}
|
||||
} else {
|
||||
if case let .asset(asset) = data, let phAsset = asset.backingAsset, let resource = PHAssetResource.assetResources(for: phAsset).last, let sizeValue = resource.value(forKey: "fileSize") as? CLong, sizeValue > 0 {
|
||||
let size = Int64(bitPattern: UInt64(sizeValue))
|
||||
|
||||
if size > 10 * 1024 * 1024 {
|
||||
fileAttributes.append(.hintFileIsLarge)
|
||||
}
|
||||
}
|
||||
}
|
||||
if estimatedSize > 10 * 1024 * 1024 {
|
||||
fileAttributes.append(.hintFileIsLarge)
|
||||
}
|
||||
|
||||
|
||||
var attributes: [MessageAttribute] = []
|
||||
|
||||
|
@ -898,7 +898,7 @@ func peerInfoScreenSettingsData(context: AccountContext, peerId: EnginePeer.Id,
|
||||
}
|
||||
}
|
||||
|
||||
func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, isSettings: Bool, isMyProfile: Bool, hintGroupInCommon: PeerId?, existingRequestsContext: PeerInvitationImportersContext?, chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>) -> Signal<PeerInfoScreenData, NoError> {
|
||||
func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, isSettings: Bool, isMyProfile: Bool, hintGroupInCommon: PeerId?, existingRequestsContext: PeerInvitationImportersContext?, chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, privacySettings: Signal<AccountPrivacySettings?, NoError>) -> Signal<PeerInfoScreenData, NoError> {
|
||||
return peerInfoScreenInputData(context: context, peerId: peerId, isSettings: isSettings)
|
||||
|> mapToSignal { inputData -> Signal<PeerInfoScreenData, NoError> in
|
||||
let wasUpgradedGroup = Atomic<Bool?>(value: nil)
|
||||
@ -1162,9 +1162,10 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
||||
hasSavedMessagesChats,
|
||||
hasSavedMessages,
|
||||
hasSavedMessageTags,
|
||||
peerInfoPersonalChannel(context: context, peerId: peerId, isSettings: false)
|
||||
peerInfoPersonalChannel(context: context, peerId: peerId, isSettings: false),
|
||||
privacySettings
|
||||
)
|
||||
|> map { peerView, availablePanes, globalNotificationSettings, encryptionKeyFingerprint, status, hasStories, hasStoryArchive, accountIsPremium, savedMessagesPeer, hasSavedMessagesChats, hasSavedMessages, hasSavedMessageTags, personalChannel -> PeerInfoScreenData in
|
||||
|> map { peerView, availablePanes, globalNotificationSettings, encryptionKeyFingerprint, status, hasStories, hasStoryArchive, accountIsPremium, savedMessagesPeer, hasSavedMessagesChats, hasSavedMessages, hasSavedMessageTags, personalChannel, privacySettings -> PeerInfoScreenData in
|
||||
var availablePanes = availablePanes
|
||||
|
||||
if isMyProfile {
|
||||
@ -1205,6 +1206,32 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
||||
|
||||
let peer = peerView.peers[userPeerId]
|
||||
|
||||
var globalSettings: TelegramGlobalSettings?
|
||||
if let privacySettings {
|
||||
globalSettings = TelegramGlobalSettings(
|
||||
suggestPhoneNumberConfirmation: false,
|
||||
suggestPasswordConfirmation: false,
|
||||
suggestPasswordSetup: false,
|
||||
premiumGracePeriod: false,
|
||||
accountsAndPeers: [],
|
||||
activeSessionsContext: nil,
|
||||
webSessionsContext: nil,
|
||||
otherSessionsCount: nil,
|
||||
proxySettings: ProxySettings(enabled: false, servers: [], activeServer: nil, useForCalls: false),
|
||||
notificationAuthorizationStatus: .notDetermined,
|
||||
notificationWarningSuppressed: false,
|
||||
notificationExceptions: nil,
|
||||
inAppNotificationSettings: InAppNotificationSettings(playSounds: false, vibrate: false, displayPreviews: false, totalUnreadCountDisplayStyle: .filtered, totalUnreadCountDisplayCategory: .chats, totalUnreadCountIncludeTags: .all, displayNameOnLockscreen: false, displayNotificationsFromAllAccounts: false, customSound: nil),
|
||||
privacySettings: privacySettings,
|
||||
unreadTrendingStickerPacks: 0,
|
||||
archivedStickerPacks: nil,
|
||||
userLimits: context.userLimits,
|
||||
bots: [],
|
||||
hasPassport: false,
|
||||
hasWatchApp: false,
|
||||
enableQRLogin: false)
|
||||
}
|
||||
|
||||
return PeerInfoScreenData(
|
||||
peer: peer,
|
||||
chatPeer: peerView.peers[peerId],
|
||||
@ -1222,7 +1249,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
||||
storyListContext: storyListContext,
|
||||
storyArchiveListContext: storyArchiveListContext,
|
||||
encryptionKeyFingerprint: encryptionKeyFingerprint,
|
||||
globalSettings: nil,
|
||||
globalSettings: globalSettings,
|
||||
invitations: nil,
|
||||
requests: nil,
|
||||
requestsContext: nil,
|
||||
|
@ -4251,7 +4251,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
strongSelf.controller?.present(emojiStatusSelectionController, in: .window(.root))
|
||||
}
|
||||
} else {
|
||||
screenData = peerInfoScreenData(context: context, peerId: peerId, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, isSettings: self.isSettings, isMyProfile: self.isMyProfile, hintGroupInCommon: hintGroupInCommon, existingRequestsContext: requestsContext, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder)
|
||||
if peerId == context.account.peerId {
|
||||
self.privacySettings.set(.single(nil) |> then(context.engine.privacy.requestAccountPrivacySettings() |> map(Optional.init)))
|
||||
} else {
|
||||
self.privacySettings.set(.single(nil))
|
||||
}
|
||||
|
||||
screenData = peerInfoScreenData(context: context, peerId: peerId, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, isSettings: self.isSettings, isMyProfile: self.isMyProfile, hintGroupInCommon: hintGroupInCommon, existingRequestsContext: requestsContext, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, privacySettings: self.privacySettings.get())
|
||||
|
||||
var previousTimestamp: Double?
|
||||
self.headerNode.displayPremiumIntro = { [weak self] sourceView, peerStatus, emojiStatusFileAndPack, white in
|
||||
|
Loading…
x
Reference in New Issue
Block a user