File tree Expand file tree Collapse file tree 3 files changed +30
-27
lines changed
android/app/src/main/java/com/zulipmobile Expand file tree Collapse file tree 3 files changed +30
-27
lines changed Original file line number Diff line number Diff line change @@ -6,26 +6,11 @@ import android.os.Bundle
6
6
import android.webkit.WebView
7
7
import com.facebook.react.ReactActivity
8
8
import com.facebook.react.ReactActivityDelegate
9
- import com.facebook.react.ReactApplication
10
9
import com.facebook.react.ReactRootView
11
- import com.facebook.react.bridge.ReactContext
12
10
import com.zulipmobile.notifications.*
13
11
import com.zulipmobile.sharing.handleSend
14
12
import expo.modules.ReactActivityDelegateWrapper
15
13
16
- // A convenience shortcut.
17
- fun ReactApplication.tryGetReactContext (): ReactContext ? =
18
- this .reactNativeHost.tryGetReactInstanceManager()?.currentReactContext
19
-
20
- /* *
21
- * Like `.application`, but with a more specific type.
22
- *
23
- * This expresses the invariant that a ReactActivity's application
24
- * should always be a ReactApplication.
25
- */
26
- val ReactActivity .reactApplication: ReactApplication
27
- get() = application as ReactApplication
28
-
29
14
open class MainActivity : ReactActivity () {
30
15
/* *
31
16
* Returns the name of the main component registered from JavaScript.
Original file line number Diff line number Diff line change
1
+ package com.zulipmobile
2
+
3
+ import com.facebook.react.ReactActivity
4
+ import com.facebook.react.ReactApplication
5
+ import com.facebook.react.ReactInstanceManager
6
+ import com.facebook.react.ReactNativeHost
7
+ import com.facebook.react.bridge.ReactContext
8
+
9
+ /* *
10
+ * Like getReactInstanceManager, but just return what exists; avoid trying to create.
11
+ *
12
+ * When there isn't already an instance manager, if we call
13
+ * getReactInstanceManager it'll try to create one... which asserts we're
14
+ * on the UI thread, which isn't true if e.g. we got here from a Service.
15
+ */
16
+ fun ReactNativeHost.tryGetReactInstanceManager (): ReactInstanceManager ? =
17
+ if (this .hasInstance()) this .reactInstanceManager else null
18
+
19
+ // A convenience shortcut.
20
+ fun ReactApplication.tryGetReactContext (): ReactContext ? =
21
+ this .reactNativeHost.tryGetReactInstanceManager()?.currentReactContext
22
+
23
+ /* *
24
+ * Like `.application`, but with a more specific type.
25
+ *
26
+ * This expresses the invariant that a ReactActivity's application
27
+ * should always be a ReactApplication.
28
+ */
29
+ val ReactActivity .reactApplication: ReactApplication
30
+ get() = application as ReactApplication
Original file line number Diff line number Diff line change @@ -4,8 +4,6 @@ package com.zulipmobile.notifications
4
4
5
5
import android.os.Bundle
6
6
import android.util.Log
7
- import com.facebook.react.ReactInstanceManager
8
- import com.facebook.react.ReactNativeHost
9
7
import com.facebook.react.bridge.Arguments
10
8
import com.facebook.react.bridge.ReactContext
11
9
import com.facebook.react.common.LifecycleState
@@ -18,16 +16,6 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
18
16
* TODO: Replace this with a fresh implementation based on RN upstream docs.
19
17
*/
20
18
21
- /* *
22
- * Like getReactInstanceManager, but just return what exists; avoid trying to create.
23
- *
24
- * When there isn't already an instance manager, if we call
25
- * getReactInstanceManager it'll try to create one... which asserts we're
26
- * on the UI thread, which isn't true if e.g. we got here from a Service.
27
- */
28
- fun ReactNativeHost.tryGetReactInstanceManager (): ReactInstanceManager ? =
29
- if (this .hasInstance()) this .reactInstanceManager else null
30
-
31
19
/* *
32
20
* A distillation of ReactContext.getLifecycleState() and related information.
33
21
*
You can’t perform that action at this time.
0 commit comments