Add initial support for Group Calling.

This commit is contained in:
Cody Henthorne
2020-11-11 15:11:03 -05:00
parent 696fffb603
commit b1f6786392
53 changed files with 1887 additions and 130 deletions

View File

@@ -64,6 +64,7 @@ public final class FeatureFlags {
private static final String MAX_ENVELOPE_SIZE = "android.maxEnvelopeSize";
private static final String GV1_AUTO_MIGRATE_VERSION = "android.groupsv2.autoMigrateVersion";
private static final String GV1_MANUAL_MIGRATE_VERSION = "android.groupsv2.manualMigrateVersion";
private static final String GROUP_CALLING_VERSION = "android.groupsv2.callingVersion";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -84,7 +85,8 @@ public final class FeatureFlags {
VIEWED_RECEIPTS,
MAX_ENVELOPE_SIZE,
GV1_AUTO_MIGRATE_VERSION,
GV1_MANUAL_MIGRATE_VERSION
GV1_MANUAL_MIGRATE_VERSION,
GROUP_CALLING_VERSION
);
/**
@@ -274,6 +276,10 @@ public final class FeatureFlags {
return groupsV1AutoMigration() && getVersionFlag(GV1_MANUAL_MIGRATE_VERSION) == VersionFlag.ON;
}
public static boolean groupCalling() {
return getVersionFlag(GROUP_CALLING_VERSION) == VersionFlag.ON;
}
/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);

View File

@@ -36,8 +36,11 @@ import androidx.annotation.IdRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.core.view.ViewCompat;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import androidx.lifecycle.Lifecycle;
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
@@ -276,4 +279,20 @@ public final class ViewUtil {
}
}
}
public static @Nullable Lifecycle getActivityLifecycle(@NonNull View view) {
return getActivityLifecycle(view.getContext());
}
private static @Nullable Lifecycle getActivityLifecycle(@Nullable Context context) {
if (context instanceof ContextThemeWrapper) {
return getActivityLifecycle(((ContextThemeWrapper) context).getBaseContext());
}
if (context instanceof AppCompatActivity) {
return ((AppCompatActivity) context).getLifecycle();
}
return null;
}
}