Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Unable to detect Apps on M1 and M2 Macs #2089

Open
logikonline opened this issue Jun 1, 2023 · 3 comments
Open

Unable to detect Apps on M1 and M2 Macs #2089

logikonline opened this issue Jun 1, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@logikonline
Copy link

Description

Essentials doesn't properly detect apps on the MacOS, mistaking them for Tablets

Steps to Reproduce

  1. Install on M1 or M2
  2. Read device Idiom

Expected Behavior

Should report Desktop

Actual Behavior

Reports Tablet

@logikonline logikonline added the bug Something isn't working label Jun 1, 2023
@logikonline
Copy link
Author

        switch (UIDevice.CurrentDevice.UserInterfaceIdiom)
        {
            case UIUserInterfaceIdiom.Pad:
                return DeviceIdiom.Tablet;
            case UIUserInterfaceIdiom.Phone:
                return DeviceIdiom.Phone;
            case UIUserInterfaceIdiom.TV:
                return DeviceIdiom.TV;
            case UIUserInterfaceIdiom.CarPlay:
            case UIUserInterfaceIdiom.Unspecified:
            default:
                return DeviceIdiom.Unknown;
        }

Add
case UIUserInterfaceIdiom.Mac:
return DeviceIdiom.Desktop;

To this code section

@logikonline
Copy link
Author

Please fix this in Maui too

@logikonline
Copy link
Author

If additional helper routines are needed, these should assist the dev.

`//A Boolean value that indicates whether the process is an iPhone or iPad app running on a Mac.

  • (BOOL) isIosAppOnMac {
    if (@available(iOS 14.0, *)) {
    NSProcessInfo *const processInfo = [[NSProcessInfo alloc] init];
    return processInfo.iOSAppOnMac;
    } else {
    return false;
    }
    }
    //A Boolean value that indicates whether the process originated as an iOS app and runs on macOS.
    //This is for if specifically making the app use AppKit APIs
    //https://developer.apple.com/documentation/uikit/mac_catalyst
  • (BOOL) isCatalystApp {
    if (@available(iOS 14.0, *)) {
    NSProcessInfo *const processInfo = [[NSProcessInfo alloc] init];
    return processInfo.macCatalystApp;
    } else {
    return false;
    }
    }`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant