GithubHelp home page GithubHelp logo

richlogan / ciscospark-unitysdk Goto Github PK

View Code? Open in Web Editor NEW
12.0 7.0 1.0 800 KB

Native Unity SDK for Cisco Spark

Home Page: http://richlogan.co.uk/CiscoSpark-UnitySDK/

License: Apache License 2.0

C# 100.00%
cisco-spark unity sdk

ciscospark-unitysdk's People

Contributors

richlogan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

glhewett

ciscospark-unitysdk's Issues

`OverflowException` on empty auth token

Actually 2 things here:

  • Need to handle empty messages in general
  • Need to check for 403 per #16
OverflowException: Value is greater than Char.MaxValue or less than Char.MinValue
System.Convert.ToChar (Int32 value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Convert.cs:624)
MiniJSON.Json+Parser.get_PeekChar () (at Assets/Cisco/Spark/Plugins/MiniJSON.cs:316)
MiniJSON.Json+Parser.EatWhitespace () (at Assets/Cisco/Spark/Plugins/MiniJSON.cs:305)
MiniJSON.Json+Parser.get_NextToken () (at Assets/Cisco/Spark/Plugins/MiniJSON.cs:344)
MiniJSON.Json+Parser.ParseValue () (at Assets/Cisco/Spark/Plugins/MiniJSON.cs:197)
MiniJSON.Json+Parser.Parse (System.String jsonString) (at Assets/Cisco/Spark/Plugins/MiniJSON.cs:121)
MiniJSON.Json.Deserialize (System.String json) (at Assets/Cisco/Spark/Plugins/MiniJSON.cs:88)
Cisco.Spark.Request+<GetRecord>c__Iterator0.MoveNext () (at Assets/Cisco/Spark/Request.cs:101)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

TearDown for tests

Not running if they fail, need to move Pass out and have it run after TearDown like in the Team tests.

Update Tests for 5.6 TestRunner

Test Runner is now built into Unity and the Unity Test Tools are deprecated. However, tests need to change as IntegrationTest no longer exists. Hopefully just a straightforward swap to Assert.Fail().

Change Request instantiation/setup

Originally, I thought doing Request setup on Awake made sense as it would mean it was done as quickly as possible. However, I realize now that Awake runs even if the script is disabled. This can cause a problem in the following situation:

  1. Request disabled at Start time with no token set.
  2. AuthToken is set.
  3. Request is enabled and expected to work.

You would expect setup to run at 3, but instead it'll happen at/before 1. This will cause an Exception to be raised as AuthToken is empty. I was going to propose a public Setup method that would be explicitly called before making requests, but I think just moving Awake->Start makes more sense as enabled would probably be expected to do this.

Fix Duplication

There is a tonne of duplication that should be removed maybe via a SparkObject parent giving implementations of:

  • Commit
  • Delete
  • List
  • GetDetails

as they are all the same except resource name and fields.

Separate Example Project and SDK

  1. SDK should just be the Spark/ folder
  2. Example project can be separate repository
  3. SDK submoduled in?
  4. Packages built from project.

Loading From Spark?

The constructor to build any SparkObject from an existing Spark instance via ID seems a bit weird to me, especially when it conflicts from a more obvious single string constructor (like in the case of Room(title)). Perhaps Load can become static and take its place? E.g Message.Load("id", returnedMessage). Not sure what best practice would be here...

Remove objLoader

I think if it's not natively supported by Unity (like downloading textures) then it can be considered out of scope. (Although obj import / mesh generation might be possible natively?)

DisplayName should be optional

Some accounts/bots may not have DisplayNames:

Minimum response I've seen is:

{"id":"","emails":[""],"avatar":"","created":""}

Everything else can be considered optional.

Request.Instance not always set in time

Request.Instance may not be set in time for API calls that are started in a Start call. Instance reference should probably be set in Request.Awake() instead.

Logs:

NullReferenceException: Object reference not set to an instance of an object
Cisco.Spark.Message+<ListMessages>c__Iterator7.MoveNext () (at Assets/Cisco/Spark/Message.cs:219)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
TestSparkFile:Start() (at Assets/Cisco/Spark/Tests/TestSparkFile.cs:8)

SparkFile Id

Id is not being set in the new URL constructor:

Id = UploadUrl.AbsoluteUri.Split(new string[] { "contents/" }, StringSplitOptions.None)[1];

Status Code Checking

Who knows why I'm not testing for status codes...

Anything other than 200 or 201 needs to be handled. On top of that empty response bodies cause MiniJSON to thrown an OverflowException.

Also need to have status code checks in all the tests and cause them of course!

Structure change

  • Remove Unity Project
  • Track docs like we did before (in a submodule)
  • Get Travis back online

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.