public Task TestUnsubscribe() { List <string> channels = new List <string>(); ParseCorePlugins.Instance.PushChannelsController = GetMockedPushChannelsController(channels); channels.Add("test"); return(ParsePush.UnsubscribeAsync("test").ContinueWith(t => { Assert.IsTrue(t.IsCompleted); Assert.IsFalse(t.IsFaulted); return ParsePush.UnsubscribeAsync(new List <string> { { "test" } }); }).ContinueWith(t => { Assert.IsTrue(t.IsCompleted); Assert.IsFalse(t.IsFaulted); CancellationTokenSource cts = new CancellationTokenSource(); return ParsePush.UnsubscribeAsync(new List <string> { { "test" } }, cts.Token); }).ContinueWith(t => { Assert.IsTrue(t.IsCompleted); Assert.IsFalse(t.IsFaulted); ParseCorePlugins.Instance.PushChannelsController = null; })); }
public async void unsubscribe(string arg) { string channel = JsonHelper.Deserialize <string[]>(arg)[0]; await ParsePush.UnsubscribeAsync(channel); DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "")); }
protected void CreateChatRooms() { chatroomsAdapter = new ChatRoomsAdapter(this); var chatRoomsListView = FindViewById <ListView> (Resource.Id.chatroomsListView); chatRoomsListView.Adapter = chatroomsAdapter; chatRoomsListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { ChatRoom currChatRoom = chatroomsAdapter.GetChatRoomAt(e.Position); var intent = new Intent(this, typeof(ChatRoomActivity)); intent.PutExtra("chatroom", currChatRoom.webID); StartActivity(intent); }; chatRoomsListView.ItemLongClick += async(object sender, AdapterView.ItemLongClickEventArgs e) => { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Do you want to delete this chatroom?"); alert.SetPositiveButton("Yes", (senderAlert, args) => { ChatRoom currChatRoom = chatroomsAdapter.GetChatRoomAt(e.Position); ParsePush.UnsubscribeAsync(currChatRoom.webID); ChatRoomUser cru = DatabaseAccessors.ChatRoomDatabaseAccessor.DeleteChatRoomUser(DatabaseAccessors.CurrentUser().webID, currChatRoom.webID); DatabaseAccessors.ChatRoomDatabaseAccessor.DeleteChatRoom(currChatRoom.webID); ParseChatRoomDatabase pcrd = new ParseChatRoomDatabase(); pcrd.DeleteChatRoomUserAsync(cru); Console.WriteLine("ERASED"); chatroomsAdapter.NotifyDataSetChanged(); }); alert.SetNegativeButton("No", (senderAlert, args) => { }); alert.Show(); }; }
public void unsubscribe(string args) { var topic = JSON.JsonHelper.Deserialize <string[]>(args)[0].ToString(); ParsePush.UnsubscribeAsync(topic); DispatchCommandResult(new PluginResult(PluginResult.Status.OK, true)); }
private async void _unsubscribe(string channel) { await ParsePush.UnsubscribeAsync(channel); PluginResult pr = new PluginResult(PluginResult.Status.OK, "onUnsubscribeSucceeded"); pr.KeepCallback = true; DispatchCommandResult(pr); //PluginResult pr = new PluginResult(PluginResult.Status.ERROR); //pr.KeepCallback = true; //DispatchCommandResult(pr); }
/// <summary> /// Unsubscribe to the given channels /// </summary> /// <param name="channel"></param> /// <returns></returns> public static async Task UnsubscribeAsync(IEnumerable <string> channels) { await ParsePush.UnsubscribeAsync(channels); }
/// <summary> /// Unsubscribe to a channel /// </summary> /// <param name="channel"></param> /// <returns></returns> public static async Task UnsubscribeAsync(string channel = "") { await ParsePush.UnsubscribeAsync(channel); }