A couple quick notifications fixes (#1262)

* Create separate .easignore to ensure google-services.json goes to eas

* Set the notifications serviceDid according to the session host

* Fix types
zio/stable
Paul Frazee 2023-08-23 17:10:00 -07:00 committed by GitHub
parent 93d5ba1820
commit c1c02f480b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 108 additions and 3 deletions

102
.easignore 100644
View File

@ -0,0 +1,102 @@
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
# Bundle artifact
*.jsbundle
# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/
# Testing
coverage/
junit.xml
artifacts
# Web bundle outputs
/dist/
# Expo
.expo/
dist/
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*
# VSCode
.vscode
# gitignore and github actions
!.gitignore
!.github
# Android & iOS folders
android/
ios/
# environment variables
.env
.env.*
# Firebase (Android) Google services
# INCLUDED: google-services.json

View File

@ -3,7 +3,10 @@ import {RootStoreModel} from '../../state'
import {resetToTab} from '../../Navigation' import {resetToTab} from '../../Navigation'
import {devicePlatform, isIOS} from 'platform/detection' import {devicePlatform, isIOS} from 'platform/detection'
// TODO prod did = did:web:api.bsky.app const SERVICE_DID = (serviceUrl?: string) =>
serviceUrl?.includes('staging')
? 'did:web:api.staging.bsky.dev'
: 'did:web:api.bsky.app'
export function init(store: RootStoreModel) { export function init(store: RootStoreModel) {
store.onUnreadNotifications(count => Notifications.setBadgeCountAsync(count)) store.onUnreadNotifications(count => Notifications.setBadgeCountAsync(count))
@ -20,7 +23,7 @@ export function init(store: RootStoreModel) {
if (token) { if (token) {
try { try {
await store.agent.api.app.bsky.notification.registerPush({ await store.agent.api.app.bsky.notification.registerPush({
serviceDid: 'did:web:api.staging.bsky.dev', serviceDid: SERVICE_DID(store.session.data?.service),
platform: devicePlatform, platform: devicePlatform,
token: token.data, token: token.data,
appId: 'xyz.blueskyweb.app', appId: 'xyz.blueskyweb.app',
@ -41,7 +44,7 @@ export function init(store: RootStoreModel) {
if (t) { if (t) {
try { try {
await store.agent.api.app.bsky.notification.registerPush({ await store.agent.api.app.bsky.notification.registerPush({
serviceDid: 'did:web:api.staging.bsky.dev', serviceDid: SERVICE_DID(store.session.data?.service),
platform: devicePlatform, platform: devicePlatform,
token: t, token: t,
appId: 'xyz.blueskyweb.app', appId: 'xyz.blueskyweb.app',