Skip to content

Commit 7501803

Browse files
author
crow
committed
Deprecate takeOff calls with launch options in proxy interface
1 parent c5ff3c2 commit 7501803

1 file changed

Lines changed: 29 additions & 4 deletions

File tree

ios/AirshipFrameworkProxy/Proxies/AirshipProxy.swift

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public final class AirshipProxy: Sendable {
125125

126126
}
127127

128-
128+
@available(*, deprecated, message: "Use AirshipProxy.takeOff(json:) instead")
129129
@MainActor
130130
public func takeOff(
131131
json: Any,
@@ -136,10 +136,22 @@ public final class AirshipProxy: Sendable {
136136
from: try AirshipJSONUtils.data(json)
137137
)
138138

139-
return try takeOff(config: proxyConfig, launchOptions: launchOptions)
139+
return try takeOff(config: proxyConfig)
140+
}
140141

142+
@MainActor
143+
public func takeOff(
144+
json: Any
145+
) throws -> Bool {
146+
let proxyConfig = try JSONDecoder().decode(
147+
ProxyConfig.self,
148+
from: try AirshipJSONUtils.data(json)
149+
)
150+
151+
return try takeOff(config: proxyConfig)
141152
}
142153

154+
@available(*, deprecated, message: "Use AirshipProxy.takeOff(config:) instead")
143155
@MainActor
144156
public func takeOff(
145157
config: ProxyConfig,
@@ -150,6 +162,15 @@ public final class AirshipProxy: Sendable {
150162
return Airship.isFlying
151163
}
152164

165+
@MainActor
166+
public func takeOff(
167+
config: ProxyConfig
168+
) throws -> Bool {
169+
self.proxyStore.config = config
170+
try? attemptTakeOff()
171+
return Airship.isFlying
172+
}
173+
153174
@objc
154175
public func isFlying(
155176
) -> Bool {
@@ -162,10 +183,16 @@ public final class AirshipProxy: Sendable {
162183
}
163184
}
164185

186+
@available(*, deprecated, message: "Use AirshipProxy.attemptTakeOff(_:) instead")
165187
@MainActor
166188
public func attemptTakeOff(
167189
launchOptions: [UIApplication.LaunchOptionsKey: Any]?
168190
) throws {
191+
try attemptTakeOff()
192+
}
193+
194+
@MainActor
195+
public func attemptTakeOff() throws {
169196
guard !Airship.isFlying else {
170197
return;
171198
}
@@ -175,8 +202,6 @@ public final class AirshipProxy: Sendable {
175202
migrateCalled = true
176203
}
177204

178-
AirshipLogger.debug("attemptTakeOff: \(String(describing: launchOptions))")
179-
180205
let airshipConfig = makeConfig()
181206

182207
self.airshipDelegate = AirshipDelegate(proxyStore: proxyStore)

0 commit comments

Comments
 (0)