Skip to content

Commit cbcecf6

Browse files
Merge pull request #14 from jpush/dev
Dev
2 parents 52afdea + dc607e3 commit cbcecf6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1309
-3306
lines changed

android/src/io/jchat/android/JMessageModule.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public boolean canOverrideExistingModule() {
104104
}
105105

106106
@ReactMethod
107-
public void init(ReadableMap map) {
107+
public void setup(ReadableMap map) {
108108
try {
109109
boolean isOpenMessageRoaming = map.getBoolean(Constant.IS_OPEN_MESSAGE_ROAMING);
110110
JMessageClient.init(getReactApplicationContext(), isOpenMessageRoaming);
@@ -1167,6 +1167,34 @@ public void resetUnreadMessageCount(ReadableMap map, Callback success, Callback
11671167
}
11681168
}
11691169

1170+
@ReactMethod
1171+
public void downloadThumbUserAvatar(ReadableMap map, final Callback success, final Callback fail) {
1172+
try {
1173+
final String username = map.getString(Constant.USERNAME);
1174+
final String appKey = map.hasKey(Constant.APP_KEY) ? map.getString(Constant.APP_KEY) : "";
1175+
JMessageClient.getUserInfo(username, appKey, new GetUserInfoCallback() {
1176+
@Override
1177+
public void gotResult(int status, String desc, UserInfo userInfo) {
1178+
if (status == 0) {
1179+
if (userInfo.getAvatar() != null) {
1180+
File file = userInfo.getAvatarFile();
1181+
WritableMap result = Arguments.createMap();
1182+
result.putString(Constant.USERNAME, username);
1183+
result.putString(Constant.APP_KEY, appKey);
1184+
result.putString(Constant.FILE_PATH, file.getAbsolutePath());
1185+
mJMessageUtils.handleCallbackWithObject(status, desc, success, fail, result);
1186+
}
1187+
} else {
1188+
mJMessageUtils.handleError(fail, status, desc);
1189+
}
1190+
}
1191+
});
1192+
} catch (Exception e) {
1193+
e.printStackTrace();
1194+
mJMessageUtils.handleError(fail, ERR_CODE_PARAMETER, ERR_MSG_PARAMETER);
1195+
}
1196+
}
1197+
11701198
public void onEvent(LoginStateChangeEvent event) {
11711199
Log.d(TAG, "登录状态改变事件:event = " + event.toString());
11721200
WritableMap map = Arguments.createMap();

android/src/io/jchat/android/utils/ResultUtils.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static WritableMap toJSObject(Map<String, String> map) {
5959

6060
public static WritableMap toJSObject(final UserInfo userInfo) {
6161
if (userInfo == null) {
62-
return null;
62+
return Arguments.createMap();
6363
}
6464
final WritableMap result = Arguments.createMap();
6565
result.putString("type", "user");
@@ -109,7 +109,7 @@ public static WritableMap toJSObject(GroupInfo groupInfo) {
109109
public static WritableMap toJSObject(Message msg) {
110110
WritableMap result = Arguments.createMap();
111111
try {
112-
result.putInt("id", msg.getId());
112+
result.putString("id", String.valueOf(msg.getId()));
113113
result.putMap("from", toJSObject(msg.getFromUser()));
114114

115115
if (msg.getDirect() == MessageDirect.send) {
@@ -127,8 +127,6 @@ public static WritableMap toJSObject(Message msg) {
127127
MessageContent content = msg.getContent();
128128
if (content.getStringExtras() != null) {
129129
result.putMap("extras", toJSObject(content.getStringExtras()));
130-
} else {
131-
result.putNull("extras");
132130
}
133131

134132
result.putDouble("createTime", msg.getCreateTime());
@@ -195,13 +193,11 @@ public static WritableMap toJSObject(Conversation conversation) {
195193

196194
try {
197195
map.putString("title", conversation.getTitle());
198-
map.putString("conversationType", conversation.getType().getLabel());
196+
map.putString("conversationType", conversation.getType().name());
199197
map.putInt("unreadCount", conversation.getUnReadMsgCnt());
200198

201199
if (conversation.getLatestMessage() != null) {
202200
map.putMap("latestMessage", toJSObject(conversation.getLatestMessage()));
203-
} else {
204-
map.putNull("latestMessage");
205201
}
206202

207203
if (conversation.getType() == ConversationType.single) {

example/android/app/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
android:theme="@style/AppTheme">
1919
<activity
2020
android:name=".MainActivity"
21+
android:windowSoftInputMode="adjustResize"
2122
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
2223
android:label="@string/app_name">
2324
<intent-filter>

example/android/app/app.iml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
7777
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
7878
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
79+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes-jar" />
7980
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
8081
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
8182
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
@@ -92,43 +93,49 @@
9293
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
9394
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
9495
</content>
95-
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
96+
<orderEntry type="jdk" jdkName="Android API 25 Platform (1)" jdkType="Android SDK" />
9697
<orderEntry type="sourceFolder" forTests="false" />
9798
<orderEntry type="library" name="okio-1.9.0" level="project" />
98-
<orderEntry type="library" name="drawee-0.11.0" level="project" />
99+
<orderEntry type="library" name="chatinput-0.4.7" level="project" />
100+
<orderEntry type="library" name="imagepipeline-base-1.0.1" level="project" />
99101
<orderEntry type="library" name="textlayoutbuilder-1.0.0" level="project" />
100-
<orderEntry type="library" name="fresco-0.11.0" level="project" />
102+
<orderEntry type="library" name="gson-2.8.0" level="project" />
101103
<orderEntry type="library" name="jsr305-3.0.0" level="project" />
104+
<orderEntry type="library" name="transition-25.3.1" level="project" />
105+
<orderEntry type="library" name="design-25.3.1" level="project" />
102106
<orderEntry type="library" name="bolts-tasks-1.4.0" level="project" />
103107
<orderEntry type="library" name="support-core-ui-25.3.1" level="project" />
108+
<orderEntry type="library" name="drawee-1.0.1" level="project" />
109+
<orderEntry type="library" name="fbcore-1.0.1" level="project" />
104110
<orderEntry type="library" name="okhttp-urlconnection-3.4.1" level="project" />
105111
<orderEntry type="library" name="android-jsc-r174650" level="project" />
106112
<orderEntry type="library" name="staticlayout-proxy-1.0" level="project" />
107-
<orderEntry type="library" name="recyclerview-v7-23.4.0" level="project" />
113+
<orderEntry type="library" name="imagepipeline-okhttp3-1.0.1" level="project" />
114+
<orderEntry type="library" name="glide-3.7.0" level="project" />
108115
<orderEntry type="library" name="support-core-utils-25.3.1" level="project" />
109-
<orderEntry type="library" name="fbcore-0.11.0" level="project" />
110116
<orderEntry type="library" name="support-fragment-25.3.1" level="project" />
111-
<orderEntry type="library" name="imagepipeline-0.11.0" level="project" />
112-
<orderEntry type="library" name="library-2.4.0" level="project" />
117+
<orderEntry type="library" name="fresco-1.0.1" level="project" />
113118
<orderEntry type="library" name="jmessage-android_v2.2.1" level="project" />
114-
<orderEntry type="library" name="imagepipeline-base-0.11.0" level="project" />
115119
<orderEntry type="library" name="soloader-0.1.0" level="project" />
120+
<orderEntry type="library" name="imagepipeline-1.0.1" level="project" />
116121
<orderEntry type="library" name="javax.inject-1" level="project" />
122+
<orderEntry type="library" name="eventbus-3.0.0" level="project" />
123+
<orderEntry type="library" name="messagelist-0.4.8" level="project" />
124+
<orderEntry type="library" name="flexbox-0.2.5" level="project" />
117125
<orderEntry type="library" name="okhttp-ws-3.4.1" level="project" />
118126
<orderEntry type="library" name="support-v4-25.3.1" level="project" />
119127
<orderEntry type="library" name="support-media-compat-25.3.1" level="project" />
120128
<orderEntry type="library" name="okhttp-3.4.1" level="project" />
129+
<orderEntry type="library" name="react-native-0.44.2" level="project" />
121130
<orderEntry type="library" name="jcore-android-1.1.6" level="project" />
122-
<orderEntry type="library" name="imagepipeline-okhttp3-0.11.0" level="project" />
123-
<orderEntry type="library" name="react-native-0.41.0" level="project" />
131+
<orderEntry type="library" name="recyclerview-v7-25.3.1" level="project" />
124132
<orderEntry type="library" name="support-annotations-25.3.1" level="project" />
125133
<orderEntry type="library" name="appcompat-v7-25.3.1" level="project" />
126134
<orderEntry type="library" name="support-vector-drawable-25.3.1" level="project" />
127135
<orderEntry type="library" name="animated-vector-drawable-25.3.1" level="project" />
128136
<orderEntry type="library" name="support-compat-25.3.1" level="project" />
129137
<orderEntry type="module" module-name="jcore-react-native" />
130-
<orderEntry type="module" module-name="react-native-dialog" />
131-
<orderEntry type="module" module-name="react-native-svg" />
138+
<orderEntry type="module" module-name="aurora-imui-react-native" />
132139
<orderEntry type="module" module-name="jmessage-react-plugin" />
133140
</component>
134141
</module>

example/android/app/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
apply plugin: "com.android.application"
2-
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
32

43
import com.android.build.OutputFile
54

@@ -142,10 +141,9 @@ android {
142141
}
143142

144143
dependencies {
145-
compile project(':react-native-svg')
146-
compile project(':react-native-dialog')
147144
compile project(':jmessage-react-plugin')
148145
compile project(':jcore-react-native')
146+
compile project(':aurora-imui-react-native')
149147
compile fileTree(dir: "libs", include: ["*.jar"])
150148
compile "com.android.support:appcompat-v7:25.3.1"
151149
compile "com.facebook.react:react-native:+" // From node_modules
25.9 KB
Loading
1.04 KB
Loading

example/android/app/src/com/sample/application/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity {
1010
*/
1111
@Override
1212
protected String getMainComponentName() {
13-
return "TestReactJChat";
13+
return "ReactJChat";
1414
}
1515
}

example/android/app/src/com/sample/application/MainApplication.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55

66
import com.facebook.react.ReactApplication;
77

8+
import cn.jiguang.imui.messagelist.ReactIMUIPackage;
89
import cn.jpush.im.android.api.JMessageClient;
910
import io.jchat.android.JMessageReactPackage;
1011

1112
import com.facebook.react.ReactNativeHost;
1213
import com.facebook.react.ReactPackage;
1314
import com.facebook.react.shell.MainReactPackage;
1415
import com.facebook.soloader.SoLoader;
15-
import com.honaf.dialog.MyDialogPackage;
16-
import com.horcrux.svg.SvgPackage;
1716

1817
import java.util.Arrays;
1918
import java.util.List;
@@ -33,8 +32,7 @@ protected List<ReactPackage> getPackages() {
3332
return Arrays.<ReactPackage>asList(
3433
new MainReactPackage(),
3534
new JMessageReactPackage(SHUTDOWN_TOAST),
36-
new MyDialogPackage(),
37-
new SvgPackage()
35+
new ReactIMUIPackage()
3836
);
3937
}
4038
};

example/android/settings.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
rootProject.name = 'TestReactJChat'
2-
include ':react-native-svg'
3-
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
4-
include ':react-native-dialog'
5-
project(':react-native-dialog').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dialog/android')
62
include ':jmessage-react-plugin'
73
project(':jmessage-react-plugin').projectDir = new File(rootProject.projectDir, '../node_modules/jmessage-react-plugin/android')
84
include ':jcore-react-native'
95
project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')
10-
include ':app'
6+
include ':app', ':aurora-imui-react-native'
7+
project(':aurora-imui-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/aurora-imui-react-native/ReactNative/android')
8+

0 commit comments

Comments
 (0)