Skip to content

Commit b71c67c

Browse files
committed
Interface to communicate from settings to privacy feature.
1 parent 5fe2b0f commit b71c67c

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.nmc.android.ui
2+
3+
import android.content.Context
4+
5+
/**
6+
* interface to open privacy settings activity from nmc/1921-settings branch
7+
* for implementation look nmc/1878-privacy branch
8+
* this class will have the declaration for it since it has the PrivacySettingsActivity.java in place
9+
* since we don't have privacy settings functionality in this branch so to handle the redirection we have used interface
10+
*/
11+
interface PrivacySettingsInterface {
12+
fun openPrivacySettingsActivity(context: Context)
13+
}

app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
import com.nextcloud.client.etm.EtmActivity;
5656
import com.nextcloud.client.logger.ui.LogsActivity;
5757
import com.nextcloud.client.network.ClientFactory;
58+
import com.nmc.android.ui.PrivacySettingsInterface;
5859
import com.nextcloud.client.preferences.AppPreferences;
5960
import com.nextcloud.client.preferences.AppPreferencesImpl;
6061
import com.owncloud.android.BuildConfig;
6162
import com.owncloud.android.MainApp;
6263
import com.owncloud.android.R;
63-
import com.nmc.android.ui.PrivacySettingsActivity;
6464
import com.owncloud.android.authentication.AuthenticatorActivity;
6565
import com.owncloud.android.datamodel.ArbitraryDataProvider;
6666
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
@@ -149,6 +149,16 @@ public class SettingsActivity extends PreferenceActivity
149149
@Inject ClientFactory clientFactory;
150150
@Inject ViewThemeUtils viewThemeUtils;
151151

152+
/**
153+
* Things to note about both the branches.
154+
* 1. nmc/1921-settings branch:
155+
* --> interface won't be initialised
156+
* --> calling of interface method will be done here
157+
* 2. nmc/1878-privacy
158+
* --> interface will be initialised
159+
* --> calling of interface method won't be done here
160+
*/
161+
private PrivacySettingsInterface privacySettingsInterface;
152162

153163
@SuppressWarnings("deprecation")
154164
@Override
@@ -352,11 +362,10 @@ private void setupDataPrivacyCategory(int titleColor) {
352362
privacySettingPreference.setTitle(StringUtils.getColorSpan(getString(R.string.privacy_settings),
353363
titleColor));
354364
privacySettingPreference.setOnPreferenceClickListener(preference -> {
355-
//Compile time error will be shown here while running build from here
356-
//look for nmc/1878-privacy for the PrivacySettingsActivity.
357-
//this is workaround to avoid code conflict of settings and privacy
358-
// TODO: 05/17/23 find a way to have the redirection in privacy branch.
359-
PrivacySettingsActivity.openPrivacySettingsActivity(this, false);
365+
//implementation and logic will be available in nmc/1878-privacy
366+
if (privacySettingsInterface != null) {
367+
privacySettingsInterface.openPrivacySettingsActivity(SettingsActivity.this);
368+
}
360369
return true;
361370
});
362371
}

app/src/main/res/values/setup.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
<string name="sourcecode_url" translatable="false">https://github.com/nextcloud/android</string>
7676
<bool name="license_enabled">true</bool>
7777
<string name="license_url" translatable="false">https://www.gnu.org/licenses/gpl-2.0.html</string>
78-
<string name="url_imprint">https://www.telekom.de/impressum</string>
78+
<!-- todo add url imprint, conflict error is coming right now as tobias -->
79+
<string name="url_imprint"></string>
7980
<string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
8081
<string name="url_server_install">https://nextcloud.com/install</string>
8182

0 commit comments

Comments
 (0)