|
1 | 1 | package com.reactnativewebbrowser |
2 | 2 |
|
| 3 | +import com.facebook.react.bridge.Promise |
3 | 4 | import com.facebook.react.bridge.ReactApplicationContext |
4 | 5 | import com.facebook.react.bridge.ReactContextBaseJavaModule |
5 | 6 | import com.facebook.react.bridge.ReactMethod |
6 | | -import com.facebook.react.bridge.Promise |
7 | | - |
8 | | -class NativeWebBrowserModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) { |
9 | | - |
10 | | - override fun getName(): String { |
11 | | - return "NativeWebBrowser" |
12 | | - } |
13 | | - |
14 | | - // Example method |
15 | | - // See https://reactnative.dev/docs/native-modules-android |
16 | | - @ReactMethod |
17 | | - fun multiply(a: Int, b: Int, promise: Promise) { |
18 | | - |
19 | | - promise.resolve(a * b) |
20 | 7 |
|
21 | | - } |
| 8 | +class NativeWebBrowserModule(reactContext: ReactApplicationContext) : |
| 9 | + ReactContextBaseJavaModule(reactContext) { |
| 10 | + |
| 11 | + val activityProvider = InternalActicityProvider(reactContext) |
| 12 | + val customTabsActivitiesHelper = InternalCustomTabsActivitiesHelper(activityProvider) |
| 13 | + val customTabsConnectionHelper = InternalCustomTabsConnectionHelper(reactContext) |
| 14 | + |
| 15 | + private val BROWSER_PACKAGE_KEY = "browserPackage" |
| 16 | + private val SERVICE_PACKAGE_KEY = "servicePackage" |
| 17 | + private val BROWSER_PACKAGES_KEY = "browserPackages" |
| 18 | + private val SERVICE_PACKAGES_KEY = "servicePackages" |
| 19 | + private val PREFERRED_BROWSER_PACKAGE = "preferredBrowserPackage" |
| 20 | + private val DEFAULT_BROWSER_PACKAGE = "defaultBrowserPackage" |
| 21 | + private val SHOW_IN_RECENTS = "showInRecents" |
| 22 | + private val CREATE_TASK = "createTask" |
| 23 | + private val DEFAULT_SHARE_MENU_ITEM = "enableDefaultShareMenuItem" |
| 24 | + private val TOOLBAR_COLOR_KEY = "toolbarColor" |
| 25 | + private val SECONDARY_TOOLBAR_COLOR_KEY = "secondaryToolbarColor" |
| 26 | + |
| 27 | + private val ERROR_CODE = "RNWebBrowser" |
| 28 | + private val TAG = "ReactNativeWebBrowser" |
| 29 | + private val SHOW_TITLE_KEY = "showTitle" |
| 30 | + private val ENABLE_BAR_COLLAPSING_KEY = "enableBarCollapsing" |
| 31 | + |
| 32 | + private val NO_PREFERRED_PACKAGE_MSG = |
| 33 | + "Cannot determine preferred package without satisfying it." |
| 34 | + |
| 35 | + override fun getName(): String { |
| 36 | + return "NativeWebBrowser" |
| 37 | + } |
| 38 | + |
| 39 | + // Example method |
| 40 | + // See https://reactnative.dev/docs/native-modules-android |
| 41 | + @ReactMethod |
| 42 | + fun multiply(a: Int, b: Int, promise: Promise) { |
| 43 | + |
| 44 | + promise.resolve(a * b) |
| 45 | + |
| 46 | + } |
22 | 47 |
|
23 | 48 |
|
24 | 49 | } |
0 commit comments