Skip to content

Commit

Permalink
update VipURLManager.m
Browse files Browse the repository at this point in the history
  • Loading branch information
李红力 committed Jan 7, 2019
1 parent 2d964cd commit 0feebb3
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions VipVideo/Helper/VipURLManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#warning 这里是否需要线上 vipurl,可直接用本地“viplist.json”

#define HostURL @"http://www.xxx.com"
#define HostURL @"https://iodefog.github.io/text/viplist.json"

@implementation VipUrlItem

Expand Down Expand Up @@ -44,9 +44,6 @@ @implementation VipMenuItem

@interface VipURLManager ()




@end


Expand Down Expand Up @@ -81,6 +78,7 @@ - (instancetype)init{
}

- (void)initDefaultData{
return;
NSError *error = nil;

//#error 请先配置 viplist.json 里的平台url。改成常见视频平台即可。例如 http://v.qq.com
Expand All @@ -105,10 +103,35 @@ - (void)initVipURLs{
if(!connectionError){
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
NSLog(@"%@",dict);

if ([dict[@"new_version_info"][@"needLimit"] intValue] == 1) {
NSAlert *alert = [[NSAlert alloc] init];
alert.alertStyle = NSAlertStyleWarning;
alert.messageText = @"app已失效";
[alert addButtonWithTitle:@"升级"];
[alert addButtonWithTitle:@"退出"];
[alert beginSheetModalForWindow:[NSApplication sharedApplication].keyWindow completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSAlertFirstButtonReturn) {
NSLog(@"确定");
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://iodefog.github.io/dmg/VipVideo.dmg"]];
exit(0);
}
else if (returnCode == NSAlertSecondButtonReturn) {
NSLog(@"退出");
exit(0);
}
else {
NSLog(@"其他按钮");
}
}];
// 这种方式下,alert是在屏幕中间弹出来的
// [alert runModal];
return;
}

self.networkLoaded = YES;
[self transformJsonToModel:dict[@"list"]];
[self transformPlatformJsonToModel:dict[@"platformlist"]];

[[NSNotificationCenter defaultCenter] postNotificationName:KHLVipVideoRequestSuccess object:nil];
}else {
NSLog(@"connectionError = %@",connectionError);
Expand Down

0 comments on commit 0feebb3

Please sign in to comment.