summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/com.parse.cordova.core.pushplugin/src/wp8/ParsePlugin.cs
diff options
context:
space:
mode:
authorRene Ae <aehtyb@gmail.com>2015-12-11 03:05:10 -0600
committerRene Ae <aehtyb@gmail.com>2015-12-11 03:05:10 -0600
commitb1775dd32d1e0113eba81cfdb9a5626295eebc4e (patch)
tree19a2f4ea004d11037e494e863a39ac834d364429 /StoneIsland/plugins/com.parse.cordova.core.pushplugin/src/wp8/ParsePlugin.cs
parent3442b2821d30dd1ca6c6db1ba089ae3f5c95a758 (diff)
parent053473394e6e0990c68a924adbb7c7d75f35973d (diff)
Merge branch 'android' of https://github.com/okfocus/stone-island into android
Diffstat (limited to 'StoneIsland/plugins/com.parse.cordova.core.pushplugin/src/wp8/ParsePlugin.cs')
-rw-r--r--StoneIsland/plugins/com.parse.cordova.core.pushplugin/src/wp8/ParsePlugin.cs90
1 files changed, 90 insertions, 0 deletions
diff --git a/StoneIsland/plugins/com.parse.cordova.core.pushplugin/src/wp8/ParsePlugin.cs b/StoneIsland/plugins/com.parse.cordova.core.pushplugin/src/wp8/ParsePlugin.cs
new file mode 100644
index 00000000..58d1c42e
--- /dev/null
+++ b/StoneIsland/plugins/com.parse.cordova.core.pushplugin/src/wp8/ParsePlugin.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using Parse;
+using WPCordovaClassLib.Cordova;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+ public class ParsePlugin : BaseCommand
+ {
+
+
+ public async void initialize(string args)
+ {
+
+ PluginResult result;
+
+ try
+ {
+ var appId = JSON.JsonHelper.Deserialize<string[]>(args)[0].ToString();
+ var clientKey = JSON.JsonHelper.Deserialize<string[]>(args)[1].ToString();
+
+ ParseClient.Initialize(appId, clientKey);
+
+
+ await ParseInstallation.CurrentInstallation.SaveAsync();
+
+
+ DispatchCommandResult( new PluginResult(PluginResult.Status.OK, true));
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, false));
+ }
+
+
+
+
+ }
+
+ public void getInstallationId(string args)
+ {
+
+ String installationId = ParseInstallation.CurrentInstallation.InstallationId.ToString();
+ var result = new PluginResult(PluginResult.Status.OK, installationId);
+ DispatchCommandResult(result);
+
+ }
+
+ public void getInstallationObjectId(string args)
+ {
+
+ String objectId = ParseInstallation.CurrentInstallation.ObjectId.ToString();
+ var result = new PluginResult(PluginResult.Status.OK, objectId);
+ DispatchCommandResult(result);
+
+ }
+
+ public void getSubscriptions(string args)
+ {
+
+
+ var installation = ParseInstallation.CurrentInstallation;
+ IEnumerable<string> subscribedChannels = installation.Channels;
+ var result = new PluginResult(PluginResult.Status.OK, subscribedChannels);
+ DispatchCommandResult(result);
+
+ }
+
+ public void subscribe(string args)
+ {
+ var topic = JSON.JsonHelper.Deserialize<string[]>(args)[0].ToString();
+ ParsePush.SubscribeAsync(topic);
+
+ DispatchCommandResult( new PluginResult(PluginResult.Status.OK, true));
+
+
+ }
+
+ public void unsubscribe(string args)
+ {
+ var topic = JSON.JsonHelper.Deserialize<string[]>(args)[0].ToString();
+ ParsePush.UnsubscribeAsync(topic);
+
+ DispatchCommandResult(new PluginResult(PluginResult.Status.OK, true));
+ }
+
+
+
+ }
+} \ No newline at end of file