1 package expo.modules.updates.launcher
2 
3 import expo.modules.updates.db.entity.AssetEntity
4 import expo.modules.updates.db.entity.UpdateEntity
5 
6 /**
7  * Provides an interface through which an update can be launched from disk. Classes that implement
8  * this interface are responsible for selecting an eligible update to launch, ensuring all
9  * required assets are present, and providing the fields here.
10  */
11 interface Launcher {
12   interface LauncherCallback {
onFailurenull13     fun onFailure(e: Exception)
14     fun onSuccess()
15   }
16 
17   val launchedUpdate: UpdateEntity?
18 
19   /**
20    * Used by React Native to launch the app when the launch asset (JS bundle or HBC) is located on
21    * the device's file system.
22    */
23   val launchAssetFile: String?
24 
25   /**
26    * Used by React Native to launch the app when the launch asset (JS bundle or HBC) is embedded in
27    * the application package.
28    */
29   val bundleAssetName: String?
30 
31   /**
32    * Exported to JS through [UpdatesModule] for use by the expo-asset package. Used to map
33    * references to `require`d assets to files on disk.
34    */
35   val localAssetFiles: Map<AssetEntity, String>?
36 
37   /**
38    * Exported to JS through [UpdatesModule] for use by the expo-asset package. Used to determine
39    * whether to map references to `require`d assets to files embedded in the application package.
40    */
41   val isUsingEmbeddedAssets: Boolean
42 }
43