Commit f151e1e5 authored by  Joel  Oksanen's avatar Joel Oksanen
Browse files

Renamed Features to Arguments

parent 45e4d866
......@@ -25,7 +25,8 @@
9449FE432403F02500025F70 /* MessageBubble.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9449FE422403F02500025F70 /* MessageBubble.swift */; };
9449FE452403F0A600025F70 /* Sender.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9449FE442403F0A600025F70 /* Sender.swift */; };
9449FE4924042D6500025F70 /* FeatureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9449FE4824042D6500025F70 /* FeatureView.swift */; };
9449FE4B24042E8800025F70 /* Feature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9449FE4A24042E8800025F70 /* Feature.swift */; };
9449FE4B24042E8800025F70 /* Argument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9449FE4A24042E8800025F70 /* Argument.swift */; };
9449FE4D2404561400025F70 /* ArgumentQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9449FE4C2404561400025F70 /* ArgumentQuery.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -49,7 +50,8 @@
9449FE422403F02500025F70 /* MessageBubble.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageBubble.swift; sourceTree = "<group>"; };
9449FE442403F0A600025F70 /* Sender.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sender.swift; sourceTree = "<group>"; };
9449FE4824042D6500025F70 /* FeatureView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureView.swift; sourceTree = "<group>"; };
9449FE4A24042E8800025F70 /* Feature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Feature.swift; sourceTree = "<group>"; };
9449FE4A24042E8800025F70 /* Argument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Argument.swift; sourceTree = "<group>"; };
9449FE4C2404561400025F70 /* ArgumentQuery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgumentQuery.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -110,7 +112,8 @@
9449FE442403F0A600025F70 /* Sender.swift */,
9449FE382403E9A400025F70 /* Message.swift */,
9449FE3A2403EC3800025F70 /* ADAMessage.swift */,
9449FE4A24042E8800025F70 /* Feature.swift */,
9449FE4A24042E8800025F70 /* Argument.swift */,
9449FE4C2404561400025F70 /* ArgumentQuery.swift */,
9449FE3C2403ED0200025F70 /* UserMessage.swift */,
9449FE302402C90800025F70 /* ChatView.swift */,
9449FE402403EF5A00025F70 /* MessageView.swift */,
......@@ -206,12 +209,13 @@
9449FE3B2403EC3800025F70 /* ADAMessage.swift in Sources */,
9449FE3D2403ED0200025F70 /* UserMessage.swift in Sources */,
9449FE2F2402C8C500025F70 /* ProductView.swift in Sources */,
9449FE4B24042E8800025F70 /* Feature.swift in Sources */,
9449FE4B24042E8800025F70 /* Argument.swift in Sources */,
9449FE372402D29E00025F70 /* Product.swift in Sources */,
9449FE432403F02500025F70 /* MessageBubble.swift in Sources */,
9449FE1B2402C84F00025F70 /* AppDelegate.swift in Sources */,
9449FE392403E9A400025F70 /* Message.swift in Sources */,
9449FE452403F0A600025F70 /* Sender.swift in Sources */,
9449FE4D2404561400025F70 /* ArgumentQuery.swift in Sources */,
9449FE4924042D6500025F70 /* FeatureView.swift in Sources */,
9449FE312402C90800025F70 /* ChatView.swift in Sources */,
9449FE352402CCDA00025F70 /* ConnectionManager.swift in Sources */,
......
......@@ -13,6 +13,6 @@ struct ADAMessage: Message, Decodable {
let id = UUID()
let sender = Sender.ADA
let text: String
let features: [Feature]
let arguments: [Argument]
}
......@@ -8,9 +8,10 @@
import UIKit
struct Feature: Decodable {
struct Argument: Codable {
let id = UUID()
let name: String
let queries = [ArgumentQuery]()
}
//
// FeatureResponse.swift
// ADAbot
//
// Created by Joel Oksanen on 24.2.2020.
// Copyright © 2020 Joel Oksanen. All rights reserved.
//
import UIKit
struct ArgumentQuery: Codable {
let argumentID: Int
let queryID: Int
let text: String
}
......@@ -22,7 +22,7 @@ struct ChatView: View {
MessageView(message: message)
.padding(EdgeInsets(top: 0, leading: 20, bottom: 15, trailing: 20))
}
FeatureView(features: connectionManager.messages.last!.features)
FeatureView(arguments: connectionManager.messages.last!.arguments)
.padding(EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 0))
}
.padding(EdgeInsets(top: 30, leading: 0, bottom: 30, trailing: 0))
......
......@@ -10,7 +10,7 @@ import SwiftUI
struct FeatureView: View {
let features: [Feature]
let arguments: [Argument]
let bubbleColor = Color(red: 75/255, green: 90/255, blue: 116/255)
var body: some View {
......@@ -19,7 +19,7 @@ struct FeatureView: View {
Text("ASK ABOUT")
.foregroundColor(self.bubbleColor)
.font(Font.custom("Gill Sans", size: 10))
.font(Font.custom("Gill Sans", size: 11))
.fixedSize(horizontal: true, vertical: false)
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 10))
......@@ -31,8 +31,8 @@ struct FeatureView: View {
HStack(spacing: 0) {
Spacer()
.frame(width: 10)
ForEach(self.features, id: \.id) { feature in
Text(feature.name)
ForEach(self.arguments, id: \.id) { argument in
Text(argument.name)
.foregroundColor(Color.white)
.font(Font.custom("Helvetica Neue", size: 12))
.fixedSize(horizontal: true, vertical: true)
......@@ -44,7 +44,7 @@ struct FeatureView: View {
.frame(width: 10)
}
}
.frame(maxWidth: 250)
.frame(maxWidth: 280)
.fixedSize(horizontal: true, vertical: false)
.zIndex(-1)
}
......
......@@ -13,6 +13,6 @@ protocol Message {
var id: UUID { get }
var sender: Sender { get }
var text: String { get }
var features: [Feature] { get }
var arguments: [Argument] { get }
}
......@@ -13,6 +13,6 @@ struct UserMessage: Message {
let id = UUID()
let sender = Sender.USER
let text: String
let features = [Feature]()
let arguments = [Argument]()
}
......@@ -11,7 +11,7 @@ import SwiftUI
class ConnectionManager: ObservableObject {
@Published var product = Product()
@Published var messages: [Message] = [UserMessage(text: "Why was the camera highly rated?"),
ADAMessage(text: "The camera was highly rated because the lens was good, although the battery was poor.", features: [Feature(name: "camera"), Feature(name: "lens")])]
ADAMessage(text: "The camera was highly rated because the lens was good, although the battery was poor.", arguments: [Argument(name: "camera"), Argument(name: "lens"), Argument(name: "battery")])]
init() {
requestProduct(id: "B00RTGK0N0")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment