@@ -36,6 +36,8 @@ public class FirebaseAnalyticsPlugin: CAPPlugin, CAPBridgedPlugin {
3636 public let errorConsentTypeMissing = " consentType must be provided. "
3737 public let errorConsentStatusMissing = " consentStatus must be provided. "
3838 public let errorTransactionIdMissing = " transactionId must be provided. "
39+ public let errorInvalidTransactionId = " transactionId is not a valid numeric identifier. "
40+ public let errorTransactionNotFound = " Transaction not found. "
3941 public let errorEmailAddressMissing = " emailAddress must be provided. "
4042 public let errorInvalidEmailFormat = " Invalid email format. Please provide a valid email address. "
4143 public let errorPhoneNumberMissing = " phoneNumber must be provided. "
@@ -45,7 +47,7 @@ public class FirebaseAnalyticsPlugin: CAPPlugin, CAPBridgedPlugin {
4547 private var implementation : FirebaseAnalytics ?
4648
4749 override public func load( ) {
48- implementation = FirebaseAnalytics ( )
50+ implementation = FirebaseAnalytics ( plugin : self )
4951 }
5052
5153 @objc func getAppInstanceId( _ call: CAPPluginCall ) {
@@ -132,17 +134,20 @@ public class FirebaseAnalyticsPlugin: CAPPlugin, CAPBridgedPlugin {
132134 call. reject ( errorTransactionIdMissing)
133135 return
134136 }
137+ guard let transactionIdUInt64 = UInt64 ( transactionId) else {
138+ call. reject ( errorInvalidTransactionId)
139+ return
140+ }
135141 if #available( iOS 15 . 0 , * ) {
136- Task {
137- do {
138- try await implementation? . logTransaction ( transactionId: transactionId)
142+ implementation? . logTransaction ( transactionId: transactionIdUInt64) { errorMessage in
143+ if let errorMessage = errorMessage {
144+ call. reject ( errorMessage)
145+ } else {
139146 call. resolve ( )
140- } catch {
141- call. reject ( error. localizedDescription)
142147 }
143148 }
144149 } else {
145- call. unimplemented ( " Not implemented on iOS < 15.0. " )
150+ call. unavailable ( " Not available on iOS < 15.0. " )
146151 }
147152 }
148153
0 commit comments