<|start_filename|>tsconfig.json<|end_filename|>
{
  "compilerOptions": {
    "target": "esnext",
    "module": "commonjs",
    "lib": ["es6", "dom"],
    "allowJs": true,
    "jsx": "react-native",
    "noEmit": true,
    "incremental": true,
    "isolatedModules": true,
    "moduleResolution": "node",
    "paths": {
      "app/*": ["./src/*"],
      // Remove these when no longer dependent on audius-client
      "audio/*": ["./node_modules/audius-client/src/audio/*"],
      "common/*": ["./node_modules/audius-client/src/common/*"],
      "components/*": ["./node_modules/audius-client/src/components/*"],
      "containers/*": ["./node_modules/audius-client/src/containers/*"],
      "models/*": ["./node_modules/audius-client/src/models/*"],
      "services/*": ["./node_modules/audius-client/src/services/*"],
      "store/*": ["./node_modules/audius-client/src/store/*"],
      "utils/*": ["./node_modules/audius-client/src/utils/*"]
    },
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    // Update these when no longer dependent on audius-client
    "strict": false,
    "skipLibCheck": true
  },
  "exclude": [
    "node_modules",
    "babel.config.js",
    "metro.config.js",
    "jest.config.js",
    "./android/*",
    "./web-app/*"
  ]
}


<|start_filename|>android/app/src/main/java/com/foo/CastOptionsProvider.java<|end_filename|>
package com.foo;

import android.content.Context;
import com.google.android.gms.cast.framework.CastOptions;
import com.reactnative.googlecast.GoogleCastOptionsProvider;

public class CastOptionsProvider extends GoogleCastOptionsProvider {
  @Override
  public CastOptions getCastOptions(Context context) {
    CastOptions castOptions = new CastOptions.Builder()
        .setReceiverApplicationId("222B31C8")
        .build();
    return castOptions;
  }
}

<|start_filename|>android/app/src/main/java/com/audiusreactnative/MainActivity.java<|end_filename|>
package co.audius.app;

import com.facebook.react.ReactActivity;

public class MainActivity extends ReactActivity {

  /**
   * Returns the name of the main component registered from JavaScript. This is used to schedule
   * rendering of the component.
   */
  @Override
  protected String getMainComponentName() {
    return "AudiusReactNative";
  }

  @Override
  public void invokeDefaultOnBackPressed() {
      // Not calling super. invokeDefaultOnBackPressed() b/c it will close the app.
      // Instead, put the app in the backgroud to allow audio to keep playing.
      moveTaskToBack(true);
  }
}


<|start_filename|>metro.config.js<|end_filename|>
const { getDefaultConfig } = require('metro-config')

// If developing locally and using yalc
// to manage local audius-client dependency,
// change this to '.yalc'
const AUDIUS_CLIENT_LOCATION = 'node_modules'
const clientPath = path =>
  `${__dirname}/${AUDIUS_CLIENT_LOCATION}/audius-client/src/${path}`

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts }
  } = await getDefaultConfig()
  return {
    transformer: {
      getTransformOptions: async () => ({
        transform: {
          experimentalImportSupport: false,
          inlineRequires: true
        }
      }),
      babelTransformerPath: require.resolve('react-native-svg-transformer')
    },
    resolver: {
      assetExts: assetExts.filter(ext => ext !== 'svg'),
      sourceExts: [...sourceExts, 'svg', 'cjs'],

      extraNodeModules: {
        // Alias for 'src' to allow for absolute paths
        app: `${__dirname}/src`,

        // This is used to resolve the absolute paths found in audius-client.
        // Eventually all shared state logic will live in @audius/client-common
        // and this can be removed
        ...[
          'assets',
          'audio',
          'common',
          'containers',
          'models',
          'schemas',
          'services',
          'store',
          'utils',
          'workers'
        ].reduce(
          (result, current) => ({ ...result, [current]: clientPath(current) }),
          {}
        ),

        // Some modules import native node modules without necessarily using them.
        // This mocks them out so the app can build
        crypto: `${__dirname}/node_modules/expo-crypto`,
        fs: `${__dirname}/node_modules/react-native-fs`,
        child_process: `${__dirname}/src/mocks/empty.ts`,
        http: `${__dirname}/src/mocks/empty.ts`,
        https: `${__dirname}/src/mocks/empty.ts`,
        stream: `${__dirname}/src/mocks/empty.ts`
      }
    },
    maxWorkers: 2
  }
})()
