PixelogicDev / Gruvee-Mobile

#WeAreGrüvee
MIT License
48 stars 11 forks source link

[Bug] Sign out of Firebase account if app is fresh installed #46

Open adilanchian opened 4 years ago

adilanchian commented 4 years ago

Using this library: https://github.com/react-native-community/async-storage

We are able to set local storage, but the issue is it persists even after app deletion. So we need to figure out a way to properly handle this. Here is the desired scenario:

getIsAppInit()
            .then(result => {
                if (result === null) {
                    console.log('Get App Init is not set.')
                    // Call logout on firebase user
                    // Set Is App Init in store
                } else {
                    console.log('IsAppInit: ', result)
                }
            })
            .catch(error => {
                console.warn(error)
            })
adilanchian commented 4 years ago

I feel as though this may be a dev environment thing and shouldn't be a problem in production. Either way we should test this.

creativenull commented 4 years ago

May I claim this one? 🙂

adilanchian commented 4 years ago

@creativenull All yours my friend!

creativenull commented 4 years ago

So, correct me if I'm wrong, are we checking if the app is freshly installed and make sure defaults are set in the local storage?

adilanchian commented 4 years ago

This is correct!

I was running into a weird issue where I would uninstall the app and things would stick around... Especially Firebase sign in info which was weird.

Really this task should be verifying if this is truly a bug or just a coding error :D

creativenull commented 4 years ago

According to this issue within their repo it seems like this is an on-going issue. Some say it's just on debug mode but others have found the issue to persist on a physical device.

I'm still setting up my dev environment to see if I get the same issue on an android simulator and a physical device.

creativenull commented 4 years ago

So after trying out on an android simulator and on a physical device (OnePlus 7T), I've not been able to reproduce the bug.

First, I manually added some key-value pair to the storage and used AsyncStorage.getAllKeys() to get keys that were set before. I did get the set keys properly, so after uninstalling and then re-installing I was able to see that storage was empty on a re-install.

Next, I did the spotify auth flow - unfortunately I got an error of a URL handling (probably because spotify does not "work" in my country, the web player works and I was able to register the Spotify app with Gruvee). However, I was able to get one of the keys added @Deep_Link_In_Progress. So I did the uninstall and re-install flow and got the exact same results as the first method.

But I am also suspecting another thing to be an issue, before I tried out the methods above. I was not able to run npm start due to an issue being some invalid RegExp. I got through this issue by running npm audit on the project to see if there are any high vulnerabilities, which came out negative but there were some low priority vulnerabilities. A quick npm audit fix seemed to fix the issue and I was able to run npm start. What it did was upgrade the react-native version in package.json file and the lock file.

I'm not sure if this might be the issue that could solve the storage bug in the app but I could be wrong. But it would also seem like this is an iOS issue as stated from my previous comment and since I don't own any iOS device I'm afraid I won't be able to test it out 😕. But given the report, we may have to wait it out. Maybe someone with an iOS device can also help contribute on figuring out this bug. Sorry for the long comment 😁

adilanchian commented 4 years ago

So just for simplicity for others - TL;DR:

Few thoughts

One question I had was - Were you able to setup Firebase and go through the auth process? One of the bigger issues was that the Firebase account would stick around after uninstall as well.

Thanks again!

creativenull commented 4 years ago

One question I had was - Were you able to setup Firebase and go through the auth process? One of the bigger issues was that the Firebase account would stick around after uninstall as well.

Unfortunately, I didn't get to the Firebase auth process since Spotify did not resolve after a successful auth from Spotify, but I will try this one again on the weekend once I have a VPN setup ready to go. Pretty sure I have Firebase setup properly, or I think I do since I got no errors from the app and I'm seeing some data being stored via the Firebase console. Neither did I get any errors on gruveebackend on runtime.

On another note, as I didn't see any Firebase settings being stored via async-storage, are you suggesting that Firebase stores data unique to the mobile device on cloud?