When a conversation was already open it affected the file sharing process.

This commit is contained in:
Lyndon
2017-11-06 18:14:34 +01:00
parent ff088cb2e4
commit 5e0a3a8d65
5 changed files with 69 additions and 6 deletions

View File

@@ -628,4 +628,20 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
startActivity(new Intent(this, MainActivity.class));
}
@Override
protected void onNewIntent(Intent intent) {
boolean test = intent.getBooleanExtra("TEST_EXTRA", false);
if(test) {
Group group = intent.getParcelableExtra(GROUP_ARG);
if(group != null) {
finish();
startActivity(intent);
}
}
super.onNewIntent(intent);
}
}

View File

@@ -122,6 +122,22 @@ public class GroupChatActivity extends BaseChatActivity {
startActivity(ChatMembersActivity.createIntent(this, mGroup));
}
// @Override
// protected void onNewIntent(Intent intent) {
// boolean test = intent.getBooleanExtra("TEST_EXTRA", false);
//
// if(test) {
// Group group = intent.getParcelableExtra(GROUP_ARG);
//
// if(group != null) {
// finish();
// startActivity(intent);
// }
// }
//
// super.onNewIntent(intent);
// }
@Override
protected BaseChatAdapter getAdapter() {
return new GroupChatAdapter(mUserIdPreference.get());

View File

@@ -62,6 +62,22 @@ public class SingleChatActivity extends BaseChatActivity {
}
}
// @Override
// protected void onNewIntent(Intent intent) {
// boolean test = intent.getBooleanExtra("TEST_EXTRA", false);
//
// if(test) {
// Group group = intent.getParcelableExtra(GROUP_ARG);
//
// if(group != null) {
// finish();
// startActivity(intent);
// }
// }
//
// super.onNewIntent(intent);
// }
@Override
protected void onResume() {
if (!mChatPresenter.isAttached()) {

View File

@@ -19,6 +19,9 @@ import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
import butterknife.OnClick;
import de.beyondsoft.ownchat.R;
import de.beyondsoft.ownchat.data.AppPrefsConstants;
import de.beyondsoft.ownchat.data.prefs.BooleanPreference;
import de.beyondsoft.ownchat.data.prefs.StringPreference;
import de.beyondsoft.ownchat.di.InjectionHelper;
import de.beyondsoft.ownchat.model.Group;
import de.beyondsoft.ownchat.utils.Constants;
@@ -27,6 +30,7 @@ import de.beyondsoft.ownchat.utils.FileUtils;
import java.io.File;
import javax.inject.Inject;
import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
@@ -172,8 +176,4 @@ public class FileConfirmationActivity extends AppCompatActivity implements FileC
public void showError(String message) {
}
public File getFile(Uri fileUri) {
return FileUtils.getFile(this, fileUri);
}
}

View File

@@ -141,13 +141,20 @@ public class SharingActivity extends AppCompatActivity implements SharingView, S
@Override
public void onOpenGroupMessage(Group group) {
startActivity(GroupChatActivity.createIntent(this, group));
Intent intent = GroupChatActivity.createIntent(this, group);
intent.putExtra("TEST_EXTRA", true);
startActivity(intent);
finishAffinity();
}
@Override
public void onOpenPrivateMessage(Group contact) {
startActivity(SingleChatActivity.createIntent(this, contact));
Intent intent = SingleChatActivity.createIntent(this, contact);
intent.putExtra("TEST_EXTRA", true);
startActivity(intent);
finishAffinity();
}
@@ -170,4 +177,12 @@ public class SharingActivity extends AppCompatActivity implements SharingView, S
public void setGroups(ArrayList<Group> groups) {
mContactsAdapter.setGroups(groups);
}
@Override
protected void onDestroy() {
mIsComingFromSharingActivity.set(false);
mSelectedFilePath.delete();
super.onDestroy();
}
}