mirror of
https://github.com/danog/Telegram.git
synced 2024-12-03 09:57:46 +01:00
31 lines
1.0 KiB
Objective-C
31 lines
1.0 KiB
Objective-C
#import "TGModernConversationControllerDynamicTypeSignals.h"
|
|
|
|
@implementation TGModernConversationControllerDynamicTypeSignals
|
|
|
|
+ (SSignal *)dynamicTypeBaseFontPointSize
|
|
{
|
|
return [[SSignal alloc] initWithGenerator:^(SSubscriber *subscriber)
|
|
{
|
|
CGFloat pointSize = [UIFont preferredFontForTextStyle:UIFontTextStyleBody].pointSize;
|
|
[subscriber putNext:@(pointSize)];
|
|
|
|
id observer = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification object:nil queue:nil usingBlock:^(__unused NSNotification *notification)
|
|
{
|
|
TGDispatchOnMainThread(^
|
|
{
|
|
[subscriber putNext:@([UIFont preferredFontForTextStyle:UIFontTextStyleBody].pointSize)];
|
|
});
|
|
}];
|
|
|
|
return [[SBlockDisposable alloc] initWithBlock:^
|
|
{
|
|
TGDispatchOnMainThread(^
|
|
{
|
|
[[NSNotificationCenter defaultCenter] removeObserver:observer];
|
|
});
|
|
}];
|
|
}];
|
|
}
|
|
|
|
@end
|