diff --git a/res/layout/profile_create_activity.xml b/res/layout/profile_create_activity.xml index 34fa5450c..f8678ca14 100644 --- a/res/layout/profile_create_activity.xml +++ b/res/layout/profile_create_activity.xml @@ -98,14 +98,14 @@ android:layout_marginBottom="20dp" android:layout_gravity="center_horizontal"/> - + android:text="@string/profile_create_activity__password_account"/> To send media and group messages, tap \'OK\' and complete the requested settings. The MMS settings for your carrier can generally be located by searching for \'your carrier APN\'. You will only need to do this once. - Set later + password and account settings FINISH Who can see this information? + Your profile picture and name will be shown alongside your messages when communicating with other users. Already sent information can not be deleted or removed. Your name @@ -1067,6 +1068,7 @@ Enable passphrase screen lock Lock screen and notifications with a passphrase Screen security + To apply the screen security setting please restart the app Block screenshots in the recents list and inside the app Auto-lock Delta Chat after a specified time interval of inactivity Inactivity timeout passphrase diff --git a/res/xml/preferences_app_protection.xml b/res/xml/preferences_app_protection.xml index 466b4cac4..136429a8d 100644 --- a/res/xml/preferences_app_protection.xml +++ b/res/xml/preferences_app_protection.xml @@ -51,11 +51,6 @@ - - - - - - - - diff --git a/src/org/thoughtcrime/securesms/CreateProfileActivity.java b/src/org/thoughtcrime/securesms/CreateProfileActivity.java index d5f309460..5c16d43f5 100644 --- a/src/org/thoughtcrime/securesms/CreateProfileActivity.java +++ b/src/org/thoughtcrime/securesms/CreateProfileActivity.java @@ -21,6 +21,7 @@ import android.text.TextUtils; import android.text.TextWatcher; import android.util.Log; import android.view.KeyEvent; +import android.view.MenuItem; import android.view.View; import android.view.ViewAnimationUtils; import android.view.WindowManager; @@ -48,6 +49,7 @@ import org.thoughtcrime.securesms.profiles.ProfileMediaConstraints; import org.thoughtcrime.securesms.profiles.SystemProfileUtil; import org.thoughtcrime.securesms.util.BitmapDecodingException; import org.thoughtcrime.securesms.util.BitmapUtil; +import org.thoughtcrime.securesms.util.Dialogs; import org.thoughtcrime.securesms.util.DynamicLanguage; import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.FileProviderUtil; @@ -110,6 +112,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); getSupportActionBar().setTitle(R.string.CreateProfileActivity_your_profile_info); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); initializeResources(); initializeEmojiInput(); @@ -126,6 +129,18 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje dynamicLanguage.onResume(this); } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + super.onOptionsItemSelected(item); + switch (item.getItemId()) { + case android.R.id.home: + onBackPressed(); + return true; + } + + return false; + } + @Override public void onBackPressed() { if (container.isInputOpen()) container.hideCurrentInput(name); @@ -204,7 +219,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje } private void initializeResources() { - TextView skipButton = ViewUtil.findById(this, R.id.skip_button); + TextView passwordAccountSettings = ViewUtil.findById(this, R.id.password_account_settings_button); TextView informationLabel = ViewUtil.findById(this, R.id.information_label); this.avatar = ViewUtil.findById(this, R.id.avatar); @@ -247,18 +262,13 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje handleUpload(); }); - skipButton.setOnClickListener(view -> { - if (nextIntent != null) startActivity(nextIntent); - finish(); + passwordAccountSettings.setOnClickListener(view -> { + Intent intent = new Intent(this, RegistrationActivity.class); + startActivity(intent); }); informationLabel.setOnClickListener(view -> { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse("https://support.signal.org/hc/en-us/articles/115001434171")); - - if (getPackageManager().queryIntentActivities(intent, 0).size() > 0) { - startActivity(intent); - } + Dialogs.showInfoDialog(this, getString(R.string.profile_create_activity__who_can_see_this_information), getString(R.string.profile_create_activity__who_can_see_this_information_explained)); }); } diff --git a/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java b/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java index f1d07fa18..305b4008a 100644 --- a/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java @@ -40,7 +40,7 @@ public class RefreshAttributesJob extends ContextJob implements InjectableType { String signalingKey = TextSecurePreferences.getSignalingKey(context); int registrationId = TextSecurePreferences.getLocalRegistrationId(context); boolean fetchesMessages = TextSecurePreferences.isGcmDisabled(context); - String pin = TextSecurePreferences.getRegistrationLockPin(context); + String pin = ""; signalAccountManager.setAccountAttributes(signalingKey, registrationId, fetchesMessages, pin); } diff --git a/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java b/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java index 51100fa92..d24b8c331 100644 --- a/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java +++ b/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java @@ -2,9 +2,7 @@ package org.thoughtcrime.securesms.lock; import android.annotation.SuppressLint; -import android.app.Activity; import android.content.Context; -import android.content.DialogInterface; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Build; @@ -33,7 +31,6 @@ import android.widget.Toast; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.components.SwitchPreferenceCompat; import org.thoughtcrime.securesms.util.ServiceUtil; -import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.whispersystems.libsignal.util.guava.Optional; import org.whispersystems.signalservice.api.SignalServiceAccountManager; @@ -99,10 +96,6 @@ public class RegistrationLockDialog { @Override public void afterTextChanged(Editable s) { - if (s != null && s.toString().replace(" ", "").equals(TextSecurePreferences.getRegistrationLockPin(context))) { - dialog.dismiss(); - RegistrationLockReminders.scheduleReminder(context, true); - } } }); @@ -153,9 +146,6 @@ public class RegistrationLockDialog { protected Boolean doInBackground(Void... voids) { try { accountManager.setPin(Optional.of(pinValue)); - TextSecurePreferences.setRegistrationLockPin(context, pinValue); - TextSecurePreferences.setRegistrationLockLastReminderTime(context, System.currentTimeMillis()); - TextSecurePreferences.setRegistrationLockNextReminderInterval(context, RegistrationLockReminders.INITIAL_INTERVAL); return true; } catch (IOException e) { Log.w(TAG, e); diff --git a/src/org/thoughtcrime/securesms/lock/RegistrationLockReminders.java b/src/org/thoughtcrime/securesms/lock/RegistrationLockReminders.java index 8df9fa0d6..75367de89 100644 --- a/src/org/thoughtcrime/securesms/lock/RegistrationLockReminders.java +++ b/src/org/thoughtcrime/securesms/lock/RegistrationLockReminders.java @@ -4,8 +4,6 @@ package org.thoughtcrime.securesms.lock; import android.content.Context; import android.support.annotation.NonNull; -import org.thoughtcrime.securesms.util.TextSecurePreferences; - import java.util.NavigableSet; import java.util.TreeSet; import java.util.concurrent.TimeUnit; @@ -23,29 +21,11 @@ public class RegistrationLockReminders { public static final long INITIAL_INTERVAL = INTERVALS.first(); public static boolean needsReminder(@NonNull Context context) { - if (!TextSecurePreferences.isRegistrationtLockEnabled(context)) return false; - - long lastReminderTime = TextSecurePreferences.getRegistrationLockLastReminderTime(context); - long nextIntervalTime = TextSecurePreferences.getRegistrationLockNextReminderInterval(context); - - return System.currentTimeMillis() > lastReminderTime + nextIntervalTime; + return false; } public static void scheduleReminder(@NonNull Context context, boolean success) { - Long nextReminderInterval; - - if (success) { - long timeSinceLastReminder = System.currentTimeMillis() - TextSecurePreferences.getRegistrationLockLastReminderTime(context); - nextReminderInterval = INTERVALS.higher(timeSinceLastReminder); - if (nextReminderInterval == null) nextReminderInterval = INTERVALS.last(); - } else { - long lastReminderInterval = TextSecurePreferences.getRegistrationLockNextReminderInterval(context); - nextReminderInterval = INTERVALS.lower(lastReminderInterval); - if (nextReminderInterval == null) nextReminderInterval = INTERVALS.first(); - } - - TextSecurePreferences.setRegistrationLockLastReminderTime(context, System.currentTimeMillis()); - TextSecurePreferences.setRegistrationLockNextReminderInterval(context, nextReminderInterval); + //TODO Remove class } } diff --git a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java index 2f3703825..982af0882 100644 --- a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java @@ -53,7 +53,6 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment disablePassphrase = (CheckBoxPreference) this.findPreference("pref_enable_passphrase_temporary"); - this.findPreference(TextSecurePreferences.REGISTRATION_LOCK_PREF).setOnPreferenceClickListener(new AccountLockClickListener()); this.findPreference(TextSecurePreferences.SCREEN_LOCK).setOnPreferenceChangeListener(new ScreenLockListener()); this.findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT).setOnPreferenceClickListener(new ScreenLockTimeoutListener()); @@ -189,17 +188,9 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment final String offRes = context.getString(R.string.ApplicationPreferencesActivity_off); if (TextSecurePreferences.isPasswordDisabled(context) && !TextSecurePreferences.isScreenLockEnabled(context)) { - if (TextSecurePreferences.isRegistrationtLockEnabled(context)) { - return context.getString(privacySummaryResId, offRes, onRes); - } else { return context.getString(privacySummaryResId, offRes, offRes); - } } else { - if (TextSecurePreferences.isRegistrationtLockEnabled(context)) { - return context.getString(privacySummaryResId, onRes, onRes); - } else { return context.getString(privacySummaryResId, onRes, offRes); - } } } diff --git a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java index 243b9cc54..e09ae584e 100644 --- a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java +++ b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java @@ -66,9 +66,7 @@ import org.webrtc.PeerConnection; import org.webrtc.PeerConnectionFactory; import org.webrtc.RtpReceiver; import org.webrtc.SessionDescription; -import org.webrtc.SurfaceEglRenderer; import org.webrtc.SurfaceViewRenderer; -import org.webrtc.VideoRenderer; import org.webrtc.VideoTrack; import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.signalservice.api.SignalServiceAccountManager; @@ -370,9 +368,7 @@ public class WebRtcCallService extends Service implements InjectableType, isSystemContact = ContactAccessor.getInstance().isSystemContact(WebRtcCallService.this, recipient.getAddress().serialize()); } - boolean isAlwaysTurn = TextSecurePreferences.isTurnOnly(WebRtcCallService.this); - - WebRtcCallService.this.peerConnection = new PeerConnectionWrapper(WebRtcCallService.this, peerConnectionFactory, WebRtcCallService.this, localRenderer, result, WebRtcCallService.this, !isSystemContact || isAlwaysTurn); + WebRtcCallService.this.peerConnection = new PeerConnectionWrapper(WebRtcCallService.this, peerConnectionFactory, WebRtcCallService.this, localRenderer, result, WebRtcCallService.this, !isSystemContact); WebRtcCallService.this.localCameraState = WebRtcCallService.this.peerConnection.getCameraState(); WebRtcCallService.this.peerConnection.setRemoteDescription(new SessionDescription(SessionDescription.Type.OFFER, offer)); WebRtcCallService.this.lockManager.updatePhoneState(LockManager.PhoneState.PROCESSING); @@ -434,9 +430,7 @@ public class WebRtcCallService extends Service implements InjectableType, @Override public void onSuccessContinue(List result) { try { - boolean isAlwaysTurn = TextSecurePreferences.isTurnOnly(WebRtcCallService.this); - - WebRtcCallService.this.peerConnection = new PeerConnectionWrapper(WebRtcCallService.this, peerConnectionFactory, WebRtcCallService.this, localRenderer, result, WebRtcCallService.this, isAlwaysTurn); + WebRtcCallService.this.peerConnection = new PeerConnectionWrapper(WebRtcCallService.this, peerConnectionFactory, WebRtcCallService.this, localRenderer, result, WebRtcCallService.this, false); WebRtcCallService.this.localCameraState = WebRtcCallService.this.peerConnection.getCameraState(); WebRtcCallService.this.dataChannel = WebRtcCallService.this.peerConnection.createDataChannel(DATA_CHANNEL_NAME); WebRtcCallService.this.dataChannel.registerObserver(WebRtcCallService.this); diff --git a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java index ca2dd20d8..72d5067d3 100644 --- a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java +++ b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java @@ -12,12 +12,11 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.NotificationCompat; import android.util.Log; +import android.widget.Toast; import org.greenrobot.eventbus.EventBus; import org.thoughtcrime.securesms.R; -import org.thoughtcrime.securesms.events.ReminderUpdateEvent; import org.thoughtcrime.securesms.jobs.requirements.SqlCipherMigrationRequirementProvider; -import org.thoughtcrime.securesms.lock.RegistrationLockReminders; import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPreference; import org.whispersystems.libsignal.util.Medium; @@ -115,7 +114,6 @@ public class TextSecurePreferences { public static final String SYSTEM_EMOJI_PREF = "pref_system_emoji"; private static final String MULTI_DEVICE_PROVISIONED_PREF = "pref_multi_device"; public static final String DIRECT_CAPTURE_CAMERA_ID = "pref_direct_capture_camera_id"; - private static final String ALWAYS_RELAY_CALLS_PREF = "pref_turn_only"; private static final String PROFILE_KEY_PREF = "pref_profile_key"; private static final String PROFILE_NAME_PREF = "pref_profile_name"; private static final String PROFILE_AVATAR_ID_PREF = "pref_profile_avatar_id"; @@ -146,11 +144,6 @@ public class TextSecurePreferences { public static final String SCREEN_LOCK = "pref_android_screen_lock"; public static final String SCREEN_LOCK_TIMEOUT = "pref_android_screen_lock_timeout"; - public static final String REGISTRATION_LOCK_PREF = "pref_registration_lock"; - private static final String REGISTRATION_LOCK_PIN_PREF = "pref_registration_lock_pin"; - private static final String REGISTRATION_LOCK_LAST_REMINDER_TIME = "pref_registration_lock_last_reminder_time"; - private static final String REGISTRATION_LOCK_NEXT_REMINDER_INTERVAL = "pref_registration_lock_next_reminder_interval"; - private static final String SERVICE_OUTAGE = "pref_service_outage"; private static final String LAST_OUTAGE_CHECK_TIME = "pref_last_outage_check_time"; @@ -173,38 +166,6 @@ public class TextSecurePreferences { setLongPreference(context, SCREEN_LOCK_TIMEOUT, value); } - public static boolean isRegistrationtLockEnabled(@NonNull Context context) { - return getBooleanPreference(context, REGISTRATION_LOCK_PREF, false); - } - - public static void setRegistrationtLockEnabled(@NonNull Context context, boolean value) { - setBooleanPreference(context, REGISTRATION_LOCK_PREF, value); - } - - public static @Nullable String getRegistrationLockPin(@NonNull Context context) { - return getStringPreference(context, REGISTRATION_LOCK_PIN_PREF, null); - } - - public static void setRegistrationLockPin(@NonNull Context context, String pin) { - setStringPreference(context, REGISTRATION_LOCK_PIN_PREF, pin); - } - - public static long getRegistrationLockLastReminderTime(@NonNull Context context) { - return getLongPreference(context, REGISTRATION_LOCK_LAST_REMINDER_TIME, 0); - } - - public static void setRegistrationLockLastReminderTime(@NonNull Context context, long time) { - setLongPreference(context, REGISTRATION_LOCK_LAST_REMINDER_TIME, time); - } - - public static long getRegistrationLockNextReminderInterval(@NonNull Context context) { - return getLongPreference(context, REGISTRATION_LOCK_NEXT_REMINDER_INTERVAL, RegistrationLockReminders.INITIAL_INTERVAL); - } - - public static void setRegistrationLockNextReminderInterval(@NonNull Context context, long value) { - setLongPreference(context, REGISTRATION_LOCK_NEXT_REMINDER_INTERVAL, value); - } - public static void setBackupPassphrase(@NonNull Context context, @Nullable String passphrase) { setStringPreference(context, BACKUP_PASSPHRASE, passphrase); } @@ -354,10 +315,6 @@ public class TextSecurePreferences { return Integer.valueOf(getStringPreference(context, MESSAGE_BODY_TEXT_SIZE_PREF, "16")); } - public static boolean isTurnOnly(Context context) { - return getBooleanPreference(context, ALWAYS_RELAY_CALLS_PREF, false); - } - public static boolean isGcmDisabled(Context context) { return getBooleanPreference(context, GCM_DISABLED_PREF, false); } @@ -680,6 +637,7 @@ public class TextSecurePreferences { } public static void setScreenSecurityEnabled(Context context, boolean value) { + Toast.makeText(context, R.string.preferences__screen_security_restart_warning, Toast.LENGTH_LONG).show(); setBooleanPreference(context, SCREEN_SECURITY_PREF, value); }