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

This commit is contained in:
Ilya Laktyushin 2021-02-19 20:28:38 +04:00
commit 558366a718
8 changed files with 78 additions and 73 deletions

View File

@ -1125,6 +1125,16 @@ plist_fragment(
) )
) )
objc_library(
name = "NotificationContentExtensionLink",
srcs = [
"NotificationContent/main.m",
],
sdk_frameworks = [
"UserNotificationsUI",
],
)
swift_library( swift_library(
name = "NotificationContentExtensionLib", name = "NotificationContentExtensionLib",
module_name = "NotificationContentExtensionLib", module_name = "NotificationContentExtensionLib",
@ -1132,7 +1142,8 @@ swift_library(
"NotificationContent/**/*.swift", "NotificationContent/**/*.swift",
]), ]),
deps = [ deps = [
"//submodules/TelegramUI:TelegramUI" "//submodules/TelegramUI:TelegramUI",
":NotificationContentExtensionLink",
], ],
) )

View File

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>NotificationContent</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>$(PRODUCT_BUNDLE_SHORT_VERSION)</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>UNNotificationExtensionCategory</key>
<array>
<string>withReplyMedia</string>
<string>withMuteMedia</string>
</array>
<key>UNNotificationExtensionInitialContentSizeRatio</key>
<real>0.0001</real>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.usernotifications.content-extension</string>
<key>NSExtensionPrincipalClass</key>
<string>NotificationViewController</string>
</dict>
</dict>
</plist>

View File

@ -1,4 +0,0 @@
#ifndef Share_Bridging_Header_h
#define Share_Bridging_Header_h
#endif

View File

View File

@ -17,6 +17,7 @@ objc_library(
"//submodules/BuildConfig:BuildConfig", "//submodules/BuildConfig:BuildConfig",
"//submodules/MtProtoKit:MtProtoKit", "//submodules/MtProtoKit:MtProtoKit",
"//submodules/NotificationsPresentationData:NotificationsPresentationData", "//submodules/NotificationsPresentationData:NotificationsPresentationData",
"//submodules/OpenSSLEncryptionProvider:OpenSSLEncryptionProvider",
], ],
sdk_frameworks = [ sdk_frameworks = [
"Foundation", "Foundation",

View File

@ -13,6 +13,7 @@
@class Api1_PhotoSize_photoSize; @class Api1_PhotoSize_photoSize;
@class Api1_PhotoSize_photoCachedSize; @class Api1_PhotoSize_photoCachedSize;
@class Api1_PhotoSize_photoStrippedSize; @class Api1_PhotoSize_photoStrippedSize;
@class Api1_PhotoSize_photoSizeProgressive;
@class Api1_FileLocation; @class Api1_FileLocation;
@class Api1_FileLocation_fileLocationToBeDeprecated; @class Api1_FileLocation_fileLocationToBeDeprecated;
@ -96,6 +97,7 @@
+ (Api1_PhotoSize_photoSize *)photoSizeWithType:(NSString *)type location:(Api1_FileLocation *)location w:(NSNumber *)w h:(NSNumber *)h size:(NSNumber *)size; + (Api1_PhotoSize_photoSize *)photoSizeWithType:(NSString *)type location:(Api1_FileLocation *)location w:(NSNumber *)w h:(NSNumber *)h size:(NSNumber *)size;
+ (Api1_PhotoSize_photoCachedSize *)photoCachedSizeWithType:(NSString *)type location:(Api1_FileLocation *)location w:(NSNumber *)w h:(NSNumber *)h bytes:(NSData *)bytes; + (Api1_PhotoSize_photoCachedSize *)photoCachedSizeWithType:(NSString *)type location:(Api1_FileLocation *)location w:(NSNumber *)w h:(NSNumber *)h bytes:(NSData *)bytes;
+ (Api1_PhotoSize_photoStrippedSize *)photoStrippedSizeWithType:(NSString *)type bytes:(NSData *)bytes; + (Api1_PhotoSize_photoStrippedSize *)photoStrippedSizeWithType:(NSString *)type bytes:(NSData *)bytes;
+ (Api1_PhotoSize_photoSizeProgressive *)photoSizeProgressiveWithType:(NSString *)type location:(Api1_FileLocation *)location w:(NSNumber *)w h:(NSNumber *)h sizes:(NSArray *)sizes;
@end @end
@ -127,6 +129,14 @@
@end @end
@interface Api1_PhotoSize_photoSizeProgressive : Api1_PhotoSize
@property (nonatomic, strong) Api1_FileLocation * location;
@property (nonatomic, strong) NSNumber * w;
@property (nonatomic, strong) NSNumber * h;
@property (nonatomic, strong) NSArray * sizes;
@end
@interface Api1_FileLocation : NSObject @interface Api1_FileLocation : NSObject

View File

@ -422,6 +422,33 @@ static const char *Api1__Serializer_Key = "Api1__Serializer";
return nil; return nil;
return [Api1_PhotoSize photoSizeWithType:type location:location w:w h:h size:size]; return [Api1_PhotoSize photoSizeWithType:type location:location w:w h:h size:size];
} copy]; } copy];
parsers[@((int32_t)0x5aa86a51)] = [^id (NSData *_data, NSUInteger* _offset, __unused id metaInfo)
{
NSString * type = nil;
if ((type = [Api1__Environment parseObject:_data offset:_offset implicitSignature:(int32_t)0xb5286e24 metaInfo:nil]) == nil)
return nil;
Api1_FileLocation * location = nil;
int32_t location_signature = 0; [_data getBytes:(void *)&location_signature range:NSMakeRange(*_offset, 4)]; *_offset += 4;
if ((location = [Api1__Environment parseObject:_data offset:_offset implicitSignature:location_signature metaInfo:nil]) == nil)
return nil;
NSNumber * w = nil;
if ((w = [Api1__Environment parseObject:_data offset:_offset implicitSignature:(int32_t)0xa8509bda metaInfo:nil]) == nil)
return nil;
NSNumber * h = nil;
if ((h = [Api1__Environment parseObject:_data offset:_offset implicitSignature:(int32_t)0xa8509bda metaInfo:nil]) == nil)
return nil;
NSMutableArray *sizes = [[NSMutableArray alloc] init];
*_offset += 4;
int32_t count = 0; [_data getBytes:(void *)&count range:NSMakeRange(*_offset, 4)]; *_offset += 4;
for (int32_t i = 0; i < count; i++) {
int32_t value = 0; [_data getBytes:(void *)&value range:NSMakeRange(*_offset, 4)]; *_offset += 4;
[sizes addObject:@(value)];
}
return [Api1_PhotoSize photoSizeProgressiveWithType:type location:location w:w h:h sizes:sizes];
} copy];
parsers[@((int32_t)0xe9a734fa)] = [^id (NSData *_data, NSUInteger* _offset, __unused id metaInfo) parsers[@((int32_t)0xe9a734fa)] = [^id (NSData *_data, NSUInteger* _offset, __unused id metaInfo)
{ {
NSString * type = nil; NSString * type = nil;
@ -1079,6 +1106,15 @@ id sizes_result = [Api1__Serializer addSerializerToObject:sizes_copy serializer:
return _object; return _object;
} }
+ (Api1_PhotoSize_photoSizeProgressive *)photoSizeProgressiveWithType:(NSString *)type location:(Api1_FileLocation *)location w:(NSNumber *)w h:(NSNumber *)h sizes:(NSArray *)sizes {
Api1_PhotoSize_photoSizeProgressive *_object = [[Api1_PhotoSize_photoSizeProgressive alloc] init];
_object.type = [Api1__Serializer addSerializerToObject:[type copy] serializer:[[Api1_BuiltinSerializer_String alloc] init]];
_object.location = location;
_object.w = [Api1__Serializer addSerializerToObject:[[Api1__Number alloc] initWithNumber:w] serializer:[[Api1_BuiltinSerializer_Int alloc] init]];
_object.h = [Api1__Serializer addSerializerToObject:[[Api1__Number alloc] initWithNumber:h] serializer:[[Api1_BuiltinSerializer_Int alloc] init]];
_object.sizes = sizes;
return _object;
}
@end @end
@ -1197,7 +1233,23 @@ id sizes_result = [Api1__Serializer addSerializerToObject:sizes_copy serializer:
@end @end
@implementation Api1_PhotoSize_photoSizeProgressive : Api1_PhotoSize
- (instancetype)init
{
self = [super init];
if (self != nil)
{
}
return self;
}
- (NSString *)description
{
return [[NSString alloc] initWithFormat:@"(photoSizeProgressive type:%d location:%@ w:%@ h:%@ sizes:%@)", (int)[self.type length], self.location, self.w, self.h, self.sizes];
}
@end
@interface Api1_FileLocation () @interface Api1_FileLocation ()

View File

@ -1,34 +1,10 @@
#import "FetchImage.h" #import "FetchImage.h"
#import <MTProtoKit/MTProtoKit.h> #import <MtProtoKit/MtProtoKit.h>
#import <EncryptionProvider/EncryptionProvider.h> #import <OpenSSLEncryptionProvider/OpenSSLEncryptionProvider.h>
#import "Serialization.h" #import "Serialization.h"
@interface EmptyEncryptionProvider: NSObject <EncryptionProvider>
@end
@implementation EmptyEncryptionProvider
- (id<MTBignumContext>)createBignumContext {
return nil;
}
- (NSData * _Nullable)rsaEncryptWithPublicKey:(NSString *)publicKey data:(NSData *)data {
return nil;
}
- (NSData * _Nullable)rsaEncryptPKCS1OAEPWithPublicKey:(NSString *)publicKey data:(NSData *)data {
return nil;
}
- (id<MTRsaPublicKey>)parseRSAPublicKey:(NSString *)publicKey {
return nil;
}
@end
@interface InMemoryKeychain : NSObject <MTKeychain> { @interface InMemoryKeychain : NSObject <MTKeychain> {
NSMutableDictionary *_dict; NSMutableDictionary *_dict;
} }
@ -108,7 +84,7 @@ dispatch_block_t fetchImage(BuildConfig *buildConfig, AccountProxyConnection * _
apiEnvironment = [apiEnvironment withUpdatedSocksProxySettings:[[MTSocksProxySettings alloc] initWithIp:proxyConnection.host port:(uint16_t)proxyConnection.port username:proxyConnection.username password:proxyConnection.password secret:proxyConnection.secret]]; apiEnvironment = [apiEnvironment withUpdatedSocksProxySettings:[[MTSocksProxySettings alloc] initWithIp:proxyConnection.host port:(uint16_t)proxyConnection.port username:proxyConnection.username password:proxyConnection.password secret:proxyConnection.secret]];
} }
MTContext *context = [[MTContext alloc] initWithSerialization:serialization encryptionProvider:[[EmptyEncryptionProvider alloc] init] apiEnvironment:apiEnvironment isTestingEnvironment:account.isTestingEnvironment useTempAuthKeys:true]; MTContext *context = [[MTContext alloc] initWithSerialization:serialization encryptionProvider:[[OpenSSLEncryptionProvider alloc] init] apiEnvironment:apiEnvironment isTestingEnvironment:account.isTestingEnvironment useTempAuthKeys:true];
context.tempKeyExpiration = 10 * 60 * 60; context.tempKeyExpiration = 10 * 60 * 60;
NSDictionary *seedAddressList = @{}; NSDictionary *seedAddressList = @{};