Skip to content

Commit a774d73

Browse files
committed
Added try/catch on CallbackGuard and updated changelog
1 parent 938e4f5 commit a774d73

2 files changed

Lines changed: 32 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
## 6.17.8
2-
Release date: *TBD*
3-
4-
- React Native >> Fixed callback double-invocation crash in React Native New Architecture on Android (prevents fatal errors when callbacks are invoked multiple times)
5-
- React Native >> Fixed Expo Android build failure related to missing secure_store XML resources
6-
- React Native >> Added optional `preferAppsFlyerBackupRules` flag for Expo Android manifest backup rules handling
7-
- React Native >> Changed Expo Android default behavior to no longer modify app's backup rules (use `preferAppsFlyerBackupRules: true` to opt-in)
8-
- React Native >> Enhanced iOS Swift header import with fallback for different CocoaPods configurations
9-
- React Native >> Fixed TypeScript definition issues (`onFailure``OnFailure` type name, import paths)
10-
- React Native >> Added ESLint configuration and lint scripts for code quality
2+
Release date: *2025-12-17*
3+
4+
- React Native >> Update Android SDK to 6.17.5
5+
- React Native >> Update iOS SDK to 6.17.8
6+
- React Native >> Update iOS Purchase Connector to 6.17.8
7+
- React Native >> Fixed callback double-invocation crash in React Native New Architecture on Android
8+
- React Native >> Fixed TypeScript return type for `validateAndLogInAppPurchaseV2`
9+
- React Native >> Fixed TypeScript type issues (`onFailure``OnFailure`, import paths)
10+
- React Native >> Fixed Expo Android build failure related to backup rules
11+
- React Native >> Added `preferAppsFlyerBackupRules` flag for Expo Android (default: false)
12+
- React Native >> Enhanced iOS Swift header import with CocoaPods fallback
13+
- React Native >> Added ESLint configuration and lint scripts
1114
- React Native >> Update Plugin to v6.17.8
1215

16+
## 6.17.7
17+
Release date: 2025-10-22
18+
19+
- React Native >> Update Android SDK to 6.17.7
20+
- React Native >> Update iOS SDK to 6.17.7
21+
- React Native >> Update Plugin to v6.17.7
22+
1323
## 6.17.5
1424
Release date: *2025-09-04*
1525

android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class RNAppsFlyerModule extends ReactContextBaseJavaModule {
6767
private String personalDevKey;
6868

6969
private static class CallbackGuard {
70+
private static final String TAG = "AppsFlyer_" + RNAppsFlyerConstants.PLUGIN_VERSION;
7071
private final AtomicBoolean invoked = new AtomicBoolean(false);
7172
private final WeakReference<Callback> callbackRef;
7273

@@ -76,9 +77,19 @@ public CallbackGuard(Callback callback) {
7677

7778
public void invoke(Object... args) {
7879
if (invoked.compareAndSet(false, true)) {
79-
Callback callback = callbackRef.get();
80+
// Store in local strong reference to prevent race condition with GC
81+
final Callback callback = callbackRef.get();
8082
if (callback != null) {
81-
callback.invoke(args);
83+
try {
84+
callback.invoke(args);
85+
} catch (RuntimeException | IllegalStateException e) {
86+
// Log error when bridge is destroyed or context is dead
87+
// Don't rethrow - callback failure shouldn't break the SDK
88+
Log.e(TAG, "Failed to invoke callback - bridge may be destroyed", e);
89+
} catch (Exception e) {
90+
// Catch any other unexpected exceptions
91+
Log.e(TAG, "Unexpected error invoking callback", e);
92+
}
8293
}
8394
}
8495
}

0 commit comments

Comments
 (0)