The desired behavior is
If the date and current date are the same if you check not to open it today and reload it, it is 0 if X is different.
The current implementation status is that when checking, save the checked date in the preference and reload it from the main
Compare the preference date with the current date
Depending on the compare value
if( comapre==0){
show( );
}else if( compare < 0){
dismiss( );
}
else if( compare > 0{
dismiss( );
}
I'm implementing it like this, but if I change the date on my phone, it's different from the value saved in the preference As the comparison value changes, the comparison value should be continued
The comparison value is set to zero, and the pop-up keeps disappearing. date compare preference
Rather than saving the checked date, save the time point at which you want the pop-up to stay open until when it should stay open.
// Turn off the pop-up until 23:59 today
if (current time <=modal_discussed_until) {
dismiss();
// If you don't meet the conditions, you can show them
// (if there is no modal_discussed_until value)
} } else {
show();
}
+ To add a comment, scenarios like "user bother to change the date on the device" are very special and difficult to consider. From the user's point of view, there are two choices (checking / going into settings and changing the date of the device) to see the pop-up just for today, but if the former works well, I wouldn't choose the latter, which is more troublesome and complicated.
© 2024 OneMinuteCode. All rights reserved.