plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[device_info_plus] Detect ios simulator phone type

Open zeroprofit opened this issue 4 years ago • 7 comments

Hi,

Here's the code to detect ios simulator phone type. Originally, if device is simulator, plugin reports architecture for utsname.machine. Replace (void)handleMethodCall in FLTDeviceInfoPlusPlugin.m under device_info_plus-1.0.1/ios/Classes folder.

(void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
  if ([@"getIosDeviceInfo" isEqualToString:call.method]) {
    UIDevice* device = [UIDevice currentDevice];
    struct utsname un;
    uname(&un);

    NSString* machine;
    if([[self isDevicePhysical] isEqualToString:@"true"]) {
      machine = @(un.machine);
    } else {
      machine = [[NSProcessInfo processInfo] environment][@"SIMULATOR_MODEL_IDENTIFIER"];
    }

    result(@{
      @"name" : [device name],
      @"systemName" : [device systemName],
      @"systemVersion" : [device systemVersion],
      @"model" : [device model],
      @"localizedModel" : [device localizedModel],
      @"identifierForVendor" : [[device identifierForVendor] UUIDString],
      @"isPhysicalDevice" : [self isDevicePhysical],
      @"utsname" : @{
        @"sysname" : @(un.sysname),
        @"nodename" : @(un.nodename),
        @"release" : @(un.release),
        @"version" : @(un.version),
        @"machine" : machine,
      }
    });
  } else {
    result(FlutterMethodNotImplemented);
  }
}

zeroprofit avatar Jun 03 '21 13:06 zeroprofit

This is also related to package_info_plus when installer info on ios could be a simulator. See #78

ekuleshov avatar Oct 20 '21 15:10 ekuleshov

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar May 31 '22 15:05 github-actions[bot]

How is this completed?

ekuleshov-idexx avatar Jun 16 '22 01:06 ekuleshov-idexx

I think it was just closed by the bot, I also need this

qharlie avatar Jun 29 '22 14:06 qharlie

@charlie-sanders I know it was, but the lack of owner's response is alerting. @zeroprofit @mhadaily @miquelbeltran could you please reopen this?

ekuleshov avatar Jun 29 '22 14:06 ekuleshov

@ekuleshov

If a feature request went stale, it is because we don't have the time and resources to implement it. If you want to invest time implementing it, then we are happy to review any PRs.

Also, please do not directly mention maintainers

miquelbeltran avatar Jun 30 '22 06:06 miquelbeltran

@miquelbeltran so, any feature requests maintainers don't have time and resources are going to be auto-closed?

I can look at providing a PR at least for android and iOS for this or a more general enhancement https://github.com/fluttercommunity/plus_plugins/issues/570. But it would be helpful to have maintainers to at least comment/reply on the issues to outline what API changes would be acceptable.

ekuleshov avatar Jun 30 '22 11:06 ekuleshov