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

Added Apple Silicon Mac compatibility (POC) #685

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/runConfigurations/Main__Linux_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/runConfigurations/Main__macOS_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/airsquared/blobsaver/app/Devices.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public final class Devices {

private static final List<String> iPhones = new ArrayList<>(), iPads = new ArrayList<>();

private static final ObservableList<String> iPhoneList, iPadList, iBridgeList = FXCollections.observableArrayList();
private static final ObservableList<String> iPhoneList, iPadList, iBridgeList = FXCollections.observableArrayList(), macsList = FXCollections.observableArrayList();

private static final ObservableList<String> iPodList = unmodifiableArrayList("iPod Touch 3", "iPod Touch 4",
"iPod Touch 5", "iPod Touch 6", "iPod Touch 7 (iPod9,1)");

private static final ObservableList<String> AppleTVList = unmodifiableArrayList("Apple TV 2G", "Apple TV 3",
"Apple TV 3 (2013)", "Apple TV 4 (2015)", "Apple TV 4K", "Apple TV 4K (2021) (AppleTV11,1)", "Apple TV 4K (2022) (AppleTV14,1)");

private static final ObservableList<String> deviceTypes = unmodifiableArrayList("iPhone", "iPod", "iPad", "AppleTV", "T2 Mac");
private static final ObservableList<String> deviceTypes = unmodifiableArrayList("iPhone", "iPod", "iPad", "AppleTV", "T2 Mac", "Apple Silicon Mac");

private static final Map<String, String> boardConfigs = (Map) new Properties();

Expand Down Expand Up @@ -110,7 +110,7 @@ public static String modelToIdentifier(String deviceModel) {
}

/**
* @return either "iPhone", "iPod", "iPad", "AppleTV", or "T2 Mac".
* @return either "iPhone", "iPod", "iPad", "AppleTV", "T2 Mac" or "Mac".
*/
public static String getDeviceType(String identifier) {
if (identifier.startsWith("iPhone")) {
Expand All @@ -123,6 +123,8 @@ public static String getDeviceType(String identifier) {
return "AppleTV";
} else if (identifier.startsWith("iBridge")) {
return "T2 Mac";
} else if (identifier.startsWith("Mac")) {
return "Mac";
}
throw new IllegalArgumentException("Not found: " + identifier);
}
Expand All @@ -134,6 +136,7 @@ public static ObservableList<String> getModelsForType(String deviceType) {
case "iPad" -> iPadList;
case "AppleTV" -> AppleTVList;
case "T2 Mac" -> iBridgeList;
case "Apple Silicon Mac" -> macsList;
default -> FXCollections.emptyObservableList();
};
}
Expand All @@ -144,6 +147,7 @@ public static String getOSNameForType(String deviceType) {
case "iPad" -> "iOS/iPadOS";
case "AppleTV" -> "tvOS";
case "T2 Mac" -> "bridgeOS";
case "Mac" -> "MacOS";
default -> null;
};
}
Expand Down Expand Up @@ -196,5 +200,6 @@ public Object put(Object key, Object value) {
loader.load("devicemodels/iPads.properties", iPads::add);
loader.load("devicemodels/iBridges.properties", iBridgeList::add);
loader.load("devicemodels/others.properties", _ -> {});
loader.load("devicemodels/Macs.properties", macsList::add);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ iBridge2,19=j185ap
iBridge2,20=j185fap
iBridge2,21=j223ap
iBridge2,22=j215ap
Mac16,10=j773gap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2024 airsquared
#
# This file is part of blobsaver.
#
# blobsaver is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# blobsaver is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with blobsaver. If not, see <https://www.gnu.org/licenses/>.
#

Mac\ Mini\ M4=Mac16,10
Loading