Skip to content

Commit

Permalink
Update ReactChatInputManager
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLipan committed Aug 28, 2018
1 parent f68602f commit ed6d73e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ReactNative/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'cn.jiguang.imui:messagelist:0.7.4'
compile 'cn.jiguang.imui:chatinput:0.8.2'
compile 'cn.jiguang.imui:chatinput:0.8.3'
compile 'pub.devrel:easypermissions:1.0.1'
compile 'org.greenrobot:eventbus:3.0.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public class ReactChatInputManager extends ViewGroupManager<ChatInputView> imple
private int mSoftKeyboardHeight;
private double mLineExpend = 0;
private int mScreenWidth;
private String mLastPhotoPath = "";
/**
* Initial soft input height, set this value via {@link #setMenuContainerHeight}
*/
Expand Down Expand Up @@ -335,6 +336,7 @@ public boolean switchToCameraMode() {
EasyPermissions.requestPermissions(activity,
activity.getResources().getString(R.string.rationale_camera),
RC_CAMERA, perms);
return false;
}
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(mChatInput.getId(),
SWITCH_TO_CAMERA_EVENT, null);
Expand Down Expand Up @@ -402,6 +404,12 @@ public void run() {
mChatInput.setOnCameraCallbackListener(new OnCameraCallbackListener() {
@Override
public void onTakePictureCompleted(String photoPath) {

if(mLastPhotoPath.equals(photoPath)){
return;
}
mLastPhotoPath = photoPath;

if (mChatInput.isFullScreen()) {
mContext.runOnUiQueueThread(new Runnable() {
@Override
Expand All @@ -422,6 +430,7 @@ public void run() {
event.putDouble("size", file.length());
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(mChatInput.getId(),
TAKE_PICTURE_EVENT, event);
mChatInput.dismissMenuLayout();
}

@Override
Expand Down

0 comments on commit ed6d73e

Please sign in to comment.