Skip to content

Commit

Permalink
iOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
jakequade committed Aug 24, 2024
1 parent fb6e3dc commit df23a5b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"com.reactnative.googlecast.RNGCExpandedControllerActivity": true
}
],
["./plugins/withExpandedController.js"],
[
"expo-build-properties",
{
Expand Down
18 changes: 18 additions & 0 deletions plugins/withExpandedController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { withAppDelegate } = require("@expo/config-plugins");

const withExpandedController = (config) => {
return withAppDelegate(config, async (config) => {
const contents = config.modResults.contents;

// this is the code generated by React native inside didFinishLaunchingWithOptions function; it might change in the future, look for your own anchor then
const injectionIndex = contents.indexOf("self.initialProps = @{};");
config.modResults.contents =
contents.substring(0, injectionIndex) +
`\n [GCKCastContext sharedInstance].useDefaultExpandedMediaControls = true; \n` +
contents.substring(injectionIndex);

return config;
});
};

module.exports = withExpandedController;

0 comments on commit df23a5b

Please sign in to comment.