Mark push as enabled in serverInfo endpoint

This commit is contained in:
Drew Gross
2016-03-23 12:33:26 -07:00
parent 7738d33399
commit 19e6293638
5 changed files with 52 additions and 137 deletions

View File

@@ -1,22 +1,17 @@
import { Parse } from 'parse/node';
import PromiseRouter from '../PromiseRouter';
import rest from '../rest';
import { Parse } from 'parse/node';
import PromiseRouter from '../PromiseRouter';
import rest from '../rest';
import AdaptableController from './AdaptableController';
import { PushAdapter } from '../Adapters/Push/PushAdapter';
import deepcopy from 'deepcopy';
import features from '../features';
import RestQuery from '../RestQuery';
import pushStatusHandler from '../pushStatusHandler';
import { PushAdapter } from '../Adapters/Push/PushAdapter';
import deepcopy from 'deepcopy';
import RestQuery from '../RestQuery';
import pushStatusHandler from '../pushStatusHandler';
const FEATURE_NAME = 'push';
const UNSUPPORTED_BADGE_KEY = "unsupported";
export class PushController extends AdaptableController {
setFeature() {
features.setFeature(FEATURE_NAME, this.adapter.feature || {});
}
/**
* Check whether the deviceType parameter in qury condition is valid or not.
* @param {Object} where A query condition
@@ -39,9 +34,13 @@ export class PushController extends AdaptableController {
}
}
pushIsAvailable() {
return !!this.adapter;
}
sendPush(body = {}, where = {}, config, auth, wait) {
var pushAdapter = this.adapter;
if (!pushAdapter) {
if (!this.pushIsAvailable()) {
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
'Push adapter is not available');
}