mirror of
https://github.com/danog/Telegram.git
synced 2024-12-04 02:17:51 +01:00
78 lines
2.4 KiB
Objective-C
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
|