Closed kefahB closed 4 years ago
@kefahB Actually, the value is cached in this.isFirst
(second line in your first snippet). So as long as that instance is reused this line will return that initially cached value.
@EddyVerbruggen,
Yes of course, but the I think is that the issu in it, is cached to false
before that we can use the functions isFirstRun
or isFirstRunSync
.
Maybe I am not clean how explain, I give an exemple :
index.ts
// Here first run is TRUE
const secure = new SecureStorage();
// Now first run is FALSE
secure.isFirstRun.then(res => {
console.log(res); // It always will be false because is cached to false on constructor
if(res) {
// Do some stuff....
}
});
If I have to do some stuff when the value is true I can not because it will never be true
after caller new SecureStorage()
@kefahB If that cached value is false
then there's a bug because it's supposed to be true
on first run and secure.isFirstRun
should return that value.
Do you see this issue on both platforms?
No just on IOS cause.
I will do some extra testing and tell you .. I know you have a lot to do 😉
Hi @EddyVerbruggen, I remark an issue on the concept to do stuff with "First run", you declare this on constructor :
Since this is declared on constructor we can not do some think with the first run because you set immediately the
SecureStorageCommon.IS_FIRST_RUN
to false, if I call theisFirstRun()
orclearAllOnFirstRun()
orclearAllOnFirstRunSync()
will return alwaysfalse
cause t it is already set on the constructor.Maybe change refactor the tow method
isFirstRunSync
andisFirstRunSync
and delete those lines from constructor :