add logging
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -61,6 +61,9 @@ struct CustomizeView: View {
|
||||
pickPeronsalityPack
|
||||
}
|
||||
}
|
||||
.onAppear(perform: {
|
||||
EventLogger.log(event: "show_customize_view")
|
||||
})
|
||||
.padding()
|
||||
.sheet(isPresented: $selectedWidget.showFuckingSheet) {
|
||||
if let fuckingWrapped = selectedWidget.fuckingWrapped {
|
||||
@@ -81,6 +84,7 @@ struct CustomizeView: View {
|
||||
HStack {
|
||||
Button(action: {
|
||||
UIApplication.shared.setAlternateIconName(nil)
|
||||
EventLogger.log(event: "change_icon_title", withData: ["title": "default"])
|
||||
}, label: {
|
||||
Image("AppIconImage", bundle: .main)
|
||||
.resizable()
|
||||
@@ -94,6 +98,7 @@ struct CustomizeView: View {
|
||||
UIApplication.shared.setAlternateIconName(iconSet.1) { (error) in
|
||||
// FIXME: Handle error
|
||||
}
|
||||
EventLogger.log(event: "change_icon_title", withData: ["title": iconSet.1])
|
||||
}, label: {
|
||||
Image(iconSet.0, bundle: .main)
|
||||
.resizable()
|
||||
@@ -122,6 +127,7 @@ struct CustomizeView: View {
|
||||
ForEach(Theme.allCases, id:\.rawValue) { aTheme in
|
||||
Button(action: {
|
||||
theme = aTheme
|
||||
EventLogger.log(event: "change_theme_id", withData: ["id": aTheme.rawValue])
|
||||
}, label: {
|
||||
VStack {
|
||||
aTheme.currentTheme.preview
|
||||
@@ -163,6 +169,7 @@ struct CustomizeView: View {
|
||||
.frame(width: 50, height: 50)
|
||||
.cornerRadius(10)
|
||||
.onTapGesture {
|
||||
EventLogger.log(event: "show_widget")
|
||||
selectedWidget.fuckingWrapped = widget.copy() as? CustomWidgetModel
|
||||
selectedWidget.showFuckingSheet = true
|
||||
}
|
||||
@@ -173,6 +180,7 @@ struct CustomizeView: View {
|
||||
Image(systemName: "plus")
|
||||
)
|
||||
.onTapGesture {
|
||||
EventLogger.log(event: "tap_create_new_widget")
|
||||
selectedWidget.fuckingWrapped = CustomWidgetModel.randomWidget
|
||||
selectedWidget.showFuckingSheet = true
|
||||
}
|
||||
@@ -221,6 +229,7 @@ struct CustomizeView: View {
|
||||
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
|
||||
impactMed.impactOccurred()
|
||||
imagePack = images
|
||||
EventLogger.log(event: "change_image_pack_id", withData: ["id": images.rawValue])
|
||||
}
|
||||
if images.rawValue != (MoodImages.allCases.sorted(by: { $0.rawValue > $1.rawValue }).first?.rawValue) ?? 0 {
|
||||
Divider()
|
||||
@@ -261,6 +270,7 @@ struct CustomizeView: View {
|
||||
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
|
||||
impactMed.impactOccurred()
|
||||
moodTint = tint
|
||||
EventLogger.log(event: "change_mood_tint_id", withData: ["id": tint.rawValue])
|
||||
}
|
||||
Divider()
|
||||
}
|
||||
@@ -376,6 +386,7 @@ struct CustomizeView: View {
|
||||
private func saveCustomMoodTint() {
|
||||
UserDefaultsStore.saveCustomMoodTint(customTint: customMoodTint)
|
||||
moodTint = .Custom
|
||||
EventLogger.log(event: "change_mood_tint_id", withData: ["id": MoodTints.Custom.rawValue])
|
||||
customMoodTintUpdateNumber += 1
|
||||
}
|
||||
|
||||
@@ -407,10 +418,12 @@ struct CustomizeView: View {
|
||||
.onTapGesture {
|
||||
if aPack.rawValue == PersonalityPack.Rude.rawValue && !showNSFW {
|
||||
showOver18Alert = true
|
||||
EventLogger.log(event: "show_over_18_alert")
|
||||
} else {
|
||||
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
|
||||
impactMed.impactOccurred()
|
||||
personalityPack = aPack
|
||||
EventLogger.log(event: "change_personality_pack", withData: ["pack_title": aPack.title()])
|
||||
LocalNotification.rescheduleNotifiations()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,9 @@ struct FilterView: View {
|
||||
Text(mood.strValue)
|
||||
.foregroundColor(moodTint.color(forMood: mood))
|
||||
}
|
||||
.onAppear(perform: {
|
||||
EventLogger.log(event: "show_filter_view")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,9 @@ struct HomeView: View {
|
||||
showUpdateEntryAlert = false
|
||||
})
|
||||
}
|
||||
.onAppear(perform: {
|
||||
EventLogger.log(event: "show_home_view")
|
||||
})
|
||||
}
|
||||
|
||||
// MARK: functions that do view type work
|
||||
|
||||
@@ -82,6 +82,9 @@ struct MonthDetailView: View {
|
||||
showUpdateEntryAlert = false
|
||||
})
|
||||
}
|
||||
.onAppear(perform: {
|
||||
EventLogger.log(event: "show_month_detail_view")
|
||||
})
|
||||
.background(
|
||||
theme.currentTheme.bg
|
||||
)
|
||||
|
||||
@@ -76,6 +76,9 @@ struct MonthView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear(perform: {
|
||||
EventLogger.log(event: "show_month_view")
|
||||
})
|
||||
.padding([.top, .bottom])
|
||||
.background(
|
||||
theme.currentTheme.bg
|
||||
|
||||
@@ -66,6 +66,9 @@ struct SettingsView: View {
|
||||
showOnboarding = false
|
||||
})
|
||||
}
|
||||
.onAppear(perform: {
|
||||
EventLogger.log(event: "show_settings_view")
|
||||
})
|
||||
.background(
|
||||
theme.currentTheme.bg
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
@@ -78,6 +81,7 @@ struct SettingsView: View {
|
||||
onCompletion: { result in
|
||||
switch result {
|
||||
case .success(let url):
|
||||
EventLogger.log(event: "exported_file")
|
||||
print("Saved to \(url)")
|
||||
case .failure(let error):
|
||||
print(error.localizedDescription)
|
||||
@@ -112,11 +116,13 @@ struct SettingsView: View {
|
||||
try! PersistenceController.shared.viewContext.save()
|
||||
}
|
||||
PersistenceController.shared.saveAndRunDataListerners()
|
||||
EventLogger.log(event: "import_file")
|
||||
} else {
|
||||
// Handle denied access
|
||||
EventLogger.log(event: "error_import_file")
|
||||
}
|
||||
} catch {
|
||||
// Handle failure.
|
||||
EventLogger.log(event: "error_import_file", withData: ["error": error.localizedDescription])
|
||||
print("Unable to read file contents")
|
||||
print(error.localizedDescription)
|
||||
}
|
||||
@@ -127,6 +133,7 @@ struct SettingsView: View {
|
||||
HStack{
|
||||
Spacer()
|
||||
Button(action: {
|
||||
EventLogger.log(event: "tap_settings_close")
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text(String(localized: "settings_view_exit"))
|
||||
@@ -141,6 +148,7 @@ struct SettingsView: View {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
VStack {
|
||||
Button(action: {
|
||||
EventLogger.log(event: "tap_show_special_thanks")
|
||||
withAnimation{
|
||||
showSpecialThanks.toggle()
|
||||
}
|
||||
@@ -222,14 +230,11 @@ struct SettingsView: View {
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private var showOnboardingButton: some View {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
Button(action: {
|
||||
EventLogger.log(event: "tap_show_onboarding")
|
||||
showOnboarding.toggle()
|
||||
}, label: {
|
||||
Text(String(localized: "settings_view_show_onboarding"))
|
||||
@@ -249,6 +254,9 @@ struct SettingsView: View {
|
||||
Text(String(localized: "settings_use_cloudkit_title"))
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.onChange(of: useCloudKit) { newValue in
|
||||
EventLogger.log(event: "toggle_use_cloudkit", withData: ["value": newValue])
|
||||
}
|
||||
.padding()
|
||||
Text(String(localized: "settings_use_cloudkit_body"))
|
||||
.foregroundColor(textColor)
|
||||
@@ -280,6 +288,9 @@ struct SettingsView: View {
|
||||
VStack {
|
||||
Toggle(String(localized: "settings_use_delete_enable"),
|
||||
isOn: $deleteEnabled)
|
||||
.onChange(of: deleteEnabled) { newValue in
|
||||
EventLogger.log(event: "toggle_can_delete", withData: ["value": newValue])
|
||||
}
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
}
|
||||
@@ -293,6 +304,7 @@ struct SettingsView: View {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
Button(action: {
|
||||
showingExporter.toggle()
|
||||
EventLogger.log(event: "export_data", withData: ["title": "default"])
|
||||
}, label: {
|
||||
Text("Export")
|
||||
})
|
||||
@@ -307,6 +319,7 @@ struct SettingsView: View {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
Button(action: {
|
||||
showingImporter.toggle()
|
||||
EventLogger.log(event: "import_data", withData: ["title": "default"])
|
||||
}, label: {
|
||||
Text("Import")
|
||||
})
|
||||
|
||||
@@ -96,6 +96,8 @@ struct SwitchableView: View {
|
||||
.onTapGesture {
|
||||
viewType = viewType.next()
|
||||
self.headerTypeChanged(viewType)
|
||||
EventLogger.log(event: "switchable_view_header_changed",
|
||||
withData: ["view_type_id": viewType.rawValue, "days_back": daysBack])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user