Пример #1
0
        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;
            }));
        }
Пример #2
0
        public async void unsubscribe(string arg)
        {
            string channel = JsonHelper.Deserialize <string[]>(arg)[0];
            await ParsePush.UnsubscribeAsync(channel);

            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, ""));
        }
Пример #3
0
        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();
            };
        }
Пример #4
0
        public void unsubscribe(string args)
        {
            var topic = JSON.JsonHelper.Deserialize <string[]>(args)[0].ToString();

            ParsePush.UnsubscribeAsync(topic);

            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, true));
        }
Пример #5
0
        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);			
        }		
Пример #6
0
 /// <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);
 }
Пример #7
0
 /// <summary>
 /// Unsubscribe to a channel
 /// </summary>
 /// <param name="channel"></param>
 /// <returns></returns>
 public static async Task UnsubscribeAsync(string channel = "")
 {
     await ParsePush.UnsubscribeAsync(channel);
 }