mirror of
https://github.com/WuKongIM/WuKongIMDocs
synced 2025-06-01 23:03:40 +00:00
feat: 修改文档和修改官网兼容手机模式
This commit is contained in:
parent
45721c6c80
commit
64e23b327c
6
.dumi/global.ts
Normal file
6
.dumi/global.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import Prism from 'prism-react-renderer/prism';
|
||||
|
||||
(typeof global !== 'undefined' ? global : window).Prism = Prism;
|
||||
|
||||
require('prismjs/components/prism-kotlin');
|
||||
require('prismjs/components/prism-java');
|
@ -38,7 +38,7 @@ const Home: any = () => {
|
||||
<div className={`card ${color}`}>
|
||||
<div className='bg'>
|
||||
<label className="big-font">特性</label>
|
||||
<div style={{ marginTop: '37px', marginLeft: '50px', marginRight: '50px' }}>
|
||||
<div style={{ marginTop: '37px'}}>
|
||||
<div style={{ display: 'flex' }}>
|
||||
<div className='card-item'>
|
||||
<img className="img" src='./././imgs/ic_no_dependency.png' />
|
||||
|
@ -56,7 +56,7 @@
|
||||
.center-title {
|
||||
font-weight: bold;
|
||||
font-size: 100px;
|
||||
margin-top: 10%;
|
||||
margin-top: 8rem;
|
||||
display: block;
|
||||
align-content: center;
|
||||
color: white;
|
||||
@ -69,11 +69,11 @@
|
||||
}
|
||||
|
||||
.des {
|
||||
margin-top: -150px;
|
||||
margin-top: -5rem;
|
||||
position: inherit;
|
||||
text-align: center;
|
||||
margin-left: 15%;
|
||||
width: 70%;
|
||||
margin-left: 10%;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.content {
|
||||
@ -86,7 +86,7 @@
|
||||
|
||||
.content-text {
|
||||
font-size: 14px;
|
||||
padding-top: 62px;
|
||||
margin-top: 5rem;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
line-height: 20px;
|
||||
@ -134,11 +134,13 @@
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
width: 33.33%;
|
||||
margin-right: 1rem;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
}
|
||||
|
||||
.big-font {
|
||||
@ -164,9 +166,6 @@
|
||||
|
||||
.characteristic-content {
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
|
@ -5,14 +5,14 @@ order: 200
|
||||
|
||||
## 设计理念
|
||||
|
||||
为了让开发者更快更方便的使用 SDK,悟空 SDK 提供了一个唯一的入口来访问 SDK 中的所有功能。就像书籍的目录一样可以通过目录查找对应的内容。如连接IM `WKIM.getInstance().getConnectionManager().connection()`
|
||||
为了让开发者更快更方便的使用 SDK,悟空 SDK 提供了一个唯一的入口来访问 SDK 中的所有功能。就像书籍的目录一样可以通过目录查找对应的内容。如连接 IM `WKIM.getInstance().getConnectionManager().connection()`
|
||||
|
||||
## 结构说明
|
||||
|
||||
 SDK 常用功能介绍
|
||||
```
|
||||
|
||||
```java
|
||||
|
||||
// 消息管理器
|
||||
// 负责消息的增删改查、新消息监听、刷新消息监听、消息入库、发送消息回执监听、监听同步某个聊天数据等
|
||||
WKIM.getInstance().getMsgManager()
|
||||
@ -58,7 +58,7 @@ WKIM.getInstance().getRobotManager()
|
||||
implementation 'com.github.WuKongIM:WuKongIMAndroidSDK:1.0.1'
|
||||
```
|
||||
|
||||
jitpack还需在主程序的`build.gradle`文件中添加:
|
||||
jitpack 还需在主程序的`build.gradle`文件中添加:
|
||||
|
||||
```
|
||||
allprojects {
|
||||
@ -68,11 +68,14 @@ allprojects {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**混淆**
|
||||
|
||||
```
|
||||
-dontwarn com.wukong.im.**
|
||||
-keep class com.wukong.im.**{*;}
|
||||
```
|
||||
|
||||
#### 通过 aar 文件集成
|
||||
|
||||
1、在项目主模块新建 Module,命名为`MyLibs`
|
||||
@ -169,7 +172,7 @@ WKIM.getInstance().getConnectionManager().addOnGetIpAndPortListener(new IGetIpAn
|
||||
```kotlin
|
||||
WKIM.getInstance().connectionManager.addOnGetIpAndPortListener { p0 ->
|
||||
p0!!.onGetSocketIpAndPort(
|
||||
"48.135.49.152",
|
||||
"172.0.0.0",
|
||||
6666
|
||||
)
|
||||
}
|
||||
@ -230,7 +233,7 @@ WKIM.getInstance().connectionManager.disconnect(isLogout)
|
||||
}
|
||||
```
|
||||
|
||||
- <font color='#999' size=2>更多连接状态请查看[状态码](/android#状态码)</font>
|
||||
- <font color='#999' size=2>更多连接状态请查看[状态码](/sdk/android#状态码)</font>
|
||||
|
||||
### 在线消息收发
|
||||
|
||||
@ -444,49 +447,6 @@ WKIM.getInstance().conversationManager.addOnSyncConversationListener { last_msg_
|
||||
}
|
||||
```
|
||||
|
||||
当进入某个聊天时,如果本地没有该 channel 的聊天记录需同步服务器聊天记录。
|
||||
|
||||
#### 监听同步某个频道的消息
|
||||
|
||||
`Java`
|
||||
|
||||
```java
|
||||
WKIM.getInstance().getMsgManager().addOnSyncChannelMsgListener(new ISyncChannelMsgListener() {
|
||||
@Override
|
||||
public void syncChannelMsgs(String channelID, byte channelType, long minMessageSeq, long maxMessageSeq, int limit, boolean reverse, ISyncChannelMsgBack iSyncChannelMsgBack) {
|
||||
/**
|
||||
* 同步某个频道的消息
|
||||
*
|
||||
* @param channelID 频道ID
|
||||
* @param channelType 频道类型
|
||||
* @param minMessageSeq 最小messageSeq
|
||||
* @param maxMessageSeq 最大messageSeq
|
||||
* @param limit 获取条数
|
||||
* @param reverse true:从maxMessageSeq往前获取。false:从minMessageSeq往后获取。
|
||||
* @param iSyncChannelMsgBack 请求返回
|
||||
*/
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
`Kotlin`
|
||||
|
||||
```kotlin
|
||||
WKIM.getInstance().msgManager.addOnSyncChannelMsgListener { channelID, channelType, minMessageSeq, maxMessageSeq, limit, reverse, iSyncChannelMsgBack ->
|
||||
/**
|
||||
* 同步某个频道的消息
|
||||
*
|
||||
* @param channelID 频道ID
|
||||
* @param channelType 频道类型
|
||||
* @param minMessageSeq 最小messageSeq
|
||||
* @param maxMessageSeq 最大messageSeq
|
||||
* @param limit 获取条数
|
||||
* @param reverse true:从maxMessageSeq往前获取。false:从minMessageSeq往后获取。
|
||||
* @param iSyncChannelMsgBack 请求返回
|
||||
*/
|
||||
}
|
||||
```
|
||||
|
||||
当在聊天页面中时用户可以上拉下拉,或者搜索查看聊天数据,对此悟空 sdk 提供了如下方法
|
||||
|
||||
#### 查看某个频道的聊天信息
|
||||
@ -516,20 +476,54 @@ WKIM.getInstance().getMsgManager().getOrSyncHistoryMessages(String channelId, by
|
||||
```kotlin
|
||||
WKIM.getInstance().msgManager.getOrSyncHistoryMessages(channelId,channelType,oldestOrderSeq,contain,dropDown,limit,aroundMsgOrderSeq,object :IGetOrSyncHistoryMsgBack{
|
||||
override fun onResult(list: MutableList<WKMsg>?) {
|
||||
// list 获取到的消息
|
||||
// list 获取到的消息 展示到UI
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
- <font color='#999' size=2>获取历史消息并不是同步方法,因为有可能存在非连续性时会往服务器同步数据</font>
|
||||
|
||||
如果本地没有该 channel 的聊天记录需同步服务器聊天记录,这时需监听获取 channel 消息事件
|
||||
|
||||
#### 监听同步某个频道的消息
|
||||
|
||||
`Java`
|
||||
|
||||
```java
|
||||
WKIM.getInstance().getMsgManager().addOnSyncChannelMsgListener(new ISyncChannelMsgListener() {
|
||||
@Override
|
||||
public void syncChannelMsgs(String channelID, byte channelType,long startMessageSeq, long endMessageSeq, int limit, int pullMode, ISyncChannelMsgBack iSyncChannelMsgBack) {
|
||||
/**
|
||||
* 同步某个频道的消息
|
||||
*
|
||||
* @param channelID 频道ID
|
||||
* @param channelType 频道类型
|
||||
* @param startMessageSeq 开始消息列号(结果包含start_message_seq的消息)
|
||||
* @param endMessageSeq 结束消息列号(结果不包含end_message_seq的消息)
|
||||
* @param limit 消息数量限制
|
||||
* @param pullMode 拉取模式 0:向下拉取 1:向上拉取
|
||||
* @param iSyncChannelMsgBack 请求返回
|
||||
*/
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
`Kotlin`
|
||||
|
||||
```kotlin
|
||||
WKIM.getInstance().msgManager.addOnSyncChannelMsgListener { channelID, channelType, startMessageSeq, endMessageSeq, limit, pullMode, iSyncChannelMsgBack ->
|
||||
// 调用接口获取channel历史消息
|
||||
// do ...
|
||||
}
|
||||
```
|
||||
|
||||
### 文本消息
|
||||
|
||||
`Java`
|
||||
|
||||
```java
|
||||
public class WKTextContent extends WKMessageContent {
|
||||
|
||||
|
||||
public WKTextContent(String content) {
|
||||
this.content = content;
|
||||
this.type = WKMsgContentType.WK_TEXT;
|
||||
@ -1565,6 +1559,7 @@ public class WKReminder {
|
||||
public int needUpload;
|
||||
}
|
||||
```
|
||||
|
||||
#### 操作数据
|
||||
|
||||
`Java`
|
||||
@ -1666,7 +1661,7 @@ WKIM.getInstance().reminderManager.addOnNewReminderListener("key",object :INewRe
|
||||
|
||||
<a href="https://github.com/WuKongIM/WuKongIMAndroidDemo" target="_blank">demo</a>
|
||||
|
||||
<a href="https://github.com/WuKongIM/WuKongIMAndroidSDK" target="_blank">sdk源码</a>
|
||||
<a href="https://github.com/WuKongIM/WuKongIMAndroidSDK" target="_blank">sdk 源码</a>
|
||||
|
||||
#### 说明
|
||||
|
||||
|
@ -19,6 +19,9 @@
|
||||
"prettier --write --no-error-on-unmatched-pattern"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"prism-react-renderer": "^2.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.1.2",
|
||||
"@commitlint/config-conventional": "^17.1.0",
|
||||
|
18
yarn.lock
18
yarn.lock
@ -1569,6 +1569,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-6.0.3.tgz#705bb349e789efa06f43f128cef51240753424cb"
|
||||
integrity sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==
|
||||
|
||||
"@types/prismjs@^1.26.0":
|
||||
version "1.26.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/prismjs/-/prismjs-1.26.0.tgz#a1c3809b0ad61c62cac6d4e0c56d610c910b7654"
|
||||
integrity sha512-ZTaqn/qSqUuAq1YwvOFQfVW1AR/oQJlLSZVustdjwI+GZ8kr0MSHBj0tsXPW1EqHubx50gtBEjbPGsdZwQwCjQ==
|
||||
|
||||
"@types/prop-types@*":
|
||||
version "15.7.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
|
||||
@ -2931,6 +2936,11 @@ cliui@^8.0.1:
|
||||
strip-ansi "^6.0.1"
|
||||
wrap-ansi "^7.0.0"
|
||||
|
||||
clsx@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12"
|
||||
integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==
|
||||
|
||||
codesandbox-import-util-types@^2.2.3:
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/codesandbox-import-util-types/-/codesandbox-import-util-types-2.2.3.tgz#b354b2f732ad130e119ebd9ead3bda3be5981a54"
|
||||
@ -7891,6 +7901,14 @@ prism-react-renderer@^1.3.5:
|
||||
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.3.5.tgz#786bb69aa6f73c32ba1ee813fbe17a0115435085"
|
||||
integrity sha512-IJ+MSwBWKG+SM3b2SUfdrhC+gu01QkV2KmRQgREThBfSQRoufqRfxfHUxpG1WcaFjP+kojcFyO9Qqtpgt3qLCg==
|
||||
|
||||
prism-react-renderer@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-2.0.5.tgz#14e2f06931412b42bc83ef0273a7d9c06f9bccfb"
|
||||
integrity sha512-VHTC2ZhOImeC3/mu/3TkEuRCa1K+kTCZQeCkwvWzQa01/ahU3dibyxWf3XiPLuO4k/rGjSTea1lEsfza6fMofw==
|
||||
dependencies:
|
||||
"@types/prismjs" "^1.26.0"
|
||||
clsx "^1.2.1"
|
||||
|
||||
prism-themes@^1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/prism-themes/-/prism-themes-1.9.0.tgz#19c034f3205f1e28d75d89728e54ccd745f7e3dd"
|
||||
|
Loading…
x
Reference in New Issue
Block a user