diff options
Diffstat (limited to 'android/app/src/main/java')
-rw-r--r-- | android/app/src/main/java/com/cyberbadge_mobile/MainActivity.kt | 22 | ||||
-rw-r--r-- | android/app/src/main/java/com/cyberbadge_mobile/MainApplication.kt | 45 |
2 files changed, 67 insertions, 0 deletions
diff --git a/android/app/src/main/java/com/cyberbadge_mobile/MainActivity.kt b/android/app/src/main/java/com/cyberbadge_mobile/MainActivity.kt new file mode 100644 index 0000000..1417a4e --- /dev/null +++ b/android/app/src/main/java/com/cyberbadge_mobile/MainActivity.kt | |||
@@ -0,0 +1,22 @@ | |||
1 | package com.cyberbadge_mobile | ||
2 | |||
3 | import com.facebook.react.ReactActivity | ||
4 | import com.facebook.react.ReactActivityDelegate | ||
5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled | ||
6 | import com.facebook.react.defaults.DefaultReactActivityDelegate | ||
7 | |||
8 | class MainActivity : ReactActivity() { | ||
9 | |||
10 | /** | ||
11 | * Returns the name of the main component registered from JavaScript. This is used to schedule | ||
12 | * rendering of the component. | ||
13 | */ | ||
14 | override fun getMainComponentName(): String = "cyberbadge_mobile" | ||
15 | |||
16 | /** | ||
17 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] | ||
18 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] | ||
19 | */ | ||
20 | override fun createReactActivityDelegate(): ReactActivityDelegate = | ||
21 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) | ||
22 | } | ||
diff --git a/android/app/src/main/java/com/cyberbadge_mobile/MainApplication.kt b/android/app/src/main/java/com/cyberbadge_mobile/MainApplication.kt new file mode 100644 index 0000000..3fc08cf --- /dev/null +++ b/android/app/src/main/java/com/cyberbadge_mobile/MainApplication.kt | |||
@@ -0,0 +1,45 @@ | |||
1 | package com.cyberbadge_mobile | ||
2 | |||
3 | import android.app.Application | ||
4 | import com.facebook.react.PackageList | ||
5 | import com.facebook.react.ReactApplication | ||
6 | import com.facebook.react.ReactHost | ||
7 | import com.facebook.react.ReactNativeHost | ||
8 | import com.facebook.react.ReactPackage | ||
9 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load | ||
10 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost | ||
11 | import com.facebook.react.defaults.DefaultReactNativeHost | ||
12 | import com.facebook.react.flipper.ReactNativeFlipper | ||
13 | import com.facebook.soloader.SoLoader | ||
14 | |||
15 | class MainApplication : Application(), ReactApplication { | ||
16 | |||
17 | override val reactNativeHost: ReactNativeHost = | ||
18 | object : DefaultReactNativeHost(this) { | ||
19 | override fun getPackages(): List<ReactPackage> { | ||
20 | // Packages that cannot be autolinked yet can be added manually here, for example: | ||
21 | // packages.add(new MyReactNativePackage()); | ||
22 | return PackageList(this).packages | ||
23 | } | ||
24 | |||
25 | override fun getJSMainModuleName(): String = "index" | ||
26 | |||
27 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG | ||
28 | |||
29 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED | ||
30 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED | ||
31 | } | ||
32 | |||
33 | override val reactHost: ReactHost | ||
34 | get() = getDefaultReactHost(this.applicationContext, reactNativeHost) | ||
35 | |||
36 | override fun onCreate() { | ||
37 | super.onCreate() | ||
38 | SoLoader.init(this, false) | ||
39 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { | ||
40 | // If you opted-in for the New Architecture, we load the native entry point for this app. | ||
41 | load() | ||
42 | } | ||
43 | ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager) | ||
44 | } | ||
45 | } | ||