diff --git a/app/build.gradle b/app/build.gradle index b1d9fc176c..25c8e6057d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,6 +55,7 @@ android { buildConfigField "boolean", "PLAY_STORE_RELEASE", "false" buildConfigField "String", "INVITE_URI", "\"https://email.faircode.eu/\"" buildConfigField "String", "PRO_FEATURES_URI", "\"https://email.faircode.eu/donate/\"" + buildConfigField "String", "CHANGELOG", "\"https://github.com/M66B/open-source-email/releases/\"" buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/open-source-email/releases/latest\"" } play_beta { @@ -63,6 +64,7 @@ android { buildConfigField "boolean", "PLAY_STORE_RELEASE", "true" buildConfigField "String", "INVITE_URI", "\"https://play.google.com/apps/testing/eu.faircode.email\"" buildConfigField "String", "PRO_FEATURES_URI", "\"https://email.faircode.eu/#pro\"" + buildConfigField "String", "CHANGELOG", "\"\"" buildConfigField "String", "GITHUB_LATEST_API", "\"\"" } play_release { @@ -71,6 +73,7 @@ android { buildConfigField "boolean", "PLAY_STORE_RELEASE", "true" buildConfigField "String", "INVITE_URI", "\"https://play.google.com/store/apps/details?id=eu.faircode.email\"" buildConfigField "String", "PRO_FEATURES_URI", "\"https://email.faircode.eu/#pro\"" + buildConfigField "String", "CHANGELOG", "\"\"" buildConfigField "String", "GITHUB_LATEST_API", "\"\"" } } diff --git a/app/src/main/java/eu/faircode/email/FragmentAbout.java b/app/src/main/java/eu/faircode/email/FragmentAbout.java index 133752d7b8..b8cbdbe8b9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAbout.java +++ b/app/src/main/java/eu/faircode/email/FragmentAbout.java @@ -19,32 +19,51 @@ package eu.faircode.email; Copyright 2018-2019 by Marcel Bokhorst (M66B) */ +import android.content.Intent; import android.graphics.Paint; +import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; public class FragmentAbout extends FragmentBase { - private TextView tvVersion; - @Override @Nullable public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { setSubtitle(R.string.menu_about); + Intent changelog = null; + if (!Helper.isPlayStoreInstall(getContext())) { + changelog = new Intent(Intent.ACTION_VIEW); + changelog.setData(Uri.parse(BuildConfig.CHANGELOG)); + if (changelog.resolveActivity(getContext().getPackageManager()) == null) + changelog = null; + } + View view = inflater.inflate(R.layout.fragment_about, container, false); + TextView tvVersion = view.findViewById(R.id.tvVersion); + Button btnChangelog = view.findViewById(R.id.btnChangelog); TextView tvLimitations = view.findViewById(R.id.tvLimitations); - tvVersion = view.findViewById(R.id.tvVersion); tvVersion.setText(getString(R.string.title_version, BuildConfig.VERSION_NAME)); + btnChangelog.setVisibility(changelog == null ? View.GONE : View.VISIBLE); tvLimitations.setPaintFlags(tvLimitations.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); + final Intent intent = changelog; + btnChangelog.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + startActivity(intent); + } + }); + return view; } } diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 7fbbe251e6..95c318f77e 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -27,6 +27,18 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvVersion" /> +