-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* starting push notifications. problems * chat push notifications logic. * add handler for different types. TODO: add more types. * add accepted request notification type. * remove comments * remove credentials. * remove app json.
- Loading branch information
Showing
12 changed files
with
2,236 additions
and
1,269 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,6 @@ web-report/ | |
.env | ||
|
||
# Because we are using yarn | ||
package-lock.json | ||
package-lock.json | ||
google-services.json | ||
app.json |
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
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,20 @@ | ||
import { ROUTES } from '@constants/routes'; | ||
|
||
export const notificationHanlder = (data) => ({ | ||
CHAT_NOTIFICATION: { | ||
redirect: ROUTES.Chat, | ||
payload: { | ||
user: { ...data } | ||
} | ||
}, | ||
FRIEND_REQUEST_NOTIFICATION: { | ||
redirect: ROUTES.Profile, | ||
payload: { | ||
tabSelected: 1 | ||
} | ||
}, | ||
ACCEPTED_REQUEST_NOTIFICATION: { | ||
redirect: ROUTES.Profile, | ||
payload: { ...data } | ||
} | ||
}); |
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,22 @@ | ||
import { Platform } from 'react-native'; | ||
import * as Notifications from 'expo-notifications'; | ||
import * as Permissions from 'expo-permissions'; | ||
import { saveNotificationToken } from './FirestoreService'; | ||
|
||
export const registerForPushNotifications = async (username) => { | ||
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS); | ||
if (status !== 'granted') { | ||
alert('No notification permissions!'); | ||
return; | ||
} | ||
|
||
// Get the token that identifies this device | ||
let token = await Notifications.getDevicePushTokenAsync(); | ||
|
||
const expoToken = await Notifications.getExpoPushTokenAsync(); | ||
|
||
console.warn(token); | ||
console.warn(expoToken); | ||
|
||
saveNotificationToken(token, expoToken, username); | ||
}; |
Oops, something went wrong.