Skip to content

Commit

Permalink
Interface to communicate from settings to privacy feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Jun 6, 2023
1 parent 5fe2b0f commit b71c67c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
13 changes: 13 additions & 0 deletions app/src/main/java/com/nmc/android/ui/PrivacySettingsInterface.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.nmc.android.ui

import android.content.Context

/**
* interface to open privacy settings activity from nmc/1921-settings branch
* for implementation look nmc/1878-privacy branch
* this class will have the declaration for it since it has the PrivacySettingsActivity.java in place
* since we don't have privacy settings functionality in this branch so to handle the redirection we have used interface
*/
interface PrivacySettingsInterface {
fun openPrivacySettingsActivity(context: Context)
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
import com.nextcloud.client.etm.EtmActivity;
import com.nextcloud.client.logger.ui.LogsActivity;
import com.nextcloud.client.network.ClientFactory;
import com.nmc.android.ui.PrivacySettingsInterface;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.nmc.android.ui.PrivacySettingsActivity;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
Expand Down Expand Up @@ -149,6 +149,16 @@ public class SettingsActivity extends PreferenceActivity
@Inject ClientFactory clientFactory;
@Inject ViewThemeUtils viewThemeUtils;

/**
* Things to note about both the branches.
* 1. nmc/1921-settings branch:
* --> interface won't be initialised
* --> calling of interface method will be done here
* 2. nmc/1878-privacy
* --> interface will be initialised
* --> calling of interface method won't be done here
*/
private PrivacySettingsInterface privacySettingsInterface;

@SuppressWarnings("deprecation")
@Override
Expand Down Expand Up @@ -352,11 +362,10 @@ private void setupDataPrivacyCategory(int titleColor) {
privacySettingPreference.setTitle(StringUtils.getColorSpan(getString(R.string.privacy_settings),
titleColor));
privacySettingPreference.setOnPreferenceClickListener(preference -> {
//Compile time error will be shown here while running build from here
//look for nmc/1878-privacy for the PrivacySettingsActivity.
//this is workaround to avoid code conflict of settings and privacy
// TODO: 05/17/23 find a way to have the redirection in privacy branch.
PrivacySettingsActivity.openPrivacySettingsActivity(this, false);
//implementation and logic will be available in nmc/1878-privacy
if (privacySettingsInterface != null) {
privacySettingsInterface.openPrivacySettingsActivity(SettingsActivity.this);
}
return true;
});
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
<string name="sourcecode_url" translatable="false">https://github.com/nextcloud/android</string>
<bool name="license_enabled">true</bool>
<string name="license_url" translatable="false">https://www.gnu.org/licenses/gpl-2.0.html</string>
<string name="url_imprint">https://www.telekom.de/impressum</string>
<!-- todo add url imprint, conflict error is coming right now as tobias -->
<string name="url_imprint"></string>
<string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
<string name="url_server_install">https://nextcloud.com/install</string>

Expand Down

0 comments on commit b71c67c

Please sign in to comment.