-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from jvandijk/feature/duplicate-android-installs
Feature: Prevent duplicate android installs
- Loading branch information
Showing
17 changed files
with
164 additions
and
55 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 |
---|---|---|
|
@@ -2,4 +2,5 @@ build/ | |
build.log | ||
.DS_Store | ||
android/build.properties | ||
parse.jar | ||
parse.jar | ||
cloudcode/config/local.json |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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,36 @@ | ||
// Parse CloudCode | ||
Parse.Cloud.beforeSave(Parse.Installation, function(request, response) { | ||
Parse.Cloud.useMasterKey(); | ||
|
||
var androidId = request.object.get("androidId"); | ||
if (androidId == null || androidId == "") { | ||
console.warn("No androidId found, exit"); | ||
response.success(); | ||
} | ||
|
||
var query = new Parse.Query(Parse.Installation); | ||
query.equalTo("deviceType", "android"); | ||
query.equalTo("androidId", androidId); | ||
query.addAscending("createdAt"); | ||
query.find().then(function(results) { | ||
for (var i = 0; i < results.length; ++i) { | ||
if (results[i].get("installationId") != request.object.get("installationId")) { | ||
console.warn("App id " + results[i].get("installationId") + ", delete!"); | ||
results[i].destroy().then(function() { | ||
console.warn("Delete success"); | ||
}, | ||
function() { | ||
console.warn("Delete error"); | ||
} | ||
); | ||
} else { | ||
console.warn("Current App id " + results[i].get("installationId") + ", dont delete"); | ||
} | ||
} | ||
response.success(); | ||
}, | ||
function(error) { | ||
response.error("Can't find Installation objects"); | ||
} | ||
); | ||
}); |
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,11 @@ | ||
{ | ||
"global": { | ||
"parseVersion": "1.5.0" | ||
}, | ||
"applications": { | ||
"dummy": { | ||
"applicationId": "dummy", | ||
"masterKey": "dummy" | ||
} | ||
} | ||
} |
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,21 @@ | ||
|
||
<html> | ||
<head> | ||
<title>My ParseApp site</title> | ||
<style> | ||
body { font-family: Helvetica, Arial, sans-serif; } | ||
div { width: 800px; height: 400px; margin: 40px auto; padding: 20px; border: 2px solid #5298fc; } | ||
h1 { font-size: 30px; margin: 0; } | ||
p { margin: 40px 0; } | ||
em { font-family: monospace; } | ||
a { color: #5298fc; text-decoration: none; } | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<h1>Congratulations! You're already hosting with Parse.</h1> | ||
<p>To get started, edit this file at <em>public/index.html</em> and start adding static content.</p> | ||
<p>If you want something a bit more dynamic, delete this file and check out <a href="https://parse.com/docs/hosting_guide#webapp">our hosting docs</a>.</p> | ||
</div> | ||
</body> | ||
</html> |