Skip to content

Commit 2687258

Browse files
committed
规范代码
1 parent 9766629 commit 2687258

File tree

8 files changed

+158
-205
lines changed

8 files changed

+158
-205
lines changed

Utils.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
'use strict'
2-
import { NativeModules,Platform, NetInfo } from 'react-native';
3-
4-
const { RNNeteaseIm,PinYin } = NativeModules;
2+
import { NativeModules,Platform, NetInfo } from 'react-native'
3+
const { RNNeteaseIm,PinYin } = NativeModules
54

65
class Utils {
76
/**
87
* 清除数据缓存
98
*/
109
cleanCache() {
11-
return RNNeteaseIm.cleanCache();
10+
return RNNeteaseIm.cleanCache()
1211
}
1312

1413
/**
1514
* 获取缓存大小
1615
*/
1716
getCacheSize() {
18-
return RNNeteaseIm.getCacheSize();
17+
return RNNeteaseIm.getCacheSize()
1918
}
2019

2120
/**
@@ -24,22 +23,19 @@ class Utils {
2423
networkIsConnected() {//0:无网络,1:有网络
2524
if (Platform.OS === 'ios') {
2625
if (RNNeteaseIm.getNetWorkStatus() === '1') {
27-
return true;
26+
return true
2827
}
29-
return false;
28+
return false
3029
} else {
31-
return NetInfo.isConnected.fetch().done();
30+
return NetInfo.isConnected.fetch().done()
3231
}
3332
}
34-
35-
/** ******************************播放 ****************************************** **/
36-
3733
/**
3834
* 播放录音
3935
* @returns {*}
4036
*/
4137
play(filepath) {
42-
return RNNeteaseIm.play(filepath);
38+
return RNNeteaseIm.play(filepath)
4339
}
4440

4541
/**
@@ -50,21 +46,21 @@ class Utils {
5046
*/
5147
playLocacl(name, type) {
5248
if (Platform.OS === 'ios') {
53-
return RNNeteaseIm.playLocal(name, type);
49+
return RNNeteaseIm.playLocal(name, type)
5450
}
55-
return RNNeteaseIm.playLocal('assets:///' + name + '.' + type, type);
51+
return RNNeteaseIm.playLocal('assets:///' + name + '.' + type, type)
5652
}
5753

5854
/**
5955
* 停止播放录音
6056
* @returns {*}
6157
*/
6258
stopPlay() {
63-
return RNNeteaseIm.stopPlay();
59+
return RNNeteaseIm.stopPlay()
6460
}
6561

6662
sortPinYin(o, key) {
67-
return PinYin.sortPinYin(o, key);
63+
return PinYin.sortPinYin(o, key)
6864
}
6965

7066

@@ -73,7 +69,7 @@ class Utils {
7369
* @returns {*}
7470
*/
7571
fetchNetInfo() {
76-
return RNNeteaseIm.fetchNetInfo();
72+
return RNNeteaseIm.fetchNetInfo()
7773
}
7874

7975
/**
@@ -82,9 +78,9 @@ class Utils {
8278
* @returns {*}
8379
*/
8480
setupWebViewUserAgent() {
85-
RNNeteaseIm.setupWebViewUserAgent();
81+
RNNeteaseIm.setupWebViewUserAgent()
8682
}
8783

8884
}
8985

90-
export default new Utils();
86+
export default new Utils()

im/Friend.js

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,71 @@
22
* Created by dowin on 2017/8/2.
33
*/
44
'use strict'
5-
import { NativeModules,Platform } from 'react-native';
6-
7-
const { RNNeteaseIm } = NativeModules;
5+
import { NativeModules,Platform } from 'react-native'
6+
const { RNNeteaseIm } = NativeModules
87
class Friend {
9-
/** ******************************好友用户资料****************************************** **/
108
/**
119
* 进入好友
1210
* @returns {*} @see observeFriend
1311
*/
1412
startFriendList(){
15-
return RNNeteaseIm.startFriendList();
13+
return RNNeteaseIm.startFriendList()
1614
}
17-
1815
/**
1916
* 退出好友
2017
* @returns {*}
2118
*/
2219
stopFriendList(){
23-
return RNNeteaseIm.stopFriendList();
20+
return RNNeteaseIm.stopFriendList()
2421
}
25-
2622
/**
2723
* 获取本地用户资料
2824
* @param contactId
2925
* @returns {*}
3026
*/
3127
getUserInfo(contactId){
32-
return RNNeteaseIm.getUserInfo(contactId);
28+
return RNNeteaseIm.getUserInfo(contactId)
3329
}
34-
3530
/**
3631
* 获取服务器用户资料
3732
* @param contactId
3833
* @returns {*}
3934
*/
4035
fetchUserInfo(contactId){
41-
return RNNeteaseIm.fetchUserInfo(contactId);
36+
return RNNeteaseIm.fetchUserInfo(contactId)
4237
}
4338
/**
4439
* 保存用户资料
4540
* @param contactId {'NIMUserInfoUpdateTagNick':'昵称'}
4641
* @returns {*}
4742
*/
4843
updateMyUserInfo(userInFo){
49-
return RNNeteaseIm.updateMyUserInfo(userInFo);
44+
return RNNeteaseIm.updateMyUserInfo(userInFo)
5045
}
5146
/**
5247
* 保存好友备注
5348
* @param contactId
5449
* @returns {*}
5550
*/
56-
updateUserInfo(contactId,alias){
57-
return RNNeteaseIm.updateUserInfo(contactId,alias);
51+
updateUserInfo(contactId, alias){
52+
return RNNeteaseIm.updateUserInfo(contactId, alias)
5853
}
5954
/**
6055
* 好友列表
6156
* @param keyword
6257
* @returns {*}
6358
*/
6459
getFriendList(keyword){
65-
return RNNeteaseIm.getFriendList(keyword);
60+
return RNNeteaseIm.getFriendList(keyword)
6661
}
6762
/**
6863
* 添加好友
6964
* @param contactId
7065
* @param msg 备注
7166
* @returns {*}
7267
*/
73-
addFriend(contactId,msg){
74-
return RNNeteaseIm.addFriend(contactId,msg);
68+
addFriend(contactId, msg){
69+
return RNNeteaseIm.addFriend(contactId, msg)
7570
}
7671

7772
/**
@@ -81,57 +76,51 @@ class Friend {
8176
* @param msg 备注
8277
* @returns {*}
8378
*/
84-
addFriendWithType(contactId,verifyType,msg){
85-
return RNNeteaseIm.addFriendWithType(contactId,verifyType,msg);
79+
addFriendWithType(contactId, verifyType, msg){
80+
return RNNeteaseIm.addFriendWithType(contactId, verifyType, msg);
8681
}
87-
8882
/**
8983
* 删除好友
9084
* @param contactId
9185
* @returns {*}
9286
*/
9387
deleteFriend(contactId){
94-
return RNNeteaseIm.deleteFriend(contactId);
88+
return RNNeteaseIm.deleteFriend(contactId)
9589
}
96-
/** ******************************blackList 黑名单****************************************** **/
97-
9890
/**
9991
* 进入黑名单列表
10092
* @returns {*} @see observeBlackList
10193
*/
10294
startBlackList(){
103-
return RNNeteaseIm.startBlackList();
95+
return RNNeteaseIm.startBlackList()
10496
}
105-
10697
/**
10798
* 退出黑名单列表
10899
* @returns {*}
109100
*/
110101
stopBlackList(){
111-
return RNNeteaseIm.stopBlackList();
102+
return RNNeteaseIm.stopBlackList()
112103
}
113104
/**
114105
* 获取黑名单列表
115106
* @returns {*}
116107
*/
117108
getBlackList(){
118-
return RNNeteaseIm.getBlackList();
109+
return RNNeteaseIm.getBlackList()
119110
}
120-
121111
/**
122112
* 加入黑名单
123113
* @returns {*}
124114
*/
125115
addToBlackList(contactId){
126-
return RNNeteaseIm.addToBlackList(contactId);
116+
return RNNeteaseIm.addToBlackList(contactId)
127117
}
128-
129118
/**
130119
* 移出黑名单
131120
* @returns {*}
132121
*/
133122
removeFromBlackList(contactId){
134-
return RNNeteaseIm.removeFromBlackList(contactId);
123+
return RNNeteaseIm.removeFromBlackList(contactId)
135124
}
136125
}
137-
export default new Friend();
126+
export default new Friend()

im/Listener.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)