mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-19 12:10:55 +00:00
Merge commit 'a03f9d45403f7ebc32db6625c80863c97531f28f'
This commit is contained in:
commit
d3d96d0fe1
@ -2328,6 +2328,7 @@
|
||||
"$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib",
|
||||
"$(PROJECT_DIR)/third-party/libwebp/lib",
|
||||
);
|
||||
MODULEMAP_PRIVATE_FILE = "$(SRCROOT)/TelegramCore/module.private.modulemap";
|
||||
OTHER_LDFLAGS = "-Wl,-dead_strip";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramCore;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -2369,6 +2370,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MODULEMAP_PRIVATE_FILE = "$(SRCROOT)/TelegramCore/module.private-mac.modulemap";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Telegram.TelegramCoreMac;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
@ -2448,6 +2450,7 @@
|
||||
"$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib",
|
||||
"$(PROJECT_DIR)/third-party/libwebp/lib",
|
||||
);
|
||||
MODULEMAP_PRIVATE_FILE = "$(SRCROOT)/TelegramCore/module.private.modulemap";
|
||||
OTHER_LDFLAGS = "-Wl,-dead_strip";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramCore;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -2592,6 +2595,7 @@
|
||||
"$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib",
|
||||
"$(PROJECT_DIR)/third-party/libwebp/lib",
|
||||
);
|
||||
MODULEMAP_PRIVATE_FILE = "$(SRCROOT)/TelegramCore/module.private.modulemap";
|
||||
OTHER_LDFLAGS = "-Wl,-dead_strip";
|
||||
OTHER_SWIFT_FLAGS = "-DDEBUG -Xfrontend -debug-time-function-bodies";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramCore;
|
||||
@ -2629,6 +2633,7 @@
|
||||
"$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib",
|
||||
"$(PROJECT_DIR)/third-party/libwebp/lib",
|
||||
);
|
||||
MODULEMAP_PRIVATE_FILE = "$(SRCROOT)/TelegramCore/module.private.modulemap";
|
||||
OTHER_LDFLAGS = "-Wl,-dead_strip";
|
||||
OTHER_SWIFT_FLAGS = "-DDEBUG -Xfrontend -debug-time-function-bodies";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramCore;
|
||||
@ -2682,6 +2687,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MODULEMAP_PRIVATE_FILE = "$(SRCROOT)/TelegramCore/module.private-mac.modulemap";
|
||||
OTHER_SWIFT_FLAGS = "-DDEBUG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Telegram.TelegramCoreMac;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -2712,6 +2718,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MODULEMAP_PRIVATE_FILE = "$(SRCROOT)/TelegramCore/module.private-mac.modulemap";
|
||||
OTHER_SWIFT_FLAGS = "-DDEBUG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Telegram.TelegramCoreMac;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -2741,6 +2748,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MODULEMAP_PRIVATE_FILE = "$(SRCROOT)/TelegramCore/module.private-mac.modulemap";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Telegram.TelegramCoreMac;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
|
@ -678,7 +678,7 @@ public class Account {
|
||||
} else {
|
||||
return .complete()
|
||||
}
|
||||
}
|
||||
}
|
||||
self.updatedPresenceDisposable.set(updatedPresence.start())
|
||||
|
||||
self.deviceContactListDisposable.set(managedDeviceContacts(postbox: self.postbox, network: self.network, deviceContacts: self.deviceContactList.get()).start())
|
||||
|
@ -18,6 +18,7 @@ public func convertGroupToSupergroup(account: Account, peerId: PeerId) -> Signal
|
||||
|> mapError { _ -> ConvertGroupToSupergroupError in
|
||||
return .generic
|
||||
}
|
||||
|> timeout(5.0, queue: Queue.concurrentDefaultQueue(), alternate: .fail(.generic))
|
||||
|> mapToSignal { updates -> Signal<PeerId, ConvertGroupToSupergroupError> in
|
||||
account.stateManager.addUpdates(updates)
|
||||
var createdPeerId: PeerId?
|
||||
|
@ -10,6 +10,7 @@ fileprivate final class FunctionDescription: CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
||||
dict[-1471112230] = { return $0.readInt32() }
|
||||
|
@ -13,6 +13,7 @@ import Foundation
|
||||
|
||||
public struct TelegramPeerPhoto {
|
||||
public let image: TelegramMediaImage
|
||||
public let reference:TelegramMediaRemoteImageReference
|
||||
public let index:Int
|
||||
public let totalCount:Int
|
||||
}
|
||||
@ -45,13 +46,16 @@ public func requestPeerPhotos(account:Account, peerId:PeerId) -> Signal<[Telegra
|
||||
for i in 0 ..< photos.count {
|
||||
let photo = photos[i]
|
||||
let image:TelegramMediaImage
|
||||
let reference: TelegramMediaRemoteImageReference
|
||||
switch photo {
|
||||
case let .photo(data):
|
||||
image = TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.CloudImage, id: data.id), representations: telegramMediaImageRepresentationsFromApiSizes(data.sizes))
|
||||
reference = .remoteImage(imageId: data.id, accessHash: data.accessHash)
|
||||
case let .photoEmpty(id: id):
|
||||
image = TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.CloudImage, id: id), representations: [])
|
||||
reference = .remoteImage(imageId: id, accessHash: 0)
|
||||
}
|
||||
images.append(TelegramPeerPhoto(image: image, index: i, totalCount: totalCount))
|
||||
images.append(TelegramPeerPhoto(image: image, reference: reference, index: i, totalCount: totalCount))
|
||||
}
|
||||
|
||||
return images
|
||||
@ -116,7 +120,7 @@ public func requestPeerPhotos(account:Account, peerId:PeerId) -> Signal<[Telegra
|
||||
switch media.action {
|
||||
case let .photoUpdated(image):
|
||||
if let image = image {
|
||||
photos.append(TelegramPeerPhoto(image: image, index: index, totalCount: messages.count))
|
||||
photos.append(TelegramPeerPhoto(image: image, reference: .none, index: index, totalCount: messages.count))
|
||||
}
|
||||
default:
|
||||
break
|
||||
|
@ -7,6 +7,7 @@ import Foundation
|
||||
|
||||
public enum TelegramMediaRemoteImageReference {
|
||||
case remoteImage(imageId: Int64, accessHash: Int64)
|
||||
case none
|
||||
}
|
||||
|
||||
public final class TelegramMediaImage: Media, Equatable {
|
||||
|
@ -241,42 +241,42 @@ func parsedTelegramProfilePhoto(_ photo: Api.UserProfilePhoto?) -> [TelegramMedi
|
||||
public extension TelegramUser {
|
||||
public convenience init(user: Api.User) {
|
||||
switch user {
|
||||
case let .user(flags, id, accessHash, firstName, lastName, username, phone, photo, _, _, _, botInlinePlaceholder, _):
|
||||
var telegramPhoto: [TelegramMediaImageRepresentation] = []
|
||||
if let photo = photo {
|
||||
switch photo {
|
||||
case let .userProfilePhoto(_, photoSmall, photoBig):
|
||||
if let smallResource = mediaResourceFromApiFileLocation(photoSmall, size: nil), let largeResource = mediaResourceFromApiFileLocation(photoBig, size: nil) {
|
||||
telegramPhoto.append(TelegramMediaImageRepresentation(dimensions: CGSize(width: 80.0, height: 80.0), resource: smallResource))
|
||||
telegramPhoto.append(TelegramMediaImageRepresentation(dimensions: CGSize(width: 640.0, height: 640.0), resource: largeResource))
|
||||
}
|
||||
case .userProfilePhotoEmpty:
|
||||
break
|
||||
case let .user(flags, id, accessHash, firstName, lastName, username, phone, photo, _, _, _, botInlinePlaceholder, _):
|
||||
var telegramPhoto: [TelegramMediaImageRepresentation] = []
|
||||
if let photo = photo {
|
||||
switch photo {
|
||||
case let .userProfilePhoto(_, photoSmall, photoBig):
|
||||
if let smallResource = mediaResourceFromApiFileLocation(photoSmall, size: nil), let largeResource = mediaResourceFromApiFileLocation(photoBig, size: nil) {
|
||||
telegramPhoto.append(TelegramMediaImageRepresentation(dimensions: CGSize(width: 80.0, height: 80.0), resource: smallResource))
|
||||
telegramPhoto.append(TelegramMediaImageRepresentation(dimensions: CGSize(width: 640.0, height: 640.0), resource: largeResource))
|
||||
}
|
||||
case .userProfilePhotoEmpty:
|
||||
break
|
||||
}
|
||||
|
||||
var userFlags: UserInfoFlags = []
|
||||
if (flags & (1 << 17)) != 0 {
|
||||
userFlags.insert(.isVerified)
|
||||
}
|
||||
|
||||
var userFlags: UserInfoFlags = []
|
||||
if (flags & (1 << 17)) != 0 {
|
||||
userFlags.insert(.isVerified)
|
||||
}
|
||||
|
||||
var botInfo: BotUserInfo?
|
||||
if (flags & (1 << 14)) != 0 {
|
||||
var botFlags = BotUserInfoFlags()
|
||||
if (flags & (1 << 15)) != 0 {
|
||||
botFlags.insert(.hasAccessToChatHistory)
|
||||
}
|
||||
|
||||
var botInfo: BotUserInfo?
|
||||
if (flags & (1 << 14)) != 0 {
|
||||
var botFlags = BotUserInfoFlags()
|
||||
if (flags & (1 << 15)) != 0 {
|
||||
botFlags.insert(.hasAccessToChatHistory)
|
||||
}
|
||||
if (flags & (1 << 16)) == 0 {
|
||||
botFlags.insert(.worksWithGroups)
|
||||
}
|
||||
if (flags & (1 << 21)) == 0 {
|
||||
botFlags.insert(.requiresGeolocationForInlineRequests)
|
||||
}
|
||||
botInfo = BotUserInfo(flags: botFlags, inlinePlaceholder: botInlinePlaceholder)
|
||||
if (flags & (1 << 16)) == 0 {
|
||||
botFlags.insert(.worksWithGroups)
|
||||
}
|
||||
self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: id), accessHash: accessHash, firstName: firstName, lastName: lastName, username: username, phone: phone, photo: telegramPhoto, botInfo: botInfo, flags: userFlags)
|
||||
case let .userEmpty(id):
|
||||
self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: id), accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, flags: [])
|
||||
if (flags & (1 << 21)) == 0 {
|
||||
botFlags.insert(.requiresGeolocationForInlineRequests)
|
||||
}
|
||||
botInfo = BotUserInfo(flags: botFlags, inlinePlaceholder: botInlinePlaceholder)
|
||||
}
|
||||
self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: id), accessHash: accessHash, firstName: firstName, lastName: lastName, username: username, phone: phone, photo: telegramPhoto, botInfo: botInfo, flags: userFlags)
|
||||
case let .userEmpty(id):
|
||||
self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: id), accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, flags: [])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public func updateGroupSpecificStickerset(postbox: Postbox, network: Network, pe
|
||||
}
|
||||
if let inputChannel = apiInputChannel(peer) {
|
||||
let api = Api.functions.channels.setStickers(channel: inputChannel, stickerset: inputStickerset)
|
||||
return network.request(api) |> retryRequest |> mapToSignal { value in
|
||||
return network.request(api) |> mapError {_ in return} |> mapToSignal { value in
|
||||
switch value {
|
||||
case .boolTrue:
|
||||
return postbox.modify { modifier -> Void in
|
||||
|
3
TelegramCore/module.private-mac.modulemap
Normal file
3
TelegramCore/module.private-mac.modulemap
Normal file
@ -0,0 +1,3 @@
|
||||
module TelegramCoreMac.TelegramCorePrivate {
|
||||
export *
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user