add listener handling and gradle updates
This commit is contained in:
parent
c47bf91d62
commit
39ba244e73
6
.gitignore
vendored
6
.gitignore
vendored
@ -69,7 +69,6 @@ android/keystores/debug.keystore
|
||||
!.yarn/versions
|
||||
|
||||
# Expo
|
||||
.expo/
|
||||
|
||||
# Turborepo
|
||||
.turbo/
|
||||
@ -81,4 +80,7 @@ lib/
|
||||
ios/generated
|
||||
android/generated
|
||||
|
||||
.env
|
||||
.env
|
||||
/package-lock.json
|
||||
/example/package-lock.json
|
||||
/example/Gemfile.lock
|
||||
|
||||
@ -36,6 +36,20 @@ class WebIdMetaPluginModule(
|
||||
.emit(eventName, data)
|
||||
}
|
||||
|
||||
private var listenerCount = 0
|
||||
|
||||
@ReactMethod
|
||||
fun addListener(eventName: String) {
|
||||
// RN ruft das auf, sobald JS einen Listener registriert.
|
||||
listenerCount += 1
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun removeListeners(count: Int) {
|
||||
// RN ruft das auf, wenn JS Listener entfernt (count = Anzahl)
|
||||
listenerCount = (listenerCount - count).coerceAtLeast(0)
|
||||
}
|
||||
|
||||
// ------------------------------------------------
|
||||
// CREATE
|
||||
// ------------------------------------------------
|
||||
|
||||
@ -19,5 +19,5 @@ class MainActivity : ReactActivity() {
|
||||
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
|
||||
*/
|
||||
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
||||
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
||||
DefaultReactActivityDelegate(this, mainComponentName, false)
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@ class MainApplication : Application(), ReactApplication {
|
||||
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
|
||||
|
||||
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
||||
|
||||
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
||||
}
|
||||
|
||||
override val reactHost: ReactHost
|
||||
|
||||
@ -13,15 +13,8 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
configurations.classpath {
|
||||
resolutionStrategy {
|
||||
force("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
|
||||
force("org.jetbrains.kotlin:kotlin-gradle-plugin-api:${kotlinVersion}")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:8.6.0")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.20")
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
|
||||
# your application. You should enable this flag either if you want
|
||||
# to write custom TurboModules/Fabric components OR use libraries that
|
||||
# are providing them.
|
||||
newArchEnabled=true
|
||||
newArchEnabled=false
|
||||
|
||||
# Use this property to enable or disable the Hermes JS engine.
|
||||
# If set to false, you will be using JSC instead.
|
||||
|
||||
@ -4,6 +4,18 @@ pluginManagement {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.id == "org.jetbrains.kotlin.android") {
|
||||
useVersion("2.1.20")
|
||||
}
|
||||
if (requested.id.id == "org.jetbrains.kotlin.jvm") {
|
||||
useVersion("2.1.20")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
includeBuild("../node_modules/@react-native/gradle-plugin")
|
||||
}
|
||||
|
||||
@ -29,12 +41,3 @@ extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
|
||||
|
||||
rootProject.name = "webidmetaplugin.example"
|
||||
include(":app")
|
||||
includeBuild("../node_modules/@react-native/gradle-plugin")
|
||||
|
||||
extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
|
||||
ex.autolinkLibrariesFromCommand()
|
||||
}
|
||||
|
||||
rootProject.name = "webidmetaplugin.example"
|
||||
include(":app")
|
||||
includeBuild("../node_modules/@react-native/gradle-plugin")
|
||||
|
||||
@ -10,8 +10,10 @@
|
||||
"build:ios": "react-native build-ios --scheme WebIdMetaPluginExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\""
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "18.3.1",
|
||||
"react-native": "0.84.0"
|
||||
"react": "^19.2.4",
|
||||
"react-dom": "^19.2.4",
|
||||
"react-native": "0.84.0",
|
||||
"react-native-web-id-meta-plugin": "file:.."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
|
||||
17
package.json
17
package.json
@ -7,6 +7,10 @@
|
||||
"module": "./lib/module/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"react-native": {
|
||||
"types": "./src/index.tsx",
|
||||
"default": "./src/index.tsx"
|
||||
},
|
||||
"import": {
|
||||
"types": "./lib/typescript/module/src/index.d.ts",
|
||||
"default": "./lib/module/index.js"
|
||||
@ -69,15 +73,16 @@
|
||||
"@react-native/eslint-config": "^0.84.0",
|
||||
"@release-it/conventional-changelog": "^5.0.0",
|
||||
"@types/jest": "^29.5.5",
|
||||
"@types/react": "^18.2.44",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"commitlint": "^17.0.2",
|
||||
"del-cli": "^5.1.0",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"eslint-config-prettier": "^9.1.2",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.0.3",
|
||||
"react": "18.3.1",
|
||||
"prettier": "^3.8.1",
|
||||
"react": "^19.2.4",
|
||||
"react-native": "0.84.0",
|
||||
"react-native-builder-bob": "^0.30.0",
|
||||
"release-it": "^15.0.0",
|
||||
@ -130,6 +135,7 @@
|
||||
"@react-native",
|
||||
"prettier"
|
||||
],
|
||||
"plugins": ["prettier"],
|
||||
"rules": {
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"prettier/prettier": [
|
||||
@ -186,6 +192,7 @@
|
||||
"version": "0.41.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"react-dom": "^19.2.4",
|
||||
"react-native-bouncy-checkbox": "^4.1.4"
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,9 @@ const WebIdMetaPlugin = NativeModules.WebIdMetaPlugin
|
||||
}
|
||||
);
|
||||
|
||||
export const webIdEventEmitter = new NativeEventEmitter(WebIdMetaPlugin);
|
||||
export const webIdEventEmitter = new NativeEventEmitter(
|
||||
Platform.OS === 'android' ? undefined : WebIdMetaPlugin
|
||||
);
|
||||
|
||||
export function createMetaPlugin(
|
||||
uri: string,
|
||||
@ -40,7 +42,7 @@ export function verifyActionId(actionId: string): Promise<VerifyActionResult> {
|
||||
try {
|
||||
const json = await WebIdMetaPlugin.verifyActionId(actionId);
|
||||
let verifyActionResult = parseJSONToType<VerifyActionResult>(json);
|
||||
if (verifyActionId != undefined) {
|
||||
if (verifyActionId !== undefined) {
|
||||
resolve(verifyActionResult!);
|
||||
} else {
|
||||
reject('JSON parsing failed');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user