diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2020-02-04 18:40:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-04 18:40:45 +0300 |
commit | ed2fc76155541ced3412293c4d8a3cae17e96467 (patch) | |
tree | 242b6c08f1745f38aed2cc0894f626a36a279233 /src | |
parent | e174683c1bf465ee119505df3b858e17b2225d9e (diff) | |
parent | 9647c19d819818285a65e59ea0a70d3b7d9276d6 (diff) |
Merge pull request #2562 from nextcloud/feature/opt-out_data_collection
Add user setting to opt-out from data collection
Diffstat (limited to 'src')
-rw-r--r-- | src/components/AppSettingsMenu.vue | 44 | ||||
-rw-r--r-- | src/main.js | 4 |
2 files changed, 47 insertions, 1 deletions
diff --git a/src/components/AppSettingsMenu.vue b/src/components/AppSettingsMenu.vue index a3c3807cc..730ac0a1f 100644 --- a/src/components/AppSettingsMenu.vue +++ b/src/components/AppSettingsMenu.vue @@ -4,6 +4,31 @@ {{ t('mail', 'Add mail account') }} </router-link> + <p v-if="loadingOptOutSettings" class="app-settings"> + <span class="icon-loading-small"></span> + {{ + t( + 'mail', + 'Allow the app to collect data about your interactions. Based on this data, the app will adapt to your preferences. The data will only be stored locally.' + ) + }} + </p> + <p v-else class="app-settings"> + <input + id="data-collection-toggle" + class="checkbox" + type="checkbox" + :checked="useDataCollection" + @change="onToggleCollectData" + /> + <label for="data-collection-toggle">{{ + t( + 'mail', + 'Allow the app to collect data about your interactions. Based on this data, the app will adapt to your preferences. The data will only be stored locally.' + ) + }}</label> + </p> + <p v-if="loadingAvatarSettings" class="app-settings avatar-settings"> <span class="icon-loading-small"></span> {{ t('mail', 'Use Gravatar and favicon avatars') }} @@ -46,12 +71,16 @@ export default { data() { return { loadingAvatarSettings: false, + loadingOptOutSettings: false, } }, computed: { useExternalAvatars() { return this.$store.getters.getPreference('external-avatars', 'true') === 'true' }, + useDataCollection() { + return this.$store.getters.getPreference('collect-data', 'true') === 'true' + }, }, methods: { onToggleExternalAvatars(e) { @@ -67,6 +96,19 @@ export default { this.loadingAvatarSettings = false }) }, + onToggleCollectData(e) { + this.loadingOptOutSettings = true + + this.$store + .dispatch('savePreference', { + key: 'collect-data', + value: e.target.checked ? 'true' : 'false', + }) + .catch(error => Logger.error('could not save preferences', {error})) + .then(() => { + this.loadingOptOutSettings = false + }) + }, registerProtocolHandler: function() { if (window.navigator.registerProtocolHandler) { var url = @@ -83,7 +125,7 @@ export default { </script> <style scoped> -p.avatar-settings span.icon-loading-small { +p.app-settings span.icon-loading-small { display: inline-block; vertical-align: middle; padding: 5px 0; diff --git a/src/main.js b/src/main.js index 064e04a35..f56480bf8 100644 --- a/src/main.js +++ b/src/main.js @@ -63,6 +63,10 @@ store.commit('savePreference', { key: 'external-avatars', value: getPreferenceFromPage('external-avatars'), }) +store.commit('savePreference', { + key: 'collect-data', + value: getPreferenceFromPage('collect-data'), +}) const accounts = JSON.parse(atob(getPreferenceFromPage('serialized-accounts'))) accounts.map(fixAccountId).forEach(account => { |