Skip to content

Commit

Permalink
Upgrade SDK to 30.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal committed Nov 18, 2020
1 parent 2361892 commit 75062ad
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 39 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Expand Up @@ -109,8 +109,8 @@ def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties')

android {
flavorDimensions 'distribution', 'environment'
compileSdkVersion 29
buildToolsVersion '29.0.3'
compileSdkVersion 30
buildToolsVersion '30.0.2'
useLibrary 'org.apache.http.legacy'

dexOptions {
Expand All @@ -133,7 +133,7 @@ android {
versionName canonicalVersionName

minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 30
multiDexEnabled true

vectorDrawables.useSupportLibrary = true
Expand Down
Expand Up @@ -12,7 +12,6 @@

import com.annimon.stream.function.Consumer;
import com.annimon.stream.function.Predicate;
import com.google.android.collect.Sets;
import com.google.protobuf.ByteString;

import net.sqlcipher.database.SQLiteDatabase;
Expand All @@ -38,6 +37,7 @@
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.profiles.AvatarHelper;
import org.thoughtcrime.securesms.util.Conversions;
import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.Stopwatch;
import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.libsignal.kdf.HKDFv3;
Expand Down Expand Up @@ -69,7 +69,7 @@ public class FullBackupExporter extends FullBackupBase {
@SuppressWarnings("unused")
private static final String TAG = FullBackupExporter.class.getSimpleName();

private static final Set<String> BLACKLISTED_TABLES = Sets.newHashSet(
private static final Set<String> BLACKLISTED_TABLES = SetUtil.newHashSet(
SignedPreKeyDatabase.TABLE_NAME,
OneTimePreKeyDatabase.TABLE_NAME,
SessionDatabase.TABLE_NAME,
Expand Down
Expand Up @@ -61,7 +61,6 @@

import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
import com.google.android.collect.Sets;

import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.LoggingFragment;
Expand Down Expand Up @@ -125,6 +124,7 @@
import org.thoughtcrime.securesms.util.HtmlUtil;
import org.thoughtcrime.securesms.util.RemoteDeleteUtil;
import org.thoughtcrime.securesms.util.SaveAttachmentTask;
import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.SnapToTopDataObserver;
import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
import org.thoughtcrime.securesms.util.StorageUtil;
Expand Down Expand Up @@ -1498,8 +1498,8 @@ private ReactionsToolbarListener(@NonNull ConversationMessage conversationMessag
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_info: handleDisplayDetails(conversationMessage); return true;
case R.id.action_delete: handleDeleteMessages(Sets.newHashSet(conversationMessage)); return true;
case R.id.action_copy: handleCopyMessage(Sets.newHashSet(conversationMessage)); return true;
case R.id.action_delete: handleDeleteMessages(SetUtil.newHashSet(conversationMessage)); return true;
case R.id.action_copy: handleCopyMessage(SetUtil.newHashSet(conversationMessage)); return true;
case R.id.action_reply: handleReplyMessage(conversationMessage); return true;
case R.id.action_multiselect: handleEnterMultiSelect(conversationMessage); return true;
case R.id.action_forward: handleForwardMessage(conversationMessage); return true;
Expand Down
@@ -1,34 +1,29 @@
package org.thoughtcrime.securesms.linkpreview;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import android.annotation.SuppressLint;
import android.os.Build;
import android.text.Html;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.URLSpan;
import android.text.util.Linkify;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.annimon.stream.Stream;
import com.google.android.collect.Sets;

import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.stickers.StickerUrl;
import org.thoughtcrime.securesms.util.DateUtils;
import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.util.OptionalUtil;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
Expand All @@ -50,7 +45,7 @@ public final class LinkPreviewUtil {
private static final Pattern FAVICON_PATTERN = Pattern.compile("<\\s*link[^>]*rel\\s*=\\s*\".*icon.*\"[^>]*>");
private static final Pattern FAVICON_HREF_PATTERN = Pattern.compile("href\\s*=\\s*\"([^\"]*)\"");

private static final Set<String> INVALID_TOP_LEVEL_DOMAINS = Sets.newHashSet("onion", "i2p");
private static final Set<String> INVALID_TOP_LEVEL_DOMAINS = SetUtil.newHashSet("onion", "i2p");

/**
* @return All whitelisted URLs in the source text.
Expand Down
Expand Up @@ -6,7 +6,6 @@
import androidx.annotation.VisibleForTesting;

import com.annimon.stream.Stream;
import com.google.android.collect.Sets;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -72,8 +71,7 @@ public final class FeatureFlags {
* We will only store remote values for flags in this set. If you want a flag to be controllable
* remotely, place it in here.
*/

private static final Set<String> REMOTE_CAPABLE = Sets.newHashSet(
private static final Set<String> REMOTE_CAPABLE = SetUtil.newHashSet(
GROUPS_V2_RECOMMENDED_LIMIT,
GROUPS_V2_HARD_LIMIT,
GROUPS_V2_JOIN_VERSION,
Expand Down Expand Up @@ -108,7 +106,7 @@ public final class FeatureFlags {
* will be updated arbitrarily at runtime. This will make values more responsive, but also places
* more burden on the reader to ensure that the app experience remains consistent.
*/
private static final Set<String> HOT_SWAPPABLE = Sets.newHashSet(
private static final Set<String> HOT_SWAPPABLE = SetUtil.newHashSet(
GROUPS_V2_JOIN_VERSION,
VERIFY_V2,
CLIENT_EXPIRATION,
Expand All @@ -118,7 +116,7 @@ public final class FeatureFlags {
/**
* Flags in this set will stay true forever once they receive a true value from a remote config.
*/
private static final Set<String> STICKY = Sets.newHashSet(
private static final Set<String> STICKY = SetUtil.newHashSet(
VERIFY_V2
);

Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/org/thoughtcrime/securesms/util/SetUtil.java
@@ -1,6 +1,11 @@
package org.thoughtcrime.securesms.util;

import android.annotation.SuppressLint;

import com.google.android.collect.Sets;

import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

Expand All @@ -24,4 +29,9 @@ public static <E> Set<E> union(Set<E> a, Set<E> b) {
result.addAll(b);
return result;
}

@SuppressLint("NewApi")
public static <E> HashSet<E> newHashSet(E... elements) {
return Sets.newHashSet(elements);
}
}
23 changes: 10 additions & 13 deletions app/src/main/java/org/thoughtcrime/securesms/util/StringUtil.java
Expand Up @@ -4,29 +4,26 @@
import androidx.annotation.Nullable;
import androidx.core.text.BidiFormatter;

import com.google.android.collect.Sets;

import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Set;

public final class StringUtil {

private static final Set<Character> WHITESPACE = Sets.newHashSet('\u200E', // left-to-right mark
'\u200F', // right-to-left mark
'\u2007'); // figure space
private static final Set<Character> WHITESPACE = SetUtil.newHashSet('\u200E', // left-to-right mark
'\u200F', // right-to-left mark
'\u2007'); // figure space

private static final class Bidi {
/** Override text direction */
private static final Set<Integer> OVERRIDES = Sets.newHashSet("\u202a".codePointAt(0), /* LRE */
"\u202b".codePointAt(0), /* RLE */
"\u202d".codePointAt(0), /* LRO */
"\u202e".codePointAt(0) /* RLO */);
private static final Set<Integer> OVERRIDES = SetUtil.newHashSet("\u202a".codePointAt(0), /* LRE */
"\u202b".codePointAt(0), /* RLE */
"\u202d".codePointAt(0), /* LRO */
"\u202e".codePointAt(0) /* RLO */);

/** Set direction and isolate surrounding text */
private static final Set<Integer> ISOLATES = Sets.newHashSet("\u2066".codePointAt(0), /* LRI */
"\u2067".codePointAt(0), /* RLI */
"\u2068".codePointAt(0) /* FSI */);
private static final Set<Integer> ISOLATES = SetUtil.newHashSet("\u2066".codePointAt(0), /* LRI */
"\u2067".codePointAt(0), /* RLI */
"\u2068".codePointAt(0) /* FSI */);
/** Closes things in {@link #OVERRIDES} */
private static final int PDF = "\u202c".codePointAt(0);

Expand Down
4 changes: 2 additions & 2 deletions reproducible-builds/Dockerfile
Expand Up @@ -11,8 +11,8 @@ RUN apt-get update -y && apt-get install -y $(cat docker/dependencies.txt)
RUN docker/print-versions.sh docker/dependencies.txt

ENV ANDROID_SDK_FILENAME android-sdk_r24.4.1-linux.tgz
ENV ANDROID_API_LEVELS android-29
ENV ANDROID_BUILD_TOOLS_VERSION 29.0.3
ENV ANDROID_API_LEVELS android-30
ENV ANDROID_BUILD_TOOLS_VERSION 30.0.2

ENV ANDROID_HOME /usr/local/android-sdk-linux
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
Expand Down

0 comments on commit 75062ad

Please sign in to comment.