Skip to content

Commit

Permalink
Merge pull request #15 from UseAlloy/feature/sc-122137/ios-package-to…
Browse files Browse the repository at this point in the history
…-be-able-to-open-the-web-view

iOS package to be able to open the web-view without creating the journey Application.
  • Loading branch information
mrestuccia authored Jun 28, 2023
2 parents 334bdb0 + f59985e commit ada63fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,25 @@ import Foundation
public class JourneySettings {

public var journeyToken: String = ""
public var journeyApplicationToken: String?
public var entities: EntityData = EntityData(entities: [], additionalEntities: false)
public var production: Bool = false;
public var showDebugInfo: Bool = false
init() {}

public init(journeyToken: String, entities: EntityData, production: Bool, showDebugInfo: Bool = false) {
self.journeyToken = journeyToken
self.journeyApplicationToken = nil
self.entities = entities
self.production = production
self.showDebugInfo = showDebugInfo
}

public init(journeyToken: String, journeyApplicationToken: String? = nil, production: Bool, showDebugInfo: Bool = false) {
self.journeyToken = journeyToken
self.journeyApplicationToken = journeyApplicationToken
self.entities = EntityData(entities: [], additionalEntities: false)
self.production = production
self.showDebugInfo = showDebugInfo
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ internal struct JourneyService {
internal mutating func startJourney(journeySettings: JourneySettings, onFinish: @escaping (FinishJourneyResult?) -> Void) async throws -> StartJourneyResult? {
self.onFinish = onFinish
self.journeySettings = journeySettings
let result = try await createJourney()

if let journeyApplicationToken = journeySettings.journeyApplicationToken {
TokenHolder.tokens.journeyApplicationToken = journeyApplicationToken
}

let result = journeySettings.journeyApplicationToken == nil ? try await createJourney() : try await getStatusJourney()
if result.resultCode == .RESULT_OK, result.journeyResultData != nil {
let urlPlugin = PluginURLBuilder(
apiKey: AlloyCodelessLiteiOS.shared.alloySettings.apiKey ?? "",
Expand Down

0 comments on commit ada63fc

Please sign in to comment.