react-native-candle 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,8 +25,8 @@ Pod::Spec.new do |s|
25
25
  spm_dependency(s,
26
26
  url: "https://github.com/candlefinance/candle-swift.git",
27
27
  requirement: {
28
- "kind": "branch",
29
- "branch": "main"
28
+ "kind": "revision",
29
+ "revision": "fa0db96e9a73740bbd4977160894a45c6db96f51"
30
30
  },
31
31
  products: ["Candle"]
32
32
  )
@@ -26,7 +26,6 @@ struct CandleLinkSheetWrapper: View {
26
26
  service: service,
27
27
  customerName: viewModel.customerName,
28
28
  cornerRadius: viewModel.cornerRadius,
29
- showSandbox: viewModel.showSandbox,
30
29
  showDynamicLoading: viewModel.showDynamicLoading,
31
30
  presentationStyle: viewModel.toCandlePresentationStyle,
32
31
  presentationBackground: viewModel.toCandlePresentationBackground
@@ -40,7 +39,7 @@ struct CandleLinkSheetWrapper: View {
40
39
  isPresented: $viewModel.showSheet,
41
40
  customerName: viewModel.customerName,
42
41
  cornerRadius: viewModel.cornerRadius,
43
- showSandbox: viewModel.showSandbox,
42
+ services: viewModel.showSandbox ? .supported + [.demo] : .supported,
44
43
  showDynamicLoading: viewModel.showDynamicLoading,
45
44
  presentationStyle: viewModel.toCandlePresentationStyle,
46
45
  presentationBackground: viewModel.toCandlePresentationBackground
@@ -48,7 +48,7 @@ final class CandleLinkViewModel: ObservableObject {
48
48
  }
49
49
  }
50
50
 
51
- var toCandleService: Candle.Models.SupportedService? {
51
+ var toCandleService: Candle.Models.Service? {
52
52
  switch service {
53
53
  case .apple:
54
54
  return .apple
@@ -58,6 +58,10 @@ final class CandleLinkViewModel: ObservableObject {
58
58
  return .demo
59
59
  case .robinhood:
60
60
  return .robinhood
61
+ case .uber:
62
+ return .uber
63
+ case .lyft:
64
+ return .lyft
61
65
  case .venmo:
62
66
  return .venmo
63
67
  case .none, .default:
@@ -1,5 +1,5 @@
1
1
  import type { HybridObject } from "react-native-nitro-modules";
2
- export type Service = "robinhood" | "cash_app" | "venmo" | "apple" | "demo" | "default";
2
+ export type Service = "robinhood" | "cash_app" | "venmo" | "apple" | "demo" | "uber" | "lyft" | "default";
3
3
  export type PresentationBackground = "default" | "blur";
4
4
  export type PresentationStyle = "sheet" | "fullScreen";
5
5
  export type ToolCall = {
@@ -1 +1 @@
1
- {"version":3,"file":"RNCandle.nitro.d.ts","sourceRoot":"","sources":["../../../../../src/specs/RNCandle.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,MAAM,OAAO,GACf,WAAW,GACX,UAAU,GACV,OAAO,GACP,OAAO,GACP,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,MAAM,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,YAAY,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,QAAS,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,CAAC;IAC9D,eAAe,CACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,OAAO,EAC3B,sBAAsB,EAAE,sBAAsB,EAC9C,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACnC,IAAI,CAAC;IACR,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,eAAe,IAAI,OAAO,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AAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C"}
@@ -1,5 +1,5 @@
1
1
  import type { HybridObject } from "react-native-nitro-modules";
2
- export type Service = "robinhood" | "cash_app" | "venmo" | "apple" | "demo" | "default";
2
+ export type Service = "robinhood" | "cash_app" | "venmo" | "apple" | "demo" | "uber" | "lyft" | "default";
3
3
  export type PresentationBackground = "default" | "blur";
4
4
  export type PresentationStyle = "sheet" | "fullScreen";
5
5
  export type ToolCall = {
@@ -1 +1 @@
1
- {"version":3,"file":"RNCandle.nitro.d.ts","sourceRoot":"","sources":["../../../../../src/specs/RNCandle.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,MAAM,OAAO,GACf,WAAW,GACX,UAAU,GACV,OAAO,GACP,OAAO,GACP,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,MAAM,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,YAAY,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,QAAS,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,CAAC;IAC9D,eAAe,CACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE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OAAO,CAAA;CAAE,CAAC;IAC9D,eAAe,CACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,OAAO,EAC3B,sBAAsB,EAAE,sBAAsB,EAC9C,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACnC,IAAI,CAAC;IACR,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C"}
@@ -15,16 +15,18 @@ public final class ReactNativeCandleAutolinking {
15
15
  * This is generated by Nitrogen and will initialize the class specified
16
16
  * in the `"autolinking"` property of `nitro.json` (in this case, `HybridRNCandle`).
17
17
  */
18
- public static func createRNCandle() -> bridge.std__shared_ptr_margelo__nitro__rncandle__HybridRNCandleSpec_ {
19
- if #available(iOS 17.0, *) {
20
- let hybridObject = HybridRNCandle()
21
- return { () -> bridge.std__shared_ptr_margelo__nitro__rncandle__HybridRNCandleSpec_ in
22
- let __cxxWrapped = hybridObject.getCxxWrapper()
23
- return __cxxWrapped.getCxxPart()
24
- }()
25
- } else {
26
- // Fallback on earlier versions
27
- fatalError("[error] Only iOS 17+ is supported.")
28
- }
18
+ public static func createRNCandle()
19
+ -> bridge.std__shared_ptr_margelo__nitro__rncandle__HybridRNCandleSpec_
20
+ {
21
+ if #available(iOS 17.0, *) {
22
+ let hybridObject = HybridRNCandle()
23
+ return { () -> bridge.std__shared_ptr_margelo__nitro__rncandle__HybridRNCandleSpec_ in
24
+ let __cxxWrapped = hybridObject.getCxxWrapper()
25
+ return __cxxWrapped.getCxxPart()
26
+ }()
27
+ } else {
28
+ // Fallback on earlier versions
29
+ fatalError("[error] Only iOS 17+ is supported.")
30
+ }
29
31
  }
30
32
  }
@@ -7,10 +7,8 @@
7
7
 
8
8
  import NitroModules
9
9
 
10
- /**
11
- * Wraps a Swift `() -> Void` as a class.
12
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
- */
10
+ /// Wraps a Swift `() -> Void` as a class.
11
+ /// This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
12
  public final class Func_void {
15
13
  public typealias bridge = margelo.nitro.rncandle.bridge.swift
16
14
 
@@ -21,7 +19,7 @@ public final class Func_void {
21
19
  }
22
20
 
23
21
  @inline(__always)
24
- public func call() -> Void {
22
+ public func call() {
25
23
  self.closure()
26
24
  }
27
25
 
@@ -7,10 +7,8 @@
7
7
 
8
8
  import NitroModules
9
9
 
10
- /**
11
- * Wraps a Swift `(_ error: Error) -> Void` as a class.
12
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
- */
10
+ /// Wraps a Swift `(_ error: Error) -> Void` as a class.
11
+ /// This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
12
  public final class Func_void_std__exception_ptr {
15
13
  public typealias bridge = margelo.nitro.rncandle.bridge.swift
16
14
 
@@ -21,7 +19,7 @@ public final class Func_void_std__exception_ptr {
21
19
  }
22
20
 
23
21
  @inline(__always)
24
- public func call(error: std.exception_ptr) -> Void {
22
+ public func call(error: std.exception_ptr) {
25
23
  self.closure(RuntimeError.from(cppError: error))
26
24
  }
27
25
 
@@ -40,7 +38,8 @@ public final class Func_void_std__exception_ptr {
40
38
  * This removes one strong reference from the object!
41
39
  */
42
40
  @inline(__always)
43
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
41
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr
42
+ {
44
43
  return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
45
44
  }
46
45
  }
@@ -7,10 +7,8 @@
7
7
 
8
8
  import NitroModules
9
9
 
10
- /**
11
- * Wraps a Swift `(_ value: String) -> Void` as a class.
12
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
- */
10
+ /// Wraps a Swift `(_ value: String) -> Void` as a class.
11
+ /// This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
12
  public final class Func_void_std__string {
15
13
  public typealias bridge = margelo.nitro.rncandle.bridge.swift
16
14
 
@@ -21,7 +19,7 @@ public final class Func_void_std__string {
21
19
  }
22
20
 
23
21
  @inline(__always)
24
- public func call(value: std.string) -> Void {
22
+ public func call(value: std.string) {
25
23
  self.closure(String(value))
26
24
  }
27
25
 
@@ -11,10 +11,12 @@ import NitroModules
11
11
  /// See ``HybridRNCandleSpec``
12
12
  public protocol HybridRNCandleSpec_protocol: HybridObject {
13
13
  // Properties
14
-
15
14
 
16
15
  // Methods
17
- func candleLinkSheet(isPresented: Bool, service: Service, cornerRadius: Double, customerName: String?, showSandbox: Bool, showDynamicLoading: Bool, presentationBackground: PresentationBackground, presentationStyle: PresentationStyle, onSuccess: @escaping (_ account: String) -> Void) throws -> Void
16
+ func candleLinkSheet(
17
+ isPresented: Bool, service: Service, cornerRadius: Double, customerName: String?,
18
+ showSandbox: Bool, showDynamicLoading: Bool, presentationBackground: PresentationBackground,
19
+ presentationStyle: PresentationStyle, onSuccess: @escaping (_ account: String) -> Void) throws
18
20
  func getLinkedAccounts() throws -> Promise<String>
19
21
  func unlinkAccount(linkedAccountID: String) throws -> Promise<Void>
20
22
  func getFiatAccounts() throws -> Promise<String>
@@ -28,11 +30,13 @@ public protocol HybridRNCandleSpec_protocol: HybridObject {
28
30
  public class HybridRNCandleSpec_base {
29
31
  private weak var cxxWrapper: HybridRNCandleSpec_cxx? = nil
30
32
  public func getCxxWrapper() -> HybridRNCandleSpec_cxx {
31
- #if DEBUG
32
- guard self is HybridRNCandleSpec else {
33
- fatalError("`self` is not a `HybridRNCandleSpec`! Did you accidentally inherit from `HybridRNCandleSpec_base` instead of `HybridRNCandleSpec`?")
34
- }
35
- #endif
33
+ #if DEBUG
34
+ guard self is HybridRNCandleSpec else {
35
+ fatalError(
36
+ "`self` is not a `HybridRNCandleSpec`! Did you accidentally inherit from `HybridRNCandleSpec_base` instead of `HybridRNCandleSpec`?"
37
+ )
38
+ }
39
+ #endif
36
40
  if let cxxWrapper = self.cxxWrapper {
37
41
  return cxxWrapper
38
42
  } else {
@@ -43,13 +47,11 @@ public class HybridRNCandleSpec_base {
43
47
  }
44
48
  }
45
49
 
46
- /**
47
- * A Swift base-protocol representing the RNCandle HybridObject.
48
- * Implement this protocol to create Swift-based instances of RNCandle.
49
- * ```swift
50
- * class HybridRNCandle : HybridRNCandleSpec {
51
- * // ...
52
- * }
53
- * ```
54
- */
50
+ /// A Swift base-protocol representing the RNCandle HybridObject.
51
+ /// Implement this protocol to create Swift-based instances of RNCandle.
52
+ /// ```swift
53
+ /// class HybridRNCandle : HybridRNCandleSpec {
54
+ /// // ...
55
+ /// }
56
+ /// ```
55
57
  public typealias HybridRNCandleSpec = HybridRNCandleSpec_protocol & HybridRNCandleSpec_base
@@ -8,15 +8,13 @@
8
8
  import Foundation
9
9
  import NitroModules
10
10
 
11
- /**
12
- * A class implementation that bridges HybridRNCandleSpec over to C++.
13
- * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
14
- *
15
- * Also, some Swift types need to be bridged with special handling:
16
- * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
17
- * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
- * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
- */
11
+ /// A class implementation that bridges HybridRNCandleSpec over to C++.
12
+ /// In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
+ ///
14
+ /// Also, some Swift types need to be bridged with special handling:
15
+ /// - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
+ /// - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
+ /// - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
20
18
  public class HybridRNCandleSpec_cxx {
21
19
  /**
22
20
  * The Swift <> C++ bridge's namespace (`margelo::nitro::rncandle::bridge::swift`)
@@ -79,14 +77,14 @@ public class HybridRNCandleSpec_cxx {
79
77
  if cachedCxxPart.__convertToBool() {
80
78
  return cachedCxxPart
81
79
  } else {
82
- let newCxxPart = bridge.create_std__shared_ptr_margelo__nitro__rncandle__HybridRNCandleSpec_(self.toUnsafe())
83
- __cxxPart = bridge.weakify_std__shared_ptr_margelo__nitro__rncandle__HybridRNCandleSpec_(newCxxPart)
80
+ let newCxxPart = bridge.create_std__shared_ptr_margelo__nitro__rncandle__HybridRNCandleSpec_(
81
+ self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_margelo__nitro__rncandle__HybridRNCandleSpec_(
83
+ newCxxPart)
84
84
  return newCxxPart
85
85
  }
86
86
  }
87
87
 
88
-
89
-
90
88
  /**
91
89
  * Get the memory size of the Swift class (plus size of any other allocations)
92
90
  * so the JS VM can properly track it and garbage-collect the JS object if needed.
@@ -97,31 +95,41 @@ public class HybridRNCandleSpec_cxx {
97
95
  }
98
96
 
99
97
  // Properties
100
-
101
98
 
102
99
  // Methods
103
100
  @inline(__always)
104
- public final func candleLinkSheet(isPresented: Bool, service: Int32, cornerRadius: Double, customerName: bridge.std__optional_std__string_, showSandbox: Bool, showDynamicLoading: Bool, presentationBackground: Int32, presentationStyle: Int32, onSuccess: bridge.Func_void_std__string) -> bridge.Result_void_ {
101
+ public final func candleLinkSheet(
102
+ isPresented: Bool, service: Int32, cornerRadius: Double,
103
+ customerName: bridge.std__optional_std__string_, showSandbox: Bool, showDynamicLoading: Bool,
104
+ presentationBackground: Int32, presentationStyle: Int32, onSuccess: bridge.Func_void_std__string
105
+ ) -> bridge.Result_void_ {
105
106
  do {
106
- try self.__implementation.candleLinkSheet(isPresented: isPresented, service: margelo.nitro.rncandle.Service(rawValue: service)!, cornerRadius: cornerRadius, customerName: { () -> String? in
107
- if let __unwrapped = customerName.value {
108
- return String(__unwrapped)
109
- } else {
110
- return nil
111
- }
112
- }(), showSandbox: showSandbox, showDynamicLoading: showDynamicLoading, presentationBackground: margelo.nitro.rncandle.PresentationBackground(rawValue: presentationBackground)!, presentationStyle: margelo.nitro.rncandle.PresentationStyle(rawValue: presentationStyle)!, onSuccess: { () -> (String) -> Void in
113
- let __wrappedFunction = bridge.wrap_Func_void_std__string(onSuccess)
114
- return { (__account: String) -> Void in
115
- __wrappedFunction.call(std.string(__account))
116
- }
117
- }())
107
+ try self.__implementation.candleLinkSheet(
108
+ isPresented: isPresented, service: margelo.nitro.rncandle.Service(rawValue: service)!,
109
+ cornerRadius: cornerRadius,
110
+ customerName: { () -> String? in
111
+ if let __unwrapped = customerName.value {
112
+ return String(__unwrapped)
113
+ } else {
114
+ return nil
115
+ }
116
+ }(), showSandbox: showSandbox, showDynamicLoading: showDynamicLoading,
117
+ presentationBackground: margelo.nitro.rncandle.PresentationBackground(
118
+ rawValue: presentationBackground)!,
119
+ presentationStyle: margelo.nitro.rncandle.PresentationStyle(rawValue: presentationStyle)!,
120
+ onSuccess: { () -> (String) -> Void in
121
+ let __wrappedFunction = bridge.wrap_Func_void_std__string(onSuccess)
122
+ return { (__account: String) -> Void in
123
+ __wrappedFunction.call(std.string(__account))
124
+ }
125
+ }())
118
126
  return bridge.create_Result_void_()
119
127
  } catch (let __error) {
120
128
  let __exceptionPtr = __error.toCpp()
121
129
  return bridge.create_Result_void_(__exceptionPtr)
122
130
  }
123
131
  }
124
-
132
+
125
133
  @inline(__always)
126
134
  public final func getLinkedAccounts() -> bridge.Result_std__shared_ptr_Promise_std__string___ {
127
135
  do {
@@ -140,11 +148,14 @@ public class HybridRNCandleSpec_cxx {
140
148
  return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
141
149
  }
142
150
  }
143
-
151
+
144
152
  @inline(__always)
145
- public final func unlinkAccount(linkedAccountID: std.string) -> bridge.Result_std__shared_ptr_Promise_void___ {
153
+ public final func unlinkAccount(linkedAccountID: std.string)
154
+ -> bridge.Result_std__shared_ptr_Promise_void___
155
+ {
146
156
  do {
147
- let __result = try self.__implementation.unlinkAccount(linkedAccountID: String(linkedAccountID))
157
+ let __result = try self.__implementation.unlinkAccount(
158
+ linkedAccountID: String(linkedAccountID))
148
159
  let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
149
160
  let __promise = bridge.create_std__shared_ptr_Promise_void__()
150
161
  let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
@@ -159,7 +170,7 @@ public class HybridRNCandleSpec_cxx {
159
170
  return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
160
171
  }
161
172
  }
162
-
173
+
163
174
  @inline(__always)
164
175
  public final func getFiatAccounts() -> bridge.Result_std__shared_ptr_Promise_std__string___ {
165
176
  do {
@@ -178,17 +189,20 @@ public class HybridRNCandleSpec_cxx {
178
189
  return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
179
190
  }
180
191
  }
181
-
192
+
182
193
  @inline(__always)
183
- public final func getActivity(span: bridge.std__optional_std__string_) -> bridge.Result_std__shared_ptr_Promise_std__string___ {
194
+ public final func getActivity(span: bridge.std__optional_std__string_)
195
+ -> bridge.Result_std__shared_ptr_Promise_std__string___
196
+ {
184
197
  do {
185
- let __result = try self.__implementation.getActivity(span: { () -> String? in
186
- if let __unwrapped = span.value {
187
- return String(__unwrapped)
188
- } else {
189
- return nil
190
- }
191
- }())
198
+ let __result = try self.__implementation.getActivity(
199
+ span: { () -> String? in
200
+ if let __unwrapped = span.value {
201
+ return String(__unwrapped)
202
+ } else {
203
+ return nil
204
+ }
205
+ }())
192
206
  let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
193
207
  let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
194
208
  let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
@@ -203,7 +217,7 @@ public class HybridRNCandleSpec_cxx {
203
217
  return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
204
218
  }
205
219
  }
206
-
220
+
207
221
  @inline(__always)
208
222
  public final func deleteUser() -> bridge.Result_std__shared_ptr_Promise_void___ {
209
223
  do {
@@ -222,7 +236,7 @@ public class HybridRNCandleSpec_cxx {
222
236
  return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
223
237
  }
224
238
  }
225
-
239
+
226
240
  @inline(__always)
227
241
  public final func getAvailableTools() -> bridge.Result_std__shared_ptr_Promise_std__string___ {
228
242
  do {
@@ -241,9 +255,11 @@ public class HybridRNCandleSpec_cxx {
241
255
  return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
242
256
  }
243
257
  }
244
-
258
+
245
259
  @inline(__always)
246
- public final func executeTool(tool: ToolCall) -> bridge.Result_std__shared_ptr_Promise_std__string___ {
260
+ public final func executeTool(tool: ToolCall)
261
+ -> bridge.Result_std__shared_ptr_Promise_std__string___
262
+ {
247
263
  do {
248
264
  let __result = try self.__implementation.executeTool(tool: tool)
249
265
  let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
@@ -5,36 +5,34 @@
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- /**
9
- * Represents the JS union `PresentationBackground`, backed by a C++ enum.
10
- */
8
+ /// Represents the JS union `PresentationBackground`, backed by a C++ enum.
11
9
  public typealias PresentationBackground = margelo.nitro.rncandle.PresentationBackground
12
10
 
13
- public extension PresentationBackground {
11
+ extension PresentationBackground {
14
12
  /**
15
13
  * Get a PresentationBackground for the given String value, or
16
14
  * return `nil` if the given value was invalid/unknown.
17
15
  */
18
- init?(fromString string: String) {
16
+ public init?(fromString string: String) {
19
17
  switch string {
20
- case "default":
21
- self = .default
22
- case "blur":
23
- self = .blur
24
- default:
25
- return nil
18
+ case "default":
19
+ self = .default
20
+ case "blur":
21
+ self = .blur
22
+ default:
23
+ return nil
26
24
  }
27
25
  }
28
26
 
29
27
  /**
30
28
  * Get the String value this PresentationBackground represents.
31
29
  */
32
- var stringValue: String {
30
+ public var stringValue: String {
33
31
  switch self {
34
- case .default:
35
- return "default"
36
- case .blur:
37
- return "blur"
32
+ case .default:
33
+ return "default"
34
+ case .blur:
35
+ return "blur"
38
36
  }
39
37
  }
40
38
  }
@@ -5,36 +5,34 @@
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- /**
9
- * Represents the JS union `PresentationStyle`, backed by a C++ enum.
10
- */
8
+ /// Represents the JS union `PresentationStyle`, backed by a C++ enum.
11
9
  public typealias PresentationStyle = margelo.nitro.rncandle.PresentationStyle
12
10
 
13
- public extension PresentationStyle {
11
+ extension PresentationStyle {
14
12
  /**
15
13
  * Get a PresentationStyle for the given String value, or
16
14
  * return `nil` if the given value was invalid/unknown.
17
15
  */
18
- init?(fromString string: String) {
16
+ public init?(fromString string: String) {
19
17
  switch string {
20
- case "sheet":
21
- self = .sheet
22
- case "fullScreen":
23
- self = .fullscreen
24
- default:
25
- return nil
18
+ case "sheet":
19
+ self = .sheet
20
+ case "fullScreen":
21
+ self = .fullscreen
22
+ default:
23
+ return nil
26
24
  }
27
25
  }
28
26
 
29
27
  /**
30
28
  * Get the String value this PresentationStyle represents.
31
29
  */
32
- var stringValue: String {
30
+ public var stringValue: String {
33
31
  switch self {
34
- case .sheet:
35
- return "sheet"
36
- case .fullscreen:
37
- return "fullScreen"
32
+ case .sheet:
33
+ return "sheet"
34
+ case .fullscreen:
35
+ return "fullScreen"
38
36
  }
39
37
  }
40
38
  }
@@ -5,52 +5,58 @@
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- /**
9
- * Represents the JS union `Service`, backed by a C++ enum.
10
- */
8
+ /// Represents the JS union `Service`, backed by a C++ enum.
11
9
  public typealias Service = margelo.nitro.rncandle.Service
12
10
 
13
- public extension Service {
11
+ extension Service {
14
12
  /**
15
13
  * Get a Service for the given String value, or
16
14
  * return `nil` if the given value was invalid/unknown.
17
15
  */
18
- init?(fromString string: String) {
16
+ public init?(fromString string: String) {
19
17
  switch string {
20
- case "robinhood":
21
- self = .robinhood
22
- case "cash_app":
23
- self = .cashApp
24
- case "venmo":
25
- self = .venmo
26
- case "apple":
27
- self = .apple
28
- case "demo":
29
- self = .demo
30
- case "default":
31
- self = .default
32
- default:
33
- return nil
18
+ case "robinhood":
19
+ self = .robinhood
20
+ case "cash_app":
21
+ self = .cashApp
22
+ case "venmo":
23
+ self = .venmo
24
+ case "apple":
25
+ self = .apple
26
+ case "demo":
27
+ self = .demo
28
+ case "uber":
29
+ self = .uber
30
+ case "lyft":
31
+ self = .lyft
32
+ case "default":
33
+ self = .default
34
+ default:
35
+ return nil
34
36
  }
35
37
  }
36
38
 
37
39
  /**
38
40
  * Get the String value this Service represents.
39
41
  */
40
- var stringValue: String {
42
+ public var stringValue: String {
41
43
  switch self {
42
- case .robinhood:
43
- return "robinhood"
44
- case .cashApp:
45
- return "cash_app"
46
- case .venmo:
47
- return "venmo"
48
- case .apple:
49
- return "apple"
50
- case .demo:
51
- return "demo"
52
- case .default:
53
- return "default"
44
+ case .robinhood:
45
+ return "robinhood"
46
+ case .cashApp:
47
+ return "cash_app"
48
+ case .venmo:
49
+ return "venmo"
50
+ case .apple:
51
+ return "apple"
52
+ case .demo:
53
+ return "demo"
54
+ case .uber:
55
+ return "uber"
56
+ case .lyft:
57
+ return "lyft"
58
+ case .default:
59
+ return "default"
54
60
  }
55
61
  }
56
62
  }
@@ -7,22 +7,20 @@
7
7
 
8
8
  import NitroModules
9
9
 
10
- /**
11
- * Represents an instance of `ToolCall`, backed by a C++ struct.
12
- */
10
+ /// Represents an instance of `ToolCall`, backed by a C++ struct.
13
11
  public typealias ToolCall = margelo.nitro.rncandle.ToolCall
14
12
 
15
- public extension ToolCall {
13
+ extension ToolCall {
16
14
  private typealias bridge = margelo.nitro.rncandle.bridge.swift
17
15
 
18
16
  /**
19
17
  * Create a new instance of `ToolCall`.
20
18
  */
21
- init(name: String, arguments: String) {
19
+ public init(name: String, arguments: String) {
22
20
  self.init(std.string(name), std.string(arguments))
23
21
  }
24
22
 
25
- var name: String {
23
+ public var name: String {
26
24
  @inline(__always)
27
25
  get {
28
26
  return String(self.__name)
@@ -32,8 +30,8 @@ public extension ToolCall {
32
30
  self.__name = std.string(newValue)
33
31
  }
34
32
  }
35
-
36
- var arguments: String {
33
+
34
+ public var arguments: String {
37
35
  @inline(__always)
38
36
  get {
39
37
  return String(self.__arguments)
@@ -34,7 +34,9 @@ namespace margelo::nitro::rncandle {
34
34
  VENMO SWIFT_NAME(venmo) = 2,
35
35
  APPLE SWIFT_NAME(apple) = 3,
36
36
  DEMO SWIFT_NAME(demo) = 4,
37
- DEFAULT SWIFT_NAME(default) = 5,
37
+ UBER SWIFT_NAME(uber) = 5,
38
+ LYFT SWIFT_NAME(lyft) = 6,
39
+ DEFAULT SWIFT_NAME(default) = 7,
38
40
  } CLOSED_ENUM;
39
41
 
40
42
  } // namespace margelo::nitro::rncandle
@@ -54,6 +56,8 @@ namespace margelo::nitro {
54
56
  case hashString("venmo"): return Service::VENMO;
55
57
  case hashString("apple"): return Service::APPLE;
56
58
  case hashString("demo"): return Service::DEMO;
59
+ case hashString("uber"): return Service::UBER;
60
+ case hashString("lyft"): return Service::LYFT;
57
61
  case hashString("default"): return Service::DEFAULT;
58
62
  default: [[unlikely]]
59
63
  throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum Service - invalid value!");
@@ -66,6 +70,8 @@ namespace margelo::nitro {
66
70
  case Service::VENMO: return JSIConverter<std::string>::toJSI(runtime, "venmo");
67
71
  case Service::APPLE: return JSIConverter<std::string>::toJSI(runtime, "apple");
68
72
  case Service::DEMO: return JSIConverter<std::string>::toJSI(runtime, "demo");
73
+ case Service::UBER: return JSIConverter<std::string>::toJSI(runtime, "uber");
74
+ case Service::LYFT: return JSIConverter<std::string>::toJSI(runtime, "lyft");
69
75
  case Service::DEFAULT: return JSIConverter<std::string>::toJSI(runtime, "default");
70
76
  default: [[unlikely]]
71
77
  throw std::invalid_argument("Cannot convert Service to JS - invalid value: "
@@ -83,6 +89,8 @@ namespace margelo::nitro {
83
89
  case hashString("venmo"):
84
90
  case hashString("apple"):
85
91
  case hashString("demo"):
92
+ case hashString("uber"):
93
+ case hashString("lyft"):
86
94
  case hashString("default"):
87
95
  return true;
88
96
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-candle",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Candle SDK for React Native",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -1,46 +1,113 @@
1
- const { withDangerousMod } = require("@expo/config-plugins");
1
+ const {
2
+ withDangerousMod,
3
+ withXcodeProject,
4
+ withPlugins,
5
+ } = require("@expo/config-plugins");
2
6
  const {
3
7
  mergeContents,
4
8
  } = require("@expo/config-plugins/build/utils/generateCode");
5
9
  const fs = require("fs");
6
10
  const path = require("path");
7
11
 
8
- const withIosDeploymentTarget = (config) => {
9
- return withDangerousMod(config, [
10
- "ios",
11
- async (config) => {
12
- // Find the Podfile
13
- const podfile = path.join(
14
- config.modRequest.platformProjectRoot,
15
- "Podfile"
16
- );
17
- // Read the Podfile
18
- const podfileContents = fs.readFileSync(podfile, "utf8");
19
- // Merge the contents of the Podfile with the new content setting
20
- // the deployment target of all targets to 17.0
21
- const setDeploymentTarget = mergeContents({
22
- tag: "ios-deployment-target",
23
- src: podfileContents,
24
- newSrc: ` installer.pods_project.targets.each do |target|
12
+ const plugin = (config, options = {}) => {
13
+ return withPlugins(config, [
14
+ [
15
+ withDangerousMod,
16
+ [
17
+ "ios",
18
+ async (config) => {
19
+ return withIosDeploymentTarget(config);
20
+ },
21
+ ],
22
+ ],
23
+ [
24
+ withXcodeProject,
25
+ async (config) => {
26
+ return withMyCustomBuildPhase(config);
27
+ },
28
+ ],
29
+ ]);
30
+ };
31
+
32
+ // This function sets the iOS deployment target to 17.0
33
+ const withIosDeploymentTarget = async (config) => {
34
+ // Find the Podfile
35
+ const podfile = path.join(config.modRequest.platformProjectRoot, "Podfile");
36
+ // Read the Podfile
37
+ const podfileContents = fs.readFileSync(podfile, "utf8");
38
+ // Merge the contents of the Podfile with the new content setting
39
+ // the deployment target of all targets to 17.0
40
+ const setDeploymentTarget = mergeContents({
41
+ tag: "ios-deployment-target",
42
+ src: podfileContents,
43
+ newSrc: ` installer.pods_project.targets.each do |target|
25
44
  target.build_configurations.each do |config|
26
45
  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '17.0'
27
46
  end
28
47
  end`,
29
- anchor: /post_install do \|installer\|/i,
30
- offset: 1,
31
- comment: "#",
32
- });
48
+ anchor: /post_install do \|installer\|/i,
49
+ offset: 1,
50
+ comment: "#",
51
+ });
33
52
 
34
- if (!setDeploymentTarget.didMerge) {
35
- console.log("Failed to set iOS deployment target");
36
- return config;
37
- }
53
+ if (!setDeploymentTarget.didMerge) {
54
+ console.log("Failed to set iOS deployment target");
55
+ return config;
56
+ }
38
57
 
39
- fs.writeFileSync(podfile, setDeploymentTarget.contents);
58
+ const setPreInstallHook = mergeContents({
59
+ tag: "rnreanimated-preinstall",
60
+ src: setDeploymentTarget.contents,
61
+ newSrc: ` pre_install do |installer|
62
+ installer.pod_targets.each do |pod|
63
+ if pod.name.eql?('RNReanimated')
64
+ def pod.build_type;
65
+ # This is a workaround for the issue with the dynamic library
66
+ Pod::BuildType.static_library;
67
+ end
68
+ end
69
+ end
70
+ end`,
71
+ anchor: /post_install do \|installer\|/i,
72
+ offset: 0,
73
+ comment: "#",
74
+ });
40
75
 
41
- return config;
42
- },
43
- ]);
76
+ if (!setPreInstallHook.didMerge) {
77
+ console.log("Failed to insert RNReanimated pre_install hook");
78
+ return config;
79
+ }
80
+
81
+ fs.writeFileSync(podfile, setPreInstallHook.contents);
82
+
83
+ return config;
84
+ };
85
+
86
+ // This function adds a custom build phase to the Xcode project
87
+ // that removes signature files from the build directory
88
+ // for Xcode 15 and 16. This is a workaround for a known issue
89
+ // with these versions of Xcode.
90
+ // I think it's because of the duplicate symbol issue.
91
+ const withMyCustomBuildPhase = async (config) => {
92
+ const xcodeProject = config.modResults;
93
+ const shellScript = `if { [ "$XCODE_VERSION_MAJOR" = "1500" ] || [ "$XCODE_VERSION_MAJOR" = "1600" ]; } && [ "$CONFIGURATION" = "Release" ]; then
94
+ echo "Remove signature files (Xcode 15/16 workaround, only in Release)"
95
+ find "$BUILD_DIR/\${CONFIGURATION}-iphoneos" -name "*.signature" -type f | xargs -r rm
96
+ fi`;
97
+
98
+ xcodeProject.addBuildPhase(
99
+ [],
100
+ "PBXShellScriptBuildPhase",
101
+ "Remove Framework signature files (Xcode 15/16 workaround)",
102
+ null,
103
+ {
104
+ shellPath: "/bin/sh",
105
+ shellScript,
106
+ runOnlyForDeploymentPostprocessing: 1,
107
+ }
108
+ );
109
+
110
+ return config;
44
111
  };
45
112
 
46
- module.exports = withIosDeploymentTarget;
113
+ module.exports = plugin;
@@ -6,6 +6,8 @@ export type Service =
6
6
  | "venmo"
7
7
  | "apple"
8
8
  | "demo"
9
+ | "uber"
10
+ | "lyft"
9
11
  | "default";
10
12
 
11
13
  export type PresentationBackground = "default" | "blur";