Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
fix: vaccine-injection (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayce45 authored Dec 9, 2021
1 parent 1b453c0 commit 3e37b54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion browser_action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
appStatus.setInjectionType.bind(appStatus, "thirdInjectionOnly");

document.getElementById("modernaInjection").onclick =
appStatus.setInjectionVaccine.bind(appStatus, "pfizerInjection");
appStatus.setInjectionVaccine.bind(appStatus, "modernaInjection");
document.getElementById("pfizerInjection").onclick =
appStatus.setInjectionVaccine.bind(appStatus, "pfizerInjection");

Expand Down
17 changes: 15 additions & 2 deletions commons/AppStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AppStatus {
this.onAutoBookChangeCb = (newValue) => {};
/** @type {('fullServiceInjection' | 'firstInjectionOnly' | 'secondInjectionOnly' | 'thirdInjectionOnly') => void} callback quand injectionType change de valeur */
this.onInjectionTypeCb = (newValue) => {};
/** @type {'modernaInjection' | 'pfizerInjection'} callback quand injectionType change de valeur */
/** @type {'modernaInjection' | 'pfizerInjection'} callback quand injectionVaccine change de valeur */
this.onInjectionVaccineCb = (newValue) => {};

this.onStorageChange = this.onStorageChange.bind(this);
Expand All @@ -48,6 +48,7 @@ class AppStatus {
stopped: false,
autoBook: false,
injectionType: "fullServiceInjection",
injectionVaccine: "modernaInjection",
});

Object.keys(result.locations).forEach((url) => {
Expand All @@ -63,6 +64,9 @@ class AppStatus {

this.injectionType = result.injectionType;
this.onInjectionTypeCb(this.injectionType);

this.injectionVaccine = result.injectionVaccine;
this.onInjectionVaccineCb(this.injectionVaccine);
}

getLocations() {
Expand Down Expand Up @@ -135,7 +139,7 @@ class AppStatus {
* @param {('modernaInjection' | 'pfizerInjection') => void} callback quand injectionVaccine change de valeur
*/
onInjectionVaccineChange(callback) {
this.onInjectionTypeCb = callback;
this.onInjectionVaccineCb = callback;
}

start() {
Expand Down Expand Up @@ -187,6 +191,8 @@ class AppStatus {
this.onAutoBookChangeCb(this.autoBook);
this.injectionType = "fullServiceInjection";
this.onInjectionTypeCb(this.injectionType);
this.injectionVaccine = "modernaInjection";
this.onInjectionTypeCb(this.injectionVaccine);
}

/**
Expand All @@ -202,6 +208,7 @@ class AppStatus {
this.onStoppedChangeCb = null;
this.onAutoBookChangeCb = null;
this.onInjectionTypeCb = null;
this.onInjectionVaccineCb = null;
}

/**
Expand Down Expand Up @@ -249,5 +256,11 @@ class AppStatus {

this.onInjectionTypeCb(this.injectionType);
}

if (change.injectionVaccine) {
this.injectionVaccine = change.injectionVaccine.newValue;

this.onInjectionVaccineCb(this.injectionVaccine);
}
}
}

0 comments on commit 3e37b54

Please sign in to comment.