Skip to content

Commit

Permalink
disable and hide hpfeeds setting
Browse files Browse the repository at this point in the history
  • Loading branch information
zafodB committed Aug 18, 2021
1 parent 2388ece commit 8b68d2d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin

if (key.equals(PREFERENCE_KEY_MULTISTAGE)) {
checkMultistage();
} else if (key.equals(PREFERENCE_KEY_HPFEEDS)) {
checkHpfeeds();
// } else if (key.equals(PREFERENCE_KEY_HPFEEDS)) {
// checkHpfeeds();
}
}

Expand All @@ -192,12 +192,12 @@ private void checkMultistage() {
}
}

private void checkHpfeeds() {
SwitchPreference switchPrefHpfeeds = (SwitchPreference) getPreferenceManager().findPreference(PREFERENCE_KEY_HPFEEDS);

if (switchPrefHpfeeds.isChecked() && !enabledHpfeeds)
confirmHpfeeds(switchPrefHpfeeds).create().show();
}
// private void checkHpfeeds() {
// SwitchPreference switchPrefHpfeeds = (SwitchPreference) getPreferenceManager().findPreference(PREFERENCE_KEY_HPFEEDS);
//
// if (switchPrefHpfeeds.isChecked() && !enabledHpfeeds)
// confirmHpfeeds(switchPrefHpfeeds).create().show();
// }

private MaterialAlertDialogBuilder confirmMultistage(SwitchPreference switchPrefMultiStage) {
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
Expand All @@ -215,23 +215,24 @@ private MaterialAlertDialogBuilder confirmMultistage(SwitchPreference switchPref
return builder;
}

private MaterialAlertDialogBuilder confirmHpfeeds(SwitchPreference switchPrefHpFeeds) {
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
builder.setTitle(R.string.data_disclaimer);
// TODO extract strings
builder.setMessage("The data collected from HosTaGe attack records will be stored for Advanced Collaborative Threat Intelligence. GDPR sensitive data include but are not limited to the public IP address of the publishing HosTaGe device. Please note that the physical geographical location of the participating HosTaGe publisher can be determined with the public IP address. Furthermore, hpfeeds include the IP address and the ports of the attack sources. Exclusive access to the hpfeeds repository is provided only with an internal review process.\n" +
"\n" +
"By enabling hpfeeds, the user of this app agrees to send Aalborg University (Denmark) attack data and provides his consent to use this data to process threat intelligence. The user has the right to ask for the deletion of the data published by him/her. Please contact [email protected] for queries and more information.");
builder.setPositiveButton(R.string.enable, (dialog, which) -> {
enabledHpfeeds = true;
});
builder.setNegativeButton(R.string.close, (dialog, which) -> {
switchPrefHpFeeds.setChecked(false);
enabledHpfeeds = false;
});

return builder;
}
// private MaterialAlertDialogBuilder confirmHpfeeds(SwitchPreference switchPrefHpFeeds) {
// MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
// builder.setTitle(R.string.data_disclaimer);
//// TODO extract strings

// builder.setMessage("The data collected from HosTaGe attack records will be stored for Advanced Collaborative Threat Intelligence. GDPR sensitive data include but are not limited to the public IP address of the publishing HosTaGe device. Please note that the physical geographical location of the participating HosTaGe publisher can be determined with the public IP address. Furthermore, hpfeeds include the IP address and the ports of the attack sources. Exclusive access to the hpfeeds repository is provided only with an internal review process.\n" +
// "\n" +
// "By enabling hpfeeds, the user of this app agrees to send Aalborg University (Denmark) attack data and provides his consent to use this data to process threat intelligence. The user has the right to ask for the deletion of the data published by him/her. Please contact [email protected] for queries and more information.");
// builder.setPositiveButton(R.string.enable, (dialog, which) -> {
// enabledHpfeeds = true;
// });
// builder.setNegativeButton(R.string.close, (dialog, which) -> {
// switchPrefHpFeeds.setChecked(false);
// enabledHpfeeds = false;
// });
//
// return builder;
// }

@Override
public Fragment getCallbackFragment() {
Expand Down
12 changes: 6 additions & 6 deletions src/main/res/xml/settings_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
android:summary="@string/multistage_summary"
android:title="@string/multistage_service"/>

<SwitchPreference
app:iconSpaceReserved="false"
android:key="pref_hpfeeds_server"
android:defaultValue="false"
android:title="@string/pref_upload"
android:summary="@string/pref_upload_hpfeeds" />
<!-- <SwitchPreference-->
<!-- app:iconSpaceReserved="false"-->
<!-- android:key="pref_hpfeeds_server"-->
<!-- android:defaultValue="false"-->
<!-- android:title="@string/pref_upload"-->
<!-- android:summary="@string/pref_upload_hpfeeds" />-->

<!--Disable Hpfeeds Settings-->
<!-- <PreferenceScreen-->
Expand Down

0 comments on commit 8b68d2d

Please sign in to comment.