mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Merge branch 'beta'
This commit is contained in:
commit
9c2fc63eb8
@ -291,6 +291,9 @@
|
||||
|
||||
if (initializeApi && _apiEnvironment != nil)
|
||||
{
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"apiEnvironment: %d", (int)_apiEnvironment.systemCode.length);
|
||||
}
|
||||
MTBuffer *buffer = [[MTBuffer alloc] init];
|
||||
|
||||
// invokeWithLayer
|
||||
|
@ -92,13 +92,13 @@ private final class OverlayStatusControllerNode: ViewControllerTracingNode {
|
||||
case .success:
|
||||
self.contentController = .progress(ProgressWindowController(light: style == .light))
|
||||
case let .shieldSuccess(text, increasedDelay):
|
||||
self.contentController = .shieldSuccess(ProxyWindowController(light: style == .light, text: text, icon: ProxyWindowController.generateShieldImage(style == .light), isShield: true), increasedDelay)
|
||||
self.contentController = .shieldSuccess(ProxyWindowController(light: style == .light, text: text, icon: ProxyWindowController.generateShieldImage(style == .light), isShield: true, showCheck: true), increasedDelay)
|
||||
case let .genericSuccess(text, increasedDelay):
|
||||
let controller = ProxyWindowController(light: style == .light, text: text, icon: nil, isShield: false)!
|
||||
let controller = ProxyWindowController(light: style == .light, text: text, icon: nil, isShield: false, showCheck: true)!
|
||||
self.contentController = .genericSuccess(controller, increasedDelay)
|
||||
isUserInteractionEnabled = false
|
||||
case let .starSuccess(text):
|
||||
self.contentController = .genericSuccess(ProxyWindowController(light: style == .light, text: text, icon: UIImage(bundleImageName: "Star"), isShield: false), false)
|
||||
self.contentController = .genericSuccess(ProxyWindowController(light: style == .light, text: text, icon: UIImage(bundleImageName: "Star"), isShield: false, showCheck: false), false)
|
||||
}
|
||||
|
||||
super.init()
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
@interface ProxyWindowController : UIViewController
|
||||
|
||||
- (instancetype)initWithLight:(bool)light text:(NSString *)text icon:(UIImage *)icon isShield:(bool)isShield;
|
||||
- (instancetype)initWithLight:(bool)light text:(NSString *)text icon:(UIImage *)icon isShield:(bool)isShield showCheck:(bool)showCheck;
|
||||
|
||||
- (void)dismissWithSuccess:(void (^)(void))completion increasedDelay:(bool)increasedDelay;
|
||||
- (void)updateLayout;
|
||||
|
@ -135,6 +135,7 @@ static bool ProxyWindowIsLight = true;
|
||||
NSString *_text;
|
||||
UIImage *_icon;
|
||||
bool _isShield;
|
||||
bool _showCheck;
|
||||
UIVisualEffectView *_effectView;
|
||||
UIView *_backgroundView;
|
||||
ProxySpinnerView *_spinner;
|
||||
@ -168,13 +169,14 @@ static bool ProxyWindowIsLight = true;
|
||||
return image;
|
||||
}
|
||||
|
||||
- (instancetype)initWithLight:(bool)light text:(NSString *)text icon:(UIImage *)icon isShield:(bool)isShield {
|
||||
- (instancetype)initWithLight:(bool)light text:(NSString *)text icon:(UIImage *)icon isShield:(bool)isShield showCheck:(bool)showCheck {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_light = light;
|
||||
_text = text;
|
||||
_icon = icon;
|
||||
_isShield = isShield;
|
||||
_showCheck = showCheck;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -316,7 +318,7 @@ static bool ProxyWindowIsLight = true;
|
||||
dismissBlock();
|
||||
}];
|
||||
|
||||
if (_isShield) {
|
||||
if (_isShield || _showCheck) {
|
||||
dispatchAfter(0.15, dispatch_get_main_queue(), ^{
|
||||
[_spinner setSucceed];
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ public struct BotUserInfoFlags: OptionSet {
|
||||
|
||||
public static let hasAccessToChatHistory = BotUserInfoFlags(rawValue: (1 << 0))
|
||||
public static let worksWithGroups = BotUserInfoFlags(rawValue: (1 << 1))
|
||||
public static let requiresGeolocationForInlineRequests = BotUserInfoFlags(rawValue: (1 << 2))
|
||||
public static let requiresGeolocationForInlineRequests = BotUserInfoFlags(rawValue: (1 << 3))
|
||||
}
|
||||
|
||||
public struct BotUserInfo: PostboxCoding, Equatable {
|
||||
|
@ -21,13 +21,24 @@ public enum RequestChatContextResultsError {
|
||||
}
|
||||
|
||||
public func requestChatContextResults(account: Account, botId: PeerId, peerId: PeerId, query: String, location: Signal<(Double, Double)?, NoError> = .single(nil), offset: String) -> Signal<ChatContextResultCollection?, RequestChatContextResultsError> {
|
||||
return combineLatest(account.postbox.transaction { transaction -> (bot: Peer, peer: Peer)? in
|
||||
return account.postbox.transaction { transaction -> (bot: Peer, peer: Peer)? in
|
||||
if let bot = transaction.getPeer(botId), let peer = transaction.getPeer(peerId) {
|
||||
return (bot, peer)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}, location)
|
||||
}
|
||||
|> mapToSignal { botAndPeer -> Signal<((bot: Peer, peer: Peer)?, (Double, Double)?), NoError> in
|
||||
if let (bot, _) = botAndPeer, let botUser = bot as? TelegramUser, let botInfo = botUser.botInfo, botInfo.flags.contains(.requiresGeolocationForInlineRequests) {
|
||||
return location
|
||||
|> take(1)
|
||||
|> map { location -> ((bot: Peer, peer: Peer)?, (Double, Double)?) in
|
||||
return (botAndPeer, location)
|
||||
}
|
||||
} else {
|
||||
return .single((botAndPeer, nil))
|
||||
}
|
||||
}
|
||||
|> castError(RequestChatContextResultsError.self)
|
||||
|> mapToSignal { botAndPeer, location -> Signal<ChatContextResultCollection?, RequestChatContextResultsError> in
|
||||
if let (bot, peer) = botAndPeer, let inputBot = apiInputUser(bot) {
|
||||
|
@ -67,7 +67,7 @@ extension TelegramUser {
|
||||
if (flags & (1 << 16)) == 0 {
|
||||
botFlags.insert(.worksWithGroups)
|
||||
}
|
||||
if (flags & (1 << 21)) == 0 {
|
||||
if (flags & (1 << 21)) != 0 {
|
||||
botFlags.insert(.requiresGeolocationForInlineRequests)
|
||||
}
|
||||
botInfo = BotUserInfo(flags: botFlags, inlinePlaceholder: botInlinePlaceholder)
|
||||
@ -110,7 +110,7 @@ extension TelegramUser {
|
||||
if (flags & (1 << 16)) == 0 {
|
||||
botFlags.insert(.worksWithGroups)
|
||||
}
|
||||
if (flags & (1 << 21)) == 0 {
|
||||
if (flags & (1 << 21)) != 0 {
|
||||
botFlags.insert(.requiresGeolocationForInlineRequests)
|
||||
}
|
||||
botInfo = BotUserInfo(flags: botFlags, inlinePlaceholder: botInlinePlaceholder)
|
||||
|
@ -223,8 +223,9 @@ final class SharedApplicationContext {
|
||||
precondition(!testIsLaunched)
|
||||
testIsLaunched = true
|
||||
|
||||
self.deviceToken.set(voipTokenPromise.get()
|
||||
|> map(Optional.init))
|
||||
let _ = voipTokenPromise.get().start(next: { token in
|
||||
self.deviceToken.set(.single(token))
|
||||
})
|
||||
|
||||
let launchStartTime = CFAbsoluteTimeGetCurrent()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user