From f6ab240d476f2e766ec59ab13604b1c5dfc0bb7d Mon Sep 17 00:00:00 2001 From: Bram del Canho Date: Wed, 17 Apr 2024 13:17:04 +0200 Subject: [PATCH] Add suspendSessionsWhenBackgrounded option to withIosGoogleCast --- .../__tests__/__snapshots__/withIosGoogleCast-test.ts.snap | 3 ++- .../src/__tests__/withIosGoogleCast-test.ts | 1 + packages/react-native-google-cast/src/withIosGoogleCast.ts | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/react-native-google-cast/src/__tests__/__snapshots__/withIosGoogleCast-test.ts.snap b/packages/react-native-google-cast/src/__tests__/__snapshots__/withIosGoogleCast-test.ts.snap index c0346caa..0030d2a9 100644 --- a/packages/react-native-google-cast/src/__tests__/__snapshots__/withIosGoogleCast-test.ts.snap +++ b/packages/react-native-google-cast/src/__tests__/__snapshots__/withIosGoogleCast-test.ts.snap @@ -10,12 +10,13 @@ exports[`addGoogleCastAppDelegateDidFinishLaunchingWithOptions adds maps import - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { -// @generated begin react-native-google-cast-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-daa990ca400f82a13f41d1ebc1f1fe9f511f3d6d +// @generated begin react-native-google-cast-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-7c4d7719024c020cbdbdec17652c4a5824b61c18 #if __has_include() NSString *receiverAppID = @"foobar-bacon"; GCKDiscoveryCriteria *criteria = [[GCKDiscoveryCriteria alloc] initWithApplicationID:receiverAppID]; GCKCastOptions* options = [[GCKCastOptions alloc] initWithDiscoveryCriteria:criteria]; options.startDiscoveryAfterFirstTapOnCastButton = true; + options.suspendSessionsWhenBackgrounded = false; [GCKCastContext setSharedInstanceWithOptions:options]; #endif // @generated end react-native-google-cast-didFinishLaunchingWithOptions diff --git a/packages/react-native-google-cast/src/__tests__/withIosGoogleCast-test.ts b/packages/react-native-google-cast/src/__tests__/withIosGoogleCast-test.ts index 6902a8d7..9a5ece6e 100644 --- a/packages/react-native-google-cast/src/__tests__/withIosGoogleCast-test.ts +++ b/packages/react-native-google-cast/src/__tests__/withIosGoogleCast-test.ts @@ -7,6 +7,7 @@ describe(addGoogleCastAppDelegateDidFinishLaunchingWithOptions, () => { getFixture("AppDelegate.mm"), { receiverAppId: "foobar-bacon", + suspendSessionsWhenBackgrounded: false, }, ); // matches a static snapshot diff --git a/packages/react-native-google-cast/src/withIosGoogleCast.ts b/packages/react-native-google-cast/src/withIosGoogleCast.ts index fb0994d8..b2f1927a 100644 --- a/packages/react-native-google-cast/src/withIosGoogleCast.ts +++ b/packages/react-native-google-cast/src/withIosGoogleCast.ts @@ -154,8 +154,8 @@ export function addGoogleCastAppDelegateDidFinishLaunchingWithOptions( " GCKCastOptions* options = [[GCKCastOptions alloc] initWithDiscoveryCriteria:criteria];", // TODO: Same as above, read statically // ` options.disableDiscoveryAutostart = ${String(!!disableDiscoveryAutostart)};`, - ` options.startDiscoveryAfterFirstTapOnCastButton = ${String(!!startDiscoveryAfterFirstTapOnCastButton,)};`, - ` options.suspendSessionsWhenBackgrounded = ${String(!!suspendSessionsWhenBackgrounded,)};`, + ` options.startDiscoveryAfterFirstTapOnCastButton = ${String(!!startDiscoveryAfterFirstTapOnCastButton)};`, + ` options.suspendSessionsWhenBackgrounded = ${String(!!suspendSessionsWhenBackgrounded)};`, " [GCKCastContext setSharedInstanceWithOptions:options];", "#endif", );