Closed pwblaine closed 10 years ago
currently the certificate was generated to mitchsolomon788@gmail.com, the .p12 file was successfully uploaded with Parse.com, however the initial push to the 2 listed installations yielded no results: https://parse.com/apps/buried/push_notifications/1759484048#details
further investigation of the Installation IDs showed that they were bound to User objects that no longer exist, and none of the new installations are registering ID's.
manually adjusting the attached User objects had no affect.
As of commit https://github.com/pwblaine/buriedios/commit/3821ab7ab9568a4d1fecdaaadd5d0a1d5481b1f2 :
Added in Push notification registration code upon successful registration the installation information is saved to Parse
TODO figure out whether to push from clients or cloud code when someone buries a capsule for you and when a capsule for you unearths, when a capsule unearths, increment the badge, when the capsule is read decrement the badge.
with commit as of commit https://github.com/pwblaine/buriedcc/commit/703340c91002c2c08528526daf773c8815f6fda3 for buriedcc and commit https://github.com/pwblaine/buriedios/commit/be97724cec900c7c73833dbf91d74fba23279bab for buriedios
email delivery has been removed, all notifications now happen through pushes sent by cloud code.
push happens when someone buries a capsule for you, or when a capsule unearths:
TODO the only piece of the puzzle left is to handle push notifications when the app is already open, and what happens when a push is tapped.
Example of an app handling code for receiving a push when the app is already open:
(void)application:(UIApplication )application didReceiveRemoteNotification:(NSDictionary )userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler { // Create empty photo object NSString photoId = [userInfo objectForKey:@"p"]; PFObject targetPhoto = [PFObject objectWithoutDataWithClassName:@"Photo" objectId:photoId];
// Fetch photo object [targetPhoto fetchIfNeededInBackgroundWithBlock:^(PFObject object, NSError error) { // Show photo view controller if (error) { handler(UIBackgroundFetchResultFailed); } else if ([PFUser currentUser]) { PhotoVC *viewController = [[PhotoVC alloc] initWithPhoto:object]; [self.navController pushViewController:viewController animated:YES]; handler(UIBackgroundFetchResultNewData); } else { handler(UIBackgroundModeNoData); } }]; }
As of commit https://github.com/pwblaine/buriedios/commit/1497e417722a63f952db3c47fa12af3193192577 push notifications are fully implemented, refresh data automatically if the app is open, and open to specific capsules when tapped.
push notifications should be called 1) when a capsule is buried for you 2) when a capsule is unearthed for you (increment badge)