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

Implemented Categories #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Implemented Categories #18

wants to merge 2 commits into from

Conversation

max-simon
Copy link

Categories help you to get your communication specified by talking
about a global category. Change a category easy with a Message.type and
define which categories you can deal with.

Important: please add a default case to your switch-Statements when asking for the Message-type (this will not be executed :))

How to Work with Topics?
If you want to create a topic go to Chatter.swift and add the Topic in the enum (with Description!)
In the initializer of your chatter give possibleTopics a list of toppings your chatter want to talk about. (by default none)
If you want to give individual answers for a ask to change the topic you can write them to sayNoToTopicChangeWith and sayYesToTopicChangeWith
You can create your own Question to ask someone to change the topic. The Last word is computed and is the name of the topic.
Now in your functions nextMessage() and responseForMessage you can ask the variable theCurrentTopic which Toping is now. With this you can adjust your answers to the topic.

max-simon added 2 commits April 27, 2016 23:12
Categories help you to get your communication specified by talking
about a global category. Change a category easy with a Message.type and
define which categories you can deal with.
@nilsvu
Copy link
Member

nilsvu commented Apr 29, 2016

Hi Max, erstmal super coole Idee mit den Topics, so etwas sollte echt in der App drin sein 👍

2/2 Pt. schonmal 💯

Damit ich das mergen kann darf es jedoch keine Auswirkungen auf die anderen Subklassen haben sondern "opt-in" sein. Ein weiterer MessageType Fall ist deshalb schwierig, wie wärs also damit:

  • Wir führen ein neues optionales Attribut proposedTopi�c: Topic? in Message ein das ein Chatter setzen kann oder eben auch nicht.
  • Das aktuelle Topic sollte am besten zusammen mit den beiden Chattern in einem Conversation Struct zusammengefasst werden. Das kann ich bei Gelegenheit mal einbauen, doch erstmal ist die Variable im ViewController am besten aufgehoben.
  • Diese askForTopicChange Mechanik finde ich recht aufwendig, ich glaube das proposedTopic in Message reicht. Die Conversation (bzw. bisher der ViewController) wechselt dann immer das topic aber der Empfänger kann ja drauf reagieren und es wieder ändern.

Du kannst das gern implementieren, sonst mach ich das mal bei Gelegenheit. Funktioniert mit Einstein und Newton jedenfalls schon top 👌

// Implementation of Topics
enum Topic : String {
case none = "none", Science = "Science", Apples = "Apples", Relativity = "Relativity", Physics = "Physics" // Add Topics here
var description: String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die rawValues brauchst du nicht, Topic muss nicht von String ableiten denke ich.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants