Skip to content

Commit

Permalink
Merge pull request urbanairship#65 from urbanairship/push_sample_cleanup
Browse files Browse the repository at this point in the history
Push Sample Cleanup
  • Loading branch information
Jeff Towle committed Aug 14, 2012
2 parents b7443f4 + d04227e commit 42b14a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
10 changes: 5 additions & 5 deletions InboxSample/InboxSampleLib.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
9A50FAE90FCA81810007E1BE /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A50FAE80FCA81810007E1BE /* CFNetwork.framework */; };
9A50FAEF0FCA81A40007E1BE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A50FAEE0FCA81A40007E1BE /* Foundation.framework */; };
9A50FAF60FCA81BD0007E1BE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A50FAF50FCA81BD0007E1BE /* UIKit.framework */; };
B676C1D7123A1CA100AF6A81 /* libUAirship-1.2.1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B6E7F8441239FFD5009BC92D /* libUAirship-1.2.1.a */; };
B676C1D7123A1CA100AF6A81 /* libUAirship-1.3.1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B6E7F8441239FFD5009BC92D /* libUAirship-1.3.1.a */; };
C14786001164675600F17AB8 /* checkConfig.sh in Resources */ = {isa = PBXBuildFile; fileRef = C14785FF1164675600F17AB8 /* checkConfig.sh */; };
D5A3F5D412C15333009731BE /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = D5A3F5D312C15333009731BE /* iTunesArtwork */; };
D5A3F5D612C1533D009731BE /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D5A3F5D512C1533D009731BE /* Icon@2x.png */; };
Expand Down Expand Up @@ -190,7 +190,7 @@
9A50FAEF0FCA81A40007E1BE /* Foundation.framework in Frameworks */,
9A50FAF60FCA81BD0007E1BE /* UIKit.framework in Frameworks */,
9A465ED40FF4AB1800DCABE9 /* CoreGraphics.framework in Frameworks */,
B676C1D7123A1CA100AF6A81 /* libUAirship-1.2.1.a in Frameworks */,
B676C1D7123A1CA100AF6A81 /* libUAirship-1.3.1.a in Frameworks */,
63C51F0211D30F730078DED4 /* MobileCoreServices.framework in Frameworks */,
63C51F0711D30F870078DED4 /* SystemConfiguration.framework in Frameworks */,
63CB563A1247164900DF2EBC /* StoreKit.framework in Frameworks */,
Expand Down Expand Up @@ -344,7 +344,7 @@
B6E7F8391239FFD5009BC92D /* Products */ = {
isa = PBXGroup;
children = (
B6E7F8441239FFD5009BC92D /* libUAirship-1.2.1.a */,
B6E7F8441239FFD5009BC92D /* libUAirship-1.3.1.a */,
BB5EBCB6159B7AF600F2A716 /* libUAirshipMini-1.2.1.a */,
49422BA2142BA678009770C6 /* AirshipLogicTests.octest */,
);
Expand Down Expand Up @@ -519,10 +519,10 @@
remoteRef = 49422BA1142BA678009770C6 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B6E7F8441239FFD5009BC92D /* libUAirship-1.2.1.a */ = {
B6E7F8441239FFD5009BC92D /* libUAirship-1.3.1.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libUAirship-1.2.1.a";
path = "libUAirship-1.3.1.a";
remoteRef = B6E7F8431239FFD5009BC92D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
Expand Down
18 changes: 3 additions & 15 deletions PushSample/Classes/iPhone/AppDelegate_Phone.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/

#import "AppDelegate_Phone.h"

#import "UAirship.h"
#import "UAPush.h"
#import "UALocationCommonValues.h"
#import "UAAnalytics.h"

@implementation AppDelegate_Phone
Expand All @@ -49,7 +49,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

//Init Airship launch options
NSMutableDictionary *takeOffOptions = [[[NSMutableDictionary alloc] init] autorelease];
[takeOffOptions setValue:[NSNumber numberWithBool:YES] forKey:UAAnalyticsOptionsLoggingKey];
[takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];

// Create Airship singleton that's used to talk to Urban Airhship servers.
Expand All @@ -66,16 +65,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

- (void)applicationDidBecomeActive:(UIApplication *)application {
UALOG(@"Application did become active.");
[[UAPush shared] resetBadge]; //zero badge when resuming from background (iOS 4+)
[[UAPush shared] resetBadge]; //zero badge when resuming from background
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
UALOG(@"APN device token: %@", deviceToken);
// Updates the device token and registers the token with UA
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"deviceToken.data"];
NSError *error = nil;
[deviceToken writeToFile:path options:NSDataWritingAtomic error:&error];
[[UAPush shared] registerDeviceToken:deviceToken];


Expand Down Expand Up @@ -148,14 +143,7 @@ - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotif

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
UALOG(@"Received remote notification: %@", userInfo);

// Get application state for iOS4.x+ devices, otherwise assume active
UIApplicationState appState = UIApplicationStateActive;
if ([application respondsToSelector:@selector(applicationState)]) {
appState = application.applicationState;
}

[[UAPush shared] handleNotification:userInfo applicationState:appState];
[[UAPush shared] handleNotification:userInfo applicationState:application.applicationState];
[[UAPush shared] resetBadge]; // zero badge after push received
}

Expand Down

0 comments on commit 42b14a8

Please sign in to comment.