1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-05 21:39:04 +01:00
Telegram/Watch/Extension/TGWatchCommon.h
2015-10-01 19:19:52 +03:00

52 lines
1.1 KiB
Objective-C

#import <Foundation/Foundation.h>
#import "WKInterface+TGInterface.h"
#import "TGColor.h"
#define TGLocalized(s) NSLocalizedString((s), nil)
#define TGLocalizedStatic(s) NSLocalizedString((s), nil)
#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
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