Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageAgent 업데이트 #1111

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extension ImageAgent {
let referrerDialogRequestId: String?

enum TypeInfo {
case sendImage
case sendImage(service: [String: AnyHashable]?)
}
}

Expand All @@ -46,6 +46,8 @@ extension ImageAgent.Event: Eventable {
var payload: [String: AnyHashable] {
var payload: [String: AnyHashable] = [:]
switch typeInfo {
case let .sendImage(service):
payload["service"] = service
default:
break
}
Expand Down
5 changes: 3 additions & 2 deletions NuguAgents/Sources/CapabilityAgents/Image/ImageAgent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private enum Const {
}

public class ImageAgent: ImageAgentProtocol {
public var capabilityAgentProperty: CapabilityAgentProperty = .init(category: .image, version: "1.0")
public var capabilityAgentProperty: CapabilityAgentProperty = .init(category: .image, version: "1.1")

// private
private let directiveSequencer: DirectiveSequenceable
Expand Down Expand Up @@ -74,6 +74,7 @@ public class ImageAgent: ImageAgentProtocol {
public extension ImageAgent {
@discardableResult func requestSendImage(
_ image: Data,
service: [String: AnyHashable]?,
completion: ((StreamDataState) -> Void)? = nil
) -> String {
let eventIdentifier = EventIdentifier()
Expand All @@ -88,7 +89,7 @@ public extension ImageAgent {
guard let self = self else { return }
self.upstreamDataSender.sendStream(
Event(
typeInfo: .sendImage,
typeInfo: .sendImage(service: service),
referrerDialogRequestId: nil
).makeEventMessage(
property: self.capabilityAgentProperty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ import NuguCore
public protocol ImageAgentProtocol: CapabilityAgentable {
@discardableResult func requestSendImage(
_ image: Data,
service: [String: AnyHashable]?,
completion: ((StreamDataState) -> Void)?
) -> String
}

public extension ImageAgentProtocol {
@discardableResult func requestSendImage(
_ image: Data,
completion: ((StreamDataState) -> Void)?
) -> String {
requestSendImage(image, service: nil, completion: completion)
}
}