-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update README(added an example) #49
base: master
Are you sure you want to change the base?
Conversation
Added a basic working code for both types of update implementation.
Thanks for the PR, but I believe this needs to be addressed properly by fixing the actual example files in the project, instead of adding more instructions on the readme. If you want to you can add that as a second example, and point to it from the readme. Can you also please remove the react-native-snackbar references and code? I'd be grateful! Thanks |
Sure, I can add a second example in a separate file, like the current one, and point to it from the README. But regarding Thank you for the quick response. |
With snack bar, the update flow somewhat becomes like this:
But again with this approach, there is one more thing that should be taken care of. Just trying to clarify the example. Hope I made it a little clearer. |
Cool, let's keep the snackbar, I think it's a-ok. |
It won't reach up to useEffect(() => {
inAppUpdates.addStatusUpdateListener(status => onStatusUpdate(status));
}, []);
...
...
inAppUpdates
.checkNeedsUpdate()
.then(result => {
if (result.shouldUpdate) {
let updateOptions = {...};
inAppUpdates.startUpdate(updateOptions);
}
})
.catch(err => console.log("IAU Error: ", err)); Looks like |
I think right way to handle previously downloaded builds it to check for the I implemented something like this in a fork: And then in the client I do something like this: const result = await inAppUpdates.checkNeedsUpdate();
if (result.other.installStatus === IAUInstallStatus.DOWNLOADED) {
inAppUpdates.installUpdate();
} else {
inAppUpdates.startUpdate({ updateType: IAUUpdateKind.FLEXIBLE });
} |
@jbaudanza can you open a PR with your addition? Or @nirajniroula do you think you can add it to this PR? |
Since this PR was only about adding an example (to achieve a better UX) in README, I think it would be better if @jbaudanza, you could open a separate PR from Hilokal@5dc7471. |
I actually went in a different direction in my branch. I removed all the dependencies and everything that wasn't a direct binding to the InAppUpdates API. This made it much easier for me to integrate into my app. I think the Apple App store API is different enough that trying to make a common API for both ends up being awkward. Also siren brings in a lot of dependencies (apisauce, axios) for what is just a simple JSON fetch. I removed it and replaced with with a simple fetch() call and Alert directly in my app. This is everything I removed: Hilokal/sp-react-native-in-app-updates@master...hilokal If you're interested in going in this direction, I can prepare a PR. Otherwise, if you only want the |
@SudoPlz |
@GoldenSoju I would love to find out what the community thinks about that. Both make sense to me, I agree that siren does add some unnecessary dependencies but on the other hand it's a set and forget thing where you install once, and it should work on both platforms. I think in an ideal world we would strip down this library so that
|
@GoldenSoju @SudoPlz In my opinion, the user flows between Android In-App-Updates and iOS app store checks are so different, that it's not worth trying to unify into a single API. The react-native module should provide a clean Javascript interface to the Android In-App-Updates API, and it should be the role of the app developer to navigate the differences in the user flows in a way that makes sense to their app. It's also been 2 years since I looked at this, so it's possible my memory is faded. But, I remember trying to make things work in siren to be more difficult than it was worth. In particular, siren has hardcoded the strategy for comparing version numbers: In our app, we ended up replacing siren with a simple fetch() call. |
Added a basic working code for both types of update implementation.