diff --git a/Mlem.xcodeproj/project.pbxproj b/Mlem.xcodeproj/project.pbxproj index 4c6f195d3..105162efd 100644 --- a/Mlem.xcodeproj/project.pbxproj +++ b/Mlem.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0304F58A2B44AF5B00537BFA /* CollapsibleSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0304F5892B44AF5B00537BFA /* CollapsibleSection.swift */; }; 0308E1142B0EA32A000CA955 /* AccountSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0308E1132B0EA32A000CA955 /* AccountSettingsView.swift */; }; 0308E1162B0EA42B000CA955 /* APILocalUserView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0308E1152B0EA42B000CA955 /* APILocalUserView.swift */; }; 0308E1182B0EA466000CA955 /* APILocalUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0308E1172B0EA466000CA955 /* APILocalUser.swift */; }; @@ -556,6 +557,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 0304F5892B44AF5B00537BFA /* CollapsibleSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollapsibleSection.swift; sourceTree = ""; }; 0308E1132B0EA32A000CA955 /* AccountSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSettingsView.swift; sourceTree = ""; }; 0308E1152B0EA42B000CA955 /* APILocalUserView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APILocalUserView.swift; sourceTree = ""; }; 0308E1172B0EA466000CA955 /* APILocalUser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APILocalUser.swift; sourceTree = ""; }; @@ -2045,6 +2047,7 @@ 03A54C302B5331D50064CCDE /* Instance */, 03BAA2392A57DC1400D48252 /* PublishedTimestampView.swift */, 6374570F2A18CB6600B69C03 /* Custom Text Field.swift */, + 0304F5892B44AF5B00537BFA /* CollapsibleSection.swift */, B11D72822A49FAA7009DC22F /* Cached Image.swift */, 0317D46E2B558CB500EEE72C /* BadgeView.swift */, 50F2851B2A5C5C1500CF8865 /* TokenRefreshView.swift */, @@ -3173,6 +3176,7 @@ CD2053102AC878B50000AA38 /* UpdatedTimestampView.swift in Sources */, CD1446232A5B336900610EF1 /* LicensesView.swift in Sources */, CD4368D02AE245F400BD8BD1 /* MessageTracker.swift in Sources */, + 0304F58A2B44AF5B00537BFA /* CollapsibleSection.swift in Sources */, CDDCF6432A66343D003DA3AC /* FancyTabBar.swift in Sources */, 505240E52A86E32700EA4558 /* CommunityListModel.swift in Sources */, CD05E77F2A4F263B0081D102 /* Menu Function.swift in Sources */, diff --git a/Mlem/Assets.xcassets/Icons/Beehaw Community By Aaron Schneider.appiconset/Beehaw Mlem Atomic 2-06.png b/Mlem/Assets.xcassets/Icons/icon.aaron.beehaw.appiconset/Beehaw Mlem Atomic 2-06.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Beehaw Community By Aaron Schneider.appiconset/Beehaw Mlem Atomic 2-06.png rename to Mlem/Assets.xcassets/Icons/icon.aaron.beehaw.appiconset/Beehaw Mlem Atomic 2-06.png diff --git a/Mlem/Assets.xcassets/Icons/Beehaw Community By Aaron Schneider.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.aaron.beehaw.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Beehaw Community By Aaron Schneider.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.aaron.beehaw.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlemhaw By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.beehaw.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlemhaw By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.beehaw.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlemhaw By Clays.appiconset/Mlemhaw-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.beehaw.appiconset/Mlemhaw-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlemhaw By Clays.appiconset/Mlemhaw-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.beehaw.appiconset/Mlemhaw-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Train Conductor Lem By Clays.appiconset/ConductorLem.png b/Mlem/Assets.xcassets/Icons/icon.clays.conductor.appiconset/ConductorLem.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Train Conductor Lem By Clays.appiconset/ConductorLem.png rename to Mlem/Assets.xcassets/Icons/icon.clays.conductor.appiconset/ConductorLem.png diff --git a/Mlem/Assets.xcassets/Icons/Train Conductor Lem By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.conductor.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Train Conductor Lem By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.conductor.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Cream By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.cream.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Cream By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.cream.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Cream By Clays.appiconset/MlemCream-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.cream.appiconset/MlemCream-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Cream By Clays.appiconset/MlemCream-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.cream.appiconset/MlemCream-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem Dark By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.dark.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Dark By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.dark.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Dark By Clays.appiconset/MlemDark-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.dark.appiconset/MlemDark-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Dark By Clays.appiconset/MlemDark-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.dark.appiconset/MlemDark-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem by Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.default.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem by Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.default.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem by Clays.appiconset/mlemmy-brighter.png b/Mlem/Assets.xcassets/Icons/icon.clays.default.appiconset/mlemmy-brighter.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem by Clays.appiconset/mlemmy-brighter.png rename to Mlem/Assets.xcassets/Icons/icon.clays.default.appiconset/mlemmy-brighter.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem Dev By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.dev.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Dev By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.dev.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Dev By Clays.appiconset/MlemDev-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.dev.appiconset/MlemDev-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Dev By Clays.appiconset/MlemDev-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.dev.appiconset/MlemDev-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem Lime by Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.lime.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Lime by Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.lime.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Lime by Clays.appiconset/MlemLime-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.lime.appiconset/MlemLime-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Lime by Clays.appiconset/MlemLime-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.lime.appiconset/MlemLime-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem Mono By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.mono.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Mono By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.mono.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Mono By Clays.appiconset/MlemMono-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.mono.appiconset/MlemMono-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Mono By Clays.appiconset/MlemMono-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.mono.appiconset/MlemMono-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem Pride By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.pride.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Pride By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.pride.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Pride By Clays.appiconset/MlemPride-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.pride.appiconset/MlemPride-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Pride By Clays.appiconset/MlemPride-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.pride.appiconset/MlemPride-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem Inclusive Pride By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.pride2.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Inclusive Pride By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.pride2.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Inclusive Pride By Clays.appiconset/MlemInclusivePride-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.pride2.appiconset/MlemInclusivePride-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Inclusive Pride By Clays.appiconset/MlemInclusivePride-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.pride2.appiconset/MlemInclusivePride-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlemkin By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.pumpkin.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlemkin By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.pumpkin.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlemkin By Clays.appiconset/MlemkinSpice-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.pumpkin.appiconset/MlemkinSpice-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlemkin By Clays.appiconset/MlemkinSpice-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.pumpkin.appiconset/MlemkinSpice-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlemmit By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.red.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlemmit By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.red.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlemmit By Clays.appiconset/Mlemmit-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.red.appiconset/Mlemmit-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlemmit By Clays.appiconset/Mlemmit-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.red.appiconset/Mlemmit-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem Trans Pride By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.trans.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Trans Pride By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.trans.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Trans Pride By Clays.appiconset/MlemTransPride-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.trans.appiconset/MlemTransPride-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Trans Pride By Clays.appiconset/MlemTransPride-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.trans.appiconset/MlemTransPride-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Mlem Wave By Clays.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.clays.wave.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Wave By Clays.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.clays.wave.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Mlem Wave By Clays.appiconset/MlemWave-ios.png b/Mlem/Assets.xcassets/Icons/icon.clays.wave.appiconset/MlemWave-ios.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Mlem Wave By Clays.appiconset/MlemWave-ios.png rename to Mlem/Assets.xcassets/Icons/icon.clays.wave.appiconset/MlemWave-ios.png diff --git a/Mlem/Assets.xcassets/Icons/Classic Lemmy by Eric Andrews.appiconset/Classic Lemmy.png b/Mlem/Assets.xcassets/Icons/icon.eric.lemmy.appiconset/Classic Lemmy.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Classic Lemmy by Eric Andrews.appiconset/Classic Lemmy.png rename to Mlem/Assets.xcassets/Icons/icon.eric.lemmy.appiconset/Classic Lemmy.png diff --git a/Mlem/Assets.xcassets/Icons/Classic Lemmy by Eric Andrews.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.eric.lemmy.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Classic Lemmy by Eric Andrews.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.eric.lemmy.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Alien By Sjmarf.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.sjmarf.alien.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Alien By Sjmarf.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.sjmarf.alien.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Alien By Sjmarf.appiconset/logo.png b/Mlem/Assets.xcassets/Icons/icon.sjmarf.alien.appiconset/logo.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Alien By Sjmarf.appiconset/logo.png rename to Mlem/Assets.xcassets/Icons/icon.sjmarf.alien.appiconset/logo.png diff --git a/Mlem/Assets.xcassets/Icons/Stargazer By Sjmarf.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.sjmarf.default.appiconset/Contents.json similarity index 100% rename from Mlem/Assets.xcassets/Icons/Stargazer By Sjmarf.appiconset/Contents.json rename to Mlem/Assets.xcassets/Icons/icon.sjmarf.default.appiconset/Contents.json diff --git a/Mlem/Assets.xcassets/Icons/Stargazer By Sjmarf.appiconset/logo.png b/Mlem/Assets.xcassets/Icons/icon.sjmarf.default.appiconset/logo.png similarity index 100% rename from Mlem/Assets.xcassets/Icons/Stargazer By Sjmarf.appiconset/logo.png rename to Mlem/Assets.xcassets/Icons/icon.sjmarf.default.appiconset/logo.png diff --git a/Mlem/Assets.xcassets/Icons/icon.sjmarf.green.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.sjmarf.green.appiconset/Contents.json new file mode 100644 index 000000000..bdf1b75ef --- /dev/null +++ b/Mlem/Assets.xcassets/Icons/icon.sjmarf.green.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "green.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mlem/Assets.xcassets/Icons/icon.sjmarf.green.appiconset/green.png b/Mlem/Assets.xcassets/Icons/icon.sjmarf.green.appiconset/green.png new file mode 100644 index 000000000..51acd0045 Binary files /dev/null and b/Mlem/Assets.xcassets/Icons/icon.sjmarf.green.appiconset/green.png differ diff --git a/Mlem/Assets.xcassets/Icons/icon.sjmarf.orange.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.sjmarf.orange.appiconset/Contents.json new file mode 100644 index 000000000..43c3f0b1c --- /dev/null +++ b/Mlem/Assets.xcassets/Icons/icon.sjmarf.orange.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "orange.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mlem/Assets.xcassets/Icons/icon.sjmarf.orange.appiconset/orange.png b/Mlem/Assets.xcassets/Icons/icon.sjmarf.orange.appiconset/orange.png new file mode 100644 index 000000000..093d5f963 Binary files /dev/null and b/Mlem/Assets.xcassets/Icons/icon.sjmarf.orange.appiconset/orange.png differ diff --git a/Mlem/Assets.xcassets/Icons/icon.sjmarf.pink.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.sjmarf.pink.appiconset/Contents.json new file mode 100644 index 000000000..347c5c69b --- /dev/null +++ b/Mlem/Assets.xcassets/Icons/icon.sjmarf.pink.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "pink.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mlem/Assets.xcassets/Icons/icon.sjmarf.pink.appiconset/pink.png b/Mlem/Assets.xcassets/Icons/icon.sjmarf.pink.appiconset/pink.png new file mode 100644 index 000000000..1391d3b0a Binary files /dev/null and b/Mlem/Assets.xcassets/Icons/icon.sjmarf.pink.appiconset/pink.png differ diff --git a/Mlem/Assets.xcassets/Icons/icon.sjmarf.silver.appiconset/Contents.json b/Mlem/Assets.xcassets/Icons/icon.sjmarf.silver.appiconset/Contents.json new file mode 100644 index 000000000..f4344003c --- /dev/null +++ b/Mlem/Assets.xcassets/Icons/icon.sjmarf.silver.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "logo.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mlem/Assets.xcassets/Icons/icon.sjmarf.silver.appiconset/logo.png b/Mlem/Assets.xcassets/Icons/icon.sjmarf.silver.appiconset/logo.png new file mode 100644 index 000000000..d3652fe3e Binary files /dev/null and b/Mlem/Assets.xcassets/Icons/icon.sjmarf.silver.appiconset/logo.png differ diff --git a/Mlem/Logic/Easter/Easter Rewards.swift b/Mlem/Logic/Easter/Easter Rewards.swift index 2356c1e21..6de947e3c 100644 --- a/Mlem/Logic/Easter/Easter Rewards.swift +++ b/Mlem/Logic/Easter/Easter Rewards.swift @@ -8,8 +8,8 @@ import Foundation enum IconId: String { - case beehawCommunity = "Beehaw Community By Aaron Schneider" - case mlemhaw = "Mlemhaw By Clays" + case beehawCommunity = "icon.aaron.beehaw" + case mlemhaw = "icon.clays.beehaw" } enum EasterFlag: Codable, Hashable { diff --git a/Mlem/Models/Settings/AlternativeIcon.swift b/Mlem/Models/Settings/AlternativeIcon.swift index 36c8b815e..ca8f999ff 100644 --- a/Mlem/Models/Settings/AlternativeIcon.swift +++ b/Mlem/Models/Settings/AlternativeIcon.swift @@ -7,9 +7,13 @@ import Foundation +struct AlternativeIconGroup { + let authorName: String + let collapsed: Bool + let icons: [AlternativeIcon] +} + struct AlternativeIcon: Identifiable { - let id: String? + var id: String? let name: String - let author: String? - let selected: Bool } diff --git a/Mlem/Views/Shared/CollapsibleSection.swift b/Mlem/Views/Shared/CollapsibleSection.swift new file mode 100644 index 000000000..5c4098113 --- /dev/null +++ b/Mlem/Views/Shared/CollapsibleSection.swift @@ -0,0 +1,70 @@ +// +// CollapsibleSection.swift +// Mlem +// +// Created by Sjmarf on 02/01/2024. +// + +import SwiftUI + +struct CollapsibleSection: View { + var header: String? + var footer: String? + + @ViewBuilder var content: () -> Content + @State private var collapsed: Bool + + init( + _ header: String? = nil, + footer: String? = nil, + collapsed: Bool = false, + @ViewBuilder _ content: @escaping () -> Content + ) { + self.header = header + self.footer = footer + self.content = content + self._collapsed = State(wrappedValue: collapsed) + } + + var body: some View { + VStack(alignment: .leading, spacing: 0) { + if let header { + HStack { + Text(header) + .textCase(.uppercase) + .opacity(0.5) + Spacer() + Image(systemName: Icons.dropdown) + .fontWeight(.semibold) + .foregroundStyle(Color.accentColor) + .rotationEffect(Angle(degrees: collapsed ? -90 : 0)) + } + .font(.footnote) + .contentShape(.rect) + .onTapGesture { withAnimation(.default) { collapsed.toggle() }} + .padding(.vertical, 6) + .padding(.horizontal, 16) + } + + if !collapsed { + Color(uiColor: .systemGroupedBackground) + .frame(height: 1.5) + VStack { + content() + } + + if let footer = footer { + Text(footer) + .textCase(.uppercase) + .font(.footnote) + .padding(.horizontal, 16) + .foregroundStyle(.secondary) + } + } + } + .background(Color(uiColor: .secondarySystemGroupedBackground)) + .clipShape(RoundedRectangle(cornerRadius: AppConstants.largeItemCornerRadius)) + .fixedSize(horizontal: false, vertical: true) + .padding(.horizontal, 16) + } +} diff --git a/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/AlternativeIconCell.swift b/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/AlternativeIconCell.swift index cafeacaf0..167437c5c 100644 --- a/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/AlternativeIconCell.swift +++ b/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/AlternativeIconCell.swift @@ -10,6 +10,7 @@ import SwiftUI struct AlternativeIconCell: View { let icon: AlternativeIcon let setAppIcon: (_ id: String?) async -> Void + let selected: Bool var body: some View { Button { @@ -17,13 +18,7 @@ struct AlternativeIconCell: View { await setAppIcon(icon.id) } } label: { - AlternativeIconLabel(icon: icon) + AlternativeIconLabel(icon: icon, selected: selected) }.accessibilityElement(children: .combine) } } - -struct AlternativeIconCellPreview: PreviewProvider { - static var previews: some View { - AlternativeIconCell(icon: AlternativeIcon(id: nil, name: "Default", author: "Mlem team", selected: true)) { _ in } - } -} diff --git a/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/AlternativeIconLabel.swift b/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/AlternativeIconLabel.swift index de2847479..820babe5b 100644 --- a/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/AlternativeIconLabel.swift +++ b/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/AlternativeIconLabel.swift @@ -9,31 +9,33 @@ import SwiftUI struct AlternativeIconLabel: View { let icon: AlternativeIcon + let selected: Bool var body: some View { - HStack { + VStack { getImage() .resizable() .scaledToFit() .frame(width: AppConstants.appIconSize, height: AppConstants.appIconSize) .foregroundColor(Color.white) .cornerRadius(AppConstants.appIconCornerRadius) + .padding(3) + .shadow(radius: 2, x: 0, y: 2) .overlay { - RoundedRectangle(cornerRadius: AppConstants.appIconCornerRadius) - .stroke(Color(.secondarySystemBackground), lineWidth: 1) + if selected { + ZStack { + RoundedRectangle(cornerRadius: AppConstants.appIconCornerRadius) + .stroke(Color(.secondarySystemBackground), lineWidth: 5) + .padding(2) + RoundedRectangle(cornerRadius: AppConstants.appIconCornerRadius + 2) + .stroke(.blue, lineWidth: 3) + } + } } - VStack(alignment: .leading) { - Text(icon.name) - if let author = icon.author { - Text(author) - .font(.footnote) - .foregroundColor(.secondary) - } - } - Spacer() - if icon.selected { - Image(systemName: Icons.success) - } + Text(icon.name) + .multilineTextAlignment(.center) + .font(.footnote) + .foregroundStyle(selected ? .blue : .secondary) } } @@ -52,3 +54,10 @@ struct AlternativeIconLabel: View { return image() } } + +#Preview { + HStack(alignment: .top, spacing: 20) { + AlternativeIconLabel(icon: .init(id: "icon.sjmarf.default", name: "Default"), selected: false) + AlternativeIconLabel(icon: .init(id: "icon.sjmarf.default", name: "Default"), selected: true) + } +} diff --git a/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/IconSettingsView.swift b/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/IconSettingsView.swift index 8e0e983eb..7b0496762 100644 --- a/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/IconSettingsView.swift +++ b/Mlem/Views/Tabs/Settings/Components/Views/Appearance/Icons/IconSettingsView.swift @@ -8,92 +8,82 @@ import RegexBuilder import SwiftUI -let iconName = Reference() -let iconAuthor = Reference() -let iconFinder = Regex { - Capture { - ZeroOrMore(.any, .eager) // Icon name - } - " By " - Capture { - ZeroOrMore(.any, .eager) // Icon Maker - } -} -.ignoresCase() - // struct AlternativeIcons: View { struct IconSettingsView: View { @State var currentIcon: String? = UIApplication.shared.alternateIconName @EnvironmentObject var easterTracker: EasterFlagsTracker - - var body: some View { - List { - iconsList() - } - .fancyTabScrollCompatible() - .hoistNavigation() - .navigationTitle("App Icon") - } - @ViewBuilder - func iconsList() -> some View { - let allIcons = getAllIcons() - let creators = allIcons.keys.sorted() - - ForEach(creators, id: \.self) { creator in - if let icons = allIcons[creator], !icons.isEmpty { - DisclosureGroup { - ForEach(icons) { icon in - AlternativeIconCell(icon: icon, setAppIcon: setAppIcon) - } - } label: { - AlternativeIconLabel(icon: AlternativeIcon(id: icons[0].id, name: creator, author: nil, selected: false)) - } - } - } - } - - func getAllIcons() -> [String: [AlternativeIcon]] { - guard let iconsBundle = Bundle.main.object(forInfoDictionaryKey: "CFBundleIcons") as? [String: Any?] else { return [:] } - - guard let altIcons = iconsBundle["CFBundleAlternateIcons"] as? [String: Any?] else { return [:] } - - let currentIconSelection = UIApplication.shared.alternateIconName + let icons: [AlternativeIconGroup] = [ + .init(authorName: "Sjmarf", collapsed: false, icons: [ + .init(id: "icon.sjmarf.default", name: "Default"), + .init(id: "icon.sjmarf.pink", name: "Pink"), + .init(id: "icon.sjmarf.orange", name: "Orange"), + .init(id: "icon.sjmarf.green", name: "Green"), + .init(id: "icon.sjmarf.alien", name: "Alien"), + .init(id: "icon.sjmarf.silver", name: "Silver") + ]), - var ret: [String: [AlternativeIcon]] = .init() + .init(authorName: "Eric Andrews", collapsed: false, icons: [ + .init(id: "icon.eric.lemmy", name: "Lemmy") + ]), - altIcons.keys.forEach { key in - // parse AlternativeIcon from icon data - print("found icon: \(key)") - let match = key.firstMatch(of: iconFinder) - let name = (match?.output.1 != nil) ? String(match!.output.1) : key - var author = (match?.output.2 != nil) ? "\(String(match!.output.2))" : "Anonymous" - author = author.replacingOccurrences(of: "Clays", with: "Clay/s") - let icon = AlternativeIcon(id: key, name: name, author: author, selected: currentIconSelection == key) - - // if we should show this icon, add to map - if shouldShowIcon(icon: icon) { - ret[author, default: []].append(icon) - } - } + .init(authorName: "Aaron Schneider", collapsed: false, icons: [ + .init(id: "icon.aaron.beehaw", name: "Beehaw") + ]), - ret.keys.forEach { key in - ret[key] = ret[key]?.sorted { - $0.name < $1.name + .init(authorName: "Clay/s", collapsed: true, icons: [ + .init(id: "icon.clays.default", name: "Default"), + .init(id: "icon.clays.red", name: "Red"), + .init(id: "icon.clays.lime", name: "Lime"), + .init(id: "icon.clays.mono", name: "Mono"), + .init(id: "icon.clays.dark", name: "Dark"), + .init(id: "icon.clays.dev", name: "Dev"), + .init(id: "icon.clays.wave", name: "Wave"), + .init(id: "icon.clays.conductor", name: "Conductor"), + .init(id: "icon.clays.pumpkin", name: "Pumpkin"), + .init(id: "icon.clays.pride", name: "Pride"), + .init(id: "icon.clays.pride2", name: "Pride 2"), + .init(id: "icon.clays.trans", name: "Trans"), + .init(id: "icon.clays.beehaw", name: "Beehaw") + ]) + ] + + var body: some View { + ScrollView { + VStack(spacing: 32) { + ForEach(icons, id: \.authorName) { group in + let icons = group.icons.filter { shouldShowIcon(icon: $0) } + if !icons.isEmpty { + CollapsibleSection(group.authorName, collapsed: group.collapsed) { + LazyVGrid(columns: .init(repeating: GridItem(.flexible()), count: 4), spacing: 10, content: { + ForEach(icons) { icon in + AlternativeIconCell( + icon: icon, + setAppIcon: setAppIcon, + selected: UIApplication.shared.alternateIconName == icon.id + ) + } + }) + .padding(.vertical, 15) + .padding(.horizontal, 12) + } + } + } } + .padding(.vertical) } - - return ret + .background(Color(uiColor: .systemGroupedBackground)) + .fancyTabScrollCompatible() + .hoistNavigation() + .navigationTitle("App Icon") } static func getCurrentIcon() -> Image { let icon = AlternativeIcon( id: UIApplication.shared.alternateIconName, - name: "", - author: "", - selected: false + name: "" ) - return AlternativeIconLabel(icon: icon).getImage() + return AlternativeIconLabel(icon: icon, selected: true).getImage() } @MainActor