Skip to content

Commit d15224a

Browse files
committed
chore: wip
1 parent 7d4f5eb commit d15224a

File tree

2 files changed

+51
-15
lines changed

2 files changed

+51
-15
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.reactnativewebbrowser
2+
3+
import android.app.Activity
4+
import com.facebook.react.bridge.ReactContext
5+
6+
class InternalActicityProvider(val reactContext: ReactContext) :
7+
ActivityProvider {
8+
override fun getCurrentActivity(): Activity? {
9+
return reactContext.currentActivity
10+
}
11+
}
Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,49 @@
11
package com.reactnativewebbrowser
22

3+
import com.facebook.react.bridge.Promise
34
import com.facebook.react.bridge.ReactApplicationContext
45
import com.facebook.react.bridge.ReactContextBaseJavaModule
56
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)
207

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+
}
2247

2348

2449
}

0 commit comments

Comments
 (0)