Simplification

This commit is contained in:
M66B 2019-09-11 14:43:32 +02:00
parent 0b3db5db31
commit f5bf3515c5
3 changed files with 14 additions and 10 deletions

View File

@ -3689,11 +3689,6 @@ public class FragmentCompose extends FragmentBase {
if (context == null)
return;
if (!ActivityBilling.isPro(context)) {
context.startActivity(new Intent(context, ActivityBilling.class));
return;
}
Bundle data = intent.getBundleExtra("args");
long id = data.getLong("id");
long duration = data.getLong("duration");

View File

@ -21,6 +21,7 @@ package eu.faircode.email;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -39,6 +40,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK;
public class FragmentDialogDuration extends FragmentDialogEx {
@ -163,4 +165,16 @@ public class FragmentDialogDuration extends FragmentDialogEx {
return dialog;
}
@Override
protected void sendResult(int result) {
if (result == RESULT_OK) {
if (!ActivityBilling.isPro(getContext())) {
getActivity().startActivity(new Intent(getContext(), ActivityBilling.class));
result = RESULT_CANCELED;
}
}
super.sendResult(result);
}
}

View File

@ -4247,11 +4247,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
private void onSnooze(Bundle args) {
if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class));
return;
}
long duration = args.getLong("duration");
long time = args.getLong("time");
args.putLong("wakeup", duration == 0 ? -1 : time);