1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-04 02:17:51 +01:00
Telegram/Watch/Extension/TGComplicationController.m
2015-10-01 19:19:52 +03:00

78 lines
2.4 KiB
Objective-C

#import "TGComplicationController.h"
#import "TGStringUtils.h"
@implementation TGComplicationController
- (void)getSupportedTimeTravelDirectionsForComplication:(CLKComplication *)complication withHandler:(void (^)(CLKComplicationTimeTravelDirections))handler
{
handler(CLKComplicationTimeTravelDirectionNone);
}
- (void)getPrivacyBehaviorForComplication:(CLKComplication *)complication withHandler:(void (^)(CLKComplicationPrivacyBehavior))handler
{
handler(CLKComplicationPrivacyBehaviorShowOnLockScreen);
}
- (void)getPlaceholderTemplateForComplication:(CLKComplication *)complication withHandler:(void (^)(CLKComplicationTemplate * _Nullable))handler
{
CLKComplicationTemplate *result = nil;
switch (complication.family)
{
case CLKComplicationFamilyModularLarge:
{
}
break;
case CLKComplicationFamilyUtilitarianSmall:
{
}
break;
case CLKComplicationFamilyUtilitarianLarge:
{
CLKComplicationTemplateUtilitarianLargeFlat *template = [[CLKComplicationTemplateUtilitarianLargeFlat alloc] init];
CLKSimpleTextProvider *textProvider = [[CLKSimpleTextProvider alloc] init];
textProvider.text = TGLocalized(@"Complication.LongNone");
template.textProvider = textProvider;
result = template;
}
break;
default:
break;
}
handler(result);
}
- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void (^)(CLKComplicationTimelineEntry * _Nullable))handler
{
CLKComplicationTemplate *result = nil;
switch (complication.family)
{
case CLKComplicationFamilyUtilitarianLarge:
{
CLKComplicationTemplateUtilitarianLargeFlat *template = [[CLKComplicationTemplateUtilitarianLargeFlat alloc] init];
CLKSimpleTextProvider *textProvider = [[CLKSimpleTextProvider alloc] init];
textProvider.text = TGLocalized(@"Complication.LongNone");
template.textProvider = textProvider;
result = template;
}
break;
default:
break;
}
CLKComplicationTimelineEntry *entry = [CLKComplicationTimelineEntry entryWithDate:[NSDate date] complicationTemplate:result];
handler(entry);
}
@end