-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[front] feat: complete PWA manifest (#1877)
* update manifest.json * add favicon images defined in pwa manifest * update icons and add screenshots * define share_target * attempt to fix share_target * update background color on PWA spash screen * update icon on iOS * add missing screenshots * redirect shared content to entity page and create video in db when user is logged in * fix typescript check
- Loading branch information
1 parent
e3dd3e9
commit 71264c3
Showing
22 changed files
with
159 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,70 @@ | ||
{ | ||
"short_name": "Tournesol", | ||
"name": "Tournesol", | ||
"description": "Compare online content and contribute to the development of responsible content recommendations.", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"src": "/icons/favicon.ico", | ||
"sizes": "48x48", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "/icons/favicon-128x128.png", | ||
"type": "image/png", | ||
"sizes": "128x128" | ||
}, | ||
{ | ||
"src": "/icons/favicon-512x512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
}, | ||
{ | ||
"src": "/icons/maskable-icon-512x512.png", | ||
"type": "image/png", | ||
"sizes": "512x512", | ||
"purpose": "maskable" | ||
} | ||
], | ||
"start_url": ".", | ||
"id": "/", | ||
"start_url": "/?utm_source=pwa", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
"theme_color": "#ffc800", | ||
"background_color": "#a09b87", | ||
"share_target": { | ||
"action": "/shared-content", | ||
"method": "GET", | ||
"params": { | ||
"title": "title", | ||
"text": "text", | ||
"url": "url" | ||
} | ||
}, | ||
"shortcuts": [ | ||
{ | ||
"name": "Compare", | ||
"url": "/comparison?utm_source=pwa", | ||
"icons": [{ "src": "/icons/compare.png", "sizes": "96x96" }] | ||
}, | ||
{ | ||
"name": "Recommendations", | ||
"url": "/recommendations?utm_source=pwa", | ||
"icons": [{ "src": "/icons/recommendations.png", "sizes": "96x96" }] | ||
} | ||
], | ||
"screenshots" : [ | ||
{ | ||
"src": "/images/screenshot_comparison_desktop.png", | ||
"sizes": "1300x850", | ||
"type": "image/png", | ||
"form_factor": "wide", | ||
"label": "Tournesol comparison page on Desktop" | ||
}, | ||
{ | ||
"src": "/images/screenshot_comparison_mobile.png", | ||
"sizes": "1290x2796", | ||
"type": "image/png", | ||
"form_factor": "narrow", | ||
"label": "Tournesol comparison page on Mobile" | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { Redirect } from 'react-router-dom'; | ||
import RedirectState from 'src/features/login/RedirectState'; | ||
import { useLoginState } from 'src/hooks'; | ||
import { extractVideoId } from 'src/utils/video'; | ||
|
||
/* | ||
This component handles a shared content, received via the "share_target" | ||
defined in the PWA manifest. | ||
*/ | ||
const SharedContent = () => { | ||
const { isLoggedIn } = useLoginState(); | ||
const queryParams = new URLSearchParams(document.location.search); | ||
let sharedUrl = queryParams.get('url'); | ||
if (!sharedUrl) { | ||
// The Youtube mobile app shares the video url as "text" | ||
sharedUrl = queryParams.get('text'); | ||
} | ||
|
||
const videoId = extractVideoId(sharedUrl ?? ''); | ||
if (!videoId) { | ||
return <Redirect to="/entities/invalid" />; | ||
} | ||
|
||
const destination = `/entities/yt:${videoId}`; | ||
if (!isLoggedIn) { | ||
return ( | ||
<Redirect | ||
to={{ | ||
pathname: '/login', | ||
state: { from: destination } as RedirectState, | ||
}} | ||
/> | ||
); | ||
} | ||
return <Redirect to={destination} />; | ||
}; | ||
|
||
export default SharedContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters