-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from marcoaraujojunior/develop
Making this app closer to Progressive Web Apps pattern
- Loading branch information
Showing
21 changed files
with
361 additions
and
51 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
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
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,42 @@ | ||
import React from 'react'; | ||
|
||
class Offline extends React.Component | ||
{ | ||
constructor(props, context) { | ||
super(props, context); | ||
this.updateNetworkStatus = this.updateNetworkStatus.bind(this); | ||
this.state = { | ||
networkStatus: { | ||
display: 'none' | ||
} | ||
}; | ||
} | ||
|
||
componentWillMount() { | ||
this.updateNetworkStatus(); | ||
window.addEventListener('online', this.updateNetworkStatus, false); | ||
window.addEventListener('offline', this.updateNetworkStatus, false); | ||
} | ||
|
||
updateNetworkStatus() { | ||
if (window.navigator.onLine) { | ||
this.setState({networkStatus: {display : 'none'}}); | ||
} else { | ||
this.setState({networkStatus: {display : ''}}); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<a className="button is-danger is-disabled" style={this.state.networkStatus}> | ||
<span className="icon"> | ||
<i className="fa fa-spinner"></i> | ||
</span> | ||
<span>Off Line</span> | ||
</a> | ||
); | ||
} | ||
} | ||
|
||
export default Offline; | ||
|
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,28 @@ | ||
|
||
codecov: | ||
notify: | ||
require_ci_to_pass: true | ||
comment: | ||
behavior: default | ||
layout: header, diff | ||
require_changes: false | ||
coverage: | ||
precision: 2 | ||
range: | ||
- 90.0 | ||
- 100.0 | ||
round: down | ||
status: | ||
changes: false | ||
patch: true | ||
project: true | ||
parsers: | ||
gcov: | ||
branch_detection: | ||
conditional: true | ||
loop: true | ||
macro: false | ||
method: false | ||
javascript: | ||
enable_partials: false | ||
|
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
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
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,27 @@ | ||
{ | ||
"name": "iClient", | ||
"short_name": "iClient", | ||
"start_url": ".", | ||
"display": "standalone", | ||
"background_color": "#00d1b2", | ||
"theme_color": "#00d1b2", | ||
"description": "A client to manager herbs sells", | ||
"icons": [ | ||
{ | ||
"src": "\/favicons\/android-chrome-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image\/png" | ||
}, | ||
{ | ||
"src": "\/favicons\/android-chrome-512x512.png", | ||
"sizes": "512x512", | ||
"type": "image\/png" | ||
} | ||
], | ||
"related_applications": [ | ||
{ | ||
"platform": "web", | ||
"id" : "iclient.web" | ||
} | ||
] | ||
} |
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,56 @@ | ||
var CACHE_NAME = 'v1::iClient'; | ||
var urlsToCache = [ | ||
'/', | ||
'/index.html', | ||
'/dist/bundle.min.js', | ||
'/favicons/favicon-16x16.png', | ||
'https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-with-addons.min.js', | ||
'https://cdnjs.cloudflare.com/ajax/libs/react-router/2.8.1/ReactRouter.min.js', | ||
'https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.min.js', | ||
]; | ||
|
||
self.addEventListener('install', function(event) { | ||
event.waitUntil( | ||
caches.open(CACHE_NAME).then(function(cache) { | ||
return cache.addAll(urlsToCache); | ||
}) | ||
); | ||
}); | ||
|
||
self.addEventListener('activate', function(event) { | ||
event.waitUntil( | ||
caches.keys().then(function(cacheNames) { | ||
return Promise.all( | ||
cacheNames.filter(function(cacheName) { | ||
return cacheName !== CACHE_NAME; | ||
}).map(function(cacheName) { | ||
return caches.delete(cacheName); | ||
}) | ||
); | ||
}) | ||
); | ||
}); | ||
self.addEventListener('fetch', function(event) { | ||
var requestURL = new URL(event.request.url); | ||
|
||
event.respondWith( | ||
caches.open(CACHE_NAME).then(function(cache) { | ||
return cache.match(event.request).then(function(response) { | ||
if (response && !navigator.onLine) { | ||
return response; | ||
} | ||
return fetch(event.request).then(function(response) { | ||
if (response.ok) { | ||
cache.put(event.request, response.clone()).catch(function(error) { | ||
return new Response("Request failed!"); | ||
}); | ||
} | ||
return response; | ||
}).catch(function(e) { | ||
return new Response("Request failed!"); | ||
}); | ||
}); | ||
}) | ||
); | ||
}); | ||
|
Oops, something went wrong.