Skip to content

Commit

Permalink
updated sensitiveMetaFields
Browse files Browse the repository at this point in the history
  • Loading branch information
lujcheng committed Mar 17, 2022
1 parent f35a418 commit 5342cda
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions EmbedFramework/AdaWebHost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public class AdaWebHost: NSObject {
self.evalJS(toRun)
}

/// Override method using builder class
public func setMetaFields(builder: MetaFields.Builder) {
let metaFields = builder.build().metaFields
guard let json = try? JSONSerialization.data(withJSONObject: metaFields, options: []),
Expand All @@ -168,6 +169,15 @@ public class AdaWebHost: NSObject {
self.evalJS(toRun)
}

public func setSensitiveMetaFields(builder: MetaFields.Builder) {
let metaFields = builder.build().metaFields
guard let json = try? JSONSerialization.data(withJSONObject: metaFields, options: []),
let jsonString = String(data: json, encoding: .utf8) else { return }
let toRun = "adaEmbed.setSensitiveMetaFields(\(jsonString));"

self.evalJS(toRun)
}

/// Re-initialize chat and optionally reset history, language, meta data, etc
public func reset(language: String? = nil, greeting: String? = nil, metaFields: [String: Any]? = nil, sensitiveMetaFields: [String: Any]? = nil, resetChatHistory: Bool? = true) {

Expand Down

0 comments on commit 5342cda

Please sign in to comment.