Skip to content

Commit

Permalink
Add old userAgent (iPhone|iPap CPU OS VERSION like MAC OS X) to allow…
Browse files Browse the repository at this point in the history
… ionic3 parse correctly what iphone/ipad and version is.
  • Loading branch information
lempere committed Sep 7, 2021
1 parent ab7dfc0 commit 57fc602
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ios/CDVWKWebViewEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,14 @@ - (WKWebViewConfiguration*) createConfigurationFromSettings:(NSDictionary*)setti
forKey:_BGStatus];
}
NSString *userAgent = configuration.applicationNameForUserAgent;
if (
[settings cordovaSettingForKey:@"OverrideUserAgent"] == nil &&
[settings cordovaSettingForKey:@"AppendUserAgent"] != nil
) {
if ( [settings cordovaSettingForKey:@"OverrideUserAgent"] == nil ) {
if ( [settings cordovaSettingForKey:@"AppendUserAgent"] == nil ) {
NSString *device = UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone ? @"iPhone" : @"iPad";
userAgent = [NSString stringWithFormat:@"%@ (%@; CPU OS %@ like Mac OS X)", userAgent, device, [UIDevice.currentDevice.systemVersion stringByReplacingOccurrencesOfString:@"." withString:@"_"]];
}
if ([settings cordovaSettingForKey:@"AppendUserAgent"] != nil ) {
userAgent = [NSString stringWithFormat:@"%@ %@", userAgent, [settings cordovaSettingForKey:@"AppendUserAgent"]];
}
}
configuration.applicationNameForUserAgent = userAgent;
configuration.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:YES];
Expand Down

0 comments on commit 57fc602

Please sign in to comment.