Created
November 6, 2009 15:45
-
-
Save jjthrash/228050 to your computer and use it in GitHub Desktop.
Allow users of Airship/StoreFront API to specify their own animations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Airship/StoreFront/StoreFront.h b/Airship/StoreFront/StoreFront.h | |
index 740467a..8433950 100644 | |
--- a/Airship/StoreFront/StoreFront.h | |
+++ b/Airship/StoreFront/StoreFront.h | |
@@ -44,6 +44,7 @@ | |
SINGLETON_INTERFACE(StoreFront) | |
++(UIView*)makeStoreFrontView; | |
+(void)displayStoreFront; | |
+(void)quitStoreFront; | |
diff --git a/Airship/StoreFront/StoreFront.m b/Airship/StoreFront/StoreFront.m | |
index 0aac8d3..3373921 100644 | |
--- a/Airship/StoreFront/StoreFront.m | |
+++ b/Airship/StoreFront/StoreFront.m | |
@@ -48,27 +48,32 @@ SINGLETON_IMPLEMENTATION(StoreFront) | |
-(id)init { | |
UALOG(@"INIT"); | |
- if (self = [super init]) { | |
+ if (self = [super init]) { | |
//Setup transaction observer | |
sfObserver = [[UAStoreKitObserver alloc] init]; | |
- } | |
- return self; | |
+ } | |
+ return self; | |
} | |
-+ (void)displayStoreFront { | |
++ (UIView*)makeStoreFrontView { | |
StoreFront* sf = [StoreFront shared]; | |
[[SKPaymentQueue defaultQueue] addTransactionObserver: sf.sfObserver]; | |
- UIWindow* kwin = [[UIApplication sharedApplication] keyWindow]; | |
UAStoreTabBarController* tabBarController = [[UAStoreTabBarController alloc] initWithNibName:nil bundle:nil]; | |
sf.rootViewController = tabBarController; | |
- [kwin addSubview: tabBarController.view]; | |
// Let download history know about updates to inventory | |
sf.inventory = [[UAInventory alloc] initWithStatusDelegate: tabBarController.downloadController]; | |
+ return tabBarController.view; | |
+} | |
+ | |
++ (void)displayStoreFront { | |
+ UIWindow* kwin = [[UIApplication sharedApplication] keyWindow]; | |
+ [kwin addSubview: [self makeStoreFrontView]]; | |
} | |
+ (void)quitStoreFront { | |
StoreFront* sf = [StoreFront shared]; | |
[[SKPaymentQueue defaultQueue] removeTransactionObserver: sf.sfObserver]; | |
+ [sf.delegate storeFrontWillHide]; | |
[sf.rootViewController.view removeFromSuperview]; | |
[sf.delegate storeFrontDidHide]; | |
sf.rootViewController = nil; | |
@@ -77,3 +82,4 @@ SINGLETON_IMPLEMENTATION(StoreFront) | |
} | |
@end | |
+//vim:noet | |
diff --git a/Airship/StoreFront/StoreFrontDelegate.h b/Airship/StoreFront/StoreFrontDelegate.h | |
index dfa0211..eb29ac5 100644 | |
--- a/Airship/StoreFront/StoreFrontDelegate.h | |
+++ b/Airship/StoreFront/StoreFrontDelegate.h | |
@@ -28,6 +28,7 @@ | |
@protocol StoreFrontDelegate | |
-(void)productPurchased:(UAProduct*) product; | |
+-(void)storeFrontWillHide; | |
-(void)storeFrontDidHide; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment