add logging

This commit is contained in:
Trey t
2022-03-13 20:06:26 -05:00
parent 8d3e9a7c6e
commit f3542117a7
14 changed files with 93 additions and 5 deletions

View File

@@ -45,6 +45,8 @@ struct CreateWidgetView: View {
}
func update(eye: CustomWidgetEyes, eyeOption: CustomWidgeImageOptions) {
EventLogger.log(event: "create_widget_view_update_eye",
withData: ["eye_value": eye.rawValue, "eye_option_value": eyeOption.rawValue])
switch eye {
case .left:
customWidget.leftEye = eyeOption
@@ -54,6 +56,7 @@ struct CreateWidgetView: View {
}
func createRandom() {
EventLogger.log(event: "create_widget_view_create_random")
customWidget.bgColor = Color.random()
customWidget.innerColor = Color.random()
customWidget.bgOverlayColor = Color.random()
@@ -70,10 +73,14 @@ struct CreateWidgetView: View {
}
func update(mouthOption: CustomWidgeImageOptions) {
EventLogger.log(event: "create_widget_view_update_mouth",
withData: ["mouthOption": mouthOption.rawValue])
customWidget.mouth = mouthOption
}
func update(background: CustomWidgetBackGroundOptions) {
EventLogger.log(event: "create_widget_view_update_background",
withData: ["background": background.rawValue])
customWidget.background = background
}
@@ -94,6 +101,7 @@ struct CreateWidgetView: View {
Group {
HStack(alignment: .center, spacing: 0) {
Button(action: {
EventLogger.log(event: "create_widget_view_shuffle")
createRandom()
}, label: {
Image(systemName: "shuffle")
@@ -106,6 +114,7 @@ struct CreateWidgetView: View {
.background(.blue)
Button(action: {
EventLogger.log(event: "create_widget_view_save_widget")
UserDefaultsStore.saveCustomWidget(widgetModel: customWidget, inUse: false)
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
impactMed.impactOccurred()
@@ -122,6 +131,7 @@ struct CreateWidgetView: View {
.background(.green)
Button(action: {
EventLogger.log(event: "customize_view_use_widget")
UserDefaultsStore.saveCustomWidget(widgetModel: customWidget, inUse: true)
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
impactMed.impactOccurred()
@@ -139,6 +149,7 @@ struct CreateWidgetView: View {
if customWidget.isSaved {
Button(action: {
EventLogger.log(event: "customize_view_delete_widget")
UserDefaultsStore.deleteCustomWidget(withUUID: customWidget.uuid)
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
impactMed.impactOccurred()
@@ -164,6 +175,9 @@ struct CreateWidgetView: View {
VStack(alignment: .center) {
Text(String(localized: "create_widget_background_color"))
ColorPicker("", selection: $customWidget.bgColor)
.onChange(of: customWidget.mouthColor, perform: { newValue in
EventLogger.log(event: "create_widget_view_update_background_color")
})
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
@@ -171,6 +185,9 @@ struct CreateWidgetView: View {
VStack(alignment: .center) {
Text(String(localized: "create_widget_inner_color"))
ColorPicker("", selection: $customWidget.innerColor)
.onChange(of: customWidget.mouthColor, perform: { newValue in
EventLogger.log(event: "create_widget_view_update_inner_color")
})
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
@@ -178,6 +195,9 @@ struct CreateWidgetView: View {
VStack(alignment: .center) {
Text(String(localized: "create_widget_face_outline_color"))
ColorPicker("", selection: $customWidget.circleStrokeColor)
.onChange(of: customWidget.mouthColor, perform: { newValue in
EventLogger.log(event: "create_widget_view_update_outline_color")
})
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
@@ -187,6 +207,9 @@ struct CreateWidgetView: View {
VStack(alignment: .center) {
Text(String(localized: "create_widget_view_left_eye_color"))
ColorPicker("", selection: $customWidget.leftEyeColor)
.onChange(of: customWidget.mouthColor, perform: { newValue in
EventLogger.log(event: "create_widget_view_update_left_eye_color")
})
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
@@ -194,6 +217,9 @@ struct CreateWidgetView: View {
VStack(alignment: .center) {
Text(String(localized: "create_widget_view_right_eye_color"))
ColorPicker("", selection: $customWidget.rightEyeColor)
.onChange(of: customWidget.mouthColor, perform: { newValue in
EventLogger.log(event: "create_widget_view_update_right_eye_color")
})
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
@@ -201,6 +227,9 @@ struct CreateWidgetView: View {
VStack(alignment: .center) {
Text(String(localized: "create_widget_view_mouth_color"))
ColorPicker("", selection: $customWidget.mouthColor)
.onChange(of: customWidget.mouthColor, perform: { newValue in
EventLogger.log(event: "create_widget_view_update_mouth_color")
})
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)