diff --git a/CHANGELOG.md b/CHANGELOG.md index 76c970747..e98c8de40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +Changes: + +- Add privacy policy dialog on first start (required by Huawei) + ## v1.10 (2021-03-07) Changes: diff --git a/app/src/main/java/protect/card_locker/MainActivity.java b/app/src/main/java/protect/card_locker/MainActivity.java index 1faf8f23f..7e5712ab2 100644 --- a/app/src/main/java/protect/card_locker/MainActivity.java +++ b/app/src/main/java/protect/card_locker/MainActivity.java @@ -1,13 +1,16 @@ package protect.card_locker; +import android.app.AlertDialog; import android.app.SearchManager; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.database.Cursor; +import android.net.Uri; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.SearchView; @@ -92,6 +95,29 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O helpText.setOnTouchListener(gestureTouchListener); noMatchingCardsText.setOnTouchListener(gestureTouchListener); list.setOnTouchListener(gestureTouchListener); + + // Show privacy policy on first run + SharedPreferences privacyPolicyShownPref = getApplicationContext().getSharedPreferences( + getString(R.string.sharedpreference_privacy_policy_shown), + Context.MODE_PRIVATE); + + if (privacyPolicyShownPref.getInt(getString(R.string.sharedpreference_privacy_policy_shown), 0) == 0) { + SharedPreferences.Editor privacyPolicyShownPrefEditor = privacyPolicyShownPref.edit(); + privacyPolicyShownPrefEditor.putInt(getString(R.string.sharedpreference_privacy_policy_shown), 1); + privacyPolicyShownPrefEditor.apply(); + + new AlertDialog.Builder(this) + .setTitle(R.string.privacy_policy) + .setMessage(R.string.privacy_policy_popup_text) + .setPositiveButton(R.string.thank_you, null) + .setNegativeButton(R.string.privacy_policy, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + openPrivacyPolicy(); + } + }) + .setIcon(android.R.drawable.ic_dialog_info) + .show(); + }; } @Override @@ -290,6 +316,14 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O groupsTabLayout.setVisibility(View.VISIBLE); } + private void openPrivacyPolicy() { + Intent browserIntent = new Intent( + Intent.ACTION_VIEW, + Uri.parse("https://thelastproject.github.io/Catima/privacy-policy") + ); + startActivity(browserIntent); + } + @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { @@ -402,6 +436,12 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O return true; } + if(id == R.id.action_privacy_policy) + { + openPrivacyPolicy(); + return true; + } + if(id == R.id.action_about) { Intent i = new Intent(getApplicationContext(), AboutActivity.class); diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml index d02adb230..1384f9852 100644 --- a/app/src/main/res/menu/main_menu.xml +++ b/app/src/main/res/menu/main_menu.xml @@ -22,6 +22,10 @@ android:id="@+id/action_settings" android:title="@string/settings" app:showAsAction="never"/> + pref_disable_lockscreen_while_viewing_card sharedpreference_active_tab + sharedpreference_privacy_policy_shown I want to share a card with you thelastproject.github.io @@ -157,4 +158,8 @@ %s does not seem to be a valid balance. Import data from which app? Loyalty Card Keychain + + Privacy Policy + Thank you + Many app stores require apps to show their privacy policy on first start. Here is ours:\n\nWe collect NO DATA AT ALL and our app is Open Source so anyone can confirm this to be true. diff --git a/docs/privacy-policy.md b/docs/privacy-policy.md index 55fc66ca2..c4bcfcc24 100644 --- a/docs/privacy-policy.md +++ b/docs/privacy-policy.md @@ -1,4 +1,4 @@ -# PRIVACY POLICY FOR LOYALTY CARD KEYCHAIN +# PRIVACY POLICY FOR CATIMA This privacy policy governs your use of the software application Catima (“Application”) for mobile devices that was created by Sylvia van Os. The Application is designed to store and display barcodes.