Compare commits

...

3 Commits

6 changed files with 26 additions and 20 deletions

View File

@ -116,7 +116,6 @@ public class ChangeEncryptionPasswordActivity extends AccountAndKeyRequiredActiv
return;
Bundle result = new Bundle();
String cipherPassphrase = ((TextView)findViewById(R.id.cipher_passphrase)).getText().toString().trim();
String newCipherPassphrase = ((TextView)findViewById(R.id.new_cipher_passphrase)).getText().toString().trim();
String newCipherPassphraseRepeat = ((TextView)findViewById(R.id.new_cipher_passphrase_repeat)).getText().toString().trim();
@ -136,11 +135,10 @@ public class ChangeEncryptionPasswordActivity extends AccountAndKeyRequiredActiv
}
Optional<String> savedPassphrase = KeyStore.getMasterPassphrase(getBaseContext());
if (!savedPassphrase.isPresent() || !savedPassphrase.get().equals(cipherPassphrase)) {
if (!savedPassphrase.isPresent()) {
result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_INVALID_CIPHER_PASSPHRASE);
ErrorToaster.handleDisplayToastBundledError(getBaseContext(), result);
((TextView)findViewById(R.id.cipher_passphrase)).setText("");
((TextView)findViewById(R.id.new_cipher_passphrase)).setText("");
((TextView)findViewById(R.id.new_cipher_passphrase_repeat)).setText("");
return;
@ -149,7 +147,7 @@ public class ChangeEncryptionPasswordActivity extends AccountAndKeyRequiredActiv
Intent changeService = new Intent(getBaseContext(), ChangeEncryptionPasswordService.class);
changeService.putExtra(ChangeEncryptionPasswordService.KEY_MESSENGER, new Messenger(new MessageHandler()));
changeService.putExtra(ChangeEncryptionPasswordService.KEY_OLD_MASTER_PASSPHRASE, cipherPassphrase);
changeService.putExtra(ChangeEncryptionPasswordService.KEY_OLD_MASTER_PASSPHRASE, savedPassphrase.get());
changeService.putExtra(ChangeEncryptionPasswordService.KEY_NEW_MASTER_PASSPHRASE, newCipherPassphrase);
changeService.putExtra(ChangeEncryptionPasswordService.KEY_ACCOUNT, account.toBundle());
@ -177,8 +175,7 @@ public class ChangeEncryptionPasswordActivity extends AccountAndKeyRequiredActiv
errorBundler.putInt(ErrorToaster.KEY_STATUS_CODE, message.arg1);
ErrorToaster.handleDisplayToastBundledError(getBaseContext(), errorBundler);
if (findViewById(R.id.cipher_passphrase) != null) {
((TextView)findViewById(R.id.cipher_passphrase)).setText("");
if (findViewById(R.id.new_cipher_passphrase) != null) {
((TextView)findViewById(R.id.new_cipher_passphrase)).setText("");
((TextView)findViewById(R.id.new_cipher_passphrase_repeat)).setText("");
}

View File

@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import org.anhonesteffort.flock.sync.account.AccountStore;
import org.anhonesteffort.flock.util.guava.Optional;
import org.anhonesteffort.flock.auth.DavAccount;
import org.anhonesteffort.flock.sync.addressbook.AddressbookSyncScheduler;
@ -125,10 +126,26 @@ public class NotificationDrawer extends BroadcastReceiver {
Intent clickIntent = new Intent(context, ManageSubscriptionActivity.class);
notificationBuilder.setContentTitle(context.getString(R.string.notification_flock_subscription_expired));
notificationBuilder.setContentText(context.getString(R.string.notification_tap_to_update_subscription));
notificationBuilder.setSmallIcon(R.drawable.flock_actionbar_icon);
notificationBuilder.setAutoCancel(true);
Optional<Long> daysRemaining = AccountStore.getDaysRemaining(context);
if (!daysRemaining.isPresent() || daysRemaining.get() > 0)
notificationBuilder.setContentText(context.getString(R.string.notification_tap_to_update_subscription));
else {
Integer limitDaysExpired = context.getResources().getInteger(R.integer.limit_days_expired);
Long daysTillExpire = limitDaysExpired - (-1 * daysRemaining.get());
if (daysTillExpire < 0)
daysTillExpire = 0L;
notificationBuilder.setContentText(context.getString(
R.string.account_will_be_deleted_in_days_tap_to_update_subscription,
daysTillExpire
));
}
Optional<DavAccount> account = DavAccountHelper.getAccount(context);
clickIntent.putExtra(ManageSubscriptionActivity.KEY_DAV_ACCOUNT_BUNDLE, account.get().toBundle());

View File

@ -44,7 +44,8 @@
android:fontFamily="sans-serif-light"
android:text="@string/welcome_to_flock"/>
<TextView android:layout_width="wrap_content"
<TextView android:id="@+id/flock_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif-light"

View File

@ -13,16 +13,6 @@
android:layout_marginRight="16dip"
android:layout_weight="1">
<EditText android:id="@+id/cipher_passphrase"
android:singleLine="true"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="48dip"
android:inputType="textPassword"
android:layout_marginTop="8dip"
android:hint="@string/hint_current_password"
android:layout_marginBottom="32dp"/>
<EditText android:id="@+id/new_cipher_passphrase"
android:singleLine="true"
android:maxLines="1"

View File

@ -2,7 +2,7 @@
<resources>
<integer name="cost_per_year_usd">5</integer>
<integer name="auto_renew_trigger_days_remaining">7</integer>
<integer name="limit_days_expired">20</integer>
<integer name="tag_view_holder">1337</integer>
<integer name="tag_collection_path">100</integer>

View File

@ -60,6 +60,7 @@
<string name="notification_tap_to_correct_encryption_password">Tap to correct encryption password.</string>
<string name="notification_flock_subscription_expired">Flock subscription expired</string>
<string name="notification_tap_to_update_subscription">Tap to update subscription.</string>
<string name="account_will_be_deleted_in_days_tap_to_update_subscription">Your account will be deleted in %1$d days, tap to update subscription.</string>
<!-- status header stuff -->
@ -124,7 +125,7 @@
<string name="title_import_account">Import Account</string>
<string name="title_register_account">Register Account</string>
<string name="title_setup_account">Setup account</string>
<string name="chose_a_username_for_your_account_and_a_strong_password_to_encrypt_your_data">Choose a username for your account and a strong password to encrypt your data.</string>
<string name="chose_a_username_for_your_account_and_a_strong_password_to_encrypt_your_data">Choose a username and a strong password to encrypt your data, If your password is forgotten it cannot be reset.</string>
<string name="do_you_have_a_flock_account">Do you have a Flock account?</string>
<string name="yes_log_me_in">Yes, log me in</string>