about summary refs log tree commit diff
path: root/modules/expo-bluesky-swiss-army/src/PlatformInfo
diff options
context:
space:
mode:
Diffstat (limited to 'modules/expo-bluesky-swiss-army/src/PlatformInfo')
-rw-r--r--modules/expo-bluesky-swiss-army/src/PlatformInfo/index.native.ts7
-rw-r--r--modules/expo-bluesky-swiss-army/src/PlatformInfo/index.ts14
-rw-r--r--modules/expo-bluesky-swiss-army/src/PlatformInfo/index.web.ts5
-rw-r--r--modules/expo-bluesky-swiss-army/src/PlatformInfo/types.ts15
4 files changed, 41 insertions, 0 deletions
diff --git a/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.native.ts b/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.native.ts
index 949bd78a2..ba9dddf82 100644
--- a/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.native.ts
+++ b/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.native.ts
@@ -1,6 +1,8 @@
 import {Platform} from 'react-native'
 import {requireNativeModule} from 'expo-modules-core'
 
+import {AudioCategory} from './types'
+
 const NativeModule = requireNativeModule('ExpoPlatformInfo')
 
 export function getIsReducedMotionEnabled(): boolean {
@@ -11,3 +13,8 @@ export function setAudioMixWithOthers(mixWithOthers: boolean): void {
   if (Platform.OS !== 'ios') return
   NativeModule.setAudioMixWithOthers(mixWithOthers)
 }
+
+export function setAudioCategory(audioCategory: AudioCategory): void {
+  if (Platform.OS !== 'ios') return
+  NativeModule.setAudioCategory(audioCategory)
+}
diff --git a/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.ts b/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.ts
index 2665748b0..5659339fb 100644
--- a/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.ts
+++ b/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.ts
@@ -1,9 +1,23 @@
 import {NotImplementedError} from '../NotImplemented'
+import {AudioCategory} from './types'
 
 export function getIsReducedMotionEnabled(): boolean {
   throw new NotImplementedError()
 }
 
+/**
+ * Set whether the app's audio should mix with other apps' audio.
+ * @param mixWithOthers
+ */
 export function setAudioMixWithOthers(mixWithOthers: boolean): void {
   throw new NotImplementedError({mixWithOthers})
 }
+
+/**
+ * Set the audio category for the app.
+ * @param audioCategory
+ * @platform ios
+ */
+export function setAudioCategory(audioCategory: AudioCategory): void {
+  throw new NotImplementedError({audioCategory})
+}
diff --git a/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.web.ts b/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.web.ts
index 917c97396..cb64d00ce 100644
--- a/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.web.ts
+++ b/modules/expo-bluesky-swiss-army/src/PlatformInfo/index.web.ts
@@ -1,4 +1,5 @@
 import {NotImplementedError} from '../NotImplemented'
+import {AudioCategory} from './types'
 
 export function getIsReducedMotionEnabled(): boolean {
   if (typeof window === 'undefined') {
@@ -10,3 +11,7 @@ export function getIsReducedMotionEnabled(): boolean {
 export function setAudioMixWithOthers(mixWithOthers: boolean): void {
   throw new NotImplementedError({mixWithOthers})
 }
+
+export function setAudioCategory(audioCategory: AudioCategory): void {
+  throw new NotImplementedError({audioCategory})
+}
diff --git a/modules/expo-bluesky-swiss-army/src/PlatformInfo/types.ts b/modules/expo-bluesky-swiss-army/src/PlatformInfo/types.ts
new file mode 100644
index 000000000..374f34318
--- /dev/null
+++ b/modules/expo-bluesky-swiss-army/src/PlatformInfo/types.ts
@@ -0,0 +1,15 @@
+/**
+ * Sets the audio session category on iOS. In general, we should only need to use this for the `playback` and `ambient`
+ * categories. This enum however includes other categories that are available in the native API for clarity and
+ * potential future use.
+ * @see https://developer.apple.com/documentation/avfoundation/avaudiosession/category
+ * @platform ios
+ */
+export enum AudioCategory {
+  Ambient = 'AVAudioSessionCategoryAmbient',
+  Playback = 'AVAudioSessionCategoryPlayback',
+  _SoloAmbient = 'AVAudioSessionCategorySoloAmbient',
+  _Record = 'AVAudioSessionCategoryRecord',
+  _PlayAndRecord = 'AVAudioSessionCategoryPlayAndRecord',
+  _MultiRoute = 'AVAudioSessionCategoryMultiRoute',
+}