Skip to content

Commit

Permalink
fix: tips popup apparition
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoblanc committed Apr 4, 2020
1 parent 3ace17d commit 07b6e17
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/app/components/slides3d/slides3d.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ion-slides {
border-radius: 6px;
width: 100%;
height: 100%;
background-color:#DDDDDD;
filter: brightness(0.8);
}

Expand Down
19 changes: 12 additions & 7 deletions src/app/provider/meta-media/meta-media.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ export class MetaMediaService {
this.storage.get<Date>(StorageService.INSTALLATION_DATE)
.subscribe((dateInstall) => {
try {
this.installDate = new Date(dateInstall);
if (dateInstall) {
this.installDate = new Date(dateInstall);
} else {
this.installDate = new Date();
}
} catch (error) {
//
console.error(error);
}
});

Expand Down Expand Up @@ -74,9 +78,9 @@ export class MetaMediaService {
if (counts == null) {
// On init l'objet
counts = {};
// Et on init le champ relatif au edia courant
counts[this.currentMetaMedia.key] = { count: 1 };
} else if (counts[this.currentMetaMedia.key] == null) {
}

if (counts[this.currentMetaMedia.key] == null) {
// On init la clé
counts[this.currentMetaMedia.key] = { count: 1 };

Expand All @@ -98,6 +102,7 @@ export class MetaMediaService {
const mcount = counts[this.currentMetaMedia.key];
// Vérification de l'ensemble des critères
// Date d'install plus petite de 5 jours mini (pour passer la vérif du store)

if (this.installDate != null && this.installDate < a
// Que l'utilisateur est incrémenté son compte de 10 passage sur le currentmedia
&& mcount.count > 10
Expand All @@ -107,11 +112,11 @@ export class MetaMediaService {
&& this.currentMetaMedia.donation.length > 2
&& (mcount.lastAsk == null || mcount.lastAsk < a)) {

// Si on a passé l'ensemble des condition alors on affiche une alerte pour proposer de soutneir
// Si on a passé l'ensemble des condition alors on affiche une alerte pour proposer de soutneir
this.currentMetaMedia.isDonationActivated = true;
this.alertService.openExternalLink('Soutenir ' + this.currentMetaMedia.title,
'On dirait bien que vous appréciez ce contenu, souhaitez-vous soutenir les auteurs ? ', this.currentMetaMedia.donation);
// On update a date de dernière mise a jour
// On update a date de dernière mise a jour
counts[this.currentMetaMedia.key].lastAsk = new Date();
}

Expand Down
7 changes: 6 additions & 1 deletion src/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ body {
}

.alert-wrapper{
--ion-text-color: black;
.alert-head{
--ion-text-color: white;
}
.alert-message{
color: #CCCCCC;
}
}

ion-back-button {
Expand Down

0 comments on commit 07b6e17

Please sign in to comment.