From cddbbc4bd4aba10306cb828bebc46af3727a6fb6 Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 4 Apr 2024 21:19:28 -0700 Subject: [PATCH] migrate to `expo-application` (#3417) * migrate to `expo-application` * replace additional usage --- package.json | 3 +-- src/lib/app-info.ts | 8 ++++---- src/lib/hooks/useOTAUpdates.ts | 4 ++-- src/lib/sentry.ts | 6 +++--- yarn.lock | 15 +++++---------- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index e7548845..8932360c 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "emoji-mart": "^5.5.2", "eventemitter3": "^5.0.1", "expo": "^50.0.8", - "expo-application": "~5.8.3", + "expo-application": "^5.8.3", "expo-build-properties": "^0.11.1", "expo-camera": "~14.0.4", "expo-clipboard": "^5.0.1", @@ -174,7 +174,6 @@ "react-native-uitextview": "^1.1.6", "react-native-url-polyfill": "^1.3.0", "react-native-uuid": "^2.0.1", - "react-native-version-number": "^0.3.6", "react-native-web": "~0.19.6", "react-native-web-linear-gradient": "^1.1.2", "react-native-web-webview": "^1.0.2", diff --git a/src/lib/app-info.ts b/src/lib/app-info.ts index 3071e031..83406bf2 100644 --- a/src/lib/app-info.ts +++ b/src/lib/app-info.ts @@ -1,9 +1,9 @@ -import VersionNumber from 'react-native-version-number' +import {nativeApplicationVersion, nativeBuildVersion} from 'expo-application' export const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development' export const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight' const UPDATES_CHANNEL = IS_TESTFLIGHT ? 'testflight' : 'production' -export const appVersion = `${VersionNumber.appVersion} (${ - VersionNumber.buildVersion -}, ${IS_DEV ? 'development' : UPDATES_CHANNEL})` +export const appVersion = `${nativeApplicationVersion} (${nativeBuildVersion}, ${ + IS_DEV ? 'development' : UPDATES_CHANNEL +})` diff --git a/src/lib/hooks/useOTAUpdates.ts b/src/lib/hooks/useOTAUpdates.ts index 181f0b2c..51fd18aa 100644 --- a/src/lib/hooks/useOTAUpdates.ts +++ b/src/lib/hooks/useOTAUpdates.ts @@ -1,6 +1,6 @@ import React from 'react' import {Alert, AppState, AppStateStatus} from 'react-native' -import app from 'react-native-version-number' +import {nativeBuildVersion} from 'expo-application' import { checkForUpdateAsync, fetchUpdateAsync, @@ -21,7 +21,7 @@ async function setExtraParams() { isIOS ? 'ios-build-number' : 'android-build-number', // Hilariously, `buildVersion` is not actually a string on Android even though the TS type says it is. // This just ensures it gets passed as a string - `${app.buildVersion}`, + `${nativeBuildVersion}`, ) await setExtraParamAsync( 'channel', diff --git a/src/lib/sentry.ts b/src/lib/sentry.ts index d0a5fe0f..6b6c1832 100644 --- a/src/lib/sentry.ts +++ b/src/lib/sentry.ts @@ -4,7 +4,7 @@ */ import {Platform} from 'react-native' -import app from 'react-native-version-number' +import {nativeApplicationVersion, nativeBuildVersion} from 'expo-application' import * as info from 'expo-updates' import {init} from 'sentry-expo' @@ -21,7 +21,7 @@ const buildChannel = (info.channel || 'development') as * - `dev` * - `1.57.0` */ -const release = app.appVersion ?? 'dev' +const release = nativeApplicationVersion ?? 'dev' /** * Examples: @@ -33,7 +33,7 @@ const release = app.appVersion ?? 'dev' * - `android.1.57.0.46` */ const dist = `${Platform.OS}.${release}${ - app.buildVersion ? `.${app.buildVersion}` : '' + nativeBuildVersion ? `.${nativeBuildVersion}` : '' }` init({ diff --git a/yarn.lock b/yarn.lock index 441da450..8104c227 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11735,16 +11735,16 @@ expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" +expo-application@^5.8.3: + version "5.8.3" + resolved "https://registry.yarnpkg.com/expo-application/-/expo-application-5.8.3.tgz#43991bd81d05c987b07b2f430c036cda1572bc62" + integrity sha512-IISxzpPX+Xe4ynnwX8yY52T6dm1g9sME1GCj4lvUlrdc5xeTPM6U35x7Wj82V7lLWBaVGe+/Tg9EeKqfylCEwA== + expo-application@~5.8.0: version "5.8.0" resolved "https://registry.yarnpkg.com/expo-application/-/expo-application-5.8.0.tgz#b82cb98a08f91d61f047f6578e883e0deb9661f2" integrity sha512-nNQ/ayC4P1ue0ZQSmUlG/K2ZHTPwHyYGsb0QtEmCFUCitsjPKIx4coNvAreZMuELvY7pD1zKr+pdtN/ULnljBA== -expo-application@~5.8.3: - version "5.8.3" - resolved "https://registry.yarnpkg.com/expo-application/-/expo-application-5.8.3.tgz#43991bd81d05c987b07b2f430c036cda1572bc62" - integrity sha512-IISxzpPX+Xe4ynnwX8yY52T6dm1g9sME1GCj4lvUlrdc5xeTPM6U35x7Wj82V7lLWBaVGe+/Tg9EeKqfylCEwA== - expo-asset@~9.0.2: version "9.0.2" resolved "https://registry.yarnpkg.com/expo-asset/-/expo-asset-9.0.2.tgz#e8a6b6da356d5fc97955599d2fa49af78c7f0bfd" @@ -18697,11 +18697,6 @@ react-native-uuid@^2.0.1: resolved "https://registry.yarnpkg.com/react-native-uuid/-/react-native-uuid-2.0.1.tgz#ed4e2dfb1683eddb66967eb5dca140dfe1abddb9" integrity sha512-cptnoIbL53GTCrWlb/+jrDC6tvb7ypIyzbXNJcpR3Vab0mkeaaVd5qnB3f0whXYzS+SMoSQLcUUB0gEWqkPC0g== -react-native-version-number@^0.3.6: - version "0.3.6" - resolved "https://registry.yarnpkg.com/react-native-version-number/-/react-native-version-number-0.3.6.tgz#dd8b1435fc217df0a166d7e4a61fdc993f3e7437" - integrity sha512-TdyXiK90NiwmSbmAUlUBOV6WI1QGoqtvZZzI5zQY4fKl67B3ZrZn/h+Wy/OYIKKFMfePSiyfeIs8LtHGOZ/NgA== - react-native-web-linear-gradient@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/react-native-web-linear-gradient/-/react-native-web-linear-gradient-1.1.2.tgz#33f85f7085a0bb5ffa5106faf02ed105b92a9ed7"