Open ogata-k opened 3 years ago
in iOS, use this function.
FlutterUserAgent.getPropertyAsync('packageUserAgent');
get followed value
<app_name>/1.1.0.59 CFNetwork/1125.2 Darwin/20.2.0 (iPhone/11 iOS/13.4))
What is last right parentheses?
I think the illegal right parentheses is occurred, because 'packageUserAgent' key's value has an illegal right parentheses in this function in the file ios/Classes/FlutterUserAgentPlugin.m.
ios/Classes/FlutterUserAgentPlugin.m
- (void)constantsToExport:(void (^ _Nullable)(NSDictionary * _Nonnull constants))completionHandler { UIDevice *currentDevice = [UIDevice currentDevice]; NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"] ?: [NSNull null]; NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] ?: [NSNull null]; NSString *buildNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] ?: [NSNull null]; NSString *darwinVersion = [self darwinVersion]; NSString *cfnVersion = [NSBundle bundleWithIdentifier:@"com.apple.CFNetwork"].infoDictionary[@"CFBundleShortVersionString"]; NSString *deviceName = [self deviceName]; NSString *userAgent = [NSString stringWithFormat:@"CFNetwork/%@ Darwin/%@ (%@ %@/%@)", cfnVersion, darwinVersion, deviceName, currentDevice.systemName, currentDevice.systemVersion]; [self getWebViewUserAgent:^(NSString * _Nullable webViewUserAgent, NSError * _Nullable error) { completionHandler(@{ @"isEmulator": @(self.isEmulator), @"systemName": currentDevice.systemName, @"systemVersion": currentDevice.systemVersion, @"applicationName": appName, @"applicationVersion": appVersion, @"buildNumber": buildNumber, @"darwinVersion": darwinVersion, @"cfnetworkVersion": cfnVersion, @"deviceName": deviceName, @"packageUserAgent": [NSString stringWithFormat:@"%@/%@.%@ %@)", appName, appVersion, buildNumber, userAgent], @"userAgent": userAgent, @"webViewUserAgent": webViewUserAgent ?: [NSNull null] }); }]; }
That's a nice spot, I'm happy to take a PR addressing it if you've tested the change and are happy to.
I don't do much flutter dev currently so it's hard to find the motivation to work on it
in iOS, use this function.
get followed value
What is last right parentheses?
I think the illegal right parentheses is occurred, because 'packageUserAgent' key's value has an illegal right parentheses in this function in the file
ios/Classes/FlutterUserAgentPlugin.m
.