Skip to content

Commit

Permalink
Merge pull request #100 from getbraincloud/release4.3.0
Browse files Browse the repository at this point in the history
Release4.3.0
  • Loading branch information
ruth0048 authored Nov 12, 2019
2 parents bfe3961 + 4c17031 commit e38b237
Show file tree
Hide file tree
Showing 11 changed files with 665 additions and 460 deletions.
2 changes: 1 addition & 1 deletion deploy/node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deploy/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "braincloud",
"version": "4.1.0",
"version": "4.3.0",
"description": " brainCloud client for NodeJS",
"main": "index.js",
"react-native": "react-native.js",
Expand Down
12 changes: 9 additions & 3 deletions deploy/node/react-native.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Set up AsyncStorage.
//Set up AsyncStorage.
var AsyncStorage = null;
try {
AsyncStorage = require('@react-native-community/async-storage').default
AsyncStorage = useReactModule('@react-native-community/async-storage')
} catch (er) {
AsyncStorage = {
getItem: function () { },
Expand All @@ -13,12 +13,18 @@ try {
var BackgroundTimer = null;
var customSetInterval = null;
try {
BackgroundTimer = require('react-native-background-timer').default;
BackgroundTimer = useReactModule('react-native-background-timer')
customSetInterval = function (func, interval) { BackgroundTimer.setInterval(func, interval); };
} catch (e) {
customSetInterval = null;
}

//Browserify processes only require() calls with literals, i.e. require('theplugin'); It will not include modules that can be required with functions.
//this is key because if you use regular requires, it will alwyas argue that the module is missing if it is not there and directed by a relative path.
function useReactModule(moduleName) {
require(moduleName).default;
}

/*
* BrainCloudClient expect localStorage to be available as a
* synchronous API, this will simulate the minimum required
Expand Down
2 changes: 1 addition & 1 deletion src/brainCloudBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function BrainCloudManager ()
bcm._rewardCallback = null;
bcm._errorCallback = null;
bcm._jsonedQueue = "";
bcm._idleTimeout = 30;
bcm._idleTimeout = 120;
bcm._heartBeatIntervalId = null;
bcm._bundlerIntervalId = null;

Expand Down
20 changes: 20 additions & 0 deletions src/brainCloudClient-authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function BCAuthentication() {
bc.authentication.AUTHENTICATION_TYPE_TWITTER = "Twitter";
bc.authentication.AUTHENTICATION_TYPE_PARSE = "Parse";
bc.authentication.AUTHENTICATION_TYPE_HANDOFF = "Handoff";
bc.authentication.AUTHENTICATION_TYPE_SETTOP_HANDOFF = "SettopHandoff";

bc.authentication.profileId = "";
bc.authentication.anonymousId = "";
Expand Down Expand Up @@ -486,6 +487,25 @@ function BCAuthentication() {
callback);
};

/**
* Authenticate a user with handoffCode
*
* Service Name - authenticationV2
* Service Operation - AUTHENTICATE
*
* @param callback The method to be invoked when the server response is received
*
*/
bc.authentication.authenticateSettopHandoff= function(handoffCode, callback) {
bc.authentication.authenticate(
handoffCode,
"",
bc.authentication.AUTHENTICATION_TYPE_SETTOP_HANDOFF,
null,
false,
callback);
};

/** Method allows a caller to authenticate with bc. Note that
* callers should use the other authenticate methods in this class as
* they incorporate the appropriate authenticationType and use better
Expand Down
2 changes: 2 additions & 0 deletions src/brainCloudClient-gamification.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ function BCGamification() {
};

/**
* @deprecated
*
* Resets the specified milestones' statuses to LOCKED.
*
* Service Name - Gamification
Expand Down
29 changes: 29 additions & 0 deletions src/brainCloudClient-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function BCGroup() {
bc.group.OPERATION_ADD_GROUP_MEMBER = "ADD_GROUP_MEMBER";
bc.group.OPERATION_APPROVE_GROUP_JOIN_REQUEST = "APPROVE_GROUP_JOIN_REQUEST";
bc.group.OPERATION_AUTO_JOIN_GROUP = "AUTO_JOIN_GROUP";
bc.group.OPERATION_AUTO_JOIN_GROUP_MULTI = "AUTO_JOIN_GROUP_MULTI";
bc.group.OPERATION_CANCEL_GROUP_INVITATION = "CANCEL_GROUP_INVITATION";
bc.group.OPERATION_CREATE_GROUP = "CREATE_GROUP";
bc.group.OPERATION_CREATE_GROUP_ENTITY = "CREATE_GROUP_ENTITY";
Expand Down Expand Up @@ -154,6 +155,34 @@ function BCGroup() {
});
};

/**
* Find and join an open group in the pool of groups in multiple group types provided as input arguments.
*
* Service Name - group
* Service Operation - AUTO_JOIN_GROUP
*
* @param groupTypes Name of the associated group type.
* @param autoJoinStrategy Selection strategy to employ when there are multiple matches
* @param where Query parameters (optional)
* @param callback The method to be invoked when the server response is received
*/
bc.group.autoJoinGroupMulti = function(groupTypes, autoJoinStrategy, where, callback) {
var message = {
groupTypes : groupTypes,
autoJoinStrategy : autoJoinStrategy
};

if(where) message.where = where;

bc.brainCloudManager.sendRequest({
service : bc.SERVICE_GROUP,
operation : bc.group.OPERATION_AUTO_JOIN_GROUP_MULTI,
data : message,
callback : callback
});
};


/**
* Cancel an outstanding invitation to the group.
*
Expand Down
39 changes: 37 additions & 2 deletions src/brainCloudClient-social-leaderboards.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ function BCSocialLeaderboard() {
bc.socialLeaderboard.OPERATION_REMOVE_GROUP_SCORE = "REMOVE_GROUP_SCORE";
bc.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW = "GET_GROUP_LEADERBOARD_VIEW";
bc.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW_BY_VERSION = "GET_GROUP_LEADERBOARD_VIEW_BY_VERSION";


bc.socialLeaderboard.OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD = "POST_GROUP_SCORE_DYNAMIC"



Expand Down Expand Up @@ -741,6 +740,42 @@ function BCSocialLeaderboard() {
callback : callback
});
}

/**
* Post the group score to the given group leaderboard and dynamically create if necessary. LeaderboardType, rotationType, rotationReset, and retainedCount are required. *
* Service Name - leaderboard
* Service Operation - POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD
*
* @param leaderboardId the id of the leaderboard
* @param groupId the group's id
* @param score the sort order
* @param data extra data
* @param leaderboardType the type
* @param rotationType the type of tournamnet rotation
* @param rotationResetTime how often to reset
* @param retainedCount
* @param callback The method to be invoked when the server response is received
*/
bc.socialLeaderboard.postScoreToDynamicGroupLeaderboard = function(leaderboardId, groupId, score, data, leaderboardType, rotationType, rotationResetTime, retainedCount, callback) {
var message = {
leaderboardId : leaderboardId,
groupId : groupId,
score : score,
data : data,
leaderboardType : leaderboardType,
rotationType : rotationType,
rotationResetTime : rotationResetTime,
retainedCount : retainedCount
};

bc.brainCloudManager.sendRequest({
service : bc.SERVICE_LEADERBOARD,
operation : bc.socialLeaderboard.OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD,
data : message,
callback : callback
});
}

}

BCSocialLeaderboard.apply(window.brainCloudClient = window.brainCloudClient || {});
Loading

0 comments on commit e38b237

Please sign in to comment.