1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-02 09:27:55 +01:00
Telegram/Telegraph/TGRevokeSessionsActor.m
2014-07-10 18:11:09 +04:00

55 lines
1.1 KiB
Objective-C

#import "TGRevokeSessionsActor.h"
#import "ActionStage.h"
#import "TGTelegraph.h"
#import "TGTelegramNetworking.h"
@implementation TGRevokeSessionsActor
- (instancetype)initWithPath:(NSString *)path
{
self = [super initWithPath:path];
if (self != nil)
{
_actionHandle = [[ASHandle alloc] initWithDelegate:self];
}
return self;
}
- (void)dealloc
{
[_actionHandle reset];
[ActionStageInstance() removeWatcher:self];
}
+ (NSString *)genericPath
{
return @"/tg/service/revokesessions";
}
- (void)execute:(NSDictionary *)__unused options
{
[[TGTelegramNetworking instance] clearExportedTokens];
self.cancelToken = [TGTelegraphInstance doRevokeOtherSessions:self];
}
- (void)revokeSessionsSuccess
{
[ActionStageInstance() requestActor:@"/tg/service/settings/push/(subscribe)" options:nil watcher:self];
}
- (void)revokeSessionsFailed
{
[ActionStageInstance() actionFailed:self.path reason:-1];
}
- (void)actorCompleted:(int)__unused status path:(NSString *)__unused path result:(id)__unused result
{
[ActionStageInstance() actionCompleted:self.path result:nil];
}
@end