Skip to content

Commit

Permalink
Merge pull request #3867 from srahim/timob-12218
Browse files Browse the repository at this point in the history
[TIMOB-12218]iOS: Implementing `significanttimechange` event.
  • Loading branch information
vishalduggal committed Feb 13, 2013
2 parents a4caa26 + 1436097 commit 14e1ce2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 11 additions & 1 deletion apidoc/Titanium/App/App.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,17 @@ events:
is being dissmissed.
platforms: [iphone, ipad]
since: '3.0.0'


- name: significanttimechange
summary: Fired when there is a significant change in the time.
description: |
Examples of significant time changes include the arrival of midnight, an update to the time by a carrier,
and the change to daylight savings time. If your application is currently in `paused` state, this message
will be is queued until your application returns to the foreground, at which point it is delievered. If multiple
changes occur, only the most recent one is delievered.
platforms: [iphone, ipad]
since: '3.1.0'

methods:
- name: fireSystemEvent
summary: Fire a system-level event such as <Titanium.App.EVENT_ACCESSIBILITY_ANNOUNCEMENT>.
Expand Down
8 changes: 7 additions & 1 deletion iphone/Classes/AppModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ -(void)keyboardFrameChanged:(NSNotification*) notification
[self fireEvent:@"keyboardframechanged" withObject:event];
}

- (void)timeChanged:(NSNotification*)notiication
{
if ([self _hasListeners:@"significanttimechange"]) {
[self fireEvent:@"significanttimechange" withObject:nil];
}
}

#pragma mark Internal Memory Management

Expand Down Expand Up @@ -339,7 +345,7 @@ -(void)startup

[nc addObserver:self selector:@selector(keyboardFrameChanged:) name:UIKeyboardDidShowNotification object:nil];
[nc addObserver:self selector:@selector(keyboardFrameChanged:) name:UIKeyboardDidHideNotification object:nil];

[nc addObserver:self selector:@selector(timeChanged:) name:UIApplicationSignificantTimeChangeNotification object:nil];
#endif

[super startup];
Expand Down

0 comments on commit 14e1ce2

Please sign in to comment.