Skip to content

Commit 46a575f

Browse files
committed
change LogUtil
1 parent 3fd2d77 commit 46a575f

24 files changed

+108
-95
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,28 @@ protected Void doInBackground(Void... params) {
5656
long allLength = 0;
5757
for (String s : pathList) {
5858
long t = makeDirSize(new File(s));
59-
LogUtil.i(TAG, s + ":" + FileUtil.formatFileSize(t));
59+
LogUtil.w(TAG, s + ":" + FileUtil.formatFileSize(t));
6060
allLength += t;
6161
}
62-
LogUtil.i(TAG, "allFile" + ":" + FileUtil.formatFileSize(allLength));
62+
LogUtil.w(TAG, "allFile" + ":" + FileUtil.formatFileSize(allLength));
6363
final long finalAllLength = allLength;
6464
getCacheSize(new IPackageStatsObserver.Stub() {
6565
@Override
6666
public void onGetStatsCompleted(PackageStats pStats, boolean succeeded) throws RemoteException {
6767

68-
LogUtil.i(TAG, "cacheSize" + ":" + FileUtil.formatFileSize(pStats.cacheSize));
69-
LogUtil.i(TAG, "externalCacheSize" + ":" + FileUtil.formatFileSize(pStats.externalCacheSize));
68+
LogUtil.w(TAG, "cacheSize" + ":" + FileUtil.formatFileSize(pStats.cacheSize));
69+
LogUtil.w(TAG, "externalCacheSize" + ":" + FileUtil.formatFileSize(pStats.externalCacheSize));
7070

71-
// LogUtil.i(TAG, "codeSize" + ":" + FileUtil.formatFileSize(pStats.codeSize));
72-
// LogUtil.i(TAG, "dataSize" + ":" + FileUtil.formatFileSize(pStats.dataSize));
73-
// LogUtil.i(TAG, "externalCodeSize" + ":" + FileUtil.formatFileSize(pStats.externalCodeSize));
74-
// LogUtil.i(TAG, "externalDataSize" + ":" + FileUtil.formatFileSize(pStats.externalDataSize));
75-
// LogUtil.i(TAG, "externalMediaSize" + ":" + FileUtil.formatFileSize(pStats.externalMediaSize));
76-
// LogUtil.i(TAG, "externalObbSize" + ":" + FileUtil.formatFileSize(pStats.externalObbSize));
71+
// LogUtil.w(TAG, "codeSize" + ":" + FileUtil.formatFileSize(pStats.codeSize));
72+
// LogUtil.w(TAG, "dataSize" + ":" + FileUtil.formatFileSize(pStats.dataSize));
73+
// LogUtil.w(TAG, "externalCodeSize" + ":" + FileUtil.formatFileSize(pStats.externalCodeSize));
74+
// LogUtil.w(TAG, "externalDataSize" + ":" + FileUtil.formatFileSize(pStats.externalDataSize));
75+
// LogUtil.w(TAG, "externalMediaSize" + ":" + FileUtil.formatFileSize(pStats.externalMediaSize));
76+
// LogUtil.w(TAG, "externalObbSize" + ":" + FileUtil.formatFileSize(pStats.externalObbSize));
7777
long result = finalAllLength;
7878
result += pStats.cacheSize;
7979
result += pStats.externalCacheSize;
80-
// LogUtil.i(TAG, "result" + ":" + FileUtil.formatFileSize(result));
80+
// LogUtil.w(TAG, "result" + ":" + FileUtil.formatFileSize(result));
8181
if (observer != null) {
8282
observer.onGetCacheSize(Long.toString(result / (1024 * 1024)));
8383
}
@@ -103,8 +103,8 @@ protected Void doInBackground(Void... params) {
103103

104104
@Override
105105
public void onRemoveCompleted(String packageName, boolean succeeded) throws RemoteException {
106-
LogUtil.i(TAG, "result" + ":" + packageName);
107-
LogUtil.i(TAG, "result" + ":" + succeeded);
106+
LogUtil.w(TAG, "result" + ":" + packageName);
107+
LogUtil.w(TAG, "result" + ":" + succeeded);
108108
if (observer != null) {
109109
observer.onCleanCache(succeeded);
110110
}
@@ -161,7 +161,7 @@ private static void getCacheSize(IPackageStatsObserver.Stub observer) {
161161
String pkg = context.getPackageName();
162162
PackageManager pm = context.getPackageManager();
163163
try {
164-
LogUtil.i(TAG, "name:" + pm.getClass().getName());
164+
LogUtil.w(TAG, "name:" + pm.getClass().getName());
165165
Method getPackageSizeInfo = pm.getClass().getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class);
166166
getPackageSizeInfo.invoke(pm, pkg, observer);
167167
} catch (Exception ex) {
@@ -211,7 +211,7 @@ private static void freeStorageAndNotify(IPackageDataObserver.Stub observer) {
211211
try {
212212
Context context = IMApplication.getContext();
213213
PackageManager pm = context.getPackageManager();
214-
LogUtil.i(TAG, "name:" + pm.getClass().getName());
214+
LogUtil.w(TAG, "name:" + pm.getClass().getName());
215215
Method localMethod = pm.getClass().getMethod("freeStorageAndNotify", Long.TYPE,
216216
IPackageDataObserver.class);
217217
long localLong = Long.valueOf(getEnvironmentSize() - 1L);

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

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ public RNNeteaseImModule(ReactApplicationContext reactContext) {
114114

115115
@Override
116116
public void initialize() {
117-
LogUtil.i(TAG, "initialize");
117+
LogUtil.w(TAG, "initialize");
118118
}
119119

120120
@Override
121121
public void onCatalystInstanceDestroy() {
122-
LogUtil.i(TAG, "onCatalystInstanceDestroy");
122+
LogUtil.w(TAG, "onCatalystInstanceDestroy");
123123
}
124124

125125
@Override
@@ -129,7 +129,7 @@ public String getName() {
129129

130130
@ReactMethod
131131
public void init(Promise promise) {
132-
LogUtil.i(TAG, "init");
132+
LogUtil.w(TAG, "init");
133133
promise.resolve("200");
134134
}
135135

@@ -142,9 +142,10 @@ public void init(Promise promise) {
142142
*/
143143
@ReactMethod
144144
public void login(String contactId, String token, final Promise promise) {
145-
// LogUtil.i(TAG, "contactId:" + contactId);
146-
// LogUtil.i(TAG, "token:" + token);
147-
// LogUtil.i(TAG, "md5:" + MD5.getStringMD5(token));
145+
LogUtil.w(TAG, "_id:" + contactId);
146+
LogUtil.w(TAG, "t:" + token);
147+
// LogUtil.w(TAG, "md5:" + MD5.getStringMD5(token));
148+
148149
NIMClient.getService(AuthService.class).openLocalCache(contactId);
149150
LoginService.getInstance().login(new LoginInfo(contactId, token), new RequestCallback<LoginInfo>() {
150151
@Override
@@ -178,7 +179,7 @@ public void onException(Throwable throwable) {
178179
*/
179180
@ReactMethod
180181
public void logout() {
181-
LogUtil.i(TAG, "logout");
182+
LogUtil.w(TAG, "logout");
182183
LoginService.getInstance().logout();
183184

184185
}
@@ -193,7 +194,7 @@ public void logout() {
193194
*/
194195
@ReactMethod
195196
public void startFriendList(final Promise promise) {
196-
LogUtil.i(TAG, "startFriendList");
197+
LogUtil.w(TAG, "startFriendList");
197198
friendObserver.startFriendList();
198199

199200
}
@@ -205,7 +206,7 @@ public void startFriendList(final Promise promise) {
205206
*/
206207
@ReactMethod
207208
public void stopFriendList(final Promise promise) {
208-
LogUtil.i(TAG, "stopFriendList");
209+
LogUtil.w(TAG, "stopFriendList");
209210
friendObserver.stopFriendList();
210211
}
211212

@@ -217,7 +218,7 @@ public void stopFriendList(final Promise promise) {
217218
*/
218219
@ReactMethod
219220
public void getUserInfo(String contactId, final Promise promise) {
220-
LogUtil.i(TAG, "getUserInfo" + contactId);
221+
LogUtil.w(TAG, "getUserInfo" + contactId);
221222
NimUserInfo userInfo = NimUserInfoCache.getInstance().getUserInfo(contactId);
222223
promise.resolve(ReactCache.createUserInfo(userInfo));
223224
}
@@ -230,7 +231,7 @@ public void getUserInfo(String contactId, final Promise promise) {
230231
*/
231232
@ReactMethod
232233
public void fetchUserInfo(String contactId, final Promise promise) {
233-
LogUtil.i(TAG, "fetchUserInfo" + contactId);
234+
LogUtil.w(TAG, "fetchUserInfo" + contactId);
234235
NimUserInfoCache.getInstance().getUserInfoFromRemote(contactId, new RequestCallbackWrapper<NimUserInfo>() {
235236
@Override
236237
public void onResult(int i, NimUserInfo userInfo, Throwable throwable) {
@@ -254,7 +255,7 @@ public void addFriendWithType(final String contactId, String verifyType, String
254255
if ("1".equals(verifyType)) {
255256
verifyTypeAdd = VerifyType.DIRECT_ADD;
256257
}
257-
LogUtil.i(TAG, "addFriend" + contactId);
258+
LogUtil.w(TAG, "addFriend" + contactId);
258259
NIMClient.getService(FriendService.class).addFriend(new AddFriendData(contactId, verifyTypeAdd, msg))
259260
.setCallback(new RequestCallbackWrapper<Void>() {
260261
@Override
@@ -279,7 +280,7 @@ public void onResult(int code, Void aVoid, Throwable throwable) {
279280
*/
280281
@ReactMethod
281282
public void addFriend(final String contactId, String msg, final Promise promise) {
282-
LogUtil.i(TAG, "addFriend" + contactId);
283+
LogUtil.w(TAG, "addFriend" + contactId);
283284
NIMClient.getService(FriendService.class).addFriend(new AddFriendData(contactId, VerifyType.VERIFY_REQUEST, msg))
284285
.setCallback(new RequestCallbackWrapper<Void>() {
285286
@Override
@@ -303,7 +304,7 @@ public void onResult(int code, Void aVoid, Throwable throwable) {
303304
*/
304305
@ReactMethod
305306
public void deleteFriend(String contactId, final Promise promise) {
306-
LogUtil.i(TAG, "deleteFriend" + contactId);
307+
LogUtil.w(TAG, "deleteFriend" + contactId);
307308
NIMClient.getService(FriendService.class).deleteFriend(contactId)
308309
.setCallback(new RequestCallbackWrapper<Void>() {
309310
@Override
@@ -645,7 +646,7 @@ public void onResult(boolean success, TeamMember member) {
645646
*/
646647
@ReactMethod
647648
public void createTeam(ReadableMap fields, String type, ReadableArray accounts, final Promise promise) {
648-
LogUtil.i(TAG, fields + "\n" + type + "\n" + accounts);
649+
LogUtil.w(TAG, fields + "\n" + type + "\n" + accounts);
649650
TeamTypeEnum teamTypeEnum = TeamTypeEnum.Advanced;
650651
try {
651652
teamTypeEnum = TeamTypeEnum.typeOfValue(Integer.parseInt(type));
@@ -1042,7 +1043,7 @@ public void onResult(int code, Void aVoid, Throwable throwable) {
10421043
*/
10431044
@ReactMethod
10441045
public void sendTextMessage(String content, ReadableArray atUserIds, final Promise promise) {
1045-
LogUtil.i(TAG, "sendTextMessage" + content);
1046+
LogUtil.w(TAG, "sendTextMessage" + content);
10461047

10471048
List<String> atUserIdList = array2ListString(atUserIds);
10481049
sessionService.sendTextMessage(content, atUserIdList, new SessionService.OnSendMessageListener() {
@@ -1055,7 +1056,7 @@ public int onResult(int code, IMMessage message) {
10551056
}
10561057

10571058
public void sendTextMessage(String content, final Promise promise) {
1058-
LogUtil.i(TAG, "sendTextMessage" + content);
1059+
LogUtil.w(TAG, "sendTextMessage" + content);
10591060
sessionService.sendTextMessage(content, null, new SessionService.OnSendMessageListener() {
10601061
@Override
10611062
public int onResult(int code, IMMessage message) {
@@ -1220,7 +1221,7 @@ public int onResult(int code, IMMessage message) {
12201221
*/
12211222
@ReactMethod
12221223
public void sendForwardMessage(String messageId, final String sessionId, final String sessionType, final String content, final Promise promise) {
1223-
LogUtil.i(TAG, "sendForwardMessage" + content);
1224+
LogUtil.w(TAG, "sendForwardMessage" + content);
12241225

12251226
sessionService.queryMessage(messageId, new SessionService.OnMessageQueryListener() {
12261227
@Override
@@ -1252,7 +1253,7 @@ public int onResult(int code, IMMessage message) {
12521253
*/
12531254
@ReactMethod
12541255
public void revokeMessage(String messageId, final Promise promise) {
1255-
LogUtil.i(TAG, "revokeMessage" + messageId);
1256+
LogUtil.w(TAG, "revokeMessage" + messageId);
12561257
sessionService.queryMessage(messageId, new SessionService.OnMessageQueryListener() {
12571258

12581259
@Override
@@ -1290,7 +1291,7 @@ public int onResult(int code, IMMessage message) {
12901291
*/
12911292
@ReactMethod
12921293
public void deleteMessage(String messageId, final Promise promise) {
1293-
LogUtil.i(TAG, "deleteMessage" + messageId);
1294+
LogUtil.w(TAG, "deleteMessage" + messageId);
12941295
sessionService.queryMessage(messageId, new SessionService.OnMessageQueryListener() {
12951296

12961297
@Override
@@ -1365,7 +1366,7 @@ public void onResult(int code, Void aVoid, Throwable throwable) {
13651366
*/
13661367
@ReactMethod
13671368
public void resendMessage(String messageId, final Promise promise) {
1368-
LogUtil.i(TAG, "resendMessage" + messageId);
1369+
LogUtil.w(TAG, "resendMessage" + messageId);
13691370
sessionService.resendMessage(messageId);
13701371
}
13711372

@@ -1377,7 +1378,7 @@ public void resendMessage(String messageId, final Promise promise) {
13771378
*/
13781379
@ReactMethod
13791380
public void deleteRecentContact(String rContactId, Promise promise) {
1380-
LogUtil.i(TAG, "deleteRecentContact" + rContactId);
1381+
LogUtil.w(TAG, "deleteRecentContact" + rContactId);
13811382
boolean result = LoginService.getInstance().deleteRecentContact(rContactId);
13821383
if (result) {
13831384
promise.resolve("" + ResponseCode.RES_SUCCESS);
@@ -1439,7 +1440,7 @@ public void updateData(ContactDataList datas) {
14391440
*/
14401441
@ReactMethod
14411442
public void startSession(String sessionId, String type, final Promise promise) {
1442-
LogUtil.i(TAG, "startSession" + sessionId);
1443+
LogUtil.w(TAG, "startSession" + sessionId);
14431444
if (TextUtils.isEmpty(sessionId)) {
14441445

14451446
return;
@@ -1454,7 +1455,7 @@ public void startSession(String sessionId, String type, final Promise promise) {
14541455
*/
14551456
@ReactMethod
14561457
public void stopSession(final Promise promise) {
1457-
LogUtil.i(TAG, "stopSession");
1458+
LogUtil.w(TAG, "stopSession");
14581459
sessionService.stopSession();
14591460
}
14601461

@@ -1472,7 +1473,7 @@ public void stopSession(final Promise promise) {
14721473
@ReactMethod
14731474
public void queryMessageListHistory(String sessionId, String sessionType, String
14741475
timeLong, String direction, int limit, String asc, final Promise promise) {
1475-
LogUtil.i(TAG, "queryMessageListHistory");
1476+
LogUtil.w(TAG, "queryMessageListHistory");
14761477
long time = 0;
14771478
try {
14781479
time = Long.parseLong(timeLong);
@@ -1509,7 +1510,7 @@ public void onResult(int code, List<IMMessage> result, Throwable exception) {
15091510
*/
15101511
@ReactMethod
15111512
public void queryMessageListEx(String messageId, final int limit, final Promise promise) {
1512-
LogUtil.i(TAG, "queryMessageListEx:" + messageId + "(" + limit + ")");
1513+
LogUtil.w(TAG, "queryMessageListEx:" + messageId + "(" + limit + ")");
15131514
sessionService.queryMessage(messageId, new SessionService.OnMessageQueryListener() {
15141515
@Override
15151516
public int onResult(int code, IMMessage message) {
@@ -1644,15 +1645,15 @@ public void play(String audioFile, Promise promise) {
16441645
public void playLocal(String resourceFile, String type, Promise promise) {
16451646

16461647
Uri uri = Uri.parse(resourceFile);
1647-
LogUtil.i(TAG, "scheme:" + uri.getScheme());
1648+
LogUtil.w(TAG, "scheme:" + uri.getScheme());
16481649
String filePath = uri.getPath();
16491650
if (filePath.startsWith("/")) {
16501651
filePath = filePath.substring(1);
16511652
if (filePath.indexOf(".") == -1) {
16521653
filePath = filePath + "." + type;
16531654
}
16541655
}
1655-
LogUtil.i(TAG, "path:" + filePath);
1656+
LogUtil.w(TAG, "path:" + filePath);
16561657
audioPlayService.playAudio(handler, reactContext, AudioManager.STREAM_RING, uri.getScheme(), filePath);
16571658
}
16581659

@@ -1810,7 +1811,7 @@ public void onResult(int code, Void aVoid, Throwable throwable) {
18101811
*/
18111812
@ReactMethod
18121813
public void ackAddFriendRequest(String messageId, final String contactId, String pass, String timestamp, final Promise promise) {
1813-
LogUtil.i(TAG, "ackAddFriendRequest" + contactId);
1814+
LogUtil.w(TAG, "ackAddFriendRequest" + contactId);
18141815
long messageIdLong = 0L;
18151816
try {
18161817
messageIdLong = Long.parseLong(messageId);
@@ -1913,29 +1914,31 @@ public void run() {
19131914

19141915
@Override
19151916
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
1916-
LogUtil.i(TAG, "onActivityResult:" + requestCode + "-result:" + resultCode);
1917+
LogUtil.w(TAG, "onActivityResult:" + requestCode + "-result:" + resultCode);
19171918
}
19181919

19191920
@Override
19201921
public void onNewIntent(Intent intent) {
19211922

1922-
LogUtil.i(TAG, "onNewIntent:" + intent);
1923+
LogUtil.w(TAG, "onNewIntent:" + intent);
19231924
// ReceiverMsgParser.openIntent(intent);
19241925

19251926
}
19261927

19271928
@Override
19281929
public void onHostResume() {
1929-
LogUtil.i(TAG, "onHostResume");
1930+
if (reactContext.getCurrentActivity() != null)
1931+
LogUtil.w(TAG, reactContext.getCurrentActivity().getClass().getPackage().getName());
1932+
LogUtil.w(TAG, "onHostResume");
19301933
}
19311934

19321935
@Override
19331936
public void onHostPause() {
1934-
LogUtil.i(TAG, "onHostPause");
1937+
LogUtil.w(TAG, "onHostPause");
19351938
}
19361939

19371940
@Override
19381941
public void onHostDestroy() {
1939-
LogUtil.i(TAG, "onHostDestroy");
1942+
LogUtil.w(TAG, "onHostDestroy");
19401943
}
19411944
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class RNNeteaseImPackage implements ReactPackage {
1414
@Override
1515
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
1616
return Arrays.<NativeModule>asList(
17-
new RNAppCacheUtilModule(reactContext),
17+
// new RNAppCacheUtilModule(reactContext),
1818
new RNNeteaseImModule(reactContext));
1919
}
2020

0 commit comments

Comments
 (0)