App working again
This commit is contained in:
		| @@ -24,7 +24,6 @@ struct FlashCardView: View { | ||||
|                 Text("Last seen: " + model.getDateFormatter().string(from: flashcard.lastSeenOn!)) | ||||
|                     .font(.subheadline) | ||||
|             } | ||||
|             Text("Next spaced repetition milestone: \(flashcard.nextSpacedRepetitionMilestone)") | ||||
|             if showDescription { | ||||
|                 flashcardText | ||||
|                     .textSelection(.enabled) | ||||
|   | ||||
| @@ -6,6 +6,7 @@ | ||||
| // | ||||
|  | ||||
| import SwiftUI | ||||
| import CoreData | ||||
|  | ||||
| struct NextRepetitionButtonView: View { | ||||
|     let buttonText: String | ||||
| @@ -15,14 +16,25 @@ struct NextRepetitionButtonView: View { | ||||
|     let color: Color | ||||
|     let geometry: GeometryProxy | ||||
|     let timeText: String | ||||
|     @Environment(\.managedObjectContext) var moc | ||||
| //            { colorScheme == .light ? .cyan : .darkCyan } | ||||
|     @Binding var showDescription: Bool | ||||
|     @EnvironmentObject var model: WordAXModelView | ||||
|     @Environment(\.colorScheme) var colorScheme | ||||
|     var body: some View { | ||||
|             Button(action: { | ||||
|                 // TODO: Fix this anki button clicked function | ||||
| //                model.ankiButtonClicked(flashcardId: flashcardId, milestone: nextMilestone) | ||||
|                 let request = NSFetchRequest<Flashcard>(entityName: "Flashcard") | ||||
|                 request.predicate = NSPredicate(format: "id == %@", flashcardId as CVarArg) | ||||
|                 do { | ||||
|                     let result = try moc.fetch(request) | ||||
|                     let flashcard = result.first | ||||
|                     flashcard?.lastSeenOn = Date() | ||||
|                     flashcard?.nextSpacedRepetitionMilestone = nextMilestone?.rawValue ?? 0 | ||||
|                     flashcard?.shownCount += 1 | ||||
|                     try moc.save() | ||||
|                 } catch { | ||||
|                     print("Something went wrong while saving the flashcard info: \(error.localizedDescription)") | ||||
|                 } | ||||
|                 self.showDescription = false | ||||
|             }) { | ||||
|                 VStack { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user