mirror of https://github.com/M66B/FairEmail.git
Allow trying pro features as far as possible
This commit is contained in:
parent
1845fe7a4d
commit
401b2d723a
|
@ -1176,11 +1176,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
}
|
||||
|
||||
private void onColor(final Intent intent) {
|
||||
if (!Helper.isPro(this)) {
|
||||
onShowPro(null);
|
||||
return;
|
||||
}
|
||||
|
||||
int color = intent.getIntExtra("color", -1);
|
||||
int[] colors = getResources().getIntArray(R.array.colorPicker);
|
||||
ColorPickerDialog colorPickerDialog = new ColorPickerDialog();
|
||||
|
@ -1188,6 +1183,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() {
|
||||
@Override
|
||||
public void onColorSelected(int color) {
|
||||
if (!Helper.isPro(ActivityView.this)) {
|
||||
onShowPro(null);
|
||||
return;
|
||||
}
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", intent.getLongExtra("id", -1));
|
||||
args.putInt("color", color);
|
||||
|
@ -1292,7 +1292,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
}
|
||||
|
||||
private void onDecrypt(Intent intent) {
|
||||
if (Helper.isPro(this)) {
|
||||
if (!Helper.isPro(this)) {
|
||||
onShowPro(intent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pgpService.isBound()) {
|
||||
Intent data = new Intent();
|
||||
data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
|
||||
|
@ -1309,8 +1313,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
});
|
||||
snackbar.show();
|
||||
}
|
||||
} else
|
||||
onShowPro(intent);
|
||||
}
|
||||
|
||||
private void onShowPro(Intent intent) {
|
||||
|
|
|
@ -2463,12 +2463,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}
|
||||
|
||||
private void onMenuManageKeywords(ActionData data) {
|
||||
if (!Helper.isPro(context)) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("message", data.message);
|
||||
|
||||
|
@ -2510,6 +2504,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (!Helper.isPro(context)) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
args.putStringArray("keywords", items.toArray(new String[0]));
|
||||
args.putBooleanArray("selected", selected);
|
||||
args.putBooleanArray("dirty", dirty);
|
||||
|
@ -2556,6 +2556,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (!Helper.isPro(context)) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
String keyword = Helper.sanitizeKeyword(etKeyword.getText().toString());
|
||||
if (!TextUtils.isEmpty(keyword)) {
|
||||
args.putString("keyword", keyword);
|
||||
|
@ -3195,15 +3201,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem target) {
|
||||
if (Helper.isPro(context))
|
||||
if (!Helper.isPro(context)) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||
return true;
|
||||
}
|
||||
|
||||
context.startActivity(new Intent(context, ActivityCompose.class)
|
||||
.putExtra("action", "reply")
|
||||
.putExtra("reference", data.message.id)
|
||||
.putExtra("answer", (long) target.getItemId()));
|
||||
else {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1719,6 +1719,7 @@ class Core {
|
|||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean badge = prefs.getBoolean("badge", true);
|
||||
boolean pro = Helper.isPro(context);
|
||||
|
||||
// Update widget/badge count
|
||||
if (lastUnseen < 0 || messages.size() != lastUnseen) {
|
||||
|
@ -1743,7 +1744,7 @@ class Core {
|
|||
continue;
|
||||
}
|
||||
|
||||
String group = Long.toString(message.accountNotify ? message.account : 0);
|
||||
String group = Long.toString(pro && message.accountNotify ? message.account : 0);
|
||||
if (!groupMessages.containsKey(group)) {
|
||||
groupMessages.put(group, new ArrayList<TupleMessageEx>());
|
||||
if (!groupNotifying.containsKey(group))
|
||||
|
@ -1828,8 +1829,8 @@ class Core {
|
|||
boolean notify_preview = prefs.getBoolean("notify_preview", true);
|
||||
boolean notify_trash = prefs.getBoolean("notify_trash", true);
|
||||
boolean notify_archive = prefs.getBoolean("notify_archive", true);
|
||||
boolean notify_reply = prefs.getBoolean("notify_reply", false);
|
||||
boolean notify_flag = prefs.getBoolean("notify_flag", false);
|
||||
boolean notify_reply = prefs.getBoolean("notify_reply", false) && pro;
|
||||
boolean notify_flag = prefs.getBoolean("notify_flag", false) && pro;
|
||||
boolean notify_seen = prefs.getBoolean("notify_seen", true);
|
||||
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
@ -1931,7 +1932,8 @@ class Core {
|
|||
channelName = channel.getId();
|
||||
}
|
||||
if (channelName == null)
|
||||
channelName = EntityAccount.getNotificationChannelId(message.accountNotify ? message.account : 0);
|
||||
channelName = EntityAccount.getNotificationChannelId(
|
||||
pro && message.accountNotify ? message.account : 0);
|
||||
|
||||
// Get folder name
|
||||
String folderName = message.folderDisplay == null
|
||||
|
|
|
@ -324,18 +324,18 @@ public class FragmentAccount extends FragmentBase {
|
|||
btnColor.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!Helper.isPro(getContext())) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
int[] colors = getContext().getResources().getIntArray(R.array.colorPicker);
|
||||
ColorPickerDialog colorPickerDialog = new ColorPickerDialog();
|
||||
colorPickerDialog.initialize(R.string.title_account_color, colors, color, 4, colors.length);
|
||||
colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() {
|
||||
@Override
|
||||
public void onColorSelected(int color) {
|
||||
if (!Helper.isPro(getContext())) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
setColor(color);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -184,8 +184,6 @@ public class FragmentCompose extends FragmentBase {
|
|||
private ContentResolver resolver;
|
||||
private AdapterAttachment adapter;
|
||||
|
||||
private boolean pro;
|
||||
|
||||
private boolean prefix_once = false;
|
||||
private boolean monospaced = false;
|
||||
private boolean style = true;
|
||||
|
@ -212,7 +210,6 @@ public class FragmentCompose extends FragmentBase {
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
pro = Helper.isPro(getContext());
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
prefix_once = prefs.getBoolean("prefix_once", false);
|
||||
|
@ -3082,7 +3079,6 @@ public class FragmentCompose extends FragmentBase {
|
|||
grpExtra.setVisibility(identity != null && identity.sender_extra ? View.VISIBLE : View.GONE);
|
||||
|
||||
Spanned signature = null;
|
||||
if (pro) {
|
||||
if (identity != null && !TextUtils.isEmpty(identity.signature))
|
||||
signature = HtmlHelper.fromHtml(identity.signature, new Html.ImageGetter() {
|
||||
@Override
|
||||
|
@ -3094,7 +3090,6 @@ public class FragmentCompose extends FragmentBase {
|
|||
return d;
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
tvSignature.setText(signature);
|
||||
grpSignature.setVisibility(signature == null ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
|
|
@ -277,18 +277,18 @@ public class FragmentIdentity extends FragmentBase {
|
|||
btnColor.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!Helper.isPro(getContext())) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
int[] colors = getContext().getResources().getIntArray(R.array.colorPicker);
|
||||
ColorPickerDialog colorPickerDialog = new ColorPickerDialog();
|
||||
colorPickerDialog.initialize(R.string.title_account_color, colors, color, 4, colors.length);
|
||||
colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() {
|
||||
@Override
|
||||
public void onColorSelected(int color) {
|
||||
if (!Helper.isPro(getContext())) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
setColor(color);
|
||||
}
|
||||
});
|
||||
|
@ -608,7 +608,7 @@ public class FragmentIdentity extends FragmentBase {
|
|||
if (TextUtils.isEmpty(bcc))
|
||||
bcc = null;
|
||||
|
||||
if (Color.TRANSPARENT == color)
|
||||
if (color == Color.TRANSPARENT || !Helper.isPro(context))
|
||||
color = null;
|
||||
if (TextUtils.isEmpty(signature))
|
||||
signature = null;
|
||||
|
|
|
@ -1627,18 +1627,18 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
}
|
||||
|
||||
private void onActionFlagColorSelection() {
|
||||
if (!Helper.isPro(getContext())) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
int[] colors = getResources().getIntArray(R.array.colorPicker);
|
||||
ColorPickerDialog colorPickerDialog = new ColorPickerDialog();
|
||||
colorPickerDialog.initialize(R.string.title_flag_color, colors, Color.TRANSPARENT, 4, colors.length);
|
||||
colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() {
|
||||
@Override
|
||||
public void onColorSelected(int color) {
|
||||
if (!Helper.isPro(getContext())) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||
return;
|
||||
}
|
||||
|
||||
onActionFlagSelection(true, color);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -201,16 +201,19 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
}
|
||||
|
||||
private void setOptions() {
|
||||
boolean pro = Helper.isPro(getContext());
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swNotifyGroup.setChecked(prefs.getBoolean("notify_group", true));
|
||||
swNotifyGroup.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? View.VISIBLE : View.GONE);
|
||||
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
||||
|
||||
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true));
|
||||
cbNotifyActionArchive.setChecked(prefs.getBoolean("notify_archive", true));
|
||||
cbNotifyActionReply.setChecked(prefs.getBoolean("notify_reply", false));
|
||||
cbNotifyActionFlag.setChecked(prefs.getBoolean("notify_flag", false));
|
||||
cbNotifyActionReply.setChecked(prefs.getBoolean("notify_reply", false) && pro);
|
||||
cbNotifyActionFlag.setChecked(prefs.getBoolean("notify_flag", false) && pro);
|
||||
cbNotifyActionSeen.setChecked(prefs.getBoolean("notify_seen", true));
|
||||
|
||||
swLight.setChecked(prefs.getBoolean("light", false));
|
||||
|
||||
grpNotification.setVisibility(Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O ? View.VISIBLE : View.GONE);
|
||||
|
|
Loading…
Reference in New Issue