private void InitSendBird(Bundle extras) { if (extras != null) { String appId = extras.GetString("appId"); String uuid = extras.GetString("uuid"); String userName = extras.GetString("userName"); mSyncContext = SynchronizationContext.Current; // required for ui update SendBirdEventHandler seh = new SendBirdEventHandler(); seh.OnConnect += (sender, e) => { }; seh.OnError += (sender, e) => { }; seh.OnMessagingEnded += (sender, e) => { }; seh.OnMessagingChannelUpdated += (sender, e) => { mSendBirdMessagingChannelAdapter.Replace(e.MessagingChannel); }; seh.OnMentionUpdated += (sender, e) => { }; SendBirdSDK.Init(appId); SendBirdSDK.Login(uuid, userName); SendBirdSDK.SetEventHandler(seh); } }
private void InitSendBird(Bundle extras) { String appId = extras.GetString("appId"); String uuid = extras.GetString("uuid"); String userName = extras.GetString("userName"); SendBirdSDK.Init(appId); SendBirdSDK.Login(uuid, userName); }
private void InitSendBird(Bundle extras) { mSyncContext = SynchronizationContext.Current; String appId = extras.GetString("appId"); String uuid = extras.GetString("uuid"); String userName = extras.GetString("userName"); SendBirdSDK.Init(appId); SendBirdSDK.Login(uuid, userName); }
void Start() { string appId = "A7A2672C-AD11-11E4-8DAA-0A18B21C2D82"; // Release userId = SystemInfo.deviceUniqueIdentifier; SendBirdSDK.Init(appId); InitComponents(); mGameObject = gameObject; mEventProcessor = mGameObject.AddComponent <EventProcessor> (); }
private void InitSendBird(Bundle extras) { if (extras != null) { String appId = extras.GetString("appId"); String uuid = extras.GetString("uuid"); String userName = extras.GetString("userName"); SendBirdSDK.Init(appId); SendBirdSDK.Login(uuid, userName); } mSyncContext = SynchronizationContext.Current; // required for ui update }
private void InitSendBird(Bundle extras) { if (extras != null) { String appId = extras.GetString("appId"); String uuid = extras.GetString("uuid"); String userName = extras.GetString("userName"); mSyncContext = SynchronizationContext.Current; // required for ui update SendBirdNotificationHandler jnh = new SendBirdNotificationHandler(); jnh.OnMessagingChannelUpdated += (sender, e) => { mSendBirdMessagingChannelAdapter.Replace(e.MessagingChannel); }; jnh.OnMentionUpdated += (sender, e) => { }; SendBirdEventHandler ieh = new SendBirdEventHandler(); ieh.OnConnect += (sender, e) => { }; ieh.OnError += (sender, e) => { if (SendBird.CommonVar.IS_DEBUG) { Console.WriteLine("ieh Messaging OnError"); Console.WriteLine(e.ErrorCode); } }; ieh.OnMessagingEnded += (sender, e) => { }; SendBirdSDK.Init(appId); SendBirdSDK.Login(uuid, userName); SendBirdSDK.RegisterNotificationHandler(jnh); SendBirdSDK.SetEventHandler(ieh); } }
private void InitSendBird(Bundle extras) { mSendBirdInfo = extras; String appId = extras.GetString("appId"); String uuid = extras.GetString("uuid"); String userName = extras.GetString("userName"); mSyncContext = SynchronizationContext.Current; // required for api queries #region SendBirdEventHandler SendBirdEventHandler seh = new SendBirdEventHandler(); seh.OnConnect += (sender, e) => { }; seh.OnError += (sender, e) => { }; seh.OnChannelLeft += (sender, e) => { }; seh.OnMessageReceived += (sender, e) => { SendBirdSDK.MarkAsRead(); mSyncContext.Post(delegate { mSendBirdMessagingAdapter.AddMessageModel(e.Message); }, null); }; seh.OnBroadcastMessageReceived += (sender, e) => { mSyncContext.Post(delegate { mSendBirdMessagingAdapter.AddMessageModel(e.Message); }, null); }; seh.OnSystemMessageReceived += (sender, e) => { var systemMessage = (SystemMessage)e.Message; mSyncContext.Post(delegate { switch (systemMessage.category) { case SystemMessage.CATEGORY_TOO_MANY_MESSAGES: systemMessage.SetMessage("Too many messages. Please try later."); break; case SystemMessage.CATEGORY_MESSAGING_USER_BLOCKED: systemMessage.SetMessage("Blocked."); break; case SystemMessage.CATEGORY_MESSAGING_USER_DEACTIVATED: systemMessage.SetMessage("Deactivated."); break; } mSendBirdMessagingAdapter.AddMessageModel(systemMessage); }, null); }; seh.OnFileReceived += (sender, e) => { }; seh.OnReadReceived += (sender, e) => { mSyncContext.Post(delegate { mSendBirdMessagingAdapter.SetReadStatus(e.ReadStatus.GetUserId(), e.ReadStatus.timestamp); }, null); }; seh.OnTypeStartReceived += (sender, e) => { mSyncContext.Post(delegate { mSendBirdMessagingAdapter.SetTypeStatus(e.TypeStatus.GetUserId(), SendBirdUtils.GetCurrentTimeMills()); }, null); }; seh.OnTypeEndReceived += (sender, e) => { mSyncContext.Post(delegate { mSendBirdMessagingAdapter.SetTypeStatus(e.TypeStatus.GetUserId(), 0); }, null); }; seh.OnAllDataReceived += (sender, e) => { mSyncContext.Post(delegate { mSendBirdMessagingAdapter.NotifyDataSetChanged(); mSendBirdMessagingFragment.mListView.SetSelection(mSendBirdMessagingAdapter.Count - 1); }, null); }; seh.OnMessageDelivery += (sender, e) => { if (!e.Sent) { mSyncContext.Post(delegate { mSendBirdMessagingFragment.mEtxtMessage.Text = e.Message; }, null); } }; seh.OnMessagingStarted += (sender, e) => { mSendBirdMessagingAdapter.Clear(); mSyncContext.Post(delegate { UpdateMessagingChannel(e.MessagingChannel); var channelUrl = e.MessagingChannel.GetUrl(); MessageListQuery messageListQuery = SendBirdSDK.QueryMessageList(channelUrl); messageListQuery.OnResult += (sender_child, e_child) => { // mSyncContext.Post for RunOnUIThread mSyncContext.Post(delegate { foreach (var messageModel in e_child.Messages) { mSendBirdMessagingAdapter.AddMessageModel(messageModel); } mSendBirdMessagingAdapter.NotifyDataSetChanged(); mSendBirdMessagingFragment.mListView.SetSelection(30); SendBirdSDK.MarkAsRead(channelUrl); SendBirdSDK.Join(channelUrl); SendBirdSDK.Connect(mSendBirdMessagingAdapter.GetMaxMessageTimestamp()); }, null); }; messageListQuery.Prev(long.MaxValue, 50); // Excute Query }, null); }; seh.OnMessagingUpdated += (sender, e) => { mSyncContext.Post(delegate { UpdateMessagingChannel(e.MessagingChannel); }, null); }; seh.OnMessagingChannelUpdated += (sender, e) => { if (mMessagingChannel != null && mMessagingChannel.GetId() == e.MessagingChannel.GetId()) { mSyncContext.Post(delegate { UpdateMessagingChannel(e.MessagingChannel); }, null); } }; seh.OnMentionUpdated += (sender, e) => { }; #endregion SendBirdSDK.Init(appId); SendBirdSDK.Login(uuid, userName); SendBirdSDK.SetEventHandler(seh); }
private void InitSendBird(Bundle extras) { string appId = extras.GetString("appId"); string uuid = extras.GetString("uuid"); string userName = extras.GetString("userName"); mChannelUrl = extras.GetString("channelUrl"); mSyncContext = SynchronizationContext.Current; // required for ui update #region SendBirdEventHandler SendBirdEventHandler seh = new SendBirdEventHandler(); seh.OnConnect += (sender, e) => { Channel channel = e.Channel; mSyncContext.Post(delegate { mTxtChannelUrl.Text = "#" + mChannelUrl; mSendBirdChatAdapter.NotifyDataSetChanged(); }, null); }; seh.OnError += (sender, e) => { }; seh.OnChannelLeft += (sender, e) => { }; seh.OnMessageReceived += (sender, e) => { mSendBirdChatAdapter.AddMessageModel(e.Message); mSyncContext.Post(delegate { mSendBirdChatAdapter.NotifyDataSetChanged(); }, null); }; seh.OnBroadcastMessageReceived += (sender, e) => { mSendBirdChatAdapter.AddMessageModel(e.Message); mSyncContext.Post(delegate { mSendBirdChatAdapter.NotifyDataSetChanged(); }, null); }; seh.OnSystemMessageReceived += (sender, e) => { mSendBirdChatAdapter.AddMessageModel(e.Message); mSyncContext.Post(delegate { mSendBirdChatAdapter.NotifyDataSetChanged(); }, null); }; seh.OnFileReceived += (sender, e) => { mSendBirdChatAdapter.AddMessageModel(e.FileLink); mSyncContext.Post(delegate { mSendBirdChatAdapter.NotifyDataSetChanged(); }, null); }; seh.OnAllDataReceived += (sender, e) => { mSyncContext.Post(delegate { mSendBirdChatAdapter.NotifyDataSetChanged(); mSendBirdChatFragment.mListView.SetSelection(mSendBirdChatAdapter.Count); }, null); }; seh.OnMessageDelivery += (sender, e) => { if (!e.Sent) { mSyncContext.Post(delegate { mSendBirdChatFragment.mEtxtMessage.Text = e.Message; }, null); } }; seh.OnMessagingEnded += (sender, e) => { }; seh.OnSystemEventReceived += (sender, e) => { }; #endregion SendBirdSDK.Init(appId); SendBirdSDK.Login(uuid, userName); SendBirdSDK.SetEventHandler(seh); }