Skip to content

Commit 1daa1b9

Browse files
committed
Clean up some of the un needed changes
1 parent b170682 commit 1daa1b9

4 files changed

Lines changed: 14 additions & 48 deletions

File tree

analytics/src/analytics_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace analytics {
2424
namespace internal {
2525

2626
enum AnalyticsFn {
27-
kAnalyticsFnGetAnalyticsInstanceId = 0,
27+
kAnalyticsFnGetAnalyticsInstanceId,
2828
kAnalyticsFnGetSessionId,
2929
kAnalyticsFnLogAppleTransaction,
3030
kAnalyticsFnCount,

analytics/src/analytics_ios.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,7 @@ void CompleteLogAppleTransaction(const void* context, bool success) {
273273
// We capture the C++ handle_ptr inside the Objective-C block. Swift never sees it.
274274
[AppleTransactionVerifier verifyWithTransactionId:SafeString(transaction_id)
275275
completion:^(BOOL isFound) {
276-
// 3. We are back in C++ land on the Main Thread.
277-
// Call your completion logic directly.
276+
// 3. We are back in C++ land. Call your completion logic directly.
278277
CompleteLogAppleTransaction(handle_ptr, isFound == YES);
279278
}];
280279

analytics/src/ios/swift/AppleTransactionVerifier.swift

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,57 +16,25 @@ import Foundation
1616
import StoreKit
1717
import FirebaseAnalytics
1818

19-
// Pure Swift worker to prevent compiler generation bugs with witness tables
20-
// when mixing @objc and Swift Concurrency on older iOS deployment targets.
21-
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)
22-
internal struct AppleTransactionWorker {
23-
static func findAndLogTransaction(id: String) async -> Bool {
24-
// Using a standard while loop instead of `for await` avoids a known
25-
// Xcode 15+ compiler bug where corrupted witness tables are generated
26-
// for AsyncSequences when targeting iOS 15/16.
27-
var iterator = Transaction.all.makeAsyncIterator()
28-
while let verificationResult = await iterator.next() {
29-
if case .verified(let transaction) = verificationResult {
30-
if String(transaction.id) == id {
31-
Analytics.logTransaction(transaction)
32-
return true
33-
}
34-
}
35-
}
36-
return false
37-
}
38-
}
39-
4019
@objc public class AppleTransactionVerifier: NSObject {
4120

42-
// Notice: To avoid C-pointer ABI layout issues across Swift boundaries,
43-
// this interface relies purely on a standard Swift closure. The calling
44-
// C++ layer captures any necessary pointers within an Objective-C block.
4521
@objc public static func verify(transactionId: String, completion: @escaping @Sendable (Bool) -> Void) {
4622
if #available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *) {
47-
// Create a pure Swift String copy of the transaction ID.
48-
// This ensures we do not rely on the memory of the bridged Objective-C
49-
// NSString, which might be destroyed by the calling C++ thread before
50-
// the asynchronous Task completes.
51-
let safeId = String(transactionId)
52-
53-
// Use a detached task to avoid inheriting any C++/ObjC thread context.
54-
// This prevents EXC_BAD_ACCESS during `swift_task_alloc` on iOS 15/16.
55-
Task.detached(priority: .userInitiated) { [safeId, completion] in
56-
let isFound = await AppleTransactionWorker.findAndLogTransaction(id: safeId)
57-
58-
// Return to the main thread to ensure thread safety when the C++
59-
// layer receives the callback and manages internal state.
60-
DispatchQueue.main.async {
61-
completion(isFound)
23+
Task {
24+
var iterator = Transaction.all.makeAsyncIterator()
25+
while let verificationResult = await iterator.next() {
26+
if case .verified(let transaction) = verificationResult {
27+
if String(transaction.id) == transactionId {
28+
Analytics.logTransaction(transaction)
29+
completion(true)
30+
return
31+
}
32+
}
6233
}
63-
}
64-
} else {
65-
// Not on a supported OS, resolve immediately on the main thread
66-
// to avoid potential deadlocks if called while holding a C++ mutex.
67-
DispatchQueue.main.async {
6834
completion(false)
6935
}
36+
} else {
37+
completion(false)
7038
}
7139
}
7240
}

app/src/secure/user_secure_fake_internal.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <errno.h>
3030

3131
#include <cstdio>
32-
#include <cstring>
3332
#include <fstream>
3433
#include <string>
3534

0 commit comments

Comments
 (0)