diff --git a/AltPlugin/ALTPluginService.h b/AltPlugin/ALTPluginService.h index d0c2fb78..b87f972a 100644 --- a/AltPlugin/ALTPluginService.h +++ b/AltPlugin/ALTPluginService.h @@ -8,11 +8,15 @@ #import +@class ALTAnisetteData; + NS_ASSUME_NONNULL_BEGIN @interface ALTPluginService : NSObject -+ (instancetype)sharedService; +@property (class, nonatomic, readonly) ALTPluginService *sharedService; + +- (ALTAnisetteData *)requestAnisetteData; @end diff --git a/AltPlugin/ALTPluginService.m b/AltPlugin/ALTPluginService.m index 003de970..563d5143 100644 --- a/AltPlugin/ALTPluginService.m +++ b/AltPlugin/ALTPluginService.m @@ -67,10 +67,8 @@ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNotification:) name:@"com.rileytestut.AltServer.FetchAnisetteData" object:nil]; } -- (void)receiveNotification:(NSNotification *)notification +- (ALTAnisetteData *)requestAnisetteData { - NSString *requestUUID = notification.userInfo[@"requestUUID"]; - NSMutableURLRequest* req = [[NSMutableURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"https://developerservices2.apple.com/services/QH65B2/listTeams.action?clientId=XABBG36SBA"]]; [req setHTTPMethod:@"POST"]; @@ -91,6 +89,14 @@ locale:[NSLocale currentLocale] timeZone:[NSTimeZone localTimeZone]]; + return anisetteData; +} + +- (void)receiveNotification:(NSNotification *)notification +{ + NSString *requestUUID = notification.userInfo[@"requestUUID"]; + + ALTAnisetteData *anisetteData = [self requestAnisetteData]; NSData *data = [NSKeyedArchiver archivedDataWithRootObject:anisetteData requiringSecureCoding:YES error:nil]; [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.rileytestut.AltServer.AnisetteDataResponse" object:nil userInfo:@{@"requestUUID": requestUUID, @"anisetteData": data} deliverImmediately:YES];