-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-15577] Exposed hideScreenShotOnAppResume on Ti.App module #4847
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -586,6 +586,14 @@ -(NSNumber*)keyboardVisible | |
return NUMBOOL([[[TiApp app] controller] keyboardVisible]); | ||
} | ||
|
||
-(void)setHideScreenShotOnAppResume:(id)args | ||
{ | ||
ENSURE_SINGLE_ARG(args, NSNumber) | ||
[self replaceValue:args forKey:@"hideScreenShotOnAppResume" notification:NO]; | ||
BOOL flag = [TiUtils boolValue:args def:YES]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. def:NO |
||
[[TiApp app] setHideScreenShotOnAppResume:flag]; | ||
} | ||
|
||
#if defined(USE_TI_APPIOS) | ||
-(id)iOS | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ TI_INLINE void waitForMemoryPanicCleared() //WARNING: This must never be run o | |
{ | ||
UIWindow *window; | ||
UIImageView *loadView; | ||
UIImageView *splashScreenImage; | ||
BOOL loaded; | ||
|
||
TiContextGroupRef contextGroup; | ||
|
@@ -61,6 +62,8 @@ TI_INLINE void waitForMemoryPanicCleared() //WARNING: This must never be run o | |
NSDictionary *localNotification; | ||
} | ||
|
||
@property (nonatomic) BOOL hideScreenShotOnAppResume; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename this as well to match method in App Module |
||
@property (nonatomic) BOOL appInBackground; | ||
/** | ||
Returns application's primary window. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,13 +291,33 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application | |
[self boot]; | ||
} | ||
|
||
-(UIImageView*)splashScreenImage | ||
{ | ||
if(splashScreenImage == nil) { | ||
UIDeviceOrientation imageOrientation; | ||
UIUserInterfaceIdiom imageIdiom; | ||
|
||
splashScreenImage = [[UIImageView alloc] init]; | ||
[splashScreenImage setBackgroundColor:[UIColor yellowColor]]; | ||
[splashScreenImage setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth]; | ||
[splashScreenImage setContentMode:UIViewContentModeScaleToFill]; | ||
[controller rotateDefaultImageViewToOrientation:[[UIApplication sharedApplication] statusBarOrientation] | ||
withImageView:splashScreenImage]; | ||
|
||
// UIImage *img = [controller defaultImageForOrientation:[[UIApplication sharedApplication] statusBarOrientation] resultingOrientation:imageOrientation idiom:imageIdiom]; | ||
// [splashScreenImage setImage:img]; | ||
[splashScreenImage setFrame:[window bounds]]; | ||
} | ||
return splashScreenImage; | ||
} | ||
|
||
- (void)generateNotification:(NSDictionary*)dict | ||
{ | ||
// Check and see if any keys from APS and the rest of the dictionary match; if they do, just | ||
// bump out the dictionary as-is | ||
remoteNotification = [[NSMutableDictionary alloc] initWithDictionary:dict]; | ||
NSDictionary* aps = [dict objectForKey:@"aps"]; | ||
for (id key in aps) | ||
for (id key in aps) | ||
{ | ||
if ([dict objectForKey:key] != nil) { | ||
DebugLog(@"[WARN] Conflicting keys in push APS dictionary and notification dictionary `%@`, not copying to toplevel from APS", key); | ||
|
@@ -439,6 +459,10 @@ - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application | |
|
||
-(void)applicationWillResignActive:(UIApplication *)application | ||
{ | ||
[self setAppInBackground:YES]; | ||
if([self hideScreenShotOnAppResume]) { | ||
[window addSubview:[self splashScreenImage]]; | ||
} | ||
[[NSNotificationCenter defaultCenter] postNotificationName:kTiSuspendNotification object:self]; | ||
|
||
// suspend any image loading | ||
|
@@ -495,6 +519,9 @@ -(void)applicationDidEnterBackground:(UIApplication *)application | |
|
||
-(void)applicationWillEnterForeground:(UIApplication *)application | ||
{ | ||
[[self splashScreenImage] removeFromSuperview]; | ||
RELEASE_TO_NIL(splashScreenImage); | ||
|
||
[sessionId release]; | ||
sessionId = [[TiUtils createUUID] retain]; | ||
|
||
|
@@ -625,6 +652,7 @@ - (void)dealloc | |
RELEASE_TO_NIL(xhrBridge); | ||
#endif | ||
RELEASE_TO_NIL(loadView); | ||
RELEASE_TO_NIL(splashScreenImage) | ||
RELEASE_TO_NIL(window); | ||
RELEASE_TO_NIL(launchOptions); | ||
RELEASE_TO_NIL(controller); | ||
|
@@ -693,6 +721,7 @@ -(void)endBackgrounding | |
|
||
[self checkBackgroundServices]; | ||
RELEASE_TO_NIL(runningServices); | ||
[self setAppInBackground:NO]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this to applicationWillEnterForeground |
||
} | ||
|
||
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,5 +61,7 @@ | |
-(void)shutdownUi:(id)arg; | ||
#endif | ||
|
||
-(void)rotateDefaultImageViewToOrientation: (UIInterfaceOrientation )newOrientation withImageView:(UIImageView*)theImageView; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename method to rotateImageViewToOrientation |
||
|
||
|
||
@end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to forceSplashAsSnapshot