-
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 #28 from KtorZ/master
Minor changes
- Loading branch information
Showing
12 changed files
with
38 additions
and
60 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
Binary file renamed
BIN
+921 KB
...d/dist/eu.rebelcorp.parse-android-0.9.zip → .../dist/eu.rebelcorp.parse-android-0.10.zip
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 |
---|---|---|
@@ -1,36 +1,32 @@ | ||
// 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"); | ||
} | ||
Parse.Cloud.useMasterKey(); | ||
|
||
var androidId = request.object.get("androidId"); | ||
if (androidId == null || androidId == "") { | ||
console.warn("No androidId found, exit"); | ||
return response.success(); | ||
} | ||
response.success(); | ||
}, | ||
function(error) { | ||
response.error("Can't find Installation objects"); | ||
} | ||
); | ||
}); | ||
|
||
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
"masterKey": "dummy" | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.