Show a warning for users on API < 19.

We'll be updating minSdk to 19 in 4.37. This lets these users continue
to use the app, but they'll be warned with a persistent banner saying
that they can't receive updates.
pull/9/head
Greyson Parrelli 5 years ago
parent 64cf032181
commit 975a121c55

@ -1397,6 +1397,7 @@
<string name="reminder_header_share_title">Invite your friends!</string>
<string name="reminder_header_share_text">The more friends use Signal, the better it gets.</string>
<string name="reminder_header_service_outage_text">Signal is experiencing technical difficulties. We are working hard to restore service as quickly as possible.</string>
<string name="reminder_header_the_latest_signal_features_wont_work">The latest Signal features won\'t work on this version of Android. Please upgrade this device to receive future Signal updates.</string>
<!-- media_preview -->
<string name="media_preview__save_title">Save</string>

@ -71,6 +71,7 @@ import org.thoughtcrime.securesms.components.reminder.ServiceOutageReminder;
import org.thoughtcrime.securesms.components.reminder.ShareReminder;
import org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder;
import org.thoughtcrime.securesms.components.reminder.UnauthorizedReminder;
import org.thoughtcrime.securesms.components.reminder.UnsupportedAndroidVersionReminder;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
import org.thoughtcrime.securesms.database.loaders.ConversationListLoader;
@ -201,6 +202,8 @@ public class ConversationListFragment extends Fragment
final Context context = params[0];
if (UnauthorizedReminder.isEligible(context)) {
return Optional.of(new UnauthorizedReminder(context));
} else if (UnsupportedAndroidVersionReminder.isEligible()) {
return Optional.of(new UnsupportedAndroidVersionReminder(context));
} else if (ExpiredBuildReminder.isEligible()) {
return Optional.of(new ExpiredBuildReminder(context));
} else if (ServiceOutageReminder.isEligible(context)) {

@ -0,0 +1,23 @@
package org.thoughtcrime.securesms.components.reminder;
import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull;
import org.thoughtcrime.securesms.R;
public class UnsupportedAndroidVersionReminder extends Reminder {
public UnsupportedAndroidVersionReminder(@NonNull Context context) {
super(null, context.getString(R.string.reminder_header_the_latest_signal_features_wont_work));
}
@Override
public boolean isDismissable() {
return false;
}
public static boolean isEligible() {
return Build.VERSION.SDK_INT < 19;
}
}

@ -395,8 +395,12 @@ public class Util {
}
public static int getDaysTillBuildExpiry() {
int age = (int)TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - BuildConfig.BUILD_TIMESTAMP);
return 90 - age;
if (Build.VERSION.SDK_INT < 19) {
return Integer.MAX_VALUE;
} else {
int age = (int) TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - BuildConfig.BUILD_TIMESTAMP);
return 90 - age;
}
}
@TargetApi(VERSION_CODES.LOLLIPOP)

Loading…
Cancel
Save