This file contains hidden or 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
| npm i firebase-dynamic-links |
This file contains hidden or 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
| const updateServiceWorker = () => { | |
| const registrationWaiting = serviceWorkerRegistration.waiting; | |
| if (registrationWaiting) { | |
| registrationWaiting.postMessage({ type: 'SKIP_WAITING' }); | |
| registrationWaiting.addEventListener('statechange', e => { | |
| if (e.target.state === 'activated') { | |
| window.location.reload(); | |
| } |
This file contains hidden or 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
| const initialState = { | |
| serviceWorkerInitialized: false, | |
| serviceWorkerUpdated: false, | |
| serviceWorkerRegistration: null, | |
| } |
This file contains hidden or 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
| const isServiceWorkerInitialized = useSelector( | |
| state => state.serviceWorkerInitialized, | |
| ); |
This file contains hidden or 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
| import { createStore } from 'redux'; | |
| import rootReducer from './reducers'; | |
| function configureStore() { | |
| return createStore(rootReducer, ); | |
| } | |
| export default configureStore; |
This file contains hidden or 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
| export const SW_INIT = 'SW_INIT'; | |
| export const SW_UPDATE = 'SW_UPDATE'; |
This file contains hidden or 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
| serviceWorkerRegistration.register({ | |
| onSuccess: () => store.dispatch({ type: SW_INIT }), | |
| onUpdate: reg => store.dispatch({ type: SW_UPDATE, payload: reg }), | |
| }); |
This file contains hidden or 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 optional code is used to register a service worker. | |
| // register() is not called by default. | |
| // This lets the app load faster on subsequent visits in production, and gives | |
| // it offline capabilities. However, it also means that developers (and users) | |
| // will only see deployed updates on subsequent visits to a page, after all the | |
| // existing tabs open on the page have been closed, since previously cached | |
| // resources are updated in the background. | |
| // To learn more about the benefits of this model and instructions on how to |
This file contains hidden or 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
| <div className="col-xl-4 col-lg-4 col-md-12 col-sm-12 mt-3"> | |
| <Card.Img variant="top" src={this.state.compressedLink}></Card.Img> | |
| {this.state.clicked ? ( | |
| <div className="d-flex justify-content-center"> | |
| <a | |
| href={this.state.compressedLink} | |
| download={this.state.outputFileName} | |
| className="mt-2 btn btn-dark w-75" | |
| > | |
| Download |
This file contains hidden or 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
| click = async e => { | |
| const ORIGINAL_IMAGE = this.state.originalImage; | |
| e.preventDefault(); | |
| const imageSize = (ORIGINAL_IMAGE.size / (1024 * 1024)).toFixed(1); | |
| const maxSize = 150 / 1024; // max size allowed | |
| const minSize = 100 / 1024; // min size possible (after adjustment) |
NewerOlder