Merge commit '0dd113dd22eee5251b76088dd937f0716494817a'

This commit is contained in:
Ali 2023-04-18 18:33:38 +04:00
commit f95f7b4afc
6 changed files with 46 additions and 14 deletions

View File

@ -47,6 +47,7 @@ CGSize TGPhotoEditorScreenImageMaxSize();
extern const CGSize TGPhotoEditorResultImageMaxSize; extern const CGSize TGPhotoEditorResultImageMaxSize;
extern const CGSize TGPhotoEditorResultImageWallpaperMaxSize; extern const CGSize TGPhotoEditorResultImageWallpaperMaxSize;
extern const CGSize TGPhotoEditorResultImageAvatarMaxSize;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -498,7 +498,7 @@
}] map:^UIImage *(UIImage *image) }] map:^UIImage *(UIImage *image)
{ {
if (avatar) { if (avatar) {
CGFloat maxSide = [GPUImageContext maximumTextureSizeForThisDevice]; CGFloat maxSide = MIN(TGPhotoEditorResultImageAvatarMaxSize.width, [GPUImageContext maximumTextureSizeForThisDevice]);
if (MAX(image.size.width, image.size.height) > maxSide) { if (MAX(image.size.width, image.size.height) > maxSide) {
CGSize fittedSize = TGScaleToFit(image.size, CGSizeMake(maxSide, maxSide)); CGSize fittedSize = TGScaleToFit(image.size, CGSizeMake(maxSide, maxSide));
return TGScaleImageToPixelSize(image, fittedSize); return TGScaleImageToPixelSize(image, fittedSize);

View File

@ -8,6 +8,7 @@
const CGSize TGPhotoEditorResultImageMaxSize = { 1280, 1280 }; const CGSize TGPhotoEditorResultImageMaxSize = { 1280, 1280 };
const CGSize TGPhotoEditorResultImageWallpaperMaxSize = { 2048, 2048 }; const CGSize TGPhotoEditorResultImageWallpaperMaxSize = { 2048, 2048 };
const CGSize TGPhotoEditorResultImageAvatarMaxSize = { 2048, 2048 };
const CGSize TGPhotoEditorScreenImageHardLimitSize = { 1280, 1280 }; const CGSize TGPhotoEditorScreenImageHardLimitSize = { 1280, 1280 };
const CGSize TGPhotoEditorScreenImageHardLimitLegacySize = { 750, 750 }; const CGSize TGPhotoEditorScreenImageHardLimitLegacySize = { 750, 750 };

View File

@ -349,7 +349,7 @@ private func channelAdminsControllerEntries(presentationData: PresentationData,
if case .group = peer.info { if case .group = peer.info {
isGroup = true isGroup = true
} }
entries.append(.recentActions(presentationData.theme, presentationData.strings.Group_Info_AdminLog)) //entries.append(.recentActions(presentationData.theme, presentationData.strings.Group_Info_AdminLog))
if isGroup && peer.hasPermission(.deleteAllMessages) && (antiSpamAvailable || antiSpamEnabled) { if isGroup && peer.hasPermission(.deleteAllMessages) && (antiSpamAvailable || antiSpamEnabled) {
entries.append(.antiSpam(presentationData.theme, presentationData.strings.Group_Management_AntiSpam, antiSpamEnabled)) entries.append(.antiSpam(presentationData.theme, presentationData.strings.Group_Management_AntiSpam, antiSpamEnabled))

View File

@ -337,11 +337,10 @@ final class ManagedAudioRecorderContext {
self.toneTimer?.invalidate() self.toneTimer?.invalidate()
} }
func start() { private func setupAudioUnit() {
assert(self.queue.isCurrent()) guard self.audioUnit.with({ $0 }) == nil else {
return
self.paused = false }
var desc = AudioComponentDescription() var desc = AudioComponentDescription()
desc.componentType = kAudioUnitType_Output desc.componentType = kAudioUnitType_Output
desc.componentSubType = kAudioUnitSubType_RemoteIO desc.componentSubType = kAudioUnitSubType_RemoteIO
@ -395,6 +394,12 @@ final class ManagedAudioRecorderContext {
} }
let _ = self.audioUnit.swap(audioUnit) let _ = self.audioUnit.swap(audioUnit)
}
func start() {
assert(self.queue.isCurrent())
self.paused = false
if self.audioSessionDisposable == nil { if self.audioSessionDisposable == nil {
let queue = self.queue let queue = self.queue
@ -402,6 +407,7 @@ final class ManagedAudioRecorderContext {
queue.async { queue.async {
if let strongSelf = self, !strongSelf.paused { if let strongSelf = self, !strongSelf.paused {
strongSelf.hasAudioSession = true strongSelf.hasAudioSession = true
strongSelf.setupAudioUnit()
strongSelf.audioSessionAcquired(headset: state.isHeadsetConnected) strongSelf.audioSessionAcquired(headset: state.isHeadsetConnected)
} }
} }

View File

@ -514,6 +514,7 @@ private final class PeerInfoInteraction {
let editingOpenDiscussionGroupSetup: () -> Void let editingOpenDiscussionGroupSetup: () -> Void
let editingToggleMessageSignatures: (Bool) -> Void let editingToggleMessageSignatures: (Bool) -> Void
let openParticipantsSection: (PeerInfoParticipantsSection) -> Void let openParticipantsSection: (PeerInfoParticipantsSection) -> Void
let openRecentActions: () -> Void
let editingOpenPreHistorySetup: () -> Void let editingOpenPreHistorySetup: () -> Void
let editingOpenAutoremoveMesages: () -> Void let editingOpenAutoremoveMesages: () -> Void
let openPermissions: () -> Void let openPermissions: () -> Void
@ -564,6 +565,7 @@ private final class PeerInfoInteraction {
editingOpenDiscussionGroupSetup: @escaping () -> Void, editingOpenDiscussionGroupSetup: @escaping () -> Void,
editingToggleMessageSignatures: @escaping (Bool) -> Void, editingToggleMessageSignatures: @escaping (Bool) -> Void,
openParticipantsSection: @escaping (PeerInfoParticipantsSection) -> Void, openParticipantsSection: @escaping (PeerInfoParticipantsSection) -> Void,
openRecentActions: @escaping () -> Void,
editingOpenPreHistorySetup: @escaping () -> Void, editingOpenPreHistorySetup: @escaping () -> Void,
editingOpenAutoremoveMesages: @escaping () -> Void, editingOpenAutoremoveMesages: @escaping () -> Void,
openPermissions: @escaping () -> Void, openPermissions: @escaping () -> Void,
@ -613,6 +615,7 @@ private final class PeerInfoInteraction {
self.editingOpenDiscussionGroupSetup = editingOpenDiscussionGroupSetup self.editingOpenDiscussionGroupSetup = editingOpenDiscussionGroupSetup
self.editingToggleMessageSignatures = editingToggleMessageSignatures self.editingToggleMessageSignatures = editingToggleMessageSignatures
self.openParticipantsSection = openParticipantsSection self.openParticipantsSection = openParticipantsSection
self.openRecentActions = openRecentActions
self.editingOpenPreHistorySetup = editingOpenPreHistorySetup self.editingOpenPreHistorySetup = editingOpenPreHistorySetup
self.editingOpenAutoremoveMesages = editingOpenAutoremoveMesages self.editingOpenAutoremoveMesages = editingOpenAutoremoveMesages
self.openPermissions = openPermissions self.openPermissions = openPermissions
@ -1486,6 +1489,7 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
let ItemMembers = 9 let ItemMembers = 9
let ItemMemberRequests = 10 let ItemMemberRequests = 10
let ItemBanned = 11 let ItemBanned = 11
let ItemRecentActions = 12
let isCreator = channel.flags.contains(.isCreator) let isCreator = channel.flags.contains(.isCreator)
@ -1602,6 +1606,10 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
items[.peerAdditionalSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemBanned, label: .text("\(bannedCount == 0 ? "" : "\(presentationStringsFormattedNumber(bannedCount, presentationData.dateTimeFormat.groupingSeparator))")"), text: presentationData.strings.GroupInfo_Permissions_Removed, icon: UIImage(bundleImageName: "Chat/Info/GroupRemovedIcon"), action: { items[.peerAdditionalSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemBanned, label: .text("\(bannedCount == 0 ? "" : "\(presentationStringsFormattedNumber(bannedCount, presentationData.dateTimeFormat.groupingSeparator))")"), text: presentationData.strings.GroupInfo_Permissions_Removed, icon: UIImage(bundleImageName: "Chat/Info/GroupRemovedIcon"), action: {
interaction.openParticipantsSection(.banned) interaction.openParticipantsSection(.banned)
})) }))
items[.peerAdditionalSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemRecentActions, label: .none, text: presentationData.strings.Group_Info_AdminLog, icon: UIImage(bundleImageName: "Chat/Info/RecentActionsIcon"), action: {
interaction.openRecentActions()
}))
} }
} }
@ -1621,13 +1629,14 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
let ItemAdmins = 108 let ItemAdmins = 108
let ItemMemberRequests = 109 let ItemMemberRequests = 109
let ItemRemovedUsers = 110 let ItemRemovedUsers = 110
let ItemLocationHeader = 111 let ItemRecentActions = 111
let ItemLocation = 112 let ItemLocationHeader = 112
let ItemLocationSetup = 113 let ItemLocation = 113
let ItemDeleteGroup = 114 let ItemLocationSetup = 114
let ItemReactions = 115 let ItemDeleteGroup = 115
let ItemTopics = 116 let ItemReactions = 116
let ItemTopicsText = 117 let ItemTopics = 117
let ItemTopicsText = 118
let isCreator = channel.flags.contains(.isCreator) let isCreator = channel.flags.contains(.isCreator)
let isPublic = channel.addressName != nil let isPublic = channel.addressName != nil
@ -1832,6 +1841,10 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemRemovedUsers, label: .text(cachedData.participantsSummary.kickedCount.flatMap { $0 > 0 ? "\(presentationStringsFormattedNumber($0, presentationData.dateTimeFormat.groupingSeparator))" : "" } ?? ""), text: presentationData.strings.GroupInfo_Permissions_Removed, icon: UIImage(bundleImageName: "Chat/Info/GroupRemovedIcon"), action: { items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemRemovedUsers, label: .text(cachedData.participantsSummary.kickedCount.flatMap { $0 > 0 ? "\(presentationStringsFormattedNumber($0, presentationData.dateTimeFormat.groupingSeparator))" : "" } ?? ""), text: presentationData.strings.GroupInfo_Permissions_Removed, icon: UIImage(bundleImageName: "Chat/Info/GroupRemovedIcon"), action: {
interaction.openParticipantsSection(.banned) interaction.openParticipantsSection(.banned)
})) }))
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemRecentActions, label: .none, text: presentationData.strings.Group_Info_AdminLog, icon: UIImage(bundleImageName: "Chat/Info/RecentActionsIcon"), action: {
interaction.openRecentActions()
}))
} }
if isCreator { if isCreator {
@ -2207,6 +2220,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
openParticipantsSection: { [weak self] section in openParticipantsSection: { [weak self] section in
self?.openParticipantsSection(section: section) self?.openParticipantsSection(section: section)
}, },
openRecentActions: { [weak self] in
self?.openRecentActions()
},
editingOpenPreHistorySetup: { [weak self] in editingOpenPreHistorySetup: { [weak self] in
self?.editingOpenPreHistorySetup() self?.editingOpenPreHistorySetup()
}, },
@ -6726,6 +6742,14 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
} }
} }
private func openRecentActions() {
guard let peer = self.data?.peer else {
return
}
let controller = self.context.sharedContext.makeChatRecentActionsController(context: self.context, peer: peer, adminPeerId: nil)
self.controller?.push(controller)
}
private func editingOpenPreHistorySetup() { private func editingOpenPreHistorySetup() {
guard let data = self.data, let peer = data.peer else { guard let data = self.data, let peer = data.peer else {
return return