From 4fbf2991f970708c4b8fa72ccf4ba9143cb8d539 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 +++++- app/src/main/java/com/owncloud/android/MainApp.java | 6 +++--- .../android/ui/activity/SettingsActivity.java | 2 +- .../android/ui/fragment/OCFileListFragment.java | 2 +- app/src/main/res/values/setup.xml | 3 --- 7 files changed, 31 insertions(+), 9 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/MainApp.java b/app/src/main/java/com/owncloud/android/MainApp.java index 6a08682a4dd8..762c120e27e3 100644 --- a/app/src/main/java/com/owncloud/android/MainApp.java +++ b/app/src/main/java/com/owncloud/android/MainApp.java @@ -63,9 +63,9 @@ import com.nextcloud.client.preferences.AppPreferencesImpl; import com.nextcloud.client.preferences.DarkMode; import com.nmc.android.ui.LauncherActivity; -import com.nmc.android.utils.AdjustSdkUtils; -import com.nmc.android.utils.MoEngageSdkUtils; -import com.nmc.android.utils.TealiumSdkUtils; +import com.nmc.android.marketTracking.AdjustSdkUtils; +import com.nmc.android.marketTracking.MoEngageSdkUtils; +import com.nmc.android.marketTracking.TealiumSdkUtils; import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.PassCodeManager; import com.owncloud.android.datamodel.ArbitraryDataProvider; 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 c369404c59c9..06ae9bc392a8 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 @@ -58,9 +58,9 @@ import com.nextcloud.client.network.ClientFactory; import com.nextcloud.client.network.ConnectivityService; 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 8e2aac67b188..4a0dc97fb7ad 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 da94c2b0cd28..1dc7a9fd8786 100644 --- a/app/src/main/res/values/setup.xml +++ b/app/src/main/res/values/setup.xml @@ -124,9 +124,6 @@ https://github.com/nextcloud/android/raw/dev/CHANGELOG.md - - - false