Skip to content

Commit

Permalink
Fixed pause and resume event firing to use cordova channels onPause a…
Browse files Browse the repository at this point in the history
…nd onResume
  • Loading branch information
shazron committed Apr 17, 2012
1 parent 9f57cdf commit 8747ba4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions CordovaLib/Classes/CDVViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,6 @@ - (void) onAppWillTerminate:(NSNotification*)notification
- (void) onAppWillResignActive:(NSNotification*)notification
{
//NSLog(@"%@",@"applicationWillResignActive");
// TODO: uhh, wut? pause/resume not enough?
[self.webView stringByEvaluatingJavaScriptFromString:@"cordova.fireDocumentEvent('resign');"];
}

Expand All @@ -941,14 +940,13 @@ - (void) onAppWillResignActive:(NSNotification*)notification
- (void) onAppWillEnterForeground:(NSNotification*)notification
{
//NSLog(@"%@",@"applicationWillEnterForeground");
[self.webView stringByEvaluatingJavaScriptFromString:@"cordova.fireDocumentEvent('resume');"];
[self.webView stringByEvaluatingJavaScriptFromString:@"cordova.require('cordova/channel').onResume.fire();"];
}

// This method is called to let your application know that it moved from the inactive to active state.
- (void) onAppDidBecomeActive:(NSNotification*)notification
{
//NSLog(@"%@",@"applicationDidBecomeActive");
// TODO: uhh, wut? pause/resume not enough?
[self.webView stringByEvaluatingJavaScriptFromString:@"cordova.fireDocumentEvent('active');"];
}

Expand All @@ -959,7 +957,7 @@ - (void) onAppDidBecomeActive:(NSNotification*)notification
- (void) onAppDidEnterBackground:(NSNotification*)notification
{
//NSLog(@"%@",@"applicationDidEnterBackground");
[self.webView stringByEvaluatingJavaScriptFromString:@"cordova.fireDocumentEvent('pause');"];
[self.webView stringByEvaluatingJavaScriptFromString:@"cordova.require('cordova/channel').onPause.fire();"];
}

// ///////////////////////
Expand Down

0 comments on commit 8747ba4

Please sign in to comment.