@@ -35,16 +35,17 @@ class MainActivity : ReactActivity() {
3535 * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
3636 */
3737 override fun createReactActivityDelegate (): ReactActivityDelegate =
38- DefaultReactActivityDelegate (this , mainComponentName, fabricEnabled)
38+ DefaultReactActivityDelegate (this , mainComponentName, fabricEnabled)
3939
4040 override fun onCreate (savedInstanceState : Bundle ? ) {
41- // pass null to super.onCreate https://github.com/software-mansion/react-native-screens?tab=readme-ov-file#android
41+ // pass null to super.onCreate
42+ // https://github.com/software-mansion/react-native-screens?tab=readme-ov-file#android
4243 super .onCreate(null )
4344
4445 val intent = intent
4546 checkAgainstIntentUpdate(intent)
4647
47- if (BuildConfig .SHOULD_RUN_BACKEND_WORKER ) {
48+ if (BuildConfig .SHOULD_RUN_BACKEND_WORKER == " true " ) {
4849 val context = applicationContext
4950 BackendWorkManager (context).enqueueRequests()
5051 }
@@ -63,16 +64,14 @@ class MainActivity : ReactActivity() {
6364
6465 @RequiresApi(Build .VERSION_CODES .TIRAMISU )
6566 private fun checkNotificationsPermission () {
66- if (ContextCompat .checkSelfPermission(
67- this ,
68- Manifest .permission.POST_NOTIFICATIONS
69- ) != PackageManager .PERMISSION_GRANTED
67+ if (ContextCompat .checkSelfPermission(this , Manifest .permission.POST_NOTIFICATIONS ) !=
68+ PackageManager .PERMISSION_GRANTED
7069 ) {
7170 // Requesting the permission
7271 ActivityCompat .requestPermissions(
73- this ,
74- arrayOf(Manifest .permission.POST_NOTIFICATIONS ),
75- NOTIFICATION_PERMISSION_REQUEST_CODE
72+ this ,
73+ arrayOf(Manifest .permission.POST_NOTIFICATIONS ),
74+ NOTIFICATION_PERMISSION_REQUEST_CODE
7675 )
7776 }
7877 }
@@ -103,12 +102,13 @@ class MainActivity : ReactActivity() {
103102
104103 @Throws(java.lang.Exception ::class )
105104 private fun respondOnNotification (bundle : Bundle ) {
106- val channel = bundle.getString(" channel" )
107- ? : throw java.lang.Exception (" respondOnNotification() failed because of missing channel" )
105+ val channel =
106+ bundle.getString(" channel" )
107+ ? : throw java.lang.Exception (
108+ " respondOnNotification() failed because of missing channel"
109+ )
108110
109- getCurrentReactContext { context: ReactContext ->
110- emitSwitchChannelEvent(context, channel)
111- }
111+ getCurrentReactContext { context: ReactContext -> emitSwitchChannelEvent(context, channel) }
112112 }
113113
114114 @SuppressLint(" VisibleForTests" )
@@ -117,19 +117,20 @@ class MainActivity : ReactActivity() {
117117 if (null != reactContext) {
118118 callback(reactContext)
119119 } else {
120- reactInstanceManager.addReactInstanceEventListener(object : ReactInstanceEventListener {
121- override fun onReactContextInitialized (context : ReactContext ) {
122- callback(context)
123- reactInstanceManager.removeReactInstanceEventListener(this )
124- }
125- })
120+ reactInstanceManager.addReactInstanceEventListener(
121+ object : ReactInstanceEventListener {
122+ override fun onReactContextInitialized (context : ReactContext ) {
123+ callback(context)
124+ reactInstanceManager.removeReactInstanceEventListener(this )
125+ }
126+ }
127+ )
126128 }
127129 }
128130
129131 private fun emitSwitchChannelEvent (reactContext : ReactContext , channel : String ) {
130- val deviceEventEmitter: RCTDeviceEventEmitter = reactContext.getJSModule(
131- RCTDeviceEventEmitter ::class .java
132- )
132+ val deviceEventEmitter: RCTDeviceEventEmitter =
133+ reactContext.getJSModule(RCTDeviceEventEmitter ::class .java)
133134
134135 deviceEventEmitter.emit(" notification" , channel)
135136 }
0 commit comments