Catch NotAllowedError in web GIF player + lint modules/ (#10806)
This commit is contained in:
@@ -1,4 +1,113 @@
|
|||||||
{
|
{
|
||||||
|
"modules/bottom-sheet/src/BottomSheetNativeComponent.tsx": {
|
||||||
|
"@typescript-eslint/no-explicit-any": {
|
||||||
|
"count": 2
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-call": {
|
||||||
|
"count": 2
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-member-access": {
|
||||||
|
"count": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/bottom-sheet/src/BottomSheetPortal.tsx": {
|
||||||
|
"no-restricted-imports": {
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/bottom-sheet/src/lib/Portal.tsx": {
|
||||||
|
"no-restricted-imports": {
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider.tsx": {
|
||||||
|
"@typescript-eslint/no-floating-promises": {
|
||||||
|
"count": 1
|
||||||
|
},
|
||||||
|
"no-restricted-imports": {
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandlerModule.web.ts": {
|
||||||
|
"@typescript-eslint/require-await": {
|
||||||
|
"count": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-bluesky-gif-view/src/GifView.tsx": {
|
||||||
|
"@typescript-eslint/no-explicit-any": {
|
||||||
|
"count": 2
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-call": {
|
||||||
|
"count": 4
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-member-access": {
|
||||||
|
"count": 4
|
||||||
|
},
|
||||||
|
"no-restricted-imports": {
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-bluesky-gif-view/src/GifView.web.tsx": {
|
||||||
|
"@typescript-eslint/no-floating-promises": {
|
||||||
|
"count": 2
|
||||||
|
},
|
||||||
|
"@typescript-eslint/require-await": {
|
||||||
|
"count": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-bluesky-swiss-army/src/PlatformInfo/index.native.ts": {
|
||||||
|
"@typescript-eslint/no-unsafe-call": {
|
||||||
|
"count": 3
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-member-access": {
|
||||||
|
"count": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-bluesky-swiss-army/src/Referrer/index.android.ts": {
|
||||||
|
"@typescript-eslint/no-unsafe-call": {
|
||||||
|
"count": 2
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-member-access": {
|
||||||
|
"count": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-bluesky-swiss-army/src/SharedPrefs/index.native.ts": {
|
||||||
|
"@typescript-eslint/no-explicit-any": {
|
||||||
|
"count": 1
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-call": {
|
||||||
|
"count": 9
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-member-access": {
|
||||||
|
"count": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-bluesky-swiss-army/src/VisibilityView/index.native.tsx": {
|
||||||
|
"@typescript-eslint/no-unsafe-call": {
|
||||||
|
"count": 1
|
||||||
|
},
|
||||||
|
"@typescript-eslint/no-unsafe-member-access": {
|
||||||
|
"count": 1
|
||||||
|
},
|
||||||
|
"no-restricted-imports": {
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-bluesky-swiss-army/src/VisibilityView/index.tsx": {
|
||||||
|
"@typescript-eslint/require-await": {
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-bluesky-swiss-army/src/VisibilityView/types.ts": {
|
||||||
|
"no-restricted-imports": {
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules/expo-emoji-picker/src/EmojiPickerView.tsx": {
|
||||||
|
"no-restricted-imports": {
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
"src/Navigation.tsx": {
|
"src/Navigation.tsx": {
|
||||||
"@typescript-eslint/no-floating-promises": {
|
"@typescript-eslint/no-floating-promises": {
|
||||||
"count": 1
|
"count": 1
|
||||||
|
|||||||
@@ -67,7 +67,18 @@ export class GifView extends PureComponent<GifViewProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async playAsync(): Promise<void> {
|
async playAsync(): Promise<void> {
|
||||||
this.videoPlayerRef.current?.play()
|
try {
|
||||||
|
await this.videoPlayerRef.current?.play()
|
||||||
|
} catch (err) {
|
||||||
|
// `play()` rejects with a NotAllowedError when the browser blocks
|
||||||
|
// playback (e.g. Safari low-power mode or autoplay policy). This is
|
||||||
|
// expected and benign - the GIF simply stays paused - so swallow it
|
||||||
|
// rather than letting it surface as an unhandled rejection.
|
||||||
|
if (err instanceof DOMException && err.name === 'NotAllowedError') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
throw err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async pauseAsync(): Promise<void> {
|
async pauseAsync(): Promise<void> {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {StyleProp, ViewStyle} from 'react-native'
|
import {type StyleProp, type ViewStyle} from 'react-native'
|
||||||
import {requireNativeModule, requireNativeViewManager} from 'expo-modules-core'
|
import {requireNativeModule, requireNativeViewManager} from 'expo-modules-core'
|
||||||
|
|
||||||
import {VisibilityViewProps} from './types'
|
import {type VisibilityViewProps} from './types'
|
||||||
const NativeView: React.ComponentType<{
|
const NativeView: React.ComponentType<{
|
||||||
onChangeStatus: (e: {nativeEvent: {isActive: boolean}}) => void
|
onChangeStatus: (e: {nativeEvent: {isActive: boolean}}) => void
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
enabled: Boolean
|
enabled: boolean
|
||||||
style: StyleProp<ViewStyle>
|
style: StyleProp<ViewStyle>
|
||||||
}> = requireNativeViewManager('ExpoBlueskyVisibilityView')
|
}> = requireNativeViewManager('ExpoBlueskyVisibilityView')
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@
|
|||||||
"test-watch": "NODE_ENV=test jest --watchAll",
|
"test-watch": "NODE_ENV=test jest --watchAll",
|
||||||
"test-ci": "NODE_ENV=test jest --ci --forceExit --reporters=default --reporters=jest-junit",
|
"test-ci": "NODE_ENV=test jest --ci --forceExit --reporters=default --reporters=jest-junit",
|
||||||
"test-coverage": "NODE_ENV=test jest --coverage",
|
"test-coverage": "NODE_ENV=test jest --coverage",
|
||||||
"lint": "eslint --cache --quiet src",
|
"lint": "eslint --cache --quiet src modules",
|
||||||
"lint-native": "swiftlint ./modules && ktlint ./modules",
|
"lint-native": "swiftlint ./modules && ktlint ./modules",
|
||||||
"lint-native:fix": "swiftlint --fix ./modules && ktlint --format ./modules",
|
"lint-native:fix": "swiftlint --fix ./modules && ktlint --format ./modules",
|
||||||
"typecheck": "tsgo --project ./tsconfig.check.json",
|
"typecheck": "tsgo --project ./tsconfig.check.json",
|
||||||
|
|||||||
Reference in New Issue
Block a user