-
Notifications
You must be signed in to change notification settings - Fork 1
Fix/#161/fcm setting edit #165
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
Changes from all commits
4c7ae0b
67c390a
883c486
18294aa
61b280c
1cc44a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const firebaseConfig = { | ||
| apiKey: 'AIzaSyD3KM0IQ4Ro3Dd2fyAY8fnhE1bQ_NesrBc', | ||
| authDomain: 'pinback-c55de.firebaseapp.com', | ||
| projectId: 'pinback-c55de', | ||
| storageBucket: 'pinback-c55de.firebasestorage.app', | ||
| messagingSenderId: '370851215931', | ||
| appId: '1:370851215931:web:08382b5e57808d29dcba1e', | ||
| measurementId: 'G-847ZNSCC3J', | ||
| }; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,10 +1,21 @@ | ||||||||||||||||||||||
| /* eslint-env serviceworker */ | ||||||||||||||||||||||
| /* eslint-disable no-undef */ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const firebaseConfig = { | ||||||||||||||||||||||
| apiKey: 'AIzaSyD3KM0IQ4Ro3Dd2fyAY8fnhE1bQ_NesrBc', | ||||||||||||||||||||||
| authDomain: 'pinback-c55de.firebaseapp.com', | ||||||||||||||||||||||
| projectId: 'pinback-c55de', | ||||||||||||||||||||||
| storageBucket: 'pinback-c55de.firebasestorage.app', | ||||||||||||||||||||||
| messagingSenderId: '370851215931', | ||||||||||||||||||||||
| appId: '1:370851215931:web:08382b5e57808d29dcba1e', | ||||||||||||||||||||||
| measurementId: 'G-847ZNSCC3J', | ||||||||||||||||||||||
| }; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| importScripts( | ||||||||||||||||||||||
| 'https://www.gstatic.com/firebasejs/9.22.2/firebase-app-compat.js' | ||||||||||||||||||||||
| ); | ||||||||||||||||||||||
| importScripts( | ||||||||||||||||||||||
| './firebase_sdk/firebase-app-compat.js', | ||||||||||||||||||||||
| './firebase_sdk/firebase-messaging-compat.js', | ||||||||||||||||||||||
| './firebase-config.js' | ||||||||||||||||||||||
| 'https://www.gstatic.com/firebasejs/9.22.2/firebase-messaging-compat.js' | ||||||||||||||||||||||
| ); | ||||||||||||||||||||||
|
Comment on lines
+14
to
19
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. ๐งฉ Analysis chainFirebase SDK ๋ฒ์ ๊ฒ์ฆ ํ์ Firebase SDK ๋ฒ์ 9.22.2๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. ์ต์ ๋ฒ์ ๋ฐ ๋ณด์ ๊ถ๊ณ ์ฌํญ์ ํ์ธํ์ฌ ์ ๋ฐ์ดํธ๊ฐ ํ์ํ์ง ๊ฒํ ํด์ฃผ์ธ์. ๐ Web query: ๐ก Result: Short answer
Details & action
Sources Would you like the exact npm install/upgrade command and a short checklist to verify the fix in your app? Firebase SDK๋ฅผ ์ต์ v10.9.0(๊ถ์ฅ v12.3.0) ์ด์์ผ๋ก ๊ธด๊ธ ์ ๊ทธ๋ ์ด๋ํ์ธ์ ํ์ฌ - importScripts('https://www.gstatic.com/firebasejs/9.22.2/firebase-app-compat.js');
- importScripts('https://www.gstatic.com/firebasejs/9.22.2/firebase-messaging-compat.js');
+ importScripts('https://www.gstatic.com/firebasejs/12.3.0/firebase-app-compat.js');
+ importScripts('https://www.gstatic.com/firebasejs/12.3.0/firebase-messaging-compat.js');(์ ํ) npm ์ฌ์ฉ ์: npm install firebase@^12.3.0๊ฒ์ฆ ์ฒดํฌ๋ฆฌ์คํธ:
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| self.addEventListener('install', function () { | ||||||||||||||||||||||
|
|
@@ -16,14 +27,16 @@ self.addEventListener('activate', function () { | |||||||||||||||||||||
| }); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| firebase.initializeApp(firebaseConfig); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const messaging = firebase.messaging(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| messaging.onBackgroundMessage((payload) => { | ||||||||||||||||||||||
| console.log('Received background message ', payload); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const notificationTitle = payload.notification?.title ?? '์๋ฆผ์ด ๋์ฐฉํ์ด์!'; | ||||||||||||||||||||||
| const notificationTitle = payload.notification?.title ?? 'PINBACK'; | ||||||||||||||||||||||
| const notificationOptions = { | ||||||||||||||||||||||
| body: payload.notification?.body, | ||||||||||||||||||||||
| body: payload.data?.body ?? '์๋ฆผ์ด ๋์ฐฉํ์ด์!', | ||||||||||||||||||||||
| icon: payload.data?.icon ?? '/link_Thumbnail.png', | ||||||||||||||||||||||
|
Comment on lines
+36
to
+39
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. ์๋ฆผ ํ์ด๋ก๋ ์ฒ๋ฆฌ ๋ถ์ผ์น ์ ๋ชฉ์ FCM ๋ฉ์์ง ์ ํ์ ๋ฐ๋ผ:
๋ชจ๋ ํ๋๋ฅผ ๋์ผํ ์์ค์์ ์ฝ๋๋ก ํต์ผํ์ธ์: ์ต์ 1: data ํ์ด๋ก๋ ์ฐ์ (data ๋ฉ์์ง ์ง์ ์) - const notificationTitle = payload.notification?.title ?? 'PINBACK';
+ const notificationTitle = payload.data?.title ?? payload.notification?.title ?? 'PINBACK';
const notificationOptions = {
body: payload.data?.body ?? '์๋ฆผ์ด ๋์ฐฉํ์ด์!',
icon: payload.data?.icon ?? '/link_Thumbnail.png',
};์ต์ 2: notification ํ์ด๋ก๋ ์ฐ์ (notification ๋ฉ์์ง ์ง์ ์) - const notificationTitle = payload.notification?.title ?? 'PINBACK';
+ const notificationTitle = payload.notification?.title ?? payload.data?.title ?? 'PINBACK';
const notificationOptions = {
- body: payload.data?.body ?? '์๋ฆผ์ด ๋์ฐฉํ์ด์!',
- icon: payload.data?.icon ?? '/link_Thumbnail.png',
+ body: payload.notification?.body ?? payload.data?.body ?? '์๋ฆผ์ด ๋์ฐฉํ์ด์!',
+ icon: payload.notification?.icon ?? payload.data?.icon ?? '/link_Thumbnail.png',
};๐ Committable suggestion
Suggested change
๐ค Prompt for AI Agents |
||||||||||||||||||||||
| }; | ||||||||||||||||||||||
| self.registration.showNotification(notificationTitle, notificationOptions); | ||||||||||||||||||||||
| }); | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -59,8 +59,6 @@ const MainCard = () => { | |||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| }, [location.search]); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // FCM ๊ตฌ๊ฐ | ||||||||||||||||||||||||||||||||||||||||
| const [fcmToken, setFcmToken] = useState<string | null>(null); | ||||||||||||||||||||||||||||||||||||||||
| const app = initializeApp(firebaseConfig); | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -131,24 +129,23 @@ const MainCard = () => { | |||||||||||||||||||||||||||||||||||||||
| const [remindTime, setRemindTime] = useState('09:00'); | ||||||||||||||||||||||||||||||||||||||||
| const nextStep = async () => { | ||||||||||||||||||||||||||||||||||||||||
| if (step === 3) { | ||||||||||||||||||||||||||||||||||||||||
| if (alarmSelected==1){ | ||||||||||||||||||||||||||||||||||||||||
| if (alarmSelected == 1) { | ||||||||||||||||||||||||||||||||||||||||
| setRemindTime('09:00'); | ||||||||||||||||||||||||||||||||||||||||
| } else if (alarmSelected==2){ | ||||||||||||||||||||||||||||||||||||||||
| } else if (alarmSelected == 2) { | ||||||||||||||||||||||||||||||||||||||||
| setRemindTime('20:00'); | ||||||||||||||||||||||||||||||||||||||||
| } else{ | ||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||
| const raw = AlarmsType[alarmSelected - 1].time; | ||||||||||||||||||||||||||||||||||||||||
| setRemindTime(normalizeTime(raw)) | ||||||||||||||||||||||||||||||||||||||||
| setRemindTime(normalizeTime(raw)); | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+132
to
139
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. ๐ ๏ธ Refactor suggestion | ๐ Major ๋์จํ ๋๋ฑ ์ฐ์ฐ์ ๋์ ์๊ฒฉํ ๋๋ฑ ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ธ์.
๋ค์ diff๋ฅผ ์ ์ฉํ์ฌ ์๊ฒฉํ ๋๋ฑ ์ฐ์ฐ์๋ก ๋ณ๊ฒฝํ์ธ์: - if (alarmSelected == 1) {
+ if (alarmSelected === 1) {
setRemindTime('09:00');
- } else if (alarmSelected == 2) {
+ } else if (alarmSelected === 2) {
setRemindTime('20:00');
} else {๐ Committable suggestion
Suggested change
๐ค Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| setDirection(1); | ||||||||||||||||||||||||||||||||||||||||
| setStep((prev) => prev + 1); | ||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| if ((isMac && step <5) || (!isMac && step <4)) { | ||||||||||||||||||||||||||||||||||||||||
| if ((isMac && step < 5) || (!isMac && step < 4)) { | ||||||||||||||||||||||||||||||||||||||||
| setDirection(1); | ||||||||||||||||||||||||||||||||||||||||
| setStep((prev) => prev + 1); | ||||||||||||||||||||||||||||||||||||||||
| } else if ( (isMac && step === 5) || (!isMac && step==4)) { | ||||||||||||||||||||||||||||||||||||||||
| } else if ((isMac && step === 5) || (!isMac && step == 4)) { | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+145
to
+148
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. ๐ ๏ธ Refactor suggestion | ๐ Major ๋์จํ ๋๋ฑ ์ฐ์ฐ์ ๋์ ์๊ฒฉํ ๋๋ฑ ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ธ์. Line 148์์ ๋ค์ diff๋ฅผ ์ ์ฉํ์ธ์: - } else if ((isMac && step === 5) || (!isMac && step == 4)) {
+ } else if ((isMac && step === 5) || (!isMac && step === 4)) {๐ Committable suggestion
Suggested change
๐ค Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||
| postSignData( | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| email: userEmail, | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -164,7 +161,7 @@ const MainCard = () => { | |||||||||||||||||||||||||||||||||||||||
| if (savedEmail) { | ||||||||||||||||||||||||||||||||||||||||
| window.location.href = '/'; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -205,7 +202,7 @@ const MainCard = () => { | |||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| <div className="mb-[4.8rem] mt-[1.2rem] flex w-full justify-between px-[3.2rem]"> | ||||||||||||||||||||||||||||||||||||||||
| {step < 4 && step > 0 && ( | ||||||||||||||||||||||||||||||||||||||||
| {step < 4 && step > 0 && ( | ||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||
| variant="secondary" | ||||||||||||||||||||||||||||||||||||||||
| size="medium" | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,7 @@ | |
| "source": "/firebase-messaging-sw.js", | ||
| "destination": "/firebase-messaging-sw.js" | ||
| }, | ||
| { | ||
| "source": "/(.*)", | ||
| "destination": "/index.html" | ||
| } | ||
| { "source": "/firebase_sdk/(.*)", "destination": "/firebase_sdk/$1" }, | ||
|
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. ๐งฉ Analysis chainFirebase SDK ๊ฒฝ๋ก์ ๋ํ ์ค์ ์์ฐ์ ํ์ธํ์ธ์.
๋ค์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ์ฌ Firebase SDK ์์ฐ ๋๋ ํ ๋ฆฌ๋ฅผ ํ์ธํ์ธ์: ๐ Script executed: #!/bin/bash
# Description: Firebase SDK ์์ฐ ๋๋ ํ ๋ฆฌ ๋ฐ ํ์ผ ํ์ธ
# public ๋๋ ํ ๋ฆฌ ๋ด firebase_sdk ํด๋ ๊ฒ์
fd -t d "firebase_sdk" apps/client/public
# Firebase SDK ๊ด๋ จ ํ์ผ ๊ฒ์
fd -e js "firebase.*sdk|firebase.*app|firebase.*messaging" apps/client/publicLength of output: 43
rewrite ๊ท์น์ด ๊ฐ๋ฆฌํค๋ ๐ค Prompt for AI Agents |
||
| { "source": "/(.*)", "destination": "/index.html" } | ||
| ] | ||
| } | ||
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.
๐ ๏ธ Refactor suggestion | ๐ Major
firebaseConfig ์ค๋ณต ์ ๊ฑฐ ํ์
firebase-config.js์ ์ด๋ฏธ ์ ์๋ ์ค์ ์ ์๋น์ค ์์ปค์์ ๋ค์ ์ ์ํ๊ณ ์์ด DRY ์์น์ ์๋ฐํ๊ณ ์์ต๋๋ค. ํฅํ ์ค์ ๋ณ๊ฒฝ ์ ๋ ๊ณณ์ ๋ชจ๋ ์์ ํด์ผ ํ๋ ์ ์ง๋ณด์ ๋ถ๋ด์ด ๋ฐ์ํฉ๋๋ค.๋ค์ diff๋ฅผ ์ ์ฉํ์ฌ ์ค๋ณต์ ์ ๊ฑฐํ์ธ์:
๐ Committable suggestion
๐ค Prompt for AI Agents