✨ Add Data safety column #49

Open
devhelper47607 wants to merge 1 commit from devhelper47607/v2-web:feat/41-data-safety-column into master
2 changed files with 49 additions and 1 deletions

View file

@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Data safety column :
- Shows the presence of collected and/or shared data for each application
- Tooltip summarizes data collection, data sharing, encryption in transit and the ability to request data deletion, based on the Google Play Data safety section
- Requires the API server to send [data safety information](https://git.kaki87.net/playsearch.kaki87.net/v2-api), see `playsearch.kaki87.net/v2-api` contributions
## 0.1.0 (2022-01-21)
Initial release

View file

@ -73,7 +73,34 @@
this.sortColumn = columnName;
},
timestampToString: timestamp => dayjs(timestamp).format('ddd, MMM D, YYYY'),
timestampToRelativeString: timestamp => dayjs().to(timestamp)
timestampToRelativeString: timestamp => dayjs().to(timestamp),
getDataSafetySummary: function(item){
const dataSafety = item['dataSafety'];
if(!dataSafety)
return null;
const collectedData = dataSafety['collectedData'] || [],
sharedData = dataSafety['sharedData'] || [],
practices = (dataSafety['securityPractices'] || []).map(practice => practice['practice']),
summary = {
available: collectedData.length > 0 || sharedData.length > 0 || practices.length > 0,
collected: collectedData.length > 0,
shared: sharedData.length > 0,
collectedCount: collectedData.length,
sharedCount: sharedData.length,
encrypted: practices.includes('Data is encrypted in transit'),
deletable: practices.includes('You can request that data be deleted')
};
return summary;
},
getDataSafetyTooltip: function(item){
const summary = this.getDataSafetySummary(item);
if(!summary)
return 'title: Google Play Data safety information is still loading; delay: 500; pos: right';
if(!summary.available)
return 'title: No Google Play Data safety information available for this app; delay: 500; pos: right';
const yesNo = value => value ? 'Yes' : 'No';
return `title: Data collected: ${yesNo(summary.collected)}${summary.collected ? ` (${summary.collectedCount} types)` : ''}; Data shared: ${yesNo(summary.shared)}${summary.shared ? ` (${summary.sharedCount} types)` : ''}; Encrypted in transit: ${yesNo(summary.encrypted)}; Request data deletion: ${yesNo(summary.deletable)}; delay: 500; pos: right`;
}
}
};
</script>
@ -144,6 +171,9 @@
@click="toggleColumnSort('hasIap')"
:data-uk-tooltip="isLoading ? undefined : `title: In-App Purchases; pos: bottom`"
>IAP</th>
<th
:data-uk-tooltip="isLoading ? undefined : `title: Google Play Data safety; pos: bottom`"
>Data<br>safety</th>
<th
:class="getTableHeadingClassName('androidVersion')"
@click="toggleColumnSort('androidVersion')"
@ -190,6 +220,15 @@
<td>${{ typeof item['price'] === 'number' ? item['price'] : '-' }}</td>
<td>{{ typeof item['adSupported'] === 'boolean' ? item['adSupported'] ? 'Yes' : 'No' : '-' }}</td>
<td>{{ typeof item['offersIAP'] === 'boolean' ? item['offersIAP'] ? 'Yes' : 'No' : '-' }}</td>
<td
:data-uk-tooltip="getDataSafetyTooltip(item)"
>
<span v-if="isLoading">-</span>
<span v-else-if="!getDataSafetySummary(item) || !getDataSafetySummary(item).available">-</span>
<span v-else-if="getDataSafetySummary(item).collected">Collected</span>
<span v-else-if="getDataSafetySummary(item).shared">Shared only</span>
<span v-else>Encrypted</span>
</td>
<td>{{ item['androidVersionText'] || '-' }}</td>
<td>{{ item['permissions'] ? item['permissions'].length : '-' }}</td>
<td>