mirror of
https://github.com/danog/Telegram.git
synced 2024-12-11 08:59:48 +01:00
31 lines
1.0 KiB
Mathematica
31 lines
1.0 KiB
Mathematica
|
#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
|