mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Use BackgroundTasks
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <BuildConfig/BuildConfig.h>
|
||||
|
||||
#ifdef __IPHONE_13_0
|
||||
#import <BackgroundTasks/BackgroundTasks.h>
|
||||
#endif
|
||||
|
||||
#import "StoredAccountInfos.h"
|
||||
#import "Attachments.h"
|
||||
#import "Api.h"
|
||||
@@ -64,10 +68,17 @@ static int64_t makePeerId(int32_t namespace, int32_t value) {
|
||||
}
|
||||
|
||||
- (void)completeWithContent:(UNNotificationContent * _Nonnull)content {
|
||||
/*NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"org.telegram.Telegram-iOS.background"];
|
||||
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
|
||||
NSURLSessionDownloadTask *task = [session downloadTaskWithURL:[NSURL URLWithString:@"https://telegram.org"]];
|
||||
[task resume];*/
|
||||
#ifdef __IPHONE_13_0
|
||||
if (_baseAppBundleId != nil) {
|
||||
BGAppRefreshTaskRequest *request = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:[_baseAppBundleId stringByAppendingString:@".refresh"]];
|
||||
request.earliestBeginDate = nil;
|
||||
NSError *error = nil;
|
||||
[[BGTaskScheduler sharedScheduler] submitTaskRequest:request error:&error];
|
||||
if (error != nil) {
|
||||
NSLog(@"Error: %@", error);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_contentHandler) {
|
||||
_contentHandler(content);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@implementation Serialization
|
||||
|
||||
- (NSUInteger)currentLayer {
|
||||
return 106;
|
||||
return 107;
|
||||
}
|
||||
|
||||
- (id _Nullable)parseMessage:(NSData * _Nullable)data {
|
||||
|
||||
Reference in New Issue
Block a user