🥚 Added 2nd app icon as easter egg

This commit is contained in:
2021-01-08 11:30:07 +01:00
committed by Patrick Müller
parent 6419e5ca1a
commit 81f9e8706c
7 changed files with 99 additions and 2 deletions
+24
View File
@@ -44,5 +44,29 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>dhbw-standard-icon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Alpaca-Alt-Icon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>alpaca-alt-icon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
</dict>
</dict>
</plist>
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

@@ -50,6 +50,7 @@ struct FirstOpeningSettings: View {
Button(action: {
self.saveToCoreData()
self.checkAppIcon()
}){
Text("Confirm")
.padding()
@@ -103,6 +104,32 @@ extension FirstOpeningSettings{
self.settings.isFirstOpening = !self.settings.isFirstOpening
PersistenceController.shared.save()
}
/*
Check the input and change app icon if necessary
*/
func checkAppIcon() {
if(self.name.lowercased().contains("alpaca")) {
UIApplication.shared.setAlternateIconName("Alpaca-Alt-Icon") { error in
if let error = error {
print("Error changing app icon:")
print(error.localizedDescription)
} else {
print("Successfully changed app icon!")
}
}
}
if(UIApplication.shared.alternateIconName == "Alpaca-Alt-Icon" && !self.name.lowercased().contains("alpaca")) {
UIApplication.shared.setAlternateIconName(nil) { error in
if let error = error {
print("Error changing app icon:")
print(error.localizedDescription)
} else {
print("Successfully changed app icon!")
}
}
}
}
}
struct FirstOpeningSettings_Previews: PreviewProvider {