Fix alternate app icons

This commit is contained in:
Thomas Ricouard 2022-12-27 21:35:41 +01:00
parent 03e5a960d2
commit aef4d86853
12 changed files with 102 additions and 6 deletions

View File

@ -6,11 +6,21 @@ struct IconSelectorView: View {
self.rawValue
}
case primary = "AppIconInApp"
case primary = "AppIcon"
case alternate1 = "AppIconAlternate1"
case alternate2 = "AppIconAlternate2"
case alternate3 = "AppIconAlternate3"
case alternate4 = "AppIconAlternate4"
var iconName: String {
switch self {
case .primary: return "icon0"
case .alternate1: return "icon1"
case .alternate2: return "icon2"
case .alternate3: return "icon3"
case .alternate4: return "icon4"
}
}
}
@State private var currentIcon = UIApplication.shared.alternateIconName ?? Icon.primary.rawValue
@ -31,7 +41,7 @@ struct IconSelectorView: View {
}
} label: {
ZStack(alignment: .bottomTrailing) {
Image(uiImage: .init(named: icon.rawValue) ?? .init())
Image(uiImage: .init(named: icon.iconName) ?? .init())
.resizable()
.aspectRatio(contentMode: .fit)
.frame(minHeight: 125, maxHeight: 1024)

View File

@ -96,10 +96,12 @@ struct SettingsTabs: View {
Label {
Text("Icon selector")
} icon: {
Image(uiImage: .init(named: UIApplication.shared.alternateIconName ?? "AppIconInApp")!)
.resizable()
.frame(width: 25, height: 25)
.cornerRadius(4)
if let icon = IconSelectorView.Icon(rawValue: UIApplication.shared.alternateIconName ?? "AppIcon") {
Image(uiImage: .init(named: icon.iconName)!)
.resizable()
.frame(width: 25, height: 25)
.cornerRadius(4)
}
}
}
Link(destination: URL(string: "https://github.com/Dimillian/IceCubesApp")!) {

View File

Before

Width:  |  Height:  |  Size: 986 KiB

After

Width:  |  Height:  |  Size: 986 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB