Below is a log of kittyUser, a state variable used to store the current user.
{"_actions":
{"createChannel": "/application/v1/channels.create", "registerDevice": "/application/v1/users/me.devices.register", "update": "/application/v1/users/me.self.update", "updateDisplayPicture": "/application/v1/users/me.display_picture.update"}, "_relays":
{"channels": "/application/v1/users/me.channels.relay.page..size..sort.", "channelsCount": "/application/v1/users/me.channels.count.relay", "contacts": "/application/v1/users/me.contacts.relay.page..size..sort.", "contactsCount": "/application/v1/users/me.contacts.count.relay", "devices": "/application/v1/users/me.devices.relay.page..size..sort.", "fileAccessGrant": "/application/v1/users/me.write_file_access_grant.relay", "joinableChannels": "/application/v1/users/me.joinable_channels.relay.page..size..sort.", "readFileAccessGrant": "/application/v1/users/me.read_file_access_grant.relay", "self": "/application/v1/users/me.relay", "unreadChannels": "/application/v1/users/me.unread_channels.relay.page..size..sort.", "unreadChannelsCount": "/application/v1/users/me.unread_channels.count.relay", "userBlockListItems": "/application/v1/users/me.user_block_list_items.relay.page..size..sort.", "writeFileAccessGrant": "/application/v1/users/me.write_file_access_grant.relay"}, "_streams":
{"displayPicture": "/v1/applications/10902/streams/users/me/display_picture"}, "_topics": {"calls": "/user/queue/v1/calls", "channels": "/user/queue/v1/channels", "contacts": "/user/queue/v1/contacts", "devices": "/user/queue/v1/devices", "errors": "/user/queue/v1/errors", "messages": "/user/queue/v1/messages", "notifications": "/user/queue/v1/notifications", "participants": "/user/queue/v1/participants", "self": "/user/queue/v1/self", "users": "/user/queue/v1/users"},
"displayName": "stevenchews",
"displayPictureUrl": "https://firebasestorage.googleapis.com:443/v0/b/tennielstagram.appspot.com/cant_show_this",
"id": 28580,
"isGuest": true,
"name": "steven@gmail.com",
"presence": {"online": true, "status": "AVAILABLE"},
"properties": {"expo-push-token": "ExponentPushToken[show_cant_this_but_its_correct]"}, "type": "CURRENT"}
User recieved notification cloud function:
const { Expo } = require('expo-server-sdk');
const expo = new Expo(); // create Expo client
async function handleEvent(
event: UserReceivedNotificationEvent,
context: Context
) {
if (event.userHasActiveSession) return; // skip if this user is online
const expoPushToken = event.user.properties['expo-push-token']; // get the expo push token registered
if (!expoPushToken || !Expo.isExpoPushToken(expoPushToken)) return; // check expo push token is present and valid
const notification = event.notification;
// send push notification with Expo
await expo.sendPushNotificationsAsync([
{
to: expoPushToken,
sound: 'default',
title: notification.title,
body: notification.body,
data: notification.data,
},
]);
}
My beta testers were telling me that they were not receiving push notifications when signed out, of my app or signed in. Please help!