Abort an Updates.fetchUpdateAsync() after a certain time [Expo/React native]

Viewed 9
  1. Expo React Native SDK Version: 46
  2. Platforms: Android/iOS
  3. Package concerned : Expo.Updates

Hello everyone, I want to programmatically check for new updates, without using the fallbackToCacheTimeout in app.json that will trigger the check of the new updates when the application is launched because like that I can't put a custom loading page. So by doing this all by code as follow :

try{
  const update = await Updates.checkForUpdateAsync();
  if(update.isAvailable){
      await Updates.fetchUpdateAsync();
      await Updates.reloadAsync();
  }else{}
}catch(err){}

But I want to be able to abort all those calls after a certain time (thus, the user that have a bad connection can use the app without waiting a very long time). I check the documentation and I cannot found any method that allow this.

I dont't think it's possible to cancel a Promise for now in Javascript, or maybe any connection ?

Or does the "fallbackToCacheTimeout" value in the app.json will automatically apply to the fetch updates call of the Expo API?

Do someone have any idea how to do it ? :(

0 Answers
Related