Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2020-08-25 19:06:33 +03:00
commit 547963c522
9 changed files with 43 additions and 36 deletions

@ -1 +1 @@
Subproject commit b8755bd2884d6bf651827c30e00bd0ea318e41a2 Subproject commit 501b4afb27745c4813a88ffa28acd901408014e4

@ -1 +1 @@
Subproject commit d6f9a87d70781e92b95b9344c7d21d921ccc3ae2 Subproject commit 748e7e2b1ee5e8976ba873394cbd5e32b61818c7

@ -1 +1 @@
Subproject commit 44e8c29afe3baa7f5fc434f4a7e83f7ac786644e Subproject commit 6408d85da799ec2af053c4e2883dce3ce6d30f08

@ -1 +1 @@
Subproject commit e890fb6c88846454c4f69abd8d265a302c0e80e4 Subproject commit ee185c4c20ea4384bc3cbf8ccd8705c904154abb

View File

@ -323,8 +323,8 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q
|> mapToSignal { result, additionalResult -> Signal<(SearchMessagesResult, SearchMessagesState), NoError> in |> mapToSignal { result, additionalResult -> Signal<(SearchMessagesResult, SearchMessagesState), NoError> in
return account.postbox.transaction { transaction -> (SearchMessagesResult, SearchMessagesState) in return account.postbox.transaction { transaction -> (SearchMessagesResult, SearchMessagesState) in
var additional: SearchMessagesPeerState? = mergedState(transaction: transaction, state: state?.additional, result: additionalResult) var additional: SearchMessagesPeerState? = mergedState(transaction: transaction, state: state?.additional, result: additionalResult)
if state?.additional == nil, case .general = location { if state?.additional == nil, case let .general(tags) = location {
let secretMessages = transaction.searchMessages(peerId: nil, query: query, tags: nil) let secretMessages = transaction.searchMessages(peerId: nil, query: query, tags: tags)
var readStates: [PeerId: CombinedPeerReadState] = [:] var readStates: [PeerId: CombinedPeerReadState] = [:]
for message in secretMessages { for message in secretMessages {
if let readState = transaction.getCombinedPeerReadState(message.id.peerId) { if let readState = transaction.getCombinedPeerReadState(message.id.peerId) {

View File

@ -102,14 +102,16 @@ typedef NS_ENUM(int32_t, OngoingCallDataSavingWebrtc) {
- (void)setOnIsMirroredUpdated:(void (^ _Nullable)(bool))onIsMirroredUpdated; - (void)setOnIsMirroredUpdated:(void (^ _Nullable)(bool))onIsMirroredUpdated;
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
- (void)setVideoContentMode:(CALayerContentsGravity _Nonnull )mode; - (void)setVideoContentMode:(CALayerContentsGravity _Nonnull )mode;
- (void)setForceMirrored:(bool)forceMirrored;
#endif #endif
@end @end
@interface OngoingCallThreadLocalContextVideoCapturer : NSObject @interface OngoingCallThreadLocalContextVideoCapturer : NSObject
- (instancetype _Nonnull)init; - (instancetype _Nonnull)init;
- (instancetype _Nonnull)initWithDeviceId:(NSString * _Nonnull)deviceId;
- (void)switchVideoInput:(bool)isFront; - (void)switchVideoInput:(NSString * _Nonnull)deviceId;
- (void)setIsVideoEnabled:(bool)isVideoEnabled; - (void)setIsVideoEnabled:(bool)isVideoEnabled;
- (void)makeOutgoingVideoView:(void (^_Nonnull)(UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable))completion; - (void)makeOutgoingVideoView:(void (^_Nonnull)(UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable))completion;
@ -132,7 +134,7 @@ typedef NS_ENUM(int32_t, OngoingCallDataSavingWebrtc) {
- (void)stop:(void (^_Nullable)(NSString * _Nullable debugLog, int64_t bytesSentWifi, int64_t bytesReceivedWifi, int64_t bytesSentMobile, int64_t bytesReceivedMobile))completion; - (void)stop:(void (^_Nullable)(NSString * _Nullable debugLog, int64_t bytesSentWifi, int64_t bytesReceivedWifi, int64_t bytesSentMobile, int64_t bytesReceivedMobile))completion;
- (bool)needRate; - (bool)needRate;
- (NSString * _Nullable)debugInfo; - (NSString * _Nullable)debugInfo;
- (NSString * _Nullable)version; - (NSString * _Nullable)version;
- (NSData * _Nonnull)getDerivedState; - (NSData * _Nonnull)getDerivedState;

View File

@ -13,7 +13,7 @@
#ifndef WEBRTC_IOS #ifndef WEBRTC_IOS
#import "platform/darwin/VideoMetalViewMac.h" #import "platform/darwin/VideoMetalViewMac.h"
#define GLVideoView VideoMetalView #import "platform/darwin/GLVideoViewMac.h"
#define UIViewContentModeScaleAspectFill kCAGravityResizeAspectFill #define UIViewContentModeScaleAspectFill kCAGravityResizeAspectFill
#define UIViewContentModeScaleAspect kCAGravityResizeAspect #define UIViewContentModeScaleAspect kCAGravityResizeAspect
@ -142,18 +142,23 @@
@implementation OngoingCallThreadLocalContextVideoCapturer @implementation OngoingCallThreadLocalContextVideoCapturer
- (instancetype _Nonnull)init { - (instancetype _Nonnull)init {
return [self initWithDeviceId:@""];
}
- (instancetype _Nonnull)initWithDeviceId:(NSString * _Nonnull)deviceId {
self = [super init]; self = [super init];
if (self != nil) { if (self != nil) {
_interface = tgcalls::VideoCaptureInterface::Create(); _interface = tgcalls::VideoCaptureInterface::Create(deviceId.UTF8String);
} }
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
} }
- (void)switchVideoInput:(bool)isFront { - (void)switchVideoInput:(NSString * _Nonnull)deviceeId {
_interface->switchToDevice(isFront ? "" : "back"); _interface->switchToDevice(deviceeId.UTF8String);
} }
- (void)setIsVideoEnabled:(bool)isVideoEnabled { - (void)setIsVideoEnabled:(bool)isVideoEnabled {
@ -210,7 +215,7 @@
NSString *_version; NSString *_version;
id<OngoingCallThreadLocalContextQueueWebrtc> _queue; id<OngoingCallThreadLocalContextQueueWebrtc> _queue;
int32_t _contextId; int32_t _contextId;
OngoingCallNetworkTypeWebrtc _networkType; OngoingCallNetworkTypeWebrtc _networkType;
NSTimeInterval _callReceiveTimeout; NSTimeInterval _callReceiveTimeout;
NSTimeInterval _callRingTimeout; NSTimeInterval _callRingTimeout;
@ -260,29 +265,29 @@
static tgcalls::NetworkType callControllerNetworkTypeForType(OngoingCallNetworkTypeWebrtc type) { static tgcalls::NetworkType callControllerNetworkTypeForType(OngoingCallNetworkTypeWebrtc type) {
switch (type) { switch (type) {
case OngoingCallNetworkTypeWifi: case OngoingCallNetworkTypeWifi:
return tgcalls::NetworkType::WiFi; return tgcalls::NetworkType::WiFi;
case OngoingCallNetworkTypeCellularGprs: case OngoingCallNetworkTypeCellularGprs:
return tgcalls::NetworkType::Gprs; return tgcalls::NetworkType::Gprs;
case OngoingCallNetworkTypeCellular3g: case OngoingCallNetworkTypeCellular3g:
return tgcalls::NetworkType::ThirdGeneration; return tgcalls::NetworkType::ThirdGeneration;
case OngoingCallNetworkTypeCellularLte: case OngoingCallNetworkTypeCellularLte:
return tgcalls::NetworkType::Lte; return tgcalls::NetworkType::Lte;
default: default:
return tgcalls::NetworkType::ThirdGeneration; return tgcalls::NetworkType::ThirdGeneration;
} }
} }
static tgcalls::DataSaving callControllerDataSavingForType(OngoingCallDataSavingWebrtc type) { static tgcalls::DataSaving callControllerDataSavingForType(OngoingCallDataSavingWebrtc type) {
switch (type) { switch (type) {
case OngoingCallDataSavingNever: case OngoingCallDataSavingNever:
return tgcalls::DataSaving::Never; return tgcalls::DataSaving::Never;
case OngoingCallDataSavingCellular: case OngoingCallDataSavingCellular:
return tgcalls::DataSaving::Mobile; return tgcalls::DataSaving::Mobile;
case OngoingCallDataSavingAlways: case OngoingCallDataSavingAlways:
return tgcalls::DataSaving::Always; return tgcalls::DataSaving::Always;
default: default:
return tgcalls::DataSaving::Never; return tgcalls::DataSaving::Never;
} }
} }
@ -706,11 +711,11 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if ([VideoMetalView isSupported]) { if ([VideoMetalView isSupported]) {
VideoMetalView *remoteRenderer = [[VideoMetalView alloc] initWithFrame:CGRectZero]; VideoMetalView *remoteRenderer = [[VideoMetalView alloc] initWithFrame:CGRectZero];
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
remoteRenderer.videoContentMode = UIViewContentModeScaleToFill; remoteRenderer.videoContentMode = UIViewContentModeScaleToFill;
#else #else
remoteRenderer.videoContentMode = UIViewContentModeScaleAspect; remoteRenderer.videoContentMode = UIViewContentModeScaleAspect;
#endif #endif
std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> sink = [remoteRenderer getSink]; std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> sink = [remoteRenderer getSink];
__strong OngoingCallThreadLocalContextWebrtc *strongSelf = weakSelf; __strong OngoingCallThreadLocalContextWebrtc *strongSelf = weakSelf;

@ -1 +1 @@
Subproject commit b906b5a955f1e6e195cb91c4513d4cb7b3620ea6 Subproject commit d8b106c94e5a5e20020ad862d835e921d4f102d9

@ -1 +1 @@
Subproject commit 2d20a42ab60f8fed37612361f2ea776d0bc7ca1a Subproject commit c413c8f18eb1932b100850505031980e27160d5f