Merge pull request #406 from thornbill/expo-45

Upgrade to Expo 45
This commit is contained in:
Anthony Lavado 2022-12-01 12:32:48 -05:00 committed by GitHub
commit c2408ec37c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 3423 additions and 3339 deletions

60
App.js
View File

@ -10,11 +10,11 @@ import 'react-native-url-polyfill/auto';
import { Ionicons } from '@expo/vector-icons';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { NavigationContainer } from '@react-navigation/native';
import AppLoading from 'expo-app-loading';
import { Asset } from 'expo-asset';
import * as FileSystem from 'expo-file-system';
import * as Font from 'expo-font';
import * as ScreenOrientation from 'expo-screen-orientation';
import * as SplashScreen from 'expo-splash-screen';
import { StatusBar } from 'expo-status-bar';
import { observer } from 'mobx-react-lite';
import { AsyncTrunk } from 'mobx-sync-lite';
@ -40,6 +40,8 @@ const App = observer(({ skipLoadingScreen }) => {
rootStore.settingStore.systemThemeId = useColorScheme();
SplashScreen.preventAutoHideAsync();
const trunk = new AsyncTrunk(rootStore, {
storage: AsyncStorage
});
@ -50,9 +52,37 @@ const App = observer(({ skipLoadingScreen }) => {
rootStore.storeLoaded = true;
};
const loadImages = () => {
const images = [
require('./assets/images/splash.png'),
require('./assets/images/logowhite.png')
];
return images.map(image => Asset.fromModule(image).downloadAsync());
};
const loadResources = async () => {
try {
await Promise.all([
Font.loadAsync({
// This is the font that we are using for our tab bar
...Ionicons.font
}),
...loadImages(),
StaticScriptLoader.load()
]);
} catch (err) {
console.warn('[App] Failed loading resources', err);
}
setIsSplashReady(true);
};
useEffect(() => {
// Hydrate mobx data stores
hydrateStores();
// Load app resources
loadResources();
}, []);
useEffect(() => {
@ -122,34 +152,8 @@ const App = observer(({ skipLoadingScreen }) => {
});
}, [ rootStore.deviceId, rootStore.downloadStore.downloads.size ]);
const loadImagesAsync = () => {
const images = [
require('./assets/images/splash.png'),
require('./assets/images/logowhite.png')
];
return images.map(image => Asset.fromModule(image).downloadAsync());
};
const loadResourcesAsync = async () => {
return Promise.all([
Font.loadAsync({
// This is the font that we are using for our tab bar
...Ionicons.font
}),
...loadImagesAsync(),
StaticScriptLoader.load()
]);
};
if (!(isSplashReady && rootStore.storeLoaded) && !skipLoadingScreen) {
return (
<AppLoading
startAsync={loadResourcesAsync}
onError={console.warn}
onFinish={() => setIsSplashReady(true)}
autoHideSplash={false}
/>
);
return null;
}
return (

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Audio } from 'expo-av';
import { Audio, InterruptionModeAndroid, InterruptionModeIOS } from 'expo-av';
import { observer } from 'mobx-react-lite';
import React, { useEffect, useState } from 'react';
@ -21,10 +21,10 @@ const AudioPlayer = observer(() => {
useEffect(() => {
Audio.setAudioModeAsync({
staysActiveInBackground: true,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
interruptionModeAndroid: InterruptionModeAndroid.DoNotMix,
playThroughEarpieceAndroid: false,
shouldDuckAndroid: true,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
interruptionModeIOS: InterruptionModeIOS.DoNotMix,
playsInSilentModeIOS: true
});

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Audio, Video } from 'expo-av';
import { Audio, InterruptionModeAndroid, InterruptionModeIOS, Video, VideoFullscreenUpdate } from 'expo-av';
import { observer } from 'mobx-react-lite';
import React, { useEffect, useRef, useState } from 'react';
import { Alert } from 'react-native';
@ -23,8 +23,8 @@ const VideoPlayer = observer(() => {
// Set the audio mode when the video player is created
useEffect(() => {
Audio.setAudioModeAsync({
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
interruptionModeAndroid: InterruptionModeAndroid.DoNotMix,
interruptionModeIOS: InterruptionModeIOS.DoNotMix,
playsInSilentModeIOS: true
});
}, []);
@ -101,17 +101,17 @@ const VideoPlayer = observer(() => {
}}
onFullscreenUpdate={({ fullscreenUpdate }) => {
switch (fullscreenUpdate) {
case Video.FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT:
case VideoFullscreenUpdate.PLAYER_WILL_PRESENT:
setIsPresenting(true);
rootStore.isFullscreen = true;
break;
case Video.FULLSCREEN_UPDATE_PLAYER_DID_PRESENT:
case VideoFullscreenUpdate.PLAYER_DID_PRESENT:
setIsPresenting(false);
break;
case Video.FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS:
case VideoFullscreenUpdate.PLAYER_WILL_DISMISS:
setIsDismissing(true);
break;
case Video.FULLSCREEN_UPDATE_PLAYER_DID_DISMISS:
case VideoFullscreenUpdate.PLAYER_DID_DISMISS:
setIsDismissing(false);
rootStore.isFullscreen = false;
rootStore.mediaStore.reset();

View File

@ -111,6 +111,7 @@ true;
},
]
}
textInteractionEnabled={true}
useSharedProcessPool={true}
useWebKit={true}
/>

View File

@ -65,6 +65,7 @@ exports[`RefreshWebView should render 1`] = `
},
]
}
textInteractionEnabled={true}
useSharedProcessPool={true}
/>
</View>

View File

@ -10,6 +10,7 @@ exports[`ServerInput should render correctly 1`] = `
}
>
<View
collapsable={false}
style={
Object {
"alignItems": "center",
@ -63,7 +64,6 @@ exports[`ServerInput should render correctly 1`] = `
</View>
</View>
<TextInput
allowFontScaling={true}
autoCapitalize="none"
autoCompleteType="off"
autoCorrect={false}
@ -73,7 +73,6 @@ exports[`ServerInput should render correctly 1`] = `
onChangeText={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="#86939e"
rejectResponderTermination={true}
returnKeyType="go"
selectionColor="#2089dc"
style={
@ -112,6 +111,7 @@ exports[`ServerInput should show error if parseUrl throws 1`] = `
}
>
<View
collapsable={false}
style={
Object {
"alignItems": "center",
@ -161,6 +161,7 @@ exports[`ServerInput should show error if parseUrl throws 1`] = `
>
<Text
allowFontScaling={false}
selectable={false}
style={
Array [
Object {
@ -187,7 +188,6 @@ exports[`ServerInput should show error if parseUrl throws 1`] = `
</View>
</View>
<TextInput
allowFontScaling={true}
autoCapitalize="none"
autoCompleteType="off"
autoCorrect={false}
@ -197,7 +197,6 @@ exports[`ServerInput should show error if parseUrl throws 1`] = `
onChangeText={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="#86939e"
rejectResponderTermination={true}
returnKeyType="go"
selectionColor="#2089dc"
style={
@ -238,6 +237,7 @@ exports[`ServerInput should show error if url is invalid 1`] = `
}
>
<View
collapsable={false}
style={
Object {
"alignItems": "center",
@ -287,6 +287,7 @@ exports[`ServerInput should show error if url is invalid 1`] = `
>
<Text
allowFontScaling={false}
selectable={false}
style={
Array [
Object {
@ -313,7 +314,6 @@ exports[`ServerInput should show error if url is invalid 1`] = `
</View>
</View>
<TextInput
allowFontScaling={true}
autoCapitalize="none"
autoCompleteType="off"
autoCorrect={false}
@ -323,7 +323,6 @@ exports[`ServerInput should show error if url is invalid 1`] = `
onChangeText={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="#86939e"
rejectResponderTermination={true}
returnKeyType="go"
selectionColor="#2089dc"
style={
@ -364,6 +363,7 @@ exports[`ServerInput should show error when input is blank 1`] = `
}
>
<View
collapsable={false}
style={
Object {
"alignItems": "center",
@ -413,6 +413,7 @@ exports[`ServerInput should show error when input is blank 1`] = `
>
<Text
allowFontScaling={false}
selectable={false}
style={
Array [
Object {
@ -439,7 +440,6 @@ exports[`ServerInput should show error when input is blank 1`] = `
</View>
</View>
<TextInput
allowFontScaling={true}
autoCapitalize="none"
autoCompleteType="off"
autoCorrect={false}
@ -449,7 +449,6 @@ exports[`ServerInput should show error when input is blank 1`] = `
onChangeText={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="#86939e"
rejectResponderTermination={true}
returnKeyType="go"
selectionColor="#2089dc"
style={
@ -490,6 +489,7 @@ exports[`ServerInput should show error when url is undefined 1`] = `
}
>
<View
collapsable={false}
style={
Object {
"alignItems": "center",
@ -539,6 +539,7 @@ exports[`ServerInput should show error when url is undefined 1`] = `
>
<Text
allowFontScaling={false}
selectable={false}
style={
Array [
Object {
@ -565,7 +566,6 @@ exports[`ServerInput should show error when url is undefined 1`] = `
</View>
</View>
<TextInput
allowFontScaling={true}
autoCapitalize="none"
autoCompleteType="off"
autoCorrect={false}
@ -575,7 +575,6 @@ exports[`ServerInput should show error when url is undefined 1`] = `
onChangeText={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="#86939e"
rejectResponderTermination={true}
returnKeyType="go"
selectionColor="#2089dc"
style={
@ -616,6 +615,7 @@ exports[`ServerInput should show error when url is whitespace 1`] = `
}
>
<View
collapsable={false}
style={
Object {
"alignItems": "center",
@ -665,6 +665,7 @@ exports[`ServerInput should show error when url is whitespace 1`] = `
>
<Text
allowFontScaling={false}
selectable={false}
style={
Array [
Object {
@ -691,7 +692,6 @@ exports[`ServerInput should show error when url is whitespace 1`] = `
</View>
</View>
<TextInput
allowFontScaling={true}
autoCapitalize="none"
autoCompleteType="off"
autoCorrect={false}
@ -701,7 +701,6 @@ exports[`ServerInput should show error when url is whitespace 1`] = `
onChangeText={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="#86939e"
rejectResponderTermination={true}
returnKeyType="go"
selectionColor="#2089dc"
style={
@ -742,6 +741,7 @@ exports[`ServerInput should succeed for valid urls 1`] = `
}
>
<View
collapsable={false}
style={
Object {
"alignItems": "center",
@ -791,6 +791,7 @@ exports[`ServerInput should succeed for valid urls 1`] = `
>
<Text
allowFontScaling={false}
selectable={false}
style={
Array [
Object {
@ -817,7 +818,6 @@ exports[`ServerInput should succeed for valid urls 1`] = `
</View>
</View>
<TextInput
allowFontScaling={true}
autoCapitalize="none"
autoCompleteType="off"
autoCorrect={false}
@ -827,7 +827,6 @@ exports[`ServerInput should succeed for valid urls 1`] = `
onChangeText={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="#86939e"
rejectResponderTermination={true}
returnKeyType="go"
selectionColor="#2089dc"
style={
@ -854,12 +853,7 @@ exports[`ServerInput should succeed for valid urls 1`] = `
}
}
>
<ActivityIndicator
animating={true}
color="#999999"
hidesWhenStopped={true}
size="small"
/>
<ActivityIndicator />
</View>
</View>
<Text

View File

@ -10,14 +10,14 @@ exports[`VideoPlayer should render correctly 1`] = `
}
>
<ViewManagerAdapter_ExpoVideoView
onError={[Function]}
onFullscreenUpdate={[Function]}
onLoad={[Function]}
onLoadStart={[Function]}
onReadyForDisplay={[Function]}
onStatusUpdate={[Function]}
proxiedProperties={
Object {
"onError": [Function],
"onFullscreenUpdate": [Function],
"onLoad": [Function],
"onLoadStart": [Function],
"onReadyForDisplay": [Function],
"onStatusUpdate": [Function],
"resizeMode": "mock",
"source": undefined,
"status": Object {},

6510
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"start": "expo-cli start",
"android": "expo-cli start --android",
"ios": "expo-cli start --ios",
"eject": "expo-cli eject",
"lint": "eslint \".\"",
"test": "jest --watchAll"
},
@ -34,27 +34,26 @@
"Android >= 5"
],
"dependencies": {
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "^6.0.7",
"@react-navigation/native": "^6.0.4",
"@react-navigation/native-stack": "^6.5.0",
"@react-navigation/stack": "^6.0.9",
"compare-versions": "^3.6.0",
"expo": "^44.0.0",
"expo-app-loading": "~1.3.0",
"expo-asset": "~8.4.6",
"expo-av": "~10.2.0",
"expo-constants": "~13.0.1",
"expo-device": "~4.1.0",
"expo-file-system": "~13.1.4",
"expo-font": "~10.0.4",
"expo-keep-awake": "~10.0.1",
"expo-localization": "~12.0.0",
"expo-screen-orientation": "~4.1.1",
"expo-splash-screen": "~0.14.1",
"expo-status-bar": "~1.2.0",
"expo-web-browser": "~10.1.0",
"expo": "^45.0.0",
"expo-asset": "~8.5.0",
"expo-av": "~11.2.3",
"expo-constants": "~13.1.1",
"expo-device": "~4.2.0",
"expo-file-system": "~14.0.0",
"expo-font": "~10.1.0",
"expo-keep-awake": "~10.1.1",
"expo-localization": "~13.0.0",
"expo-screen-orientation": "~4.2.0",
"expo-splash-screen": "~0.15.1",
"expo-status-bar": "~1.3.0",
"expo-web-browser": "~10.2.1",
"i18next": "^21.2.4",
"mobx": "^5.15.4",
"mobx-react-lite": "^2.2.2",
@ -62,18 +61,18 @@
"mobx-task": "^2.0.1",
"normalize-url": "^7.0.2",
"prop-types": "^15.7.2",
"react": "17.0.1",
"react": "17.0.2",
"react-i18next": "^11.7.0",
"react-lifecycles-compat": "^3.0.4",
"react-native": "0.64.3",
"react-native": "0.68.2",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.1.0",
"react-native-get-random-values": "~1.7.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-gesture-handler": "~2.2.1",
"react-native-get-random-values": "~1.8.0",
"react-native-reanimated": "~2.8.0",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-url-polyfill": "^1.3.0",
"react-native-webview": "11.15.0",
"react-native-webview": "11.18.1",
"uuid": "^8.3.2"
},
"devDependencies": {
@ -85,7 +84,7 @@
"@types/react": "~17.0.21",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^4.33.0",
"babel-preset-expo": "9.0.2",
"babel-preset-expo": "~9.1.0",
"domexception": "^4.0.0",
"eslint": "^7.4.0",
"eslint-plugin-compat": "^3.9.0",
@ -97,7 +96,7 @@
"eslint-plugin-react-native": "^3.10.0",
"expo-cli": "^6.0.6",
"jest": "^26.6.3",
"jest-expo": "^44.0.0",
"jest-expo": "^45.0.0",
"jest-fetch-mock": "^3.0.3",
"node-abort-controller": "^3.0.1",
"typescript": "~4.3.5"

View File

@ -90,6 +90,11 @@ exports[`AddServerScreen should render correctly 1`] = `
}
>
<View
accessibilityState={
Object {
"disabled": false,
}
}
accessible={true}
focusable={true}
onClick={[Function]}
@ -115,6 +120,7 @@ exports[`AddServerScreen should render correctly 1`] = `
</View>
</View>
<View
collapsable={false}
style={
Object {
"alignItems": "center",
@ -168,7 +174,6 @@ exports[`AddServerScreen should render correctly 1`] = `
</View>
</View>
<TextInput
allowFontScaling={true}
autoCapitalize="none"
autoCompleteType="off"
autoCorrect={false}
@ -179,7 +184,6 @@ exports[`AddServerScreen should render correctly 1`] = `
onSubmitEditing={[Function]}
placeholder="https://jellyfin.org"
placeholderTextColor="#86939e"
rejectResponderTermination={true}
returnKeyType="go"
selectionColor="#2089dc"
style={

View File

@ -45,16 +45,12 @@ exports[`DevSettingsScreen should render correctly 1`] = `
},
]
}
disableVirtualization={false}
getItem={[Function]}
getItemCount={[Function]}
horizontal={false}
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
onMomentumScrollBegin={[Function]}
onMomentumScrollEnd={[Function]}
onScroll={[Function]}
onScrollBeginDrag={[Function]}
@ -64,9 +60,7 @@ exports[`DevSettingsScreen should render correctly 1`] = `
scrollEventThrottle={50}
showsVerticalScrollIndicator={false}
stickyHeaderIndices={Array []}
updateCellsBatchingPeriod={50}
viewabilityConfigCallbackPairs={Array []}
windowSize={21}
>
<View>
<View

View File

@ -49,7 +49,6 @@ exports[`DownloadScreen should render correctly 1`] = `
},
]
}
disableVirtualization={false}
extraData={
Object {
"server-id_item-id": [Circular],
@ -58,13 +57,10 @@ exports[`DownloadScreen should render correctly 1`] = `
}
getItem={[Function]}
getItemCount={[Function]}
horizontal={false}
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
onMomentumScrollBegin={[Function]}
onMomentumScrollEnd={[Function]}
onScroll={[Function]}
onScrollBeginDrag={[Function]}
@ -73,9 +69,7 @@ exports[`DownloadScreen should render correctly 1`] = `
renderItem={[Function]}
scrollEventThrottle={50}
stickyHeaderIndices={Array []}
updateCellsBatchingPeriod={50}
viewabilityConfigCallbackPairs={Array []}
windowSize={21}
>
<View>
<View
@ -203,10 +197,6 @@ exports[`DownloadScreen should render correctly 1`] = `
}
/>
<ActivityIndicator
animating={true}
color="#999999"
hidesWhenStopped={true}
size="small"
testID="loading-indicator"
/>
</View>
@ -336,10 +326,6 @@ exports[`DownloadScreen should render correctly 1`] = `
}
/>
<ActivityIndicator
animating={true}
color="#999999"
hidesWhenStopped={true}
size="small"
testID="loading-indicator"
/>
</View>

View File

@ -184,6 +184,7 @@ exports[`ErrorScreen should render correctly 1`] = `
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}

View File

@ -175,14 +175,14 @@ exports[`HomeScreen should render correctly 1`] = `
}
>
<ViewManagerAdapter_ExpoVideoView
onError={[Function]}
onFullscreenUpdate={[Function]}
onLoad={[Function]}
onLoadStart={[Function]}
onReadyForDisplay={[Function]}
onStatusUpdate={[Function]}
proxiedProperties={
Object {
"onError": [Function],
"onFullscreenUpdate": [Function],
"onLoad": [Function],
"onLoadStart": [Function],
"onReadyForDisplay": [Function],
"onStatusUpdate": [Function],
"resizeMode": "mock",
"source": undefined,
"status": Object {},

View File

@ -22,11 +22,6 @@ exports[`LoadingScreen should render correctly 1`] = `
}
}
/>
<ActivityIndicator
animating={true}
color="#999999"
hidesWhenStopped={true}
size="small"
/>
<ActivityIndicator />
</View>
`;

View File

@ -82,6 +82,7 @@ In order to use this client, you need to host your own Jellyfin server.
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
@ -151,6 +152,7 @@ In order to use this client, you need to host your own Jellyfin server.
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}

View File

@ -171,7 +171,6 @@ exports[`SettingsScreen should render correctly 1`] = `
},
]
}
disableVirtualization={false}
extraData={
Object {
"activeServer": undefined,
@ -180,13 +179,10 @@ exports[`SettingsScreen should render correctly 1`] = `
}
getItem={[Function]}
getItemCount={[Function]}
horizontal={false}
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
onMomentumScrollBegin={[Function]}
onMomentumScrollEnd={[Function]}
onScroll={[Function]}
onScrollBeginDrag={[Function]}
@ -202,8 +198,6 @@ exports[`SettingsScreen should render correctly 1`] = `
9,
]
}
updateCellsBatchingPeriod={50}
windowSize={21}
>
<View>
<View

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from 'expo-constants';
import * as Device from 'expo-device';
import { Platform } from 'react-native';
import { getAppName, getDeviceProfile, getSafeDeviceName, isCompact, isSystemThemeSupported } from '../Device';
@ -40,9 +41,9 @@ describe('Device', () => {
expect(getSafeDeviceName()).toBe('iPhone');
});
it('should return a default name if device name only contains non-ascii and whitespace characters', () => {
it('should return the device model name if device name only contains non-ascii and whitespace characters', () => {
Constants.deviceName = ' 🌮😂 ';
expect(getSafeDeviceName()).toBe('Jellyfin Mobile Device');
expect(getSafeDeviceName()).toBe(Device.modelName);
});
});