Delete MessageSentEvent and its listeners as it's not used anymore
It was replaced by the new `SendMessage` implementation which uses `userNotifier` to display the outcome of the sending process instead of the bus. In one case, the event was causing `AlarmReceiver` to be executed immediately performing a refresh of the folder the user is in. As it turned out from the tests done, the interested message is updated also through a db observer, making that refresh superflous. MAILAND-914
This commit is contained in:
parent
3b4e418c21
commit
230f3cae54
|
@ -33,7 +33,6 @@ import android.view.View;
|
|||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -43,7 +42,6 @@ import androidx.work.WorkManager;
|
|||
|
||||
import com.birbit.android.jobqueue.JobManager;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -56,7 +54,6 @@ import ch.protonmail.android.api.NetworkConfigurator;
|
|||
import ch.protonmail.android.api.ProtonMailApiManager;
|
||||
import ch.protonmail.android.api.models.MailSettings;
|
||||
import ch.protonmail.android.api.models.User;
|
||||
import ch.protonmail.android.api.segments.event.AlarmReceiver;
|
||||
import ch.protonmail.android.bl.Html5Handler;
|
||||
import ch.protonmail.android.bl.HtmlDivHandler;
|
||||
import ch.protonmail.android.bl.HtmlProcessor;
|
||||
|
@ -68,7 +65,6 @@ import ch.protonmail.android.core.QueueNetworkUtil;
|
|||
import ch.protonmail.android.core.UserManager;
|
||||
import ch.protonmail.android.events.ForceSwitchedAccountNotifier;
|
||||
import ch.protonmail.android.events.LogoutEvent;
|
||||
import ch.protonmail.android.events.MessageSentEvent;
|
||||
import ch.protonmail.android.events.Status;
|
||||
import ch.protonmail.android.jobs.organizations.GetOrganizationJob;
|
||||
import ch.protonmail.android.settings.pin.ValidatePinActivity;
|
||||
|
@ -76,7 +72,6 @@ import ch.protonmail.android.utils.AppUtil;
|
|||
import ch.protonmail.android.utils.CustomLocale;
|
||||
import ch.protonmail.android.utils.INetworkConfiguratorCallback;
|
||||
import ch.protonmail.android.utils.UiUtil;
|
||||
import ch.protonmail.android.utils.extensions.TextExtensions;
|
||||
import ch.protonmail.android.worker.FetchMailSettingsWorker;
|
||||
import ch.protonmail.android.worker.FetchUserInfoWorker;
|
||||
import dagger.hilt.android.AndroidEntryPoint;
|
||||
|
@ -448,20 +443,6 @@ public abstract class BaseActivity extends AppCompatActivity implements INetwork
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMessageSentEvent(MessageSentEvent event){
|
||||
switch (event.getStatus()) {
|
||||
case SUCCESS:
|
||||
TextExtensions.showToast(this, R.string.message_sent, Toast.LENGTH_SHORT);
|
||||
AlarmReceiver alarmReceiver = new AlarmReceiver();
|
||||
alarmReceiver.setAlarm(this, true);
|
||||
break;
|
||||
case FAILED:
|
||||
TextExtensions.showToast(this, R.string.message_failed, Toast.LENGTH_SHORT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected BroadcastReceiver setupLangReceiver(){
|
||||
if (mLangReceiver == null) {
|
||||
mLangReceiver = new BroadcastReceiver() {
|
||||
|
|
|
@ -136,7 +136,6 @@ import ch.protonmail.android.events.MailboxLoadedEvent
|
|||
import ch.protonmail.android.events.MailboxLoginEvent
|
||||
import ch.protonmail.android.events.MailboxNoMessagesEvent
|
||||
import ch.protonmail.android.events.MessageCountsEvent
|
||||
import ch.protonmail.android.events.MessageSentEvent
|
||||
import ch.protonmail.android.events.ParentEvent
|
||||
import ch.protonmail.android.events.RefreshDrawerEvent
|
||||
import ch.protonmail.android.events.SettingsChangedEvent
|
||||
|
@ -1198,12 +1197,6 @@ class MailboxActivity :
|
|||
OnParentEventTask(messageDetailsRepository, messagesAdapter, event!!).execute()
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
override fun onMessageSentEvent(event: MessageSentEvent) {
|
||||
super.onMessageSentEvent(event)
|
||||
syncUUID = UUID.randomUUID().toString()
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
fun onLabelsLoadedEvent(event: FetchLabelsEvent) {
|
||||
if (/* messagesAdapter != null && */ event.status == Status.SUCCESS) {
|
||||
|
|
|
@ -73,7 +73,6 @@ import ch.protonmail.android.core.UserManager
|
|||
import ch.protonmail.android.events.DownloadEmbeddedImagesEvent
|
||||
import ch.protonmail.android.events.DownloadedAttachmentEvent
|
||||
import ch.protonmail.android.events.LogoutEvent
|
||||
import ch.protonmail.android.events.MessageSentEvent
|
||||
import ch.protonmail.android.events.PostPhishingReportEvent
|
||||
import ch.protonmail.android.events.Status
|
||||
import ch.protonmail.android.events.user.MailSettingsEvent
|
||||
|
@ -521,11 +520,6 @@ internal class MessageDetailsActivity :
|
|||
finish()
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
override fun onMessageSentEvent(event: MessageSentEvent) {
|
||||
super.onMessageSentEvent(event)
|
||||
}
|
||||
|
||||
private fun getDecryptedBody(decryptedHtml: String?): String {
|
||||
var decryptedBody = decryptedHtml
|
||||
if (decryptedBody.isNullOrEmpty()) {
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Proton Technologies AG
|
||||
*
|
||||
* This file is part of ProtonMail.
|
||||
*
|
||||
* ProtonMail is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ProtonMail is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ProtonMail. If not, see https://www.gnu.org/licenses/.
|
||||
*/
|
||||
package ch.protonmail.android.events;
|
||||
|
||||
import ch.protonmail.android.core.Constants;
|
||||
|
||||
/**
|
||||
* Created by sunny on 7/28/15.
|
||||
*/
|
||||
public class MessageSentEvent {
|
||||
private Status status;
|
||||
|
||||
public MessageSentEvent(int code){
|
||||
if (code == Constants.RESPONSE_CODE_OK){
|
||||
status = Status.SUCCESS;
|
||||
} else {
|
||||
status = Status.FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
public Status getStatus(){
|
||||
return status;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue