Skip to content
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
15 changes: 13 additions & 2 deletions src/lime/tools/AdaptiveIcon.hx
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
package lime.tools;

import sys.FileSystem;
import haxe.io.Path;

/**
This file is a wrapper to save to path and some properties about the AdaptiveIcon format from Android
It is also used to store Apple's Icon Composer .icon file for iOS since its also a dynamic icon file
**/
class AdaptiveIcon
{
public var path:String;
public var hasRoundIcon:Bool;
public var hasRoundIcon:Bool; // No use on iOS
public var iconComposerFile:Bool; // No use on Android

public function new(path:String, hasRoundIcon:Bool)
{
this.path = path;
this.hasRoundIcon = hasRoundIcon;
this.hasRoundIcon = hasRoundIcon;

// macOS files are actually folders with a file extension
this.iconComposerFile = Path.extension(path) == "icon" && FileSystem.isDirectory(path);
}

public function clone():AdaptiveIcon
Expand Down
6 changes: 6 additions & 0 deletions templates/ios/template/{{app.file}}.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
792E75C91C6C876900D01DE1 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 792E75C81C6C876900D01DE1 /* CoreText.framework */; };
7C1D3D2F27403D7800CFEBE5 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C1D3D2E27403D7800CFEBE5 /* CoreHaptics.framework */; };
::if (IOS_LAUNCH_STORYBOARD != null)::D099CA9021A64C87003837AD /* ::IOS_LAUNCH_STORYBOARD::.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D099CA8F21A64C86003837AD /* ::IOS_LAUNCH_STORYBOARD::.storyboard */; };::end::
::if (IOS_ADAPTIVE_ICON != null)::D4E8A1F09C3B47E2F6A5D0BC /* AppIcon.icon in Resources */ = {isa = PBXBuildFile; fileRef = A7F3C9201B8E4D6FA1C2B7D9 /* AppIcon.icon */; };::end::
::ADDL_PBX_BUILD_FILE::

/* End PBXBuildFile section */
Expand Down Expand Up @@ -78,6 +79,7 @@
792E75C81C6C876900D01DE1 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
7C1D3D2E27403D7800CFEBE5 /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = System/Library/Frameworks/CoreHaptics.framework; sourceTree = SDKROOT; };
::if (IOS_LAUNCH_STORYBOARD != null)::D099CA8F21A64C86003837AD /* ::IOS_LAUNCH_STORYBOARD::.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "::APP_FILE::/::IOS_LAUNCH_STORYBOARD::.storyboard"; sourceTree = "<group>"; };::end::
::if (IOS_ADAPTIVE_ICON != null)::A7F3C9201B8E4D6FA1C2B7D9 /* AppIcon.icon */ = {isa = PBXFileReference; lastKnownFileType = file; path = "::APP_FILE::/AppIcon.icon"; sourceTree = "<group>"; };::end::
::ADDL_PBX_FILE_REFERENCE::

8D1107310486CEB800E47090 /* ::APP_FILE::-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "::APP_FILE::/::APP_FILE::-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -178,6 +180,7 @@
children = (
4257533E1A5EFD8C004AA45B /* Images.xcassets */,
::if (IOS_LAUNCH_STORYBOARD != null)::D099CA8F21A64C86003837AD /* ::IOS_LAUNCH_STORYBOARD::.storyboard */,::end::
::if (IOS_ADAPTIVE_ICON != null)::A7F3C9201B8E4D6FA1C2B7D9 /* AppIcon.icon */,::end::
8D1107310486CEB800E47090 /* ::APP_FILE::/::APP_FILE::-Info.plist */,
1E2E17A5131E8B5D0048F3C7 /* ::APP_FILE::/assets */,
::ADDL_PBX_RESOURCE_GROUP::
Expand Down Expand Up @@ -257,6 +260,7 @@
files = (
1E2E17AD131E8B5D0048F3C7 /* ::APP_FILE::/assets in Resources */,
::if (IOS_LAUNCH_STORYBOARD != null)::D099CA9021A64C87003837AD /* ::IOS_LAUNCH_STORYBOARD::.storyboard in Resources */,::end::
::if (IOS_ADAPTIVE_ICON != null)::D4E8A1F09C3B47E2F6A5D0BC /* AppIcon.icon in Ressources */,::end::
4257533F1A5EFD8C004AA45B /* Images.xcassets in Resources */,
::ADDL_PBX_RESOURCES_BUILD_PHASE::
);
Expand Down Expand Up @@ -393,6 +397,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
::if (IOS_ADAPTIVE_ICON != null)::ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;::end::
::if (IOS_LAUNCH_STORYBOARD == null)::ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;::end::
CODE_SIGN_ENTITLEMENTS = "::APP_FILE::/::APP_FILE::.entitlements";
::if DEVELOPMENT_TEAM_ID::DEVELOPMENT_TEAM = ::DEVELOPMENT_TEAM_ID::;::end::
Expand Down Expand Up @@ -458,6 +463,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
::if (IOS_ADAPTIVE_ICON != null)::ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;::end::
::if (IOS_LAUNCH_STORYBOARD == null)::ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;::end::
CODE_SIGN_ENTITLEMENTS = "::APP_FILE::/::APP_FILE::.entitlements";
::if DEVELOPMENT_TEAM_ID::DEVELOPMENT_TEAM = ::DEVELOPMENT_TEAM_ID::;::end::
Expand Down
5 changes: 5 additions & 0 deletions tools/platforms/IOSPlatform.hx
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,11 @@ class IOSPlatform extends PlatformTarget

context.HAS_ICON = true;

if (project.adaptiveIcon != null && project.adaptiveIcon.iconComposerFile) {
context.IOS_ADAPTIVE_ICON = project.adaptiveIcon.path;
ProjectHelper.recursiveSmartCopyDirectory(project, project.adaptiveIcon.path, Path.combine(projectDirectory, "AppIcon.icon"), context);
}

var iconPath = Path.combine(projectDirectory, "Images.xcassets/AppIcon.appiconset");
System.mkdir(iconPath);

Expand Down
Binary file modified tools/tools.n
Binary file not shown.