diff --git a/.buildkite/commands/build-prototype.sh b/.buildkite/commands/build-prototype.sh index bb9932cf7..ede5c0807 100644 --- a/.buildkite/commands/build-prototype.sh +++ b/.buildkite/commands/build-prototype.sh @@ -5,11 +5,8 @@ set -eu echo "--- :rubygems: Setting up Gems" install_gems -echo "--- Installing Secrets" -# This is a hack until our AMI has a newer version of glibc and openSSL -./gradlew -chmod +x vendor/configure/configure -docker run -it --rm --workdir /app --env CONFIGURE_ENCRYPTION_KEY -v $(pwd):/app public.ecr.aws/automattic/android-build-image:4281c9e97b2d821df3de34c046b7c067499b35bb /bin/bash -c 'vendor/configure/configure apply' +echo "--- :closed_lock_with_key: Installing Secrets" +bundle exec fastlane run configure_apply echo "--- :hammer_and_wrench: Build and Test" bundle exec fastlane build_and_upload_prototype_build diff --git a/.buildkite/commands/checkout-release-branch.sh b/.buildkite/commands/checkout-release-branch.sh index 29bbde406..e2bf45b90 100755 --- a/.buildkite/commands/checkout-release-branch.sh +++ b/.buildkite/commands/checkout-release-branch.sh @@ -1,14 +1,12 @@ #!/bin/bash -eu -# We expect BUILDKITE_RELEASE_VERSION to be as an environment variable, e.g. by the automation that triggers the build on Buildkite. -# It must use the `BUILDKITE_` prefix to be passed to the agent due to how `hostmgr` works, in case this runs on a Mac agents. -if [[ -z "${BUILDKITE_RELEASE_VERSION}" ]]; then - echo "BUILDKITE_RELEASE_VERSION is not set." +if [[ -z "${RELEASE_VERSION}" ]]; then + echo "RELEASE_VERSION is not set." exit 1 fi # Buildkite, by default, checks out a specific commit. # For many release actions, we need to be on a release branch instead. -BRANCH_NAME="release/${BUILDKITE_RELEASE_VERSION}" +BRANCH_NAME="release/${RELEASE_VERSION}" git fetch origin "$BRANCH_NAME" git checkout "$BRANCH_NAME" diff --git a/.buildkite/commands/release-build.sh b/.buildkite/commands/release-build.sh old mode 100644 new mode 100755 index cb2a662fe..f6801563e --- a/.buildkite/commands/release-build.sh +++ b/.buildkite/commands/release-build.sh @@ -12,12 +12,12 @@ bundle exec fastlane build_for_distribution echo "--- :computer: Use deterministic APK name for next steps" OUTPUT_DIR="build" -if [ "$(find "$OUTPUT_DIR/*.apk" | wc -l)" -gt 1 ]; then +if [ "$(find "$OUTPUT_DIR" -maxdepth 1 -name "*.apk" | wc -l)" -gt 1 ]; then echo "Found more than one APK in $OUTPUT_DIR." exit 1 fi -ORIGINAL_APK_PATH=$(ls -1 "$OUTPUT_DIR/*.apk") +ORIGINAL_APK_PATH=$(find "$OUTPUT_DIR" -name "*.apk" -maxdepth 1 | head -1) set -x mv "$ORIGINAL_APK_PATH" $OUTPUT_DIR/simplenote.apk diff --git a/.buildkite/commands/release-create-on-github.sh b/.buildkite/commands/release-create-on-github.sh old mode 100644 new mode 100755 diff --git a/.buildkite/commands/release-upload.sh b/.buildkite/commands/release-upload.sh old mode 100644 new mode 100755 index 96ab64cd4..50e57a3c5 --- a/.buildkite/commands/release-upload.sh +++ b/.buildkite/commands/release-upload.sh @@ -13,5 +13,5 @@ bundle exec fastlane run configure_apply echo "--- :android: Upload to Play Store" bundle exec fastlane upload_build_to_play_store \ - apk_path:"$ARTIFACT_PATH/simplenote.apk" \ + apk_path:"$ARTIFACT_PATH" \ "beta:${1:-true}" # use first call param, default to true for safety diff --git a/.configure b/.configure index e937ce870..061fd5d3d 100644 --- a/.configure +++ b/.configure @@ -1,27 +1,35 @@ { "project_name": "Simplenote-Android", "branch": "trunk", - "pinned_hash": "9b6326550a87fe0b6423a9e12f79ca92be8c9cff", + "pinned_hash": "2c5509d08ff9b9620381f4dc602fc2e5edcfcb40", "files_to_copy": [ { "file": "android/simplenote/Simplenote/gradle.properties", - "destination": "Simplenote/gradle.properties" + "destination": "Simplenote/gradle.properties", + "encrypt": true }, { "file": "android/simplenote/sentry.properties", - "destination": "sentry.properties" + "destination": "sentry.properties", + "encrypt": true }, { "file": "android/automattic.jks", - "destination": ".configure-files/release.jks" + "destination": ".configure-files/release.jks", + "encrypt": true }, { "file": "android/debug.keystore", - "destination": ".configure-files/debug_a8c.keystore" + "destination": ".configure-files/debug_a8c.keystore", + "encrypt": true }, { "file": "android/Simplenote/google-upload-credentials.json", - "destination": ".configure-files/google-upload-credentials.json" + "destination": ".configure-files/google-upload-credentials.json", + "encrypt": true } + ], + "file_dependencies": [ + ] -} +} \ No newline at end of file diff --git a/.configure-files/automattic.jks.enc b/.configure-files/automattic.jks.enc new file mode 100644 index 000000000..c36dfc0a2 Binary files /dev/null and b/.configure-files/automattic.jks.enc differ diff --git a/.configure-files/debug.keystore.enc b/.configure-files/debug.keystore.enc index 486c23880..655abad47 100644 Binary files a/.configure-files/debug.keystore.enc and b/.configure-files/debug.keystore.enc differ diff --git a/.configure-files/google-upload-credentials.json.enc b/.configure-files/google-upload-credentials.json.enc index 790809881..bd33e91a0 100644 Binary files a/.configure-files/google-upload-credentials.json.enc and b/.configure-files/google-upload-credentials.json.enc differ diff --git a/.configure-files/gradle.properties.enc b/.configure-files/gradle.properties.enc index 72af2f868..76f99286e 100644 Binary files a/.configure-files/gradle.properties.enc and b/.configure-files/gradle.properties.enc differ diff --git a/.configure-files/sentry.properties.enc b/.configure-files/sentry.properties.enc index 72ddd72cc..d70454396 100644 Binary files a/.configure-files/sentry.properties.enc and b/.configure-files/sentry.properties.enc differ diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 1922b9341..227d89e6d 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,3 +1,7 @@ +2.35 +----- + + 2.34 ----- diff --git a/Simplenote/metadata/PlayStoreStrings.pot b/Simplenote/metadata/PlayStoreStrings.pot index f536e1b19..5fed4f36d 100644 --- a/Simplenote/metadata/PlayStoreStrings.pot +++ b/Simplenote/metadata/PlayStoreStrings.pot @@ -11,6 +11,12 @@ msgstr "" "Project-Id-Version: Release Notes & Play Store Descriptions\n" #. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas! +msgctxt "release_note_0234" +msgid "" +"2.34:\n" +"Under the hood improvements\n" +msgstr "" + msgctxt "release_note_0233" msgid "" "2.33:\n" @@ -18,13 +24,6 @@ msgid "" "\n" msgstr "" -msgctxt "release_note_0232" -msgid "" -"2.32:\n" -"• Added adaptive app icon\n" -"• Removed Sustainer plan information and upgrade UI\n" -msgstr "" - #. translators: Short description of the app to be displayed in the Play Store. Limit to 80 characters including spaces and commas! msgctxt "play_store_promo" msgid "Take notes, create to-do lists, capture ideas, and more." diff --git a/Simplenote/src/main/java/com/automattic/simplenote/DeepLinkActivity.kt b/Simplenote/src/main/java/com/automattic/simplenote/DeepLinkActivity.kt index 2140618bd..419906b02 100644 --- a/Simplenote/src/main/java/com/automattic/simplenote/DeepLinkActivity.kt +++ b/Simplenote/src/main/java/com/automattic/simplenote/DeepLinkActivity.kt @@ -83,6 +83,8 @@ class DeepLinkActivity : AppCompatActivity() { getString(R.string.magic_link_general_error), Toast.LENGTH_SHORT ).show() + + SimplenoteAuthenticationActivity.startNotesActivity(applicationContext, false); } } diff --git a/Simplenote/src/main/java/com/automattic/simplenote/authentication/SimplenoteAuthenticationActivity.java b/Simplenote/src/main/java/com/automattic/simplenote/authentication/SimplenoteAuthenticationActivity.java index c6b33acd5..647bd216a 100644 --- a/Simplenote/src/main/java/com/automattic/simplenote/authentication/SimplenoteAuthenticationActivity.java +++ b/Simplenote/src/main/java/com/automattic/simplenote/authentication/SimplenoteAuthenticationActivity.java @@ -2,15 +2,17 @@ import android.app.AlertDialog; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.util.Log; import android.view.ContextThemeWrapper; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StringRes; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; import com.automattic.simplenote.R; @@ -22,6 +24,7 @@ import com.automattic.simplenote.viewmodels.MagicLinkUiState; import com.automattic.simplenote.viewmodels.CompleteMagicLinkViewModel; import com.simperium.android.AuthenticationActivity; +import com.simperium.android.ProgressDialogFragment; import net.openid.appauth.AuthorizationException; import net.openid.appauth.AuthorizationRequest; @@ -50,22 +53,27 @@ public class SimplenoteAuthenticationActivity extends AuthenticationActivity { @Inject Simplenote simplenote; + @Nullable + CompleteMagicLinkViewModel completeMagicLinkViewModel; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Intent intent = getIntent(); + final boolean isMagicLink = intent.getBooleanExtra(KEY_IS_MAGIC_LINK, false); - if (isMagicLink) { - CompleteMagicLinkViewModel completeMagicLinkViewModel = new ViewModelProvider(this).get(CompleteMagicLinkViewModel.class); + final String authKey = intent.getStringExtra(KEY_MAGIC_LINK_AUTH_KEY); + final String authCode = intent.getStringExtra(KEY_MAGIC_LINK_AUTH_CODE); + if (isMagicLink && authKey != null && authCode != null) { + completeMagicLinkViewModel = new ViewModelProvider(this).get(CompleteMagicLinkViewModel.class); completeMagicLinkViewModel.getMagicLinkUiState().observe(this, state -> { if (state instanceof MagicLinkUiState.Success) { + hideDialog(); final MagicLinkUiState.Success stateResult = (MagicLinkUiState.Success) state; simplenote.loginWithToken(stateResult.getEmail(), stateResult.getToken()); - final Intent notesIntent = IntentUtils.maybeAliasedIntent(this.getApplicationContext()); - notesIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION & (Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK)); - startActivity(notesIntent); + startNotesActivity(this, false); AnalyticsTracker.track( AnalyticsTracker.Stat.USER_CONFIRMED_LOGIN_LINK, @@ -74,16 +82,29 @@ public void onCreate(Bundle savedInstanceState) { ); finish(); + } else if (state instanceof MagicLinkUiState.Loading) { + showLoadingDialog(R.string.magic_link_complete_login_loading_message); } else if (state instanceof MagicLinkUiState.Error) { + hideDialog(); showDialogError(((MagicLinkUiState.Error) state).getMessageRes()); } }); - final String authKey = intent.getStringExtra(KEY_MAGIC_LINK_AUTH_KEY); - final String authCode = intent.getStringExtra(KEY_MAGIC_LINK_AUTH_CODE); completeMagicLinkViewModel.completeLogin(authKey, authCode, false); } } + public static void startNotesActivity(final Context context, final boolean showAnimation) { + final Intent notesIntent = IntentUtils.maybeAliasedIntent(context.getApplicationContext()); + int flags; + if (showAnimation) { + flags = Intent.FLAG_ACTIVITY_NO_ANIMATION & (Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + } else { + flags = Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK; + } + notesIntent.addFlags(flags); + context.startActivity(notesIntent); + } + @Override protected void onPause() { if (mPendingDialog != null) { @@ -192,6 +213,29 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) { } } + private void showLoadingDialog(@StringRes int stringRes) { + final Fragment fragment = getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG); + if (fragment == null) { + final ProgressDialogFragment progressDialogFragment = ProgressDialogFragment.newInstance(getString(stringRes)); + progressDialogFragment.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium); + progressDialogFragment.show(getSupportFragmentManager(), ProgressDialogFragment.TAG); + } + } + + private void hideDialog() { + final Fragment fragment = getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG); + if (fragment != null) { + try { + final ProgressDialogFragment progressDialogFragment = (ProgressDialogFragment) fragment; + if (!progressDialogFragment.isHidden()) { + progressDialogFragment.dismiss(); + } + } catch (final ClassCastException e) { + Log.e(TAG, "We have a class other than ProgressDialogFragment", e); + } + } + } + private void showDialogError(@StringRes int message) { if (isFinishing() || message == 0) { return; @@ -199,16 +243,15 @@ private void showDialogError(@StringRes int message) { Context context = new ContextThemeWrapper(SimplenoteAuthenticationActivity.this, getTheme()); mPendingDialog = new AlertDialog.Builder(context) - .setTitle(R.string.simperium_dialog_title_error) - .setMessage(message) - .setPositiveButton(android.R.string.ok, null) - .setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - mPendingDialog = null; + .setTitle(R.string.simperium_dialog_title_error) + .setMessage(message) + .setPositiveButton(android.R.string.ok, (dialog, which) -> { + if (completeMagicLinkViewModel != null) { + completeMagicLinkViewModel.resetState(); } }) - .show(); + .setOnDismissListener(dialog -> mPendingDialog = null) + .show(); AnalyticsTracker.track( AnalyticsTracker.Stat.WPCC_LOGIN_FAILED, diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d403abac0..7fadc813d 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -20,7 +20,7 @@ ORGANIZATION = 'automattic' REPO_NAME = 'simplenote-android' GITHUB_REPO = "#{ORGANIZATION}/#{REPO_NAME}".freeze DEFAULT_BRANCH = 'trunk' -BUILDKITE_ORG = ORGANIZATION +BUILDKITE_ORGANIZATION = ORGANIZATION BUILDKITE_PIPELINE = REPO_NAME APP_PACKAGE_NAME = 'com.automattic.simplenote' diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index 23964c532..55a899265 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -2,6 +2,9 @@ platform :android do lane :build_for_distribution do + version = VERSION_FILE.read_version_name + build_code = build_code_current + user_friendly_output_dir = File.join(PROJECT_ROOT_FOLDER, 'build') user_friendly_output_apk_name = "simplenote-#{version}.apk" user_friendly_output_path = File.join(user_friendly_output_dir, user_friendly_output_apk_name) diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index 4a9909a04..53d11a112 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -130,7 +130,7 @@ trigger_buildkite_release_build(branch: branch_to_build, beta: false) end - lane :create_release_on_github do |version: release_version_current, beta: true, apk_path: GRADLE_APK_OUTPUT_PATH.to_s| + lane :create_release_on_github do |version: VERSION_FILE.read_version_name, beta: true, apk_path: GRADLE_APK_OUTPUT_PATH.to_s| create_github_release( repository: GITHUB_REPO, version: version, diff --git a/fastlane/metadata/android/en-US/changelogs/default.txt b/fastlane/metadata/android/en-US/changelogs/default.txt new file mode 100644 index 000000000..75237ff13 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/default.txt @@ -0,0 +1 @@ +Under the hood improvements diff --git a/fastlane/resources/values/strings.xml b/fastlane/resources/values/strings.xml index a851d8515..a1d48e504 100644 --- a/fastlane/resources/values/strings.xml +++ b/fastlane/resources/values/strings.xml @@ -450,4 +450,5 @@ Or Enter password We\'ve sent a code to \n%1$s. The code will be valid for a few minutes. + Enter the password for the account %1$s diff --git a/version.properties b/version.properties index 66211cb99..8ca320d76 100644 --- a/version.properties +++ b/version.properties @@ -1,2 +1,2 @@ -versionName=2.33 -versionCode=169 \ No newline at end of file +versionName=2.34-rc-1 +versionCode=170 \ No newline at end of file