Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@effect/atom-react": "catalog:",
"@expo-google-fonts/dm-sans": "^0.4.2",
"@expo/metro-runtime": "~58.0.17",
"@expo/ui": "58.0.27",
"@expo/ui": "58.0.29",
"@formatjs/intl-displaynames": "6.8.13",
"@formatjs/intl-getcanonicallocales": "2.5.6",
"@formatjs/intl-locale": "4.2.13",
Expand All @@ -83,44 +83,44 @@
"clsx": "^2.1.1",
"diff": "8.0.3",
"effect": "catalog:",
"expo": "58.0.23",
"expo": "58.0.26",
"expo-application": "~58.1.2",
"expo-asset": "~58.0.20",
"expo-audio": "58.0.11",
"expo-auth-session": "~58.0.17",
"expo-blur": "58.0.5",
"expo-asset": "~58.0.21",
"expo-audio": "58.0.12",
"expo-auth-session": "~58.0.19",
"expo-blur": "58.0.6",
"expo-build-properties": "~58.0.12",
"expo-camera": "~58.0.14",
"expo-clipboard": "~58.0.4",
"expo-constants": "~58.0.15",
"expo-crypto": "~58.0.7",
"expo-dev-client": "~58.0.18",
"expo-constants": "~58.0.16",
"expo-crypto": "~58.0.8",
"expo-dev-client": "~58.0.21",
"expo-device": "~58.0.5",
"expo-document-picker": "~58.0.4",
"expo-file-system": "~58.0.13",
"expo-font": "~58.0.11",
"expo-document-picker": "~58.0.5",
"expo-file-system": "~58.0.14",
"expo-font": "~58.0.12",
"expo-glass-effect": "58.0.5",
"expo-haptics": "~58.0.7",
"expo-haptics": "~58.0.8",
"expo-image": "~58.0.18",
"expo-image-manipulator": "~58.0.16",
"expo-image-picker": "~58.0.10",
"expo-keep-awake": "~58.0.3",
"expo-linking": "~58.0.16",
"expo-network": "~58.0.4",
"expo-notifications": "~58.1.8",
"expo-observe": "~58.0.18",
"expo-keep-awake": "~58.0.4",
"expo-linking": "~58.0.17",
"expo-network": "~58.0.5",
"expo-notifications": "~58.1.9",
"expo-observe": "~58.0.19",
"expo-paste-input": "^0.2.2",
"expo-quick-actions": "^6.0.2",
"expo-secure-store": "~58.0.2",
"expo-sensors": "~58.0.4",
"expo-sharing": "58.0.22",
"expo-splash-screen": "~58.0.13",
"expo-sqlite": "~58.0.15",
"expo-symbols": "~58.0.4",
"expo-updates": "~58.0.21",
"expo-video": "58.0.13",
"expo-web-browser": "~58.0.7",
"expo-widgets": "58.0.27",
"expo-secure-store": "~58.0.3",
"expo-sensors": "~58.0.5",
"expo-sharing": "58.0.23",
"expo-splash-screen": "~58.0.14",
"expo-sqlite": "~58.0.18",
"expo-symbols": "~58.0.5",
"expo-updates": "~58.0.22",
"expo-video": "58.0.14",
"expo-web-browser": "~58.1.0",
"expo-widgets": "58.0.29",
"gt-react-native": "11.4.18",
"pele": "catalog:",
"react": "catalog:",
Expand Down Expand Up @@ -153,7 +153,7 @@
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"aws4fetch": "1.0.20",
"babel-preset-expo": "~58.0.24",
"babel-preset-expo": "~58.0.26",
"gt": "2.27.0",
"jsdom": "^30.0.1",
"nitrogen": "0.37.2",
Expand Down
6 changes: 3 additions & 3 deletions apps/mobile/src/features/sharing/incoming-share-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,18 +680,18 @@ describe("share cleanup ownership", () => {
cacheUri: `${data}/cache/`,
otherRootUris: [`${data}/files/`],
});
const copy = `${data}/cache/shared-0b0e3f0c-6c1d-4b53-9d0a-2f6f1c3a9e11`;
const copy = `${data}/cache/expo-sharing/0b0e3f0c-6c1d-4b53-9d0a-2f6f1c3a9e11`;
expect(owned(`file:${copy.slice("file://".length)}/report.pdf`)).toBe(true);
expect(
owned(
"file:///data/data/codes.t3.app/cache/shared-0b0e3f0c-6c1d-4b53-9d0a-2f6f1c3a9e11/a.png",
"file:///data/data/codes.t3.app/cache/expo-sharing/0b0e3f0c-6c1d-4b53-9d0a-2f6f1c3a9e11/a.png",
),
).toBe(true);
for (const uri of [
`${data}/files/t3-composer-attachments/id-report.pdf`,
`${data}/files/SQLite/state.db`,
`${data}/cache/http-cache/journal`,
`${data}/cache/shared-notes/notes.txt`,
`${data}/cache/expo-sharing/notes/notes.txt`,
`${copy}/..%2F..%2Ffiles%2FSQLite%2Fstate.db`,
copy,
]) {
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/features/sharing/incoming-share-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function isShareFileUriUnderOwnedRoots(
}

/**
* On Android only the native resolver's `shared-<uuid>` copies are this app's to delete; other
* On Android only the native resolver's `expo-sharing/<uuid>` copies are this app's to delete; other
* shared URIs are not copies.
*/
export function isOwnedShareFileUri(
Expand All @@ -117,7 +117,7 @@ export function isOwnedShareFileUri(
path !== undefined &&
cachePath !== undefined &&
path.startsWith(cachePath) &&
/^shared-[\da-f-]{36}\/[^/]+$/i.test(path.slice(cachePath.length))
/^expo-sharing\/[\da-f-]{36}\/[^/]+$/i.test(path.slice(cachePath.length))
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
diff --git a/android/src/main/java/expo/modules/ui/RNHostView.kt b/android/src/main/java/expo/modules/ui/RNHostView.kt
index d1fe94a23ebcbbde6ed629bb7e566d0b6a0f6714..39408ccc4c1f726dde655b17987ac80eb914ba80 100644
--- a/android/src/main/java/expo/modules/ui/RNHostView.kt
+++ b/android/src/main/java/expo/modules/ui/RNHostView.kt
@@ -847,7 +847,19 @@
@@ -847,7 +847,19 @@ private class TouchDispatchingRootViewGroup(
override fun setNestedScrollingEnabled(enabled: Boolean) {
childHelper.isNestedScrollingEnabled = enabled
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ index 0d63c9b949cfae7a101902fc3bb70fcf46094f68..a312b8fcdaf728220db3d6c04d92fd78
* Replaces the current audio source with a new one.
*/
diff --git a/ios/AudioModule.swift b/ios/AudioModule.swift
index 42ce9e8f213ebc243db25ef836456757b0daeb09..1d46e81a30321c9432322ab6616ac382abb97208 100644
index 6d26c72148005a36361168310dca6ebdeead8d85..040092bd069216bd7e55d923962e2c312111c71f 100644
--- a/ios/AudioModule.swift
+++ b/ios/AudioModule.swift
@@ -6,6 +6,7 @@ public class AudioModule: Module {
Expand Down Expand Up @@ -457,7 +457,7 @@ index 42ce9e8f213ebc243db25ef836456757b0daeb09..1d46e81a30321c9432322ab6616ac382
deactivateSessionOnFailure: deactivateSessionOnFailure
)
recordSessionActive(true)
@@ -892,11 +904,15 @@ public class AudioModule: Module {
@@ -895,11 +907,15 @@ public class AudioModule: Module {
if !mode.shouldRouteThroughEarpiece {
categoryOptions.insert(.defaultToSpeaker)
}
Expand All @@ -475,7 +475,7 @@ index 42ce9e8f213ebc243db25ef836456757b0daeb09..1d46e81a30321c9432322ab6616ac382
}
#endif

@@ -957,6 +973,7 @@ public class AudioModule: Module {
@@ -960,6 +976,7 @@ public class AudioModule: Module {
sessionQueue.asyncAfter(deadline: .now() + .milliseconds(100)) { [weak self] in
guard let self,
self.sessionIsActive,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/android/src/main/java/expo/modules/kotlin/views/ExpoView.kt b/android/src/main/java/expo/modules/kotlin/views/ExpoView.kt
index c732ab4..2e3f40e 100644
index c732ab419395526d42a51df664e63afe88a79302..2e3f40e1f966167584ceb853faad8f84889a9b74 100644
--- a/android/src/main/java/expo/modules/kotlin/views/ExpoView.kt
+++ b/android/src/main/java/expo/modules/kotlin/views/ExpoView.kt
@@ -3,6 +3,7 @@ package expo.modules.kotlin.views
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,8 @@ index 1113a0adbb951081dea5214a711fe1dbb5a3e814..e89529a43258ae3bd6ec730c19453aed
) : Record

@OptimizedRecord
diff --git a/android/src/main/java/expo/modules/sharing/dataParsers/ResolvingShareIntentDataParser.kt b/android/src/main/java/expo/modules/sharing/dataParsers/ResolvingShareIntentDataParser.kt
index 0a4c92e4b6459632933027827a86a4ec994ce72f..54ff2b5f44df740c9b971e409397e4a08a973717 100644
--- a/android/src/main/java/expo/modules/sharing/dataParsers/ResolvingShareIntentDataParser.kt
+++ b/android/src/main/java/expo/modules/sharing/dataParsers/ResolvingShareIntentDataParser.kt
@@ -9,6 +9,7 @@ import java.io.File
import java.io.FileOutputStream
import java.net.HttpURLConnection
import java.net.URL
+import java.util.UUID
import kotlin.text.indexOf
import kotlin.text.substring

@@ -56,14 +57,20 @@ class ResolvingShareIntentDataParser {

private fun resolveUri(context: Context, uri: Uri, mimeType: String): ResolvedSharePayload {
val contentResolver = context.contentResolver
- val fileName = getFileName(contentResolver, uri) ?: "unknown"
+ val fileName = safeFileName(getFileName(contentResolver, uri))
val fileSize = getFileSize(contentResolver, uri)
val specificMimeType = contentResolver.getType(uri) ?: mimeType
val type = ShareType.fromMimeType(specificMimeType)

- // Copy to cache dir to ensure access
- val file = File(context.cacheDir, fileName)
+ // The sending app controls the name, so copy into a fresh directory and refuse any
+ // destination that resolves outside cacheDir.
+ val cacheDir = context.cacheDir.canonicalFile
+ val file = File(File(cacheDir, "shared-${UUID.randomUUID()}"), fileName)
+ if (!file.canonicalPath.startsWith(cacheDir.path + File.separator)) {
+ throw SecurityException("Shared file name escapes the cache directory")
+ }
try {
+ file.parentFile?.mkdirs()
contentResolver.openInputStream(uri)?.use { input ->
FileOutputStream(file).use { output ->
input.copyTo(output)
@@ -85,6 +92,11 @@ class ResolvingShareIntentDataParser {
}
}

+ private fun safeFileName(name: String?): String {
+ val baseName = name?.let { File(it).name }
+ return if (baseName.isNullOrBlank() || baseName == "." || baseName == "..") "unknown" else baseName
+ }
+
private fun getFileName(resolver: ContentResolver, uri: Uri): String? {
val cursor = resolver.query(uri, null, null, null, null)
val name = cursor?.use { cursor ->
diff --git a/android/src/main/java/expo/modules/sharing/dataParsers/SimpleShareIntentDataParser.kt b/android/src/main/java/expo/modules/sharing/dataParsers/SimpleShareIntentDataParser.kt
index 3381c5fd207ebb4cd8e0301aac59d307939ff162..481cdb4bc64ea5ae49919071f686324f6d56d55c 100644
index 3381c5fd207ebb4cd8e0301aac59d307939ff162..88984c7237751e3a859aa425a3dfe55ec6f7897e 100644
--- a/android/src/main/java/expo/modules/sharing/dataParsers/SimpleShareIntentDataParser.kt
+++ b/android/src/main/java/expo/modules/sharing/dataParsers/SimpleShareIntentDataParser.kt
@@ -3,6 +3,7 @@ package expo.modules.sharing
Expand Down Expand Up @@ -141,7 +93,7 @@ index 3381c5fd207ebb4cd8e0301aac59d307939ff162..481cdb4bc64ea5ae49919071f686324f
}
}
diff --git a/build/Sharing.types.d.ts b/build/Sharing.types.d.ts
index 74544e0728d5f845351693d8d90596abae42eaea..92bd2f53108ac717f1ef7292fe89aea05c676c5e 100644
index 213447a18257338804e5adc911d8e035d5c10f23..ec6495189c7b14c00501ba8676899392dbe004b0 100644
--- a/build/Sharing.types.d.ts
+++ b/build/Sharing.types.d.ts
@@ -100,6 +100,11 @@ export type SharePayload = {
Expand Down Expand Up @@ -223,7 +175,7 @@ index 943c263c0cf58be595bfc9745c91827da81befec..3a99a1822beb25fea3835123b9a4ad7a

if (mainGroupUuid && sharedGroupUuid) {
diff --git a/src/Sharing.types.ts b/src/Sharing.types.ts
index 18af320420e7c01a8ffbd7fa5347320409f905d8..3a52b70a20efbc588ad5ca974c38c951e5757c97 100644
index 1393ffaf5857bc2972f6138a1909b5ce294e4a8f..6a346f7bc6ef22aef0946d2da705ea629dec431d 100644
--- a/src/Sharing.types.ts
+++ b/src/Sharing.types.ts
@@ -108,6 +108,12 @@ export type SharePayload = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/android/src/main/java/expo/modules/video/player/VideoPlayer.kt b/android/src/main/java/expo/modules/video/player/VideoPlayer.kt
index 7ccce96..b6f30df 100644
index 7ccce9681477328701755792fdc3bab09b428e30..b6f30dfeaf1638454a8370656bb761fd4f6e2cd5 100644
--- a/android/src/main/java/expo/modules/video/player/VideoPlayer.kt
+++ b/android/src/main/java/expo/modules/video/player/VideoPlayer.kt
@@ -265,6 +265,10 @@ class VideoPlayer(val context: Context, appContext: AppContext, source: VideoSou
Expand All @@ -13,8 +13,39 @@ index 7ccce96..b6f30df 100644
override fun onIsPlayingChanged(isPlaying: Boolean) {
this@VideoPlayer.playing = isPlaying
}
diff --git a/build/VideoPlayerEvents.types.d.ts b/build/VideoPlayerEvents.types.d.ts
index 9c7eaeaf9f27ef6735b2e356ec724af5d5ae58f3..25b87998ca01261fb39bf715a8124fe6f6d90da5 100644
--- a/build/VideoPlayerEvents.types.d.ts
+++ b/build/VideoPlayerEvents.types.d.ts
@@ -3,6 +3,9 @@ import type { PlayerError, SubtitleTrack, VideoPlayerStatus, VideoSource, VideoT
* Handlers for events which can be emitted by the player.
*/
export type VideoPlayerEvents = {
+ /** Native play/pause intent, preserved while buffering or seeking. */
+ playbackRequestedChange(payload: { isPlaybackRequested: boolean }): void;
+
/**
* Handler for an event emitted when the status of the player changes.
*/
diff --git a/ios/VideoPlayer.swift b/ios/VideoPlayer.swift
index 3c2fde463a10c78546947dacd8c0fda67f0494c7..ef432481c7641502a504ad70fe644b532d16af50 100644
--- a/ios/VideoPlayer.swift
+++ b/ios/VideoPlayer.swift
@@ -396,6 +396,12 @@ internal final class VideoPlayer: SharedRef<AVPlayer>, Hashable, VideoPlayerObse
VideoManager.shared.setAppropriateAudioSessionOrWarn()
}

+ func onPlaybackRequestedChanged(player: AVPlayer, requested: Bool) {
+ if self.appContext != nil {
+ self.emit(event: "playbackRequestedChange", payload: ["isPlaybackRequested": requested])
+ }
+ }
+
func onRateChanged(player: AVPlayer, oldRate: Float?, newRate: Float) {
if #available(iOS 16.0, tvOS 16.0, *) {
if player.defaultRate != playbackRate {
diff --git a/ios/VideoPlayerObserver.swift b/ios/VideoPlayerObserver.swift
index adf5820..ce69210 100644
index adf5820b4848be7da35d212d9cff91172aacdb2a..364483cdf251148d8ea1dd241aee45ef5bf7426a 100644
--- a/ios/VideoPlayerObserver.swift
+++ b/ios/VideoPlayerObserver.swift
@@ -46,6 +46,7 @@ private actor ObserverTaskManager {
Expand Down Expand Up @@ -46,25 +77,8 @@ index adf5820..ce69210 100644
// iOS changes timeControlStatus after an error, so we need to check for errors.
if player.status == .failed || player.currentItem?.status == .failed {
isPlaying = false
diff --git a/ios/VideoPlayer.swift b/ios/VideoPlayer.swift
index 3c2fde4..ef43248 100644
--- a/ios/VideoPlayer.swift
+++ b/ios/VideoPlayer.swift
@@ -396,6 +396,12 @@ internal final class VideoPlayer: SharedRef<AVPlayer>, Hashable, VideoPlayerObse
VideoManager.shared.setAppropriateAudioSessionOrWarn()
}

+ func onPlaybackRequestedChanged(player: AVPlayer, requested: Bool) {
+ if self.appContext != nil {
+ self.emit(event: "playbackRequestedChange", payload: ["isPlaybackRequested": requested])
+ }
+ }
+
func onRateChanged(player: AVPlayer, oldRate: Float?, newRate: Float) {
if #available(iOS 16.0, tvOS 16.0, *) {
if player.defaultRate != playbackRate {
diff --git a/src/VideoPlayerEvents.types.ts b/src/VideoPlayerEvents.types.ts
index c53b082..2d5fbcb 100644
index c53b0821c46601d52d52bab17e2b81d3a2bc22a9..2d5fbcbb2273a8bd5b3375e79a7963a7b901841a 100644
--- a/src/VideoPlayerEvents.types.ts
+++ b/src/VideoPlayerEvents.types.ts
@@ -11,6 +11,9 @@ import type {
Expand All @@ -77,17 +91,3 @@ index c53b082..2d5fbcb 100644
/**
* Handler for an event emitted when the status of the player changes.
*/
diff --git a/build/VideoPlayerEvents.types.d.ts b/build/VideoPlayerEvents.types.d.ts
index 9c7eaea..25b8799 100644
--- a/build/VideoPlayerEvents.types.d.ts
+++ b/build/VideoPlayerEvents.types.d.ts
@@ -3,6 +3,9 @@ import type { PlayerError, SubtitleTrack, VideoPlayerStatus, VideoSource, VideoT
* Handlers for events which can be emitted by the player.
*/
export type VideoPlayerEvents = {
+ /** Native play/pause intent, preserved while buffering or seeking. */
+ playbackRequestedChange(payload: { isPlaybackRequested: boolean }): void;
+
/**
* Handler for an event emitted when the status of the player changes.
*/
File renamed without changes.
Loading
Loading