Skip to content

Commit

Permalink
Nakama-Java 2.0.2 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
mofirouz committed Oct 14, 2019
1 parent 0b839aa commit dc96afe
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [keep a changelog](http://keepachangelog.com/) and this p

## [Unreleased]

## [2.0.2] - 2019-10-14
### Added
- Add support for session vars.
- Add support for sending metadata when joining a match with an ID.
- Add pagination support for friends and groups.

## [2.0.1] - 2019-06-19
### Added
- Add support for listing expired leaderboard/tournament records.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ plugins {
}

group = 'com.heroiclabs.nakama'
version = '2.0.2-SNAPSHOT'
version = '2.0.2'
def description = 'Android optimized Java client for Nakama server.'
def gopath = System.getenv('GOPATH')
sourceCompatibility = 1.7
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/heroiclabs/nakama/DefaultSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class DefaultSession implements Session {
this.username = jsonMap.get("usn").toString();
this.userId = jsonMap.get("uid").toString();
this.vars = new HashMap();
if (jsonMap.get("vars") != null) {
var v = jsonMap.get("vars");
if (jsonMap.get("vrs") != null) {
var v = jsonMap.get("vrs");
if (v instanceof Map) {
var vm = (Map) v;
for (Object key : vm.keySet()) {
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/com/heroiclabs/nakama/AuthenticateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.junit.Before;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -53,4 +55,17 @@ public void testCustom() throws Exception {
Assert.assertNotNull(future);
Assert.assertNotNull(future.get());
}

@Test
public void testCustomVars() throws Exception {
final Map<String, String> vars = new HashMap<>();
vars.put("hello", "world");
final ListenableFuture<Session> future = client.authenticateCustom(UUID.randomUUID().toString(), vars);
Assert.assertNotNull(future);
final Session session = future.get();
Assert.assertNotNull(session);
final Map<String, String> sessionVars = session.getVars();
Assert.assertNotNull(sessionVars);
Assert.assertEquals("world", sessionVars.get("hello"));
}
}

0 comments on commit dc96afe

Please sign in to comment.