Cleaning code

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Remove unnecessary copy on User alias method

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Serialize DP to json outside of queue + atomic

on DP main entities (User, Device, Session, Device, DataPoint).

This solves a lot of concurrency problems and reduces consumption of memory.

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Fix tests that now use a single Liquid instance

instead of Liquid singleton.

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Review of memory management and concurrency

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Use a single instance per spec test

No more sharedInstances on kiwi tests.

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Merge branch 'master' into refactoring

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>

Conflicts:
	Liquid/LQDefaults.h
	Liquid/Liquid.m
Fixes on tests

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Return unmutable dicts on jsonDictionary: methods

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Add tests for LQUser "copy" method

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Better log messages

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
autoIdentifyUser now uses identifyUserSynced:

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Attribute with a reason (by) on startSession and endSession

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Better pointers handling on startSession, endSession and identifyUser

* `init`: property `_currentUser` is now set by `identifyUserSynced:`

Better pointer handling at methods:

* `startSessionAt:`
* `endSessionAt:`
* `identifyUserSynced:`

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Queued data (dispatch queue) is now NSData (json)

instead of a NSDictionary

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Add atomic references to some @properties

Liquid.m:

* Liquid.loadedLiquidPackage
* Liquid.networking
* Liquid.queue (dispatch_queue_t)

LQLiquidPackage:

* LQLiquidPackage.values
* LQLiquidPackage.liquidVersion
* LQLiquidPackage.dictOfVariablesAndValues

LQNetworking:

* LQNetworking.httpQueue

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Remove __block from four dispatch_async

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Refactor: normalize block syntax from ^(){ to ^{

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Do not use uniqueNow inside flush: method

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>
Change cache policy and timeout interval for POST requests

* cachePolicy: NSURLRequestReloadIgnoringLocalCacheData
* timeoutInterval: 5.0f (seconds)

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>