/// <summary>
        /// 注册获取badge数量的回调(仅iOS有效)
        /// </summary>
        /// <param name="action"></param>
        public static void RegisterBadgeCountCallback(SessionBadgeCountDelegate action)
        {
            IntPtr ptr = IntPtr.Zero;

            if (action != null)
            {
                ptr = NimUtility.DelegateConverter.ConvertToIntPtr(action);
            }
            SessionNativeMethods.nim_session_reg_badge_count_cb(null, GlobalBadgeCountCb, ptr);
            _sessionBadgeCountHandler = action;
        }
Beispiel #2
0
        /// <summary>
        /// 最近联系人项未读数清零
        /// </summary>
        /// <param name="toType">会话类型</param>
        /// <param name="id">对方的account id或者群组tid</param>
        /// <param name="handler">最近会话列表项变更的回调</param>
        public static void SetUnreadCountZero(Session.NIMSessionType toType, string id, SessionChangeHandler handler)
        {
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            SessionNativeMethods.nim_session_set_unread_count_zero_async((int)toType, id, "", SessionChangeCb, ptr);
        }
Beispiel #3
0
        /// <summary>
        /// 删除全部最近联系人
        /// </summary>
        /// <param name="handler">最近会话列表项变更的回调</param>
        public static void DeleteAllRecentSession(SessionChangeHandler handler)
        {
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            SessionNativeMethods.nim_session_delete_all_recent_session_async("", SessionChangeCb, ptr);
        }
Beispiel #4
0
        /// <summary>
        /// 删除最近联系人
        /// </summary>
        /// <param name="toType">会话类型</param>
        /// <param name="id">对方的account id或者群组tid</param>
        /// <param name="handler">最近会话列表项变更的回调</param>
        public static void DeleteRecentSession(Session.NIMSessionType toType, string id, SessionChangeHandler handler)
        {
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            SessionNativeMethods.nim_session_delete_recent_session_async((int)toType, id, "", SessionChangeCb, ptr);
        }
Beispiel #5
0
        /// <summary>
        /// 查询会话列表
        /// </summary>
        /// <param name="handler">查询会话列表的回调</param>
        public static void QueryAllRecentSession(QueryRecentHandler handler)
        {
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            SessionNativeMethods.nim_session_query_all_recent_session_async("", QueryRecentSessionCb, ptr);
        }
Beispiel #6
0
 /// <summary>
 /// 注册最近会话列表项变更通知
 /// </summary>
 public static void RegisterCallbacks()
 {
     SessionNativeMethods.nim_session_reg_change_cb("", GlobalSessionChangedCb, IntPtr.Zero);
 }
Beispiel #7
0
        /// <summary>
        /// 设置会话项是否置顶(置顶属性只保存在本地)
        /// </summary>
        /// <param name="to_type"></param>
        /// <param name="id"></param>
        /// <param name="top"></param>
        /// <param name="cb"></param>
        public static void PinSessionOnTop(NIMSessionType to_type, string id, bool top, SessionChangeHandler cb)
        {
            var ptr = DelegateConverter.ConvertToIntPtr(cb);

            SessionNativeMethods.nim_session_set_top(to_type, id, top, null, SessionChangeCb, ptr);
        }
Beispiel #8
0
        /// <summary>
        /// 设置会话项扩展数据(扩展数据只保存在本地)
        /// </summary>
        /// <param name="to_type"></param>
        /// <param name="id"></param>
        /// <param name="data"></param>
        /// <param name="cb"></param>
        public static void SetSessionExtendData(NIMSessionType to_type, string id, string data, SessionChangeHandler cb)
        {
            var ptr = DelegateConverter.ConvertToIntPtr(cb);

            SessionNativeMethods.nim_session_set_extend_data(to_type, id, data, null, SessionChangeCb, ptr);
        }
Beispiel #9
0
        /// <summary>
        /// 最近联系人项全部未读数清零
        /// </summary>
        public static void ResetAllUnreadCount(SessionChangeHandler cb)
        {
            var ptr = DelegateConverter.ConvertToIntPtr(cb);

            SessionNativeMethods.nim_session_reset_all_unread_count_async(null, SessionChangeCb, ptr);
        }
 /// <summary>
 /// 注册最近会话列表项变更通知
 /// </summary>
 private static void RegChangeCb()
 {
     SessionNativeMethods.nim_session_reg_change_cb("", GlobalSessionChangedCb, IntPtr.Zero);
 }
Beispiel #11
0
 /// <summary>
 /// 获取所有的未读消息总数
 /// </summary>
 /// <returns></returns>
 public static int GetAllUnreadMsgCount()
 {
     return((int)SessionNativeMethods.nim_session_get_all_unread_count(null));
 }