private async Task Login()
        {
            var account = AccountText.Text;

            AgoraRtm.Current = account;

            var token = await AgoraTokenService.GetRtmToken(account);

            AgoraRtm.RtmKit.LoginByToken(token, account, (status) =>
            {
                if (status == Xamarin.Agora.AgoraRtmLoginErrorCode.Ok)
                {
                    InvokeOnMainThread(() =>
                    {
                        AgoraRtm.OneToOneMessageType = OfflineSwitch.On ? OneToOneMessageType.Offline : OneToOneMessageType.Normal;
                        //getting offline messages
                        var rtmDelegate            = new RtmDelegate();
                        rtmDelegate.AppendMessage += (user, message) => AgoraRtm.AddOfflineMessage(message, user);
                        AgoraRtm.UpdateKit(rtmDelegate);

                        AgoraRtm.Status = LoginStatus.Online;
                        PerformSegue("mainToTab", null);
                    });
                }
            });
        }
 private void LoadOfflineMessages()
 {
     if (_type == ChatType.Peer)
     {
         var messages = AgoraRtm.GetOfflineMessages(ChannelOrPeerName);
         messages.ForEach(m => AppendMsg(ChannelOrPeerName, m));
         AgoraRtm.RemoveAllOfflineMessages(ChannelOrPeerName);
     }
 }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var _callKitDelegate = new CallKitDelegate
            {
                ViewController = this
            };

            AgoraRtm.UpdateCallKit(_callKitDelegate);
        }
Exemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            AddKeyboradObserver();
            UpdateViews();
            TableView.DataSource = new TableSource(list);

            _rtmDelegate = new RtmDelegate();
            _rtmDelegate.AppendMessage += AppendMsg;

            AgoraRtm.UpdateKit(_rtmDelegate);

            inputTextField.ShouldReturn += ShouldReturn;
        }