Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macos support #184 #217

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

phimage
Copy link
Contributor

@phimage phimage commented Nov 10, 2019

The commit allow to compile with SwiftPM and if necessary I can make a PR just for this one

The second one add models dumped from apple web site

There is some double when using "identifier" so I put the PR as WIP
I do not know what to do. Merge into one. Find a way to make some alias with template generations

My very dirty dump script is available here https://github.com/phimage/MacModelDump

@devicekit-danger-bot
Copy link

devicekit-danger-bot commented Nov 10, 2019

4 Warnings
⚠️ Big PR, consider splitting into smaller
⚠️ Plist changed, don’t forget to localize your plist values
⚠️ Source/Device.generated.swift#L995 - Prefer non-optional booleans over optional booleans.
⚠️ Source/Device.generated.swift#L1734 - Prefer empty collection over optional collection.

SwiftLint found issues

Warnings

File Line Reason
Device.generated.swift 995 Prefer non-optional booleans over optional booleans.
Device.generated.swift 1734 Prefer empty collection over optional collection.

Generated by 🚫 Danger

Implement some basic method on current device (system name and version, model name)
@phimage phimage changed the title WIP: Add macos support #184 Add macos support #184 Nov 11, 2019
@phimage
Copy link
Contributor Author

phimage commented Nov 11, 2019

manually removed the double and old mac devices
wip: removed

/// Device is an [iMac Pro](https://support.apple.com/kb/SP771)
///
/// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP771/SP771-imac-pro-2017.png)
case iMacPro
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest changing this to iMaxPro2017 to prevent having to introduce a breaking change at a later date.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zandor300
Copy link
Member

Next to the little thing a very nice addition!

@phimage
Copy link
Contributor Author

phimage commented Nov 12, 2019

Thanks for the review. I updated manually the iMacPro name


I make different output formats
https://github.com/phimage/MacModelDump
To output for DeviceKit launch macmodeldump devicekit

@@ -286,6 +288,239 @@ public enum Device {
///
/// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP808/sp808-apple-watch-series-5_2x.png)
case appleWatchSeries5_44mm
#elseif os(macOS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure os(macOS) is true when running on a Catalyst target?

If not, we can use:

#elseif os(macOS) || targetEnvironment(macCatalyst)

to support both Catalyst and native macOS apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os(macOS) return false on Catalyst. os(iOS)return true.
catalyst is an iOS device so the code compiled will be the one create before with #if os(iOS)

I make this PR to see if catalyst must be managed well by DeviceKit, and cut my work into two features. First macOS , then macCatalyst

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay that fine then.

@phimage
Copy link
Contributor Author

phimage commented Nov 14, 2019

@@ -331,6 +672,8 @@ public enum Device {
case .simulator(let model): return model.diagonal
case .unknown: return -1
}
#elseif os(macOS)
return -1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return -1
return -1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it to be compliant with the switch, but I think there is some issues with formatting
because now #if #elseif do not shift the code anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting done ✅

"macMini2018",
"Device is a [Mac mini (2018)](https://support.apple.com/kb/SP782)",
"https://support.apple.com/library/content/dam/edam/applecare/images/en_US/macmini/mac-mini-2018-space-gray.jpg",
["Macmini8,1"], 0,(), "Mac mini (2018)", -1, False, False, False, False, False, False, False, False, False, 0, False, 0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
["Macmini8,1"], 0,(), "Mac mini (2018)", -1, False, False, False, False, False, False, False, False, False, 0, False, 0),
["Macmini8,1"], 0, (), "Mac mini (2018)", -1, False, False, False, False, False, False, False, False, False, 0, False, 0),

Applies to all other devices as well...

Copy link
Contributor Author

@phimage phimage Nov 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add missing space in template done ✅

@Zandor300
Copy link
Member

Zandor300 commented Nov 27, 2019

@phimage Sorry for late reply and inactivity. I found some formatting inconsistencies. Please fix those.

Also, the device identifier is available now: MacBookPro16,1 Edit: I see you already added that.

@phimage
Copy link
Contributor Author

phimage commented Jan 1, 2020

    case macPro2019

Mac Pro (2019)
Image

With also some missing macPro that apple add to the its support page

ytyubox added a commit to ytyubox/DeviceKit that referenced this pull request Mar 25, 2021
ytyubox added a commit to ytyubox/DeviceKit that referenced this pull request Jul 16, 2021
@AvdLee AvdLee mentioned this pull request Sep 20, 2021
@Kylmakalle
Copy link

Hey, any updates on this? Looks pretty useful.

@Kylmakalle
Copy link

@phimage @Zandor300 anything that blocks merge? 😄

@skeletom
Copy link

skeletom commented Jan 6, 2022

Hello, it is a really useful PR do you plan to merge it soon? Thank you!

@pfandrade
Copy link

Would also love to see this merged.

@vincentleclerc
Copy link

Why wasn't this merged...? No more discussion on it, and this is just stagnant.. very important feature for DeviceKit imo.

@AvdLee
Copy link

AvdLee commented Dec 4, 2022

@Zandor300 would love to see this getting merged as well! 🙏

@phimage
Copy link
Contributor Author

phimage commented Dec 5, 2022

Hi, my Pull Request is very old, a lot of change happens on DeviceKit (see conflicts and new features)
and I do not use it anymore (so I will no work on it)

If someone want macOS I think, first is to make a new Pull Request (and maybe be inspired by this one)

@phimage phimage closed this Dec 5, 2022
@Zandor300
Copy link
Member

I do want to take a look at this still at some point, just need to find the time...

@Zandor300 Zandor300 reopened this Dec 15, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #217 (ecdfbb1) into master (f19f9f8) will not change coverage.
The diff coverage is n/a.

@@      Coverage Diff      @@
##   master   #217   +/-   ##
=============================
=============================

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet