Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into cust_remove_call_…
Browse files Browse the repository at this point in the history
…confirm
  • Loading branch information
simonsso committed Feb 3, 2021
2 parents 88bc2d9 + 213ffda commit 1bb4c08
Show file tree
Hide file tree
Showing 84 changed files with 2,302 additions and 189 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ protobuf {
}
}

def canonicalVersionCode = 783
def canonicalVersionName = "5.3.10"
def canonicalVersionCode = 784
def canonicalVersionName = "5.3.11"

def postFixSize = 100
def abiPostFix = ['universal' : 0,
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<!-- So we can add a TextSecure 'Account' -->
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
Expand Down Expand Up @@ -255,6 +254,14 @@
<data android:scheme="https"
android:host="signal.group"/>
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="signal.tube" />
</intent-filter>
</activity>

<activity android:name=".conversation.ConversationActivity"
Expand Down Expand Up @@ -350,7 +357,8 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

<activity android:name=".ApplicationPreferencesActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.thoughtcrime.securesms;

import android.content.Context;
import android.hardware.SensorManager;
import android.os.Build;

import androidx.annotation.NonNull;
Expand All @@ -33,7 +32,6 @@

import org.conscrypt.Conscrypt;
import org.signal.aesgcmprovider.AesGcmProvider;
import org.signal.core.util.ShakeDetector;
import org.signal.core.util.concurrent.SignalExecutors;
import org.signal.core.util.logging.AndroidLogger;
import org.signal.core.util.logging.Log;
Expand All @@ -46,7 +44,6 @@
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencyProvider;
import org.thoughtcrime.securesms.gcm.FcmJobService;
import org.thoughtcrime.securesms.jobmanager.JobManager;
import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob;
import org.thoughtcrime.securesms.jobs.FcmRefreshJob;
import org.thoughtcrime.securesms.jobs.GroupV1MigrationJob;
Expand All @@ -71,7 +68,6 @@
import org.thoughtcrime.securesms.service.RotateSenderCertificateListener;
import org.thoughtcrime.securesms.service.RotateSignedPreKeyListener;
import org.thoughtcrime.securesms.service.UpdateApkRefreshListener;
import org.thoughtcrime.securesms.shakereport.ShakeToReport;
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
import org.thoughtcrime.securesms.util.AppStartup;
import org.thoughtcrime.securesms.util.DynamicTheme;
Expand Down Expand Up @@ -145,6 +141,12 @@ public void onCreate() {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
})
.addBlocking("proxy-init", () -> {
if (SignalStore.proxy().isProxyEnabled()) {
Log.w(TAG, "Proxy detected. Enabling Conscrypt.setUseEngineSocketByDefault()");
Conscrypt.setUseEngineSocketByDefault(true);
}
})
.addNonBlocking(this::initializeRevealableMessageManager)
.addNonBlocking(this::initializeGcmCheck)
.addNonBlocking(this::initializeSignedPreKeyCheck)
Expand Down Expand Up @@ -272,7 +274,7 @@ public void initializeMessageRetrieval() {
}

private void initializeAppDependencies() {
ApplicationDependencies.init(this, new ApplicationDependencyProvider(this, new SignalServiceNetworkAccess(this)));
ApplicationDependencies.init(this, new ApplicationDependencyProvider(this));
}

private void initializeFirstEverAppLaunch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.thoughtcrime.securesms.preferences.ChatsPreferenceFragment;
import org.thoughtcrime.securesms.preferences.CorrectedPreferenceFragment;
import org.thoughtcrime.securesms.preferences.DataAndStoragePreferenceFragment;
import org.thoughtcrime.securesms.preferences.EditProxyFragment;
import org.thoughtcrime.securesms.preferences.NotificationsPreferenceFragment;
import org.thoughtcrime.securesms.preferences.SmsMmsPreferenceFragment;
import org.thoughtcrime.securesms.preferences.widgets.ProfilePreference;
Expand Down Expand Up @@ -67,6 +68,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActivity
{
public static final String LAUNCH_TO_BACKUPS_FRAGMENT = "launch.to.backups.fragment";
public static final String LAUNCH_TO_HELP_FRAGMENT = "launch.to.help.fragment";
public static final String LAUNCH_TO_PROXY_FRAGMENT = "launch.to.proxy.fragment";

@SuppressWarnings("unused")
private static final String TAG = ApplicationPreferencesActivity.class.getSimpleName();
Expand Down Expand Up @@ -108,6 +110,8 @@ protected void onCreate(Bundle icicle, boolean ready) {
initFragment(android.R.id.content, new BackupsPreferenceFragment());
} else if (getIntent() != null && getIntent().getBooleanExtra(LAUNCH_TO_HELP_FRAGMENT, false)) {
initFragment(android.R.id.content, new HelpFragment());
} else if (getIntent() != null && getIntent().getBooleanExtra(LAUNCH_TO_PROXY_FRAGMENT, false)) {
initFragment(android.R.id.content, EditProxyFragment.newInstance());
} else if (icicle == null) {
initFragment(android.R.id.content, new ApplicationPreferenceFragment());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected void onCreate(Bundle savedInstanceState, boolean ready) {
navigator.onCreate(savedInstanceState);

handleGroupLinkInIntent(getIntent());
handleProxyInIntent(getIntent());

CachedInflater.from(this).clear();
}
Expand All @@ -56,6 +57,7 @@ public Intent getIntent() {
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
handleGroupLinkInIntent(intent);
handleProxyInIntent(intent);
}

@Override
Expand Down Expand Up @@ -95,4 +97,11 @@ private void handleGroupLinkInIntent(Intent intent) {
CommunicationActions.handlePotentialGroupLinkUrl(this, data.toString());
}
}

private void handleProxyInIntent(Intent intent) {
Uri data = intent.getData();
if (data != null) {
CommunicationActions.handlePotentialProxyLinkUrl(this, data.toString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
import org.thoughtcrime.securesms.logsubmit.SubmitDebugLogActivity;
import org.thoughtcrime.securesms.util.CommunicationActions;
import org.thoughtcrime.securesms.util.DynamicIntroTheme;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.SupportEmailUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;

/**
Expand Down Expand Up @@ -137,7 +139,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = this.getMenuInflater();
menu.clear();

inflater.inflate(R.menu.log_submit, menu);
inflater.inflate(R.menu.passphrase_prompt, menu);

super.onCreateOptionsMenu(menu);
return true;
Expand All @@ -146,8 +148,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case R.id.menu_submit_debug_logs: handleLogSubmit(); return true;
if (item.getItemId() == R.id.menu_submit_debug_logs) {
handleLogSubmit();
return true;
} else if (item.getItemId() == R.id.menu_contact_support) {
sendEmailToSupport();
return true;
}

return false;
Expand Down Expand Up @@ -294,6 +300,17 @@ private void pauseScreenLock() {
}
}

private void sendEmailToSupport() {
String body = SupportEmailUtil.generateSupportEmailBody(this,
R.string.PassphrasePromptActivity_signal_android_lock_screen,
null,
null);
CommunicationActions.openEmail(this,
SupportEmailUtil.getSupportEmailAddress(this),
getString(R.string.PassphrasePromptActivity_signal_android_lock_screen),
body);
}

private class PassphraseActionListener implements TextView.OnEditorActionListener {
@Override
public boolean onEditorAction(TextView exampleView, int actionId, KeyEvent keyEvent) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.components.emoji;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.text.InputFilter;
import android.util.AttributeSet;
Expand All @@ -27,7 +28,12 @@ public EmojiEditText(Context context, AttributeSet attrs) {

public EmojiEditText(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
if (!TextSecurePreferences.isSystemEmojiPreferred(getContext())) {

TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.EmojiTextView, 0, 0);
boolean forceCustom = a.getBoolean(R.styleable.EmojiTextView_emoji_forceCustom, false);
a.recycle();

if (forceCustom || !TextSecurePreferences.isSystemEmojiPreferred(getContext())) {
setFilters(appendEmojiFilter(this.getFilters()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.ViewGroup;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
Expand Down Expand Up @@ -137,6 +138,10 @@ protected void onDraw(Canvas canvas) {
}
}
}

if (getLayoutParams() != null && getLayoutParams().width == ViewGroup.LayoutParams.WRAP_CONTENT) {
requestLayout();
}
}

public void setOverflowText(@Nullable CharSequence overflowText) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
Expand Down Expand Up @@ -130,6 +131,7 @@
import org.thoughtcrime.securesms.util.RemoteDeleteUtil;
import org.thoughtcrime.securesms.util.SaveAttachmentTask;
import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.SignalProxyUtil;
import org.thoughtcrime.securesms.util.SnapToTopDataObserver;
import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
import org.thoughtcrime.securesms.util.StorageUtil;
Expand Down Expand Up @@ -309,7 +311,9 @@ private void setListVerticalTranslation() {
list.setTranslationY(Math.min(0, -chTop));
list.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
}
listener.onListVerticalTranslationChanged(list.getTranslationY());

int offset = WindowUtil.isStatusBarPresent(requireActivity().getWindow()) ? ViewUtil.getStatusBarHeight(list) : 0;
listener.onListVerticalTranslationChanged(list.getTranslationY() - offset);
}

@Override
Expand All @@ -333,6 +337,7 @@ public void onAttach(Activity activity) {
public void onStart() {
super.onStart();
initializeTypingObserver();
SignalProxyUtil.startListeningToWebsocket();
}

@Override
Expand Down Expand Up @@ -1426,7 +1431,8 @@ public void onUnregisterVoiceNoteCallbacks(@NonNull Observer<VoiceNotePlaybackSt

@Override
public boolean onUrlClicked(@NonNull String url) {
return CommunicationActions.handlePotentialGroupLinkUrl(requireActivity(), url);
return CommunicationActions.handlePotentialGroupLinkUrl(requireActivity(), url) ||
CommunicationActions.handlePotentialProxyLinkUrl(requireActivity(), url);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected void onFinishInflate() {
}

public void setListVerticalTranslation(float translationY) {
maskView.setTargetParentTranslationY(translationY - ViewUtil.getStatusBarHeight(maskView));
maskView.setTargetParentTranslationY(translationY);
}

public void show(@NonNull Activity activity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import org.greenrobot.eventbus.ThreadMode;
import org.signal.core.util.concurrent.SignalExecutors;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.MainFragment;
import org.thoughtcrime.securesms.MainNavigator;
import org.thoughtcrime.securesms.NewConversationActivity;
Expand Down Expand Up @@ -108,6 +109,7 @@
import org.thoughtcrime.securesms.megaphone.MegaphoneViewBuilder;
import org.thoughtcrime.securesms.megaphone.Megaphones;
import org.thoughtcrime.securesms.mms.GlideApp;
import org.thoughtcrime.securesms.net.PipeConnectivityListener;
import org.thoughtcrime.securesms.notifications.MarkReadReceiver;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.recipients.Recipient;
Expand All @@ -118,6 +120,7 @@
import org.thoughtcrime.securesms.util.AvatarUtil;
import org.thoughtcrime.securesms.util.PlayStoreUtil;
import org.thoughtcrime.securesms.util.ServiceUtil;
import org.thoughtcrime.securesms.util.SignalProxyUtil;
import org.thoughtcrime.securesms.util.SnapToTopDataObserver;
import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
import org.thoughtcrime.securesms.util.Stopwatch;
Expand Down Expand Up @@ -161,6 +164,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
private PulsingFloatingActionButton fab;
private PulsingFloatingActionButton cameraFab;
private Stub<SearchToolbar> searchToolbar;
private ImageView proxyStatus;
private ImageView searchAction;
private View toolbarShadow;
private ConversationListViewModel viewModel;
Expand Down Expand Up @@ -199,6 +203,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
searchEmptyState = view.findViewById(R.id.search_no_results);
searchAction = view.findViewById(R.id.search_action);
toolbarShadow = view.findViewById(R.id.conversation_list_toolbar_shadow);
proxyStatus = view.findViewById(R.id.conversation_list_proxy_status);
reminderView = new Stub<>(view.findViewById(R.id.reminder));
emptyState = new Stub<>(view.findViewById(R.id.empty_state));
searchToolbar = new Stub<>(view.findViewById(R.id.search_toolbar));
Expand All @@ -208,6 +213,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
toolbar.setVisibility(View.VISIBLE);
((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar);

proxyStatus.setOnClickListener(v -> onProxyStatusClicked());

fab.show();
cameraFab.show();

Expand Down Expand Up @@ -262,6 +269,8 @@ public void onResume() {
if (activeAdapter != null) {
activeAdapter.notifyDataSetChanged();
}

SignalProxyUtil.startListeningToWebsocket();
}

@Override
Expand Down Expand Up @@ -543,6 +552,7 @@ private void initializeViewModel() {
viewModel.getMegaphone().observe(getViewLifecycleOwner(), this::onMegaphoneChanged);
viewModel.getConversationList().observe(getViewLifecycleOwner(), this::onSubmitList);
viewModel.hasNoConversations().observe(getViewLifecycleOwner(), this::updateEmptyState);
viewModel.getPipeState().observe(getViewLifecycleOwner(), this::updateProxyStatus);

visibilityLifecycleObserver = new DefaultLifecycleObserver() {
@Override
Expand Down Expand Up @@ -856,6 +866,34 @@ void updateEmptyState(boolean isConversationEmpty) {
}
}

private void updateProxyStatus(@NonNull PipeConnectivityListener.State state) {
if (SignalStore.proxy().isProxyEnabled()) {
proxyStatus.setVisibility(View.VISIBLE);

switch (state) {
case CONNECTING:
case DISCONNECTED:
proxyStatus.setImageResource(R.drawable.ic_proxy_connecting_24);
break;
case CONNECTED:
proxyStatus.setImageResource(R.drawable.ic_proxy_connected_24);
break;
case FAILURE:
proxyStatus.setImageResource(R.drawable.ic_proxy_failed_24);
break;
}
} else {
proxyStatus.setVisibility(View.GONE);
}
}

private void onProxyStatusClicked() {
Intent intent = new Intent(requireContext(), ApplicationPreferencesActivity.class);
intent.putExtra(ApplicationPreferencesActivity.LAUNCH_TO_PROXY_FRAGMENT, true);

startActivity(intent);
}

protected void onPostSubmitList(int conversationCount) {
if (conversationCount >= 6 && (SignalStore.onboarding().shouldShowInviteFriends() || SignalStore.onboarding().shouldShowNewGroup())) {
SignalStore.onboarding().clearAll();
Expand Down
Loading

0 comments on commit 1bb4c08

Please sign in to comment.