1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-04 02:17:51 +01:00
Telegram/Watch/Extension/TGWatchCommon.h
2016-02-25 01:03:51 +01:00

57 lines
1.5 KiB
Objective-C

#import <Foundation/Foundation.h>
#import "WKInterface+TGInterface.h"
#import "TGColor.h"
#define TGTick NSDate *startTime = [NSDate date]
#define TGTock NSLog(@"%s Time: %f", __func__, -[startTime timeIntervalSinceNow])
#define TGLog(s) NSLog(s)
#ifdef __cplusplus
extern "C" {
#endif
extern int TGLocalizedStaticVersion;
#define TGLocalizedStatic(s) ({ static int _localizedStringVersion = 0; static NSString *_localizedString = nil; if (_localizedString == nil || _localizedStringVersion != TGLocalizedStaticVersion) { _localizedString = TGLocalized(s); _localizedStringVersion = TGLocalizedStaticVersion; } _localizedString; })
void TGSetLocalizationFromFile(NSURL *fileUrl);
bool TGIsCustomLocalizationActive();
void TGResetLocalization();
NSString *TGLocalized(NSString *s);
static inline void TGDispatchOnMainThread(dispatch_block_t block)
{
if ([NSThread isMainThread])
block();
else
dispatch_async(dispatch_get_main_queue(), block);
}
static inline void TGDispatchAfter(double delay, dispatch_queue_t queue, dispatch_block_t block)
{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((delay) * NSEC_PER_SEC)), queue, block);
}
void TGSwizzleMethodImplementation(Class class, SEL originalMethod, SEL modifiedMethod);
CGSize TGWatchScreenSize();
typedef NS_ENUM(NSUInteger, TGScreenType)
{
TGScreenType38mm,
TGScreenType42mm
};
TGScreenType TGWatchScreenType();
#ifdef __cplusplus
}
#endif
@interface NSNumber (IntegerTypes)
- (int32_t)int32Value;
- (int64_t)int64Value;
@end