8
0

add listener handling and gradle updates

This commit is contained in:
andre 2026-02-12 19:47:01 +01:00
parent c47bf91d62
commit 39ba244e73
11 changed files with 7992 additions and 14298 deletions

4
.gitignore vendored
View File

@ -69,7 +69,6 @@ android/keystores/debug.keystore
!.yarn/versions !.yarn/versions
# Expo # Expo
.expo/
# Turborepo # Turborepo
.turbo/ .turbo/
@ -82,3 +81,6 @@ ios/generated
android/generated android/generated
.env .env
/package-lock.json
/example/package-lock.json
/example/Gemfile.lock

View File

@ -36,6 +36,20 @@ class WebIdMetaPluginModule(
.emit(eventName, data) .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 // CREATE
// ------------------------------------------------ // ------------------------------------------------

View File

@ -19,5 +19,5 @@ class MainActivity : ReactActivity() {
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled] * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/ */
override fun createReactActivityDelegate(): ReactActivityDelegate = override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) DefaultReactActivityDelegate(this, mainComponentName, false)
} }

View File

@ -28,6 +28,8 @@ class MainApplication : Application(), ReactApplication {
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
} }
override val reactHost: ReactHost override val reactHost: ReactHost

View File

@ -13,15 +13,8 @@ buildscript {
mavenCentral() mavenCentral()
} }
configurations.classpath {
resolutionStrategy {
force("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
force("org.jetbrains.kotlin:kotlin-gradle-plugin-api:${kotlinVersion}")
}
}
dependencies { dependencies {
classpath("com.android.tools.build:gradle:8.6.0") 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")
} }
} }

View File

@ -32,7 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# your application. You should enable this flag either if you want # your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that # to write custom TurboModules/Fabric components OR use libraries that
# are providing them. # are providing them.
newArchEnabled=true newArchEnabled=false
# Use this property to enable or disable the Hermes JS engine. # Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead. # If set to false, you will be using JSC instead.

View File

@ -4,6 +4,18 @@ pluginManagement {
google() google()
mavenCentral() 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") includeBuild("../node_modules/@react-native/gradle-plugin")
} }
@ -29,12 +41,3 @@ extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
rootProject.name = "webidmetaplugin.example" rootProject.name = "webidmetaplugin.example"
include(":app") 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")

View File

@ -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\"" "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": { "dependencies": {
"react": "18.3.1", "react": "^19.2.4",
"react-native": "0.84.0" "react-dom": "^19.2.4",
"react-native": "0.84.0",
"react-native-web-id-meta-plugin": "file:.."
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.20.0", "@babel/core": "^7.20.0",

View File

@ -7,6 +7,10 @@
"module": "./lib/module/index.js", "module": "./lib/module/index.js",
"exports": { "exports": {
".": { ".": {
"react-native": {
"types": "./src/index.tsx",
"default": "./src/index.tsx"
},
"import": { "import": {
"types": "./lib/typescript/module/src/index.d.ts", "types": "./lib/typescript/module/src/index.d.ts",
"default": "./lib/module/index.js" "default": "./lib/module/index.js"
@ -69,15 +73,16 @@
"@react-native/eslint-config": "^0.84.0", "@react-native/eslint-config": "^0.84.0",
"@release-it/conventional-changelog": "^5.0.0", "@release-it/conventional-changelog": "^5.0.0",
"@types/jest": "^29.5.5", "@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", "commitlint": "^17.0.2",
"del-cli": "^5.1.0", "del-cli": "^5.1.0",
"eslint": "^8.51.0", "eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.1.2",
"eslint-plugin-prettier": "^5.0.1", "eslint-plugin-prettier": "^5.5.5",
"jest": "^29.7.0", "jest": "^29.7.0",
"prettier": "^3.0.3", "prettier": "^3.8.1",
"react": "18.3.1", "react": "^19.2.4",
"react-native": "0.84.0", "react-native": "0.84.0",
"react-native-builder-bob": "^0.30.0", "react-native-builder-bob": "^0.30.0",
"release-it": "^15.0.0", "release-it": "^15.0.0",
@ -130,6 +135,7 @@
"@react-native", "@react-native",
"prettier" "prettier"
], ],
"plugins": ["prettier"],
"rules": { "rules": {
"react/react-in-jsx-scope": "off", "react/react-in-jsx-scope": "off",
"prettier/prettier": [ "prettier/prettier": [
@ -186,6 +192,7 @@
"version": "0.41.0" "version": "0.41.0"
}, },
"dependencies": { "dependencies": {
"react-dom": "^19.2.4",
"react-native-bouncy-checkbox": "^4.1.4" "react-native-bouncy-checkbox": "^4.1.4"
} }
} }

View File

@ -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( export function createMetaPlugin(
uri: string, uri: string,
@ -40,7 +42,7 @@ export function verifyActionId(actionId: string): Promise<VerifyActionResult> {
try { try {
const json = await WebIdMetaPlugin.verifyActionId(actionId); const json = await WebIdMetaPlugin.verifyActionId(actionId);
let verifyActionResult = parseJSONToType<VerifyActionResult>(json); let verifyActionResult = parseJSONToType<VerifyActionResult>(json);
if (verifyActionId != undefined) { if (verifyActionId !== undefined) {
resolve(verifyActionResult!); resolve(verifyActionResult!);
} else { } else {
reject('JSON parsing failed'); reject('JSON parsing failed');

22205
yarn.lock

File diff suppressed because it is too large Load Diff