From 88e51ab5321bcb5c5ffa24e2e4c12b4c02ec6249 Mon Sep 17 00:00:00 2001 From: A117870935 Date: Thu, 18 May 2023 23:31:37 +0530 Subject: [PATCH] Code refactoring. --- .../nextcloud/client/preferences/AppPreferences.java | 9 +++++++++ .../client/preferences/AppPreferencesImpl.java | 12 ++++++++++++ .../nmc/android/marketTracking/MoEngageSdkUtils.kt | 6 +++++- .../android/ui/activity/SettingsActivity.java | 2 +- .../android/ui/fragment/OCFileListFragment.java | 2 +- app/src/main/res/values/setup.xml | 3 --- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/preferences/AppPreferences.java b/app/src/main/java/com/nextcloud/client/preferences/AppPreferences.java index 8687ff928fe9..ed20b449c57b 100644 --- a/app/src/main/java/com/nextcloud/client/preferences/AppPreferences.java +++ b/app/src/main/java/com/nextcloud/client/preferences/AppPreferences.java @@ -350,6 +350,15 @@ default void onDarkThemeModeChanged(DarkMode mode) { void setDataAnalysis(boolean enableDataAnalysis); boolean isDataAnalysisEnabled(); + /** + * Saves the privacy policy action taken by user + * this will maintain the state of current privacy policy action taken + * @see com.nmc.android.ui.LoginPrivacySettingsActivity for actions + * @param userAction taken by user + */ + void setPrivacyPolicyAction(int userAction); + int getPrivacyPolicyAction(); + /** * Gets status of migration to user id, default false * diff --git a/app/src/main/java/com/nextcloud/client/preferences/AppPreferencesImpl.java b/app/src/main/java/com/nextcloud/client/preferences/AppPreferencesImpl.java index 04edec1f2d93..92746a24a4bd 100644 --- a/app/src/main/java/com/nextcloud/client/preferences/AppPreferencesImpl.java +++ b/app/src/main/java/com/nextcloud/client/preferences/AppPreferencesImpl.java @@ -30,6 +30,7 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.account.UserAccountManagerImpl; +import com.nmc.android.ui.LoginPrivacySettingsActivity; import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.datamodel.ArbitraryDataProviderImpl; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -104,6 +105,7 @@ public final class AppPreferencesImpl implements AppPreferences { private static final String PREF__IN_APP_REVIEW_DATA = "in_app_review_data"; private static final String PREF__DATA_ANALYSIS = "data_analysis"; + private static final String PREF__PRIVACY_POLICY_ACTION = "privacy_policy_action"; private final Context context; private final SharedPreferences preferences; @@ -584,6 +586,16 @@ public boolean isDataAnalysisEnabled() { return preferences.getBoolean(PREF__DATA_ANALYSIS, true); } + @Override + public void setPrivacyPolicyAction(int userAction) { + preferences.edit().putInt(PREF__PRIVACY_POLICY_ACTION, userAction).apply(); + } + + @Override + public int getPrivacyPolicyAction() { + return preferences.getInt(PREF__PRIVACY_POLICY_ACTION, LoginPrivacySettingsActivity.NO_ACTION); + } + @Override public boolean isUserIdMigrated() { return preferences.getBoolean(PREF__MIGRATED_USER_ID, false); diff --git a/app/src/main/java/com/nmc/android/marketTracking/MoEngageSdkUtils.kt b/app/src/main/java/com/nmc/android/marketTracking/MoEngageSdkUtils.kt index cddf6c31e709..725aa0eb9391 100644 --- a/app/src/main/java/com/nmc/android/marketTracking/MoEngageSdkUtils.kt +++ b/app/src/main/java/com/nmc/android/marketTracking/MoEngageSdkUtils.kt @@ -6,9 +6,13 @@ import com.owncloud.android.BuildConfig import com.owncloud.android.R object MoEngageSdkUtils { + + //enable/disable moengage as we are not using it right now due to no proper firebase api key + private const val MOENGAGE_ENABLED = false + @JvmStatic fun initMoEngageSDK(application: Application) { - if (application.resources.getBoolean(R.bool.moengage_enabled)) { + if (MOENGAGE_ENABLED) { val moEngage = MoEngage.Builder(application, BuildConfig.MOENGAGE_APP_ID) .build() MoEngage.initialise(moEngage) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java index 8a71b2f25c75..74bacb015df2 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java @@ -57,9 +57,9 @@ import com.nextcloud.client.logger.ui.LogsActivity; import com.nextcloud.client.network.ClientFactory; import com.nextcloud.client.preferences.AppPreferences; +import com.nmc.android.marketTracking.TealiumSdkUtils; import com.nextcloud.client.preferences.AppPreferencesImpl; import com.nextcloud.client.preferences.DarkMode; -import com.nmc.android.marketTracking.TealiumSdkUtils; import com.owncloud.android.BuildConfig; import com.owncloud.android.MainApp; import com.owncloud.android.R; diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 5afe804c9cce..8fd6b5e11cc4 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -64,9 +64,9 @@ import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.utils.EditorUtils; import com.nextcloud.utils.ShortcutUtil; +import com.nmc.android.marketTracking.TrackingScanInterface; import com.nextcloud.utils.view.FastScrollUtils; import com.nmc.android.marketTracking.AdjustSdkUtils; -import com.nmc.android.marketTracking.TrackingScanInterface; import com.nmc.android.marketTracking.TrackingScanInterfaceImpl; import com.nmc.android.marketTracking.TealiumSdkUtils; import com.owncloud.android.MainApp; diff --git a/app/src/main/res/values/setup.xml b/app/src/main/res/values/setup.xml index d88d40ed7a0f..71521eee8511 100644 --- a/app/src/main/res/values/setup.xml +++ b/app/src/main/res/values/setup.xml @@ -122,9 +122,6 @@ https://github.com/nextcloud/android/raw/dev/CHANGELOG.md - - - false