@@ -8,6 +8,7 @@ const config_plugins_1 = require("@expo/config-plugins");
88const fs_1 = __importDefault ( require ( "fs" ) ) ;
99const path_1 = __importDefault ( require ( "path" ) ) ;
1010const insertLinesHelper_1 = require ( "./util/insertLinesHelper" ) ;
11+ let viroPluginConfig = [ "AR" ] ;
1112const withBranchAndroid = ( config , props ) => {
1213 // Directly edit MainApplication.java
1314 config = ( 0 , config_plugins_1 . withDangerousMod ) ( config , [
@@ -36,6 +37,7 @@ const withBranchAndroid = (config, props) => {
3637 *
3738 * ********************************************************************
3839 * Sample app.json with multiple options for Viro config
40+ * The default configuration is "AR"
3941 * ********************************************************************
4042 * plugins: [
4143 * [
@@ -47,15 +49,12 @@ const withBranchAndroid = (config, props) => {
4749 * ],
4850 * ********************************************************************
4951 * Sample app.json without property config
50- * The default configuration is "AR"
5152 * ********************************************************************
5253 *
5354 * plugins: [ "@viro-community/react-viro" ],
5455 *
5556 */
5657 const viroPlugin = config ?. plugins ?. find ( ( plugin ) => Array . isArray ( plugin ) && plugin [ 0 ] === "@viro-community/react-viro" ) ;
57- console . log ( "viroPlugin" , viroPlugin ) ;
58- let viroPluginConfig = [ "AR" ] ;
5958 if ( Array . isArray ( viroPlugin ) ) {
6059 if ( Array . isArray ( viroPlugin [ 1 ] . androidXrMode ) ) {
6160 viroPluginConfig = viroPlugin [ 1 ] . androidXrMode . filter ( ( mode ) => [ "AR" , "GVR" , "OVR_MOBILE" ] . includes ( mode ) ) ;
@@ -64,14 +63,12 @@ const withBranchAndroid = (config, props) => {
6463 viroPluginConfig = [ viroPlugin [ 1 ] ?. androidXrMode ] ;
6564 }
6665 }
67- console . log ( "viroPluginConfig" , viroPluginConfig ) ;
6866 let target = "" ;
6967 for ( const viroConfig of viroPluginConfig ) {
7068 target =
7169 target +
7270 ` packages.add(new ReactViroPackage(ReactViroPackage.ViroPlatform.valueOf("${ viroConfig } ")));\n` ;
7371 }
74- console . log ( "target" , target ) ;
7572 data = ( 0 , insertLinesHelper_1 . insertLinesHelper ) ( target , "List<ReactPackage> packages = new PackageList(this).getPackages();" , data ) ;
7673 fs_1 . default . writeFile ( mainApplicationPath , data , "utf-8" , function ( err ) {
7774 if ( err )
@@ -118,6 +115,27 @@ const withViroManifest = (config) => (0, config_plugins_1.withAndroidManifest)(c
118115 "android:value" : "optional" ,
119116 } ,
120117 } ) ;
118+ if ( viroPluginConfig . includes ( "GVR" ) ||
119+ viroPluginConfig . includes ( "OVR_MOBILE" ) ) {
120+ console . log ( contents ?. manifest ?. application ?. [ 0 ] ?. activity [ 0 ] [ "intent-filter" ] [ 0 ]
121+ . category ) ;
122+ // <!-- Add the following line for cardboard -->
123+ // <category android:name="com.google.intent.category.CARDBOARD" />
124+ contents ?. manifest ?. application ?. [ 0 ] ?. activity [ 0 ] [ "intent-filter" ] [ 0 ] . category . push ( {
125+ $ : {
126+ "android:name" : "com.google.intent.category.CARDBOARD" ,
127+ } ,
128+ } ) ;
129+ // <!-- Add the following line for daydream -->
130+ // <category android:name="com.google.intent.category.DAYDREAM" />
131+ contents ?. manifest ?. application ?. [ 0 ] ?. activity [ 0 ] [ "intent-filter" ] [ 0 ] . category . push ( {
132+ $ : {
133+ "android:name" : "com.google.intent.category.DAYDREAM" ,
134+ } ,
135+ } ) ;
136+ console . log ( contents ?. manifest ?. application ?. [ 0 ] ?. activity [ 0 ] [ "intent-filter" ] [ 0 ]
137+ . category ) ;
138+ }
121139 contents . manifest . queries = [
122140 {
123141 package : [
0 commit comments