-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes problems related to increment badge
- name conventions are aweful in PushController - properly looks at the badge into body.data instead of body - We may want to refactor that as it's confusing to use a full body
- Loading branch information
1 parent
f1f9bde
commit 5370fd9
Showing
4 changed files
with
78 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
describe('Parse.Push', () => { | ||
it('should properly send push', (done) => { | ||
var pushAdapter = { | ||
send: function(body, installations) { | ||
return Promise.resolve({ | ||
body: body, | ||
installations: installations | ||
}) | ||
}, | ||
getValidPushTypes: function() { | ||
return ["ios", "android"]; | ||
} | ||
} | ||
setServerConfiguration({ | ||
appId: Parse.applicationId, | ||
masterKey: Parse.masterKey, | ||
serverURL: Parse.serverURL, | ||
push: { | ||
adapter: pushAdapter | ||
} | ||
}); | ||
var installations = []; | ||
while(installations.length != 10) { | ||
var installation = new Parse.Object("_Installation"); | ||
installation.set("installationId", "installation_"+installations.length); | ||
installation.set("deviceToken","device_token_"+installations.length) | ||
installation.set("badge", installations.length); | ||
installation.set("originalBadge", installations.length); | ||
installation.set("deviceType", "ios"); | ||
installations.push(installation); | ||
} | ||
Parse.Object.saveAll(installations).then(() => { | ||
return Parse.Push.send({ | ||
where: { | ||
deviceType: 'ios' | ||
}, | ||
data: { | ||
badge: 'Increment', | ||
alert: 'Hello world!' | ||
} | ||
}, {useMasterKey: true}); | ||
}) | ||
.then(() => { | ||
console.log("OK!"); | ||
done(); | ||
}, (err) => { | ||
console.error(err); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters