Merge pull request #23 from fancy-flashcard/bug-fixes-#21-#22
Bug fixes #21 #22
This commit is contained in:
commit
7af2eeb8a6
2 changed files with 11 additions and 2 deletions
|
@ -85,8 +85,13 @@ export default class Learn extends LearnProps {
|
||||||
this.moveToPrev();
|
this.moveToPrev();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
destroyed() {
|
||||||
|
this.$eventHub.$off(Event.SWIPE_LEFT_IN_LEARN);
|
||||||
|
this.$eventHub.$off(Event.SWIPE_RIGHT_IN_LEARN);
|
||||||
|
}
|
||||||
|
|
||||||
updateCurLearningElement() {
|
updateCurLearningElement() {
|
||||||
|
if (!this.learningSessionManager) return;
|
||||||
this.curLearningElement = this.learningSessionManager.getCurrentLearningSessionElementWithCardDetails();
|
this.curLearningElement = this.learningSessionManager.getCurrentLearningSessionElementWithCardDetails();
|
||||||
this.updateRatingForCurrentLearningElement();
|
this.updateRatingForCurrentLearningElement();
|
||||||
saveLearningSessionManagerDataToLocalStorage(this.learningSessionManager);
|
saveLearningSessionManagerDataToLocalStorage(this.learningSessionManager);
|
||||||
|
@ -177,7 +182,9 @@ export default class Learn extends LearnProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
finishSession() {
|
finishSession() {
|
||||||
finishLearningDialog(this, this.getBarsForFinishLearningDialog());
|
finishLearningDialog(this, this.getBarsForFinishLearningDialog(), () => {
|
||||||
|
this.learningSessionManager = null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBarsForFinishLearningDialog(): CustomDialogOptionsBarChartBar[] {
|
getBarsForFinishLearningDialog(): CustomDialogOptionsBarChartBar[] {
|
||||||
|
|
|
@ -9,7 +9,8 @@ import { clearLearningSessionManagerDataInLocalStorage } from "./learningSession
|
||||||
|
|
||||||
export function finishLearningDialog(
|
export function finishLearningDialog(
|
||||||
context: any,
|
context: any,
|
||||||
bars: CustomDialogOptionsBarChartBar[]
|
bars: CustomDialogOptionsBarChartBar[],
|
||||||
|
callbackLearningFinished: { (): void }
|
||||||
) {
|
) {
|
||||||
const options = {
|
const options = {
|
||||||
title: "Finish Learning?",
|
title: "Finish Learning?",
|
||||||
|
@ -32,6 +33,7 @@ export function finishLearningDialog(
|
||||||
QuitLearningReason.NO_MORE_CARDS
|
QuitLearningReason.NO_MORE_CARDS
|
||||||
);
|
);
|
||||||
clearLearningSessionManagerDataInLocalStorage();
|
clearLearningSessionManagerDataInLocalStorage();
|
||||||
|
callbackLearningFinished();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue