diff --git a/app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java b/app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java index f3661050ba8d..6274a2f255b8 100644 --- a/app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java +++ b/app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java @@ -46,7 +46,6 @@ import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.device.DeviceInfo; import com.nextcloud.client.documentscan.AppScanOptionalFeature; -import com.nextcloud.client.preferences.AppPreferencesImpl; import com.nextcloud.ui.ChooseAccountDialogFragment; import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.utils.EditorUtils; @@ -469,8 +468,7 @@ public MaterialSchemes getMaterialSchemesForPrimaryBackground() { fda.themeUtils, viewThemeUtils, editorUtils, - appScanOptionalFeature, - AppPreferencesImpl.fromContext(targetContext)); + appScanOptionalFeature); fda.runOnUiThread(sut::show); 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..6034276d0527 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.PrivacyUserAction; 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, PrivacyUserAction.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/nmc/android/ui/PrivacyUserAction.kt b/app/src/main/java/com/nmc/android/ui/PrivacyUserAction.kt new file mode 100644 index 000000000000..6dca412cc29b --- /dev/null +++ b/app/src/main/java/com/nmc/android/ui/PrivacyUserAction.kt @@ -0,0 +1,9 @@ +package com.nmc.android.ui + +//class to handle user action for privacy +object PrivacyUserAction { + //privacy user action to maintain the state of privacy policy + const val NO_ACTION = 0 //user has taken no action + const val REJECT_ACTION = 1 //user rejected the privacy policy + const val ACCEPT_ACTION = 2 //user has accepted the privacy policy +} \ No newline at end of file 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/OCFileListBottomSheetDialog.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListBottomSheetDialog.java index e7393b024070..323244f04046 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListBottomSheetDialog.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListBottomSheetDialog.java @@ -29,7 +29,7 @@ import com.nextcloud.client.device.DeviceInfo; import com.nextcloud.client.di.Injectable; import com.nextcloud.client.documentscan.AppScanOptionalFeature; -import com.nextcloud.client.preferences.AppPreferences; +import com.nextcloud.client.preferences.AppPreferencesImpl; import com.nextcloud.utils.EditorUtils; import com.nmc.android.marketTracking.TealiumSdkUtils; import com.owncloud.android.R; @@ -62,7 +62,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In private final EditorUtils editorUtils; private final AppScanOptionalFeature appScanOptionalFeature; - private final AppPreferences preferences; + public OCFileListBottomSheetDialog(FileActivity fileActivity, OCFileListBottomSheetActions actions, @@ -72,8 +72,7 @@ public OCFileListBottomSheetDialog(FileActivity fileActivity, ThemeUtils themeUtils, ViewThemeUtils viewThemeUtils, EditorUtils editorUtils, - AppScanOptionalFeature appScanOptionalFeature, - AppPreferences preferences) { + AppScanOptionalFeature appScanOptionalFeature) { super(fileActivity); this.actions = actions; this.fileActivity = fileActivity; @@ -84,7 +83,6 @@ public OCFileListBottomSheetDialog(FileActivity fileActivity, this.viewThemeUtils = viewThemeUtils; this.editorUtils = editorUtils; this.appScanOptionalFeature = appScanOptionalFeature; - this.preferences = preferences; } @Override @@ -176,7 +174,10 @@ protected void onCreate(Bundle savedInstanceState) { setupClickListener(); //track screen view when fragment is visible - TealiumSdkUtils.trackView(TealiumSdkUtils.SCREEN_VIEW_FAB_PLUS, preferences); + TealiumSdkUtils.trackView(TealiumSdkUtils.SCREEN_VIEW_FAB_PLUS, + //Need to create direct instance of AppPreferences as Injection doesn't work in Dialogs + //If we take AppPreferences as parameter in constructor it will affect the other NMC PRs test cases + AppPreferencesImpl.fromContext(fileActivity)); } private void setupClickListener() { 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..251ee4051d19 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; @@ -507,8 +507,7 @@ public void registerFabListener() { themeUtils, viewThemeUtils, editorUtils, - appScanOptionalFeature, - preferences); + appScanOptionalFeature); dialog.getBehavior().setState(BottomSheetBehavior.STATE_EXPANDED); dialog.show(); 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