Skip to content

Commit

Permalink
加入浦公英 api, 用來比對最新版本
Browse files Browse the repository at this point in the history
  • Loading branch information
DaidoujiChen committed Dec 19, 2014
1 parent 390579c commit 57ce497
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 1 deletion.
22 changes: 22 additions & 0 deletions e-Hentai.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
0199269919ADDB83009F814B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0199269819ADDB83009F814B /* AppDelegate.m */; };
019926A119ADDB83009F814B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 019926A019ADDB83009F814B /* Images.xcassets */; };
01A166EC19E28D5E00203360 /* NSDictionary+Hentai.m in Sources */ = {isa = PBXBuildFile; fileRef = 01A166EB19E28D5E00203360 /* NSDictionary+Hentai.m */; };
01B423211A44136400FAB920 /* Pgyer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 01B4231F1A44136400FAB920 /* Pgyer.a */; };
01BBD60119E3D428003538CF /* HentaiPhotoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 01BBD5FF19E3D428003538CF /* HentaiPhotoCell.m */; };
01BBD60219E3D428003538CF /* HentaiPhotoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01BBD60019E3D428003538CF /* HentaiPhotoCell.xib */; };
01BC52251A0CC04B00B37891 /* DaiInboxDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 01BC52241A0CC04B00B37891 /* DaiInboxDisplayLink.m */; };
Expand Down Expand Up @@ -227,6 +228,8 @@
019926A719ADDB83009F814B /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
01A166EA19E28D5E00203360 /* NSDictionary+Hentai.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Hentai.h"; sourceTree = "<group>"; };
01A166EB19E28D5E00203360 /* NSDictionary+Hentai.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Hentai.m"; sourceTree = "<group>"; };
01B4231F1A44136400FAB920 /* Pgyer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = Pgyer.a; sourceTree = "<group>"; };
01B423201A44136400FAB920 /* Pgyer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pgyer.h; sourceTree = "<group>"; };
01BBD5FE19E3D428003538CF /* HentaiPhotoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HentaiPhotoCell.h; path = HentaiPhotoCell/HentaiPhotoCell.h; sourceTree = "<group>"; };
01BBD5FF19E3D428003538CF /* HentaiPhotoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HentaiPhotoCell.m; path = HentaiPhotoCell/HentaiPhotoCell.m; sourceTree = "<group>"; };
01BBD60019E3D428003538CF /* HentaiPhotoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = HentaiPhotoCell.xib; path = HentaiPhotoCell/HentaiPhotoCell.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -258,6 +261,7 @@
010E3AE119E3B94700B866FB /* SystemConfiguration.framework in Frameworks */,
010E3ADF19E3B93800B866FB /* MobileCoreServices.framework in Frameworks */,
016DADA619E3940C00E528BE /* Security.framework in Frameworks */,
01B423211A44136400FAB920 /* Pgyer.a in Frameworks */,
016DADA419E393EB00E528BE /* CoreMotion.framework in Frameworks */,
016DADA219E393DF00E528BE /* CoreLocation.framework in Frameworks */,
016DADA019E393D600E528BE /* AssetsLibrary.framework in Frameworks */,
Expand Down Expand Up @@ -362,6 +366,7 @@
0150033619B6E5E90055F47D /* ThirdParty */ = {
isa = PBXGroup;
children = (
01B4231E1A44136400FAB920 /* Pgyer */,
019290161A25D6C70094B423 /* DaiPortal */,
01624CDF1A0B5A6400568EC8 /* DaiInboxHUD */,
016BBEF919B94E4F0015E11E /* FilesManager */,
Expand Down Expand Up @@ -611,6 +616,15 @@
name = "Supporting Files";
sourceTree = "<group>";
};
01B4231E1A44136400FAB920 /* Pgyer */ = {
isa = PBXGroup;
children = (
01B4231F1A44136400FAB920 /* Pgyer.a */,
01B423201A44136400FAB920 /* Pgyer.h */,
);
path = Pgyer;
sourceTree = "<group>";
};
01BBD5FD19E3D415003538CF /* HentaiPhotoCell */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -957,6 +971,10 @@
);
INFOPLIST_FILE = "e-Hentai/e-Hentai-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/e-Hentai/ThirdParty/Pgyer",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = "e-Hentai";
PROVISIONING_PROFILE = "";
Expand All @@ -983,6 +1001,10 @@
);
INFOPLIST_FILE = "e-Hentai/e-Hentai-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/e-Hentai/ThirdParty/Pgyer",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = "e-Hentai";
PROVISIONING_PROFILE = "";
Expand Down
12 changes: 12 additions & 0 deletions e-Hentai/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
[Pgyer lastestInformationByShortcut:@"DaiHentai" completion:^(NSDictionary *information) {
if ([information[@"appVersion"] floatValue] > [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] floatValue]) {
NSLog(@"獻上比較新");
[UIAlertView hentai_alertViewWithTitle:[NSString stringWithFormat:@"新版本 v%@ 通知", information[@"appVersion"]] message:information[@"appUpdateDescription"] cancelButtonTitle:@"我不想更新~ O3O" otherButtonTitles:@[@"麻煩幫我跳轉更新頁~ O3O"] onClickIndex:^(NSInteger clickIndex) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.pgyer.com/DaiHentai"]];
} onCancel:^{
}];
}
}];
}

@end
Binary file added e-Hentai/ThirdParty/Pgyer/Pgyer.a
Binary file not shown.
7 changes: 7 additions & 0 deletions e-Hentai/ThirdParty/Pgyer/Pgyer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#import <Foundation/Foundation.h>

@interface Pgyer : NSObject

+ (void)lastestInformationByShortcut:(NSString *)shortcut completion:(void (^)(NSDictionary *information))completion;

@end
2 changes: 1 addition & 1 deletion e-Hentai/e-Hentai-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>1.7</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIFileSharingEnabled</key>
Expand Down
1 change: 1 addition & 0 deletions e-Hentai/e-Hentai-Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#import "NSDictionary+Hentai.h"
#import "DaiInboxHUD.h"
#import "NSObject+DaiPortal.h"
#import "Pgyer.h"

//from pod
#import <ViewDeck/IIViewDeckController.h>
Expand Down

0 comments on commit 57ce497

Please sign in to comment.