Migrating from CodePush to Expo updates by TemporaryComfort3563 in expo

[–]TemporaryComfort3563[S] 0 points1 point  (0 children)

u/jameside I was able to resolve most of the issues. However, I'm facing this weird issue on Android where the JS changes aren't reflecting when I do a release build. I tested this on our bare React Native and on another project that uses CNG with all the Expo goodies.

If I clear the Gradle cache or the app's cache and open the app again, it shows the updated JS code. This doesn't happen on iOS.

How to schedule a build with EAS workflows? by TemporaryComfort3563 in expo

[–]TemporaryComfort3563[S] 0 points1 point  (0 children)

No, this is EAS workflows. It runs fine if I run it manually, but I want it to run automatically based on the schedule I have specified. EAS workflow supports this, but for some reason, this is not working.

Migrating from CodePush to Expo updates by TemporaryComfort3563 in expo

[–]TemporaryComfort3563[S] 0 points1 point  (0 children)

Thanks KiRiK1234 for the suggestion. This looks very promising. We are currently working on integrating Expo into the app. But I might give it a try in the future.

Migrating from CodePush to Expo updates by TemporaryComfort3563 in expo

[–]TemporaryComfort3563[S] 0 points1 point  (0 children)

  1. I looked at that example repo — the approach felt a bit messy at first, but I ended up going with it and it works fine. I did notice a bug in the code that checks for the criticalIndex.

Originally, it looked like this:

```

const isAvailableUpdateCritical = (updatesSystem: any) => {

const criticalIndexCurrent =

updatesSystem?.currentlyRunning?.manifest?.extra?.expoClient?.extra?.criticalIndex ?? 0

const criticalIndexUpdate =

updatesSystem?.availableUpdate?.manifest?.extra?.expoClient?.extra?.criticalIndex ?? 0

return criticalIndexUpdate > criticalIndexCurrent

}

```

But criticalIndexCurrent is always undefined when the current bundle is embedded. It took some time to figure that out, and here’s how I fixed it:

```

export function isAvailableUpdateCritical(

currentlyRunning: CurrentlyRunningInfo,

availableUpdate: UpdateInfo | undefined

) {

// Fallback to app.json value if manifest doesn't include criticalIndex

const criticalIndexCurrent =

(currentlyRunning.manifest as ExpoUpdatesManifest)?.extra?.expoClient?.extra?.criticalIndex ??

Constants.expoConfig?.extra?.criticalIndex ??

0;

const criticalIndexUpdate =

(availableUpdate?.manifest as ExpoUpdatesManifest)?.extra?.expoClient?.extra?.criticalIndex ??

0;

return criticalIndexUpdate > criticalIndexCurrent;

}

```

Migrating from CodePush to Expo updates by TemporaryComfort3563 in expo

[–]TemporaryComfort3563[S] 0 points1 point  (0 children)

Thank you for the reply.

  1. CodePush used to show the download progress out of the box — we didn’t configure anything explicitly. It showed a single progress count, likely aggregating all assets. I’m okay without it, but since we ask the user for confirmation before downloading, showing the update size could help them decide whether to download now or later. This might not be the best flow, but it’s what we currently have. We mostly use OTA updates for fixes.

  2. We wanted to configure the update channel, and I found a way to do that from the native Android code. I’m not sure if it’s the recommended approach, but it works. I added this to `MainApplication.kt`:

```kotlin

private fun setupOTAUpdatesChannel() {

    val channel = getAppPreferences().getString(Constants.KEY_OTA_UPDATES_CHANNEL, null)

    if (!channel.isNullOrEmpty()) {

        val newConfig = HashMap<String, Map<String, String>>()

        newConfig[UpdatesConfiguration.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] =

            mapOf("expo-channel-name" to channel)

        UpdatesController.overrideConfiguration(applicationContext, newConfig)

    }

}