EMClientDelegate.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /**
  2. * \~chinese
  3. * @header EMClientDelegate.h
  4. * @abstract 协议提供了与账号登录状态相关的回调。
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMClientDelegate.h
  10. * @abstract The protocol provides callbacks related to account login status
  11. * @author Hyphenate
  12. * @version 3.00
  13. */
  14. #import <Foundation/Foundation.h>
  15. #import "EMErrorCode.h"
  16. /**
  17. * \~chinese
  18. * 网络连接状态。
  19. *
  20. * \~english
  21. * The connection state.
  22. */
  23. typedef NS_ENUM(NSInteger, EMConnectionState) {
  24. EMConnectionConnected = 0, /**
  25. * \~chinese 服务器已连接。
  26. * \~english The SDK is connected to the chat server.
  27. */
  28. EMConnectionDisconnected, /**
  29. * \~chinese 服务器未连接。
  30. * \~english The SDK is disconnected from the chat server.
  31. */
  32. };
  33. @class EMError;
  34. /**
  35. * \~chinese
  36. * @abstract EMClientDelegate 提供与账号登录状态相关的回调。
  37. *
  38. * \~english
  39. * @abstract This protocol provides a number of utility classes callback
  40. */
  41. @protocol EMClientDelegate <NSObject>
  42. @optional
  43. /**
  44. * \~chinese
  45. * SDK 连接服务器的状态变化时会接收到该回调。
  46. *
  47. * SDK 会在以下情况下触发该回调:
  48. * 1.登录成功后,设备无法上网时。
  49. * 2.登录成功后,连接状态发生变化时。
  50. *
  51. * @param aConnectionState 当前的连接状态。
  52. *
  53. * \~english
  54. * Occurs when the connection state between the SDK and the server changes.
  55. *
  56. * The SDK triggers this callback in any of the following situations:
  57. * - After login, the device is disconnected from the internet.
  58. * - After login, the network status changes.
  59. *
  60. * @param aConnectionState The current connection state.
  61. */
  62. - (void)connectionStateDidChange:(EMConnectionState)aConnectionState;
  63. /**
  64. * \~chinese
  65. * 自动登录完成时的回调。
  66. *
  67. * @param aError 错误信息,包含失败原因。
  68. *
  69. * \~english
  70. * Occurs when the auto login is completed.
  71. *
  72. * @param aError Error A description of the issue that caused this call to fail.
  73. */
  74. - (void)autoLoginDidCompleteWithError:(EMError * _Nullable)aError;
  75. /**
  76. * \~chinese
  77. * 当前登录账号在其它设备登录时会接收到此回调。
  78. *
  79. * \~english
  80. * Occurs when the current user account is logged in to another device.
  81. */
  82. - (void)userAccountDidLoginFromOtherDevice;
  83. /**
  84. * \~chinese
  85. * 当前登录账号已经被从服务器端删除时会收到该回调。
  86. *
  87. * \~english
  88. * Occurs when the current chat user is removed from the server.
  89. */
  90. - (void)userAccountDidRemoveFromServer;
  91. /**
  92. * \~chinese
  93. * 当前用户账号被禁用时会收到该回调。
  94. *
  95. * \~english
  96. * The delegate method will be invoked when the User account is forbidden.
  97. */
  98. - (void)userDidForbidByServer;
  99. /**
  100. * \~chinese
  101. * 当前登录账号被强制退出时会收到该回调,有以下原因:
  102. * - 密码被修改;
  103. * - 登录设备数过多;
  104. * - 服务被封禁;
  105. * - 被强制下线;
  106. *
  107. * \~english
  108. * The delegate method will be invoked when current IM account is forced to logout with the following reasons:
  109. * 1. The password is modified;
  110. * 2. Logged in too many devices;
  111. * 3. User for forbidden;
  112. * 4. Forced offline.
  113. */
  114. - (void)userAccountDidForcedToLogout:(EMError *_Nullable)aError;
  115. /**
  116. * \~chinese
  117. * token 即将过期 (使用声网 token 即 Agora Chat user token 登录)。
  118. *
  119. * \~english
  120. * token will expire (log in using agoraToken)
  121. */
  122. - (void)tokenWillExpire:(EMErrorCode)aErrorCode;
  123. /**
  124. * \~chinese
  125. * token已经过期 (使用声网token agoraToken 登录)
  126. *
  127. * \~english
  128. * token did expire (log in using agoraToken)
  129. */
  130. - (void)tokenDidExpire:(EMErrorCode)aErrorCode;
  131. @end