add shape picker for backgrounds
This commit is contained in:
@@ -11,13 +11,15 @@ struct CustomizeView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.moodImages.rawValue, store: GroupUserDefaults.groupDefaults) private var imagePack: MoodImages = .FontAwesome
|
||||
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.shape.rawValue, store: GroupUserDefaults.groupDefaults) private var shape: BGShape = .circle
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.personalityPack.rawValue, store: GroupUserDefaults.groupDefaults) private var personalityPack: PersonalityPack = .Default
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.customMoodTintUpdateNumber.rawValue, store: GroupUserDefaults.groupDefaults) private var customMoodTintUpdateNumber: Int = 0
|
||||
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.showNSFW.rawValue, store: GroupUserDefaults.groupDefaults) private var showNSFW: Bool = false
|
||||
@@ -27,13 +29,15 @@ struct CustomizeView: View {
|
||||
|
||||
@StateObject private var customMoodTint = UserDefaultsStore.getCustomMoodTint()
|
||||
|
||||
@State var shapeRefreshToggleThing: Bool = false
|
||||
|
||||
class StupidAssCustomWidgetObservableObject: ObservableObject {
|
||||
@Published var fuckingWrapped: CustomWidgetModel? = nil
|
||||
@Published var showFuckingSheet = false
|
||||
}
|
||||
|
||||
@StateObject private var selectedWidget = StupidAssCustomWidgetObservableObject()
|
||||
|
||||
|
||||
let iconSets: [(String,String)] = [
|
||||
("AppIconGoodImage", "AppIconGood"),
|
||||
("AppIconAverageImage", "AppIconAverage"),
|
||||
@@ -47,17 +51,21 @@ struct CustomizeView: View {
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack {
|
||||
createCustomWidget
|
||||
changeIcon
|
||||
themePicker
|
||||
Divider()
|
||||
sampleEntryView
|
||||
pickMoodImagePack
|
||||
Group {
|
||||
createCustomWidget
|
||||
changeIcon
|
||||
themePicker
|
||||
Divider()
|
||||
sampleEntryView
|
||||
pickMoodImagePack
|
||||
}
|
||||
Group {
|
||||
pickMoodTintPack
|
||||
pickTextColor
|
||||
}
|
||||
Divider()
|
||||
shapePicker
|
||||
Divider()
|
||||
pickPeronsalityPack
|
||||
}
|
||||
}
|
||||
@@ -91,7 +99,7 @@ struct CustomizeView: View {
|
||||
.frame(width: 50, height:50)
|
||||
.cornerRadius(10)
|
||||
})
|
||||
|
||||
|
||||
|
||||
ForEach(iconSets, id: \.self.0){ iconSet in
|
||||
Button(action: {
|
||||
@@ -140,13 +148,13 @@ struct CustomizeView: View {
|
||||
.font(.body)
|
||||
}
|
||||
})
|
||||
.contentShape(Rectangle())
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10, style: .continuous)
|
||||
.fill(theme == aTheme ? theme.currentTheme.bgColor : .clear)
|
||||
.padding(-5)
|
||||
|
||||
)
|
||||
.contentShape(Rectangle())
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10, style: .continuous)
|
||||
.fill(theme == aTheme ? theme.currentTheme.bgColor : .clear)
|
||||
.padding(-5)
|
||||
|
||||
)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
@@ -450,6 +458,60 @@ struct CustomizeView: View {
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
private var shapePicker: some View {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(shapeRefreshToggleThing.description.localizedLowercase)
|
||||
.hidden()
|
||||
Image(systemName: "arrow.triangle.2.circlepath.circle")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20, alignment: .trailing)
|
||||
.foregroundColor(Color(UIColor.systemGray))
|
||||
.onTapGesture {
|
||||
shapeRefreshToggleThing.toggle()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
|
||||
VStack(alignment:.leading) {
|
||||
Text(String(localized: "customize_view_view_pick_shape"))
|
||||
.padding([.leading])
|
||||
.foregroundColor(textColor)
|
||||
Divider()
|
||||
|
||||
HStack {
|
||||
ForEach(BGShape.allCases, id: \.rawValue) { ashape in
|
||||
ashape.view(withText: Text("20"),
|
||||
bgColor: moodTint.color(forMood: Mood.allValues.randomElement()!), textColor: textColor)
|
||||
.frame(height: 50)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.onTapGesture {
|
||||
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
|
||||
impactMed.impactOccurred()
|
||||
shape = ashape
|
||||
EventLogger.log(event: "change_mood_shape_id", withData: ["id": shape.rawValue])
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10, style: .continuous)
|
||||
.fill(shape == ashape ? theme.currentTheme.bgColor : .clear)
|
||||
.padding(-5)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
}
|
||||
|
||||
struct CustomizeView_Previews: PreviewProvider {
|
||||
|
||||
Reference in New Issue
Block a user