[GitHub] johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen
johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen URL: https://github.com/apache/cordova-plugin-splashscreen/pull/148#discussion_r163698117 ## File path: README.md ## @@ -376,6 +376,36 @@ To disable the splashscreen add the following preference to `config.xml`: ``` +# Display app version (Android, iOS) + +To display your app version on splashscreen add the following preference to `config.xml`: +```xml + +``` + +Now just configure your app version into the widget version attribute, like that : +```xml +... +``` + + +## Prefix app version +To set a prefix version add the following preference to `config.xml`: +```xml + +``` +In this case you'll have `v1.0` + + +## Customize app version Review comment: For the screenshot, could i commit picture into the repo ? Or do i need to upload file on the web ? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org
[GitHub] johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen
johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen URL: https://github.com/apache/cordova-plugin-splashscreen/pull/148#discussion_r163686411 ## File path: README.md ## @@ -376,6 +376,36 @@ To disable the splashscreen add the following preference to `config.xml`: ``` +# Display app version (Android, iOS) + +To display your app version on splashscreen add the following preference to `config.xml`: +```xml + +``` + +Now just configure your app version into the widget version attribute, like that : Review comment: I'm not sure to understand this part : `Is there a way to not do that?` The widget `version` attribute is required (cf. https://cordova.apache.org/docs/en/latest/config_ref/index.html). So, if i remove preference `ShowSplashScreenAppVersion`, the app version will be always displayed on splashscreen. Some users don't want this behaviour. What would i mean in the doc is that you need to add this preference to enable display app version. If i'm wrong, do not hesitate to be more explicit ;) Sorry, i need to improve my english. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org
[GitHub] johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen
johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen URL: https://github.com/apache/cordova-plugin-splashscreen/pull/148#discussion_r162004407 ## File path: src/ios/CDVSplashScreen.m ## @@ -60,6 +60,63 @@ - (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NS [self updateImage]; } +- (UIColor *)colorFromHexString:(NSString *)hexString { Review comment: For the moment i will not change this part because i don't know what is the better solution. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org
[GitHub] johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen
johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen URL: https://github.com/apache/cordova-plugin-splashscreen/pull/148#discussion_r161989736 ## File path: src/ios/CDVSplashScreen.m ## @@ -60,6 +60,63 @@ - (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NS [self updateImage]; } +- (UIColor *)colorFromHexString:(NSString *)hexString { +unsigned rgbValue = 0; +NSScanner *scanner = [NSScanner scannerWithString:hexString]; +[scanner setScanLocation:1]; // bypass '#' character +[scanner scanHexInt:]; +return [UIColor colorWithRed:((rgbValue & 0xFF) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0]; +} + +-(UIImage*) drawText:(NSString*) text inImage:(UIImage*) image gravity:(NSString*) gravity fontSize:(CGFloat) fontSize fontColor:(NSString*) fontColor +{ + +UIFont *font = [UIFont boldSystemFontOfSize:fontSize]; +UIGraphicsBeginImageContext(image.size); +[image drawInRect:CGRectMake(0,0,image.size.width,image.size.height)]; + +UIScreen* mainScreen = [UIScreen mainScreen]; +CGFloat mainScreenHeight = mainScreen.bounds.size.height; +CGFloat mainScreenWidth = mainScreen.bounds.size.width; + +CGSize textSize = [text sizeWithFont:font]; +CGFloat padding = 15.0; +CGFloat position = mainScreenWidth - (textSize.width + padding); + +if([gravity isEqualToString:@"left"]) { +position = padding; +} else if ([gravity isEqualToString:@"center"]) { +position = (mainScreenWidth / 2) - padding; +} + +CGRect rect = CGRectMake(position, mainScreenHeight - 30.0, textSize.width, textSize.height); +UIColor *color = [self colorFromHexString:fontColor]; +[color set]; +[text drawInRect:CGRectIntegral(rect) withFont:font]; +UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); +UIGraphicsEndImageContext(); + +return newImage; +} + + +-(NSString*) getAppVersion +{ +NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + +if (version == nil) { + NSLog(@"CFBundleShortVersionString was nil, attempting CFBundleVersion"); + version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; +} + + +if(version != nil) { +version = [NSString stringWithFormat:@"v%@", version]; Review comment: Here too, i'll use a preference. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org
[GitHub] johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen
johnlejardinnier commented on a change in pull request #148: CB-13392(Android & iOS): Display app version on splashscreen URL: https://github.com/apache/cordova-plugin-splashscreen/pull/148#discussion_r161987406 ## File path: src/android/SplashScreen.java ## @@ -410,4 +428,60 @@ public void run() { } }); } + +private String getAppVersion() { + + String appVersion = null; + + try { + +String packageName = cordova.getActivity().getPackageName(); +PackageManager packageManager = cordova.getActivity().getApplicationContext().getPackageManager(); +PackageInfo pi = packageManager.getPackageInfo(packageName, 0); + +appVersion = "v" + pi.versionName; Review comment: You're right, i will change that as a preference. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org