Skip to content

Commit 5b59596

Browse files
guangyaoguangyao
authored andcommitted
2 parents 8f12ee3 + c07a2d8 commit 5b59596

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ React Native的网易云信插件
33
## Demo
44
[react-native-chat-demo](https://github.com/reactnativecomponent/react-native-chat-demo)
55

6-
#### 注意: react-native版本需要0.40.0及以上
6+
#### 注意: react-native版本需要0.47.0及以上NIMSDK版本4.0以上
77

88
## 如何安装
99

@@ -215,21 +215,13 @@ import NIM from 'react-native-netease-im';
215215
```
216216

217217
### API
218-
#### NIM.login()
219-
```javascript
220-
// 登录参数
221-
{
222-
accid: "", //云信注册帐号
223-
  token:"" //登录的token
224-
}
225-
```
226-
返回一个`Promise`对象
218+
219+
参考[index.js](https://github.com/reactnativecomponent/react-native-netease-im/blob/master/index.js)
227220

228221
#### 监听会话
229222
```
230223
NativeAppEventEmitter.addListener("observeRecentContact",(data)=>{
231224
 console.log(data); //返回内容android和ios有区别
232225
});
233226
```
234-
更多接口请参阅`index.js`,或者参考Demo
235227

android/src/main/java/com/netease/im/MessageConstant.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static class Link {
8888
public static class Location {
8989
public final static String LATITUDE = "latitude";
9090
public final static String LONGITUDE = "longitude";
91-
public final static String ADDRESS = "address";
91+
public final static String ADDRESS = "title";
9292
}
9393

9494
public static class MediaFile {

android/src/main/java/com/netease/im/RNNeteaseImModule.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,11 +1945,20 @@ public void onNewIntent(Intent intent) {
19451945

19461946
}
19471947

1948+
public static String status = "";
1949+
19481950
@Override
19491951
public void onHostResume() {
19501952
if (reactContext.getCurrentActivity() != null)
19511953
LogUtil.w(TAG, reactContext.getCurrentActivity().getClass().getPackage().getName());
19521954
LogUtil.w(TAG, "onHostResume");
1955+
1956+
if (!TextUtils.isEmpty(status)) {
1957+
WritableMap r = Arguments.createMap();
1958+
r.putString("status", status);
1959+
ReactCache.emit(ReactCache.observeOnKick, r);
1960+
status = "";
1961+
}
19531962
}
19541963

19551964
@Override

android/src/main/java/com/netease/im/login/RecentContactObserver.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import com.facebook.react.bridge.Arguments;
66
import com.facebook.react.bridge.WritableMap;
7+
import com.netease.im.RNNeteaseImModule;
78
import com.netease.im.ReactCache;
89
import com.netease.im.uikit.cache.SimpleCallback;
910
import com.netease.im.uikit.cache.TeamDataCache;
@@ -279,6 +280,7 @@ public void onEvent(LoginSyncStatus loginSyncStatus) {
279280

280281
@Override
281282
public void onEvent(StatusCode code) {
283+
RNNeteaseImModule.status = "";
282284
if (code != PWD_ERROR && code.wontAutoLogin()) {
283285
WritableMap r = Arguments.createMap();
284286
String status = "";
@@ -293,6 +295,7 @@ public void onEvent(StatusCode code) {
293295
status = "2";
294296
break;
295297
}
298+
RNNeteaseImModule.status = status;
296299
r.putString("status", status);
297300
ReactCache.emit(ReactCache.observeOnKick, r);
298301
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{
33
"name": "react-native-netease-im",
4-
"version": "2.0.0",
4+
"version": "2.0.1",
55
"description": "网易云信ReactNative插件",
66
"main": "index.js",
77
"scripts": {

0 commit comments

Comments
 (0)