-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/#130 pwa #132
Merged
Merged
Feat/#130 pwa #132
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
74136e0
[ bug ] add manifest options
joohaem 3db78b7
[ bug ] add pwabuilder service worker
joohaem 160696d
[ bug ] add serviceWorker with react-ts
joohaem 5797ce6
[ fix ] resolve manifest error
joohaem 7ef2c74
[ fix ] service worker 연결
joohaem 5bb6eda
[ fix ] make up service worker for caching (offline page)
joohaem cbf5a3d
[ feat ] make up offline page
joohaem c7f36fb
[ feat ] add images for pwa
joohaem 1509856
[ fix ] make up manifest for pwa
joohaem d5b41ca
[ etc ] 불필요 코드 제거
joohaem 0f4935f
Merge branch 'develop' into feat/#130-pwa
joohaem 26ae24d
[ fix ] add maskable icon on manifest
joohaem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,31 @@ | ||
{ | ||
"short_name": "Piickle", | ||
"name": "Piickle", | ||
"description": "지금 내게 필요한 대화주제 추천 서비스, Piickle", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff", | ||
"dir": "ltr", | ||
"display": "standalone", | ||
"orientation": "any", | ||
"scope": "/", | ||
"start_url": ".", | ||
"icons": [ | ||
{ | ||
"src": "images/logo.png", | ||
"type": "image/x-icon", | ||
"sizes": "512x512", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "images/logo.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
}, | ||
Comment on lines
+13
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 두 칭구는 뭐가 다른건가욤?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @NYeonK |
||
{ | ||
"src": "images/banner.jpg", | ||
"type": "image/jpg", | ||
"sizes": "480x288", | ||
"purpose": "any maskable" | ||
} | ||
] | ||
} |
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,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>No Internet Connection</title> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" /> | ||
</head> | ||
<body> | ||
<main style="height: 100vh; | ||
padding: 6.4rem 1.6rem 0; | ||
background-color: #EEF5F3" | ||
> | ||
<h1 style="font-family: Pretendard; | ||
font-weight: 600; | ||
font-size: 20px; | ||
line-height: 130%; | ||
letter-spacing: -0.04rem;" | ||
>인터넷 연결에 실패하였습니다</h1> | ||
<p style="margin-top: 0.8rem; | ||
font-family: Pretendard; | ||
font-weight: 400; | ||
font-size: 14px; | ||
line-height: 140%; | ||
letter-spacing: -0.03rem; | ||
color: #606060;" | ||
>인터넷 연결을 확인하고 다시 시도해주십시오</p> | ||
</main> | ||
</body> | ||
</html> |
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,68 @@ | ||
/* eslint-disable no-undef */ | ||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js"); | ||
|
||
const CACHE = "pwabuilder-page"; | ||
|
||
const offlineFallbackPage = "offline.html"; | ||
const urlsToCache = ["index.html", offlineFallbackPage]; | ||
|
||
self.addEventListener("message", (event) => { | ||
if (event.data && event.data.type === "SKIP_WAITING") { | ||
self.skipWaiting(); | ||
} | ||
}); | ||
|
||
// SW 설치 | ||
self.addEventListener("install", async (event) => { | ||
event.waitUntil( | ||
caches.open(CACHE).then((cache) => { | ||
console.log("Opened Cache"); | ||
return cache.addAll(urlsToCache); | ||
}), | ||
); | ||
}); | ||
|
||
if (workbox.navigationPreload.isSupported()) { | ||
workbox.navigationPreload.enable(); | ||
} | ||
|
||
// Listen for requests | ||
self.addEventListener("fetch", (event) => { | ||
if (event.request.mode === "navigate") { | ||
event.respondWith( | ||
(async () => { | ||
try { | ||
// 만약 preload 된 response가 있으면 받는다 | ||
const preloadResp = await event.preloadResponse; | ||
if (preloadResp) return preloadResp; | ||
|
||
// 만약 없으면 network를 이용한다 | ||
const networkResp = await fetch(event.request); | ||
return networkResp; | ||
} catch (error) { | ||
// 인터넷 연결이 불안정할 경우, offline 페이지를 보여준다 | ||
const cache = await caches.open(CACHE); | ||
const cachedResp = await cache.match(offlineFallbackPage); | ||
return cachedResp; | ||
} | ||
})(), | ||
); | ||
} | ||
}); | ||
|
||
// SW 활성화 | ||
// 업데이트 할 때마다 caching 을 확인하고 promise 를 동작함 | ||
self.addEventListener("activate", (event) => { | ||
const cacheWhiteList = []; | ||
cacheWhiteList.push(CACHE); | ||
|
||
event.waitUntil( | ||
caches.keys().then((cachesNames) => | ||
Promise.all( | ||
cachesNames.map((cacheName) => { | ||
if (!cacheWhiteList.includes(cacheName)) return caches.delete(cacheName); | ||
}), | ||
), | ||
), | ||
); | ||
}); |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거 성공하면, 로컬호스트 뜨던데!! 연결이 됐는지 확인하는 용도의 console일까여??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞아요 !! 지워도 될 거 같으네요 !!!?