@@ -12,6 +12,7 @@ const serverPort = Number(process.env.SIMDECK_INTEGRATION_PORT ?? "4510");
1212const serverUrl = `http://127.0.0.1:${ serverPort } ` ;
1313const origin = serverUrl ;
1414const fixtureBundleId = "dev.nativescript.simdeck.integration.fixture" ;
15+ const fixtureUrlScheme = "simdeck-fixture" ;
1516const fixtureUrl = "simdeck-fixture://integration" ;
1617const verbose = process . env . SIMDECK_INTEGRATION_VERBOSE === "1" ;
1718const traceHttp = process . env . SIMDECK_INTEGRATION_TRACE_HTTP === "1" ;
@@ -91,6 +92,7 @@ async function main() {
9192 ) ;
9293
9394 simdeckJson ( [ "install" , simulatorUDID , fixture . appPath ] ) ;
95+ preapproveFixtureUrlScheme ( ) ;
9496 await verifyUi ( "after install" ) ;
9597
9698 startServer ( ) ;
@@ -1381,6 +1383,44 @@ function openSimulatorApp(udid) {
13811383 } ) ;
13821384}
13831385
1386+ function preapproveFixtureUrlScheme ( ) {
1387+ const plist = path . join (
1388+ os . homedir ( ) ,
1389+ "Library" ,
1390+ "Developer" ,
1391+ "CoreSimulator" ,
1392+ "Devices" ,
1393+ simulatorUDID ,
1394+ "data" ,
1395+ "Library" ,
1396+ "Preferences" ,
1397+ "com.apple.launchservices.schemeapproval.plist" ,
1398+ ) ;
1399+ const key = `com.apple.CoreSimulator.CoreSimulatorBridge-->${ fixtureUrlScheme } ` ;
1400+ fs . mkdirSync ( path . dirname ( plist ) , { recursive : true } ) ;
1401+
1402+ const setResult = spawnSync (
1403+ "/usr/libexec/PlistBuddy" ,
1404+ [ "-c" , `Set :${ key } ${ fixtureBundleId } ` , plist ] ,
1405+ {
1406+ cwd : root ,
1407+ encoding : "utf8" ,
1408+ timeout : 60_000 ,
1409+ } ,
1410+ ) ;
1411+ if ( setResult . status === 0 ) {
1412+ logStep ( `preapproved fixture URL scheme in ${ path . basename ( plist ) } ` ) ;
1413+ return ;
1414+ }
1415+
1416+ runText (
1417+ "/usr/libexec/PlistBuddy" ,
1418+ [ "-c" , `Add :${ key } string ${ fixtureBundleId } ` , plist ] ,
1419+ { timeoutMs : 60_000 } ,
1420+ ) ;
1421+ logStep ( `preapproved fixture URL scheme in ${ path . basename ( plist ) } ` ) ;
1422+ }
1423+
13841424function assertSimulatorListed ( udid ) {
13851425 const payload = simdeckJson ( [ "list" ] ) ;
13861426 if ( ! payload . simulators ?. some ( ( simulator ) => simulator . udid === udid ) ) {
0 commit comments