1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-12 09:29:55 +01:00
Telegram/Watch/Extension/TGComplicationController.m

78 lines
2.4 KiB
Mathematica
Raw Normal View History

2015-10-01 18:19:52 +02:00
#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