Repository navigation
feat(A2): 真 FCM 推播——App 被殺點推播可喚醒接單卡 - #38
Merged
Merged
Conversation
後端原本只有 LogPusher stub。實作 FCMPusher(Firebase Admin SDK), 讓司機 App 被殺/背景時系統匣顯示派單通知,點擊喚醒 App 直達接單卡。 - notify.AppPusher.SendRideOffer 加 data map[string]string 參數; Dispatcher.NotifyDriverRideOffer 一路帶下去;LogPusher 記錄 data - internal/notify/fcm.go:FCMPusher 用 messaging Notification+Data+ Android high priority;只送 FCM platform token;逐台判斷失敗 (單台 token 失效不影響其他台),全數失敗才回錯 - dispatch.go rideOfferPushData:組推播 data,值一律字串 (FCM 限制),欄位對齊 rideAssignedPayload 但**不帶 stops**—— 結構化陣列不塞 FCM data,App 接單後重讀 rides/active 補齊全程 - config FCM_CREDENTIALS_FILE;main.go 有憑證才啟用,初始化失敗 只打 log 降級 stub(憑證問題不讓服務起不來、派單路徑不受影響) - 測試:rideOfferPushData 欄位字串化+不帶 stops+無 dropoff 省略; notify recordingPusher 斷言 data 一路帶到 pusher go build/vet 通過;notify/service(純)/config 測試綠。FCMPusher 本身 需真憑證/網路無法單元測,改測純函式與介面串接。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
後端原本只有
LogPusherstub。實作FCMPusher(Firebase Admin SDK),讓司機 App 被殺/背景時系統匣顯示派單通知,點擊喚醒 App 直達接單卡(A2)。改動
notify.AppPusher.SendRideOffer加data map[string]string;Dispatcher.NotifyDriverRideOffer一路帶下去;LogPusher記錄 datainternal/notify/fcm.go:FCMPusher用 messagingNotification+Data+Androidhighpriority;只送 FCM platform token;逐台判斷失敗(單台 token 失效不影響其他台),全數失敗才回錯dispatch.go rideOfferPushData:組推播 data,值一律字串(FCM 限制),欄位對齊rideAssignedPayload但不帶 stops——結構化陣列不塞 FCM data,App 接單後重讀rides/active補齊全程(見 fleet-app#32)FCM_CREDENTIALS_FILE;main.go有憑證才啟用,初始化失敗只打 log 降級 stub(憑證問題不讓服務起不來、派單路徑不受影響)rideOfferPushData字串化+不帶 stops+無 dropoff 省略;notifyrecordingPusher 斷言 data 一路帶到 pusher驗收
go build ./...、go vet ./...通過internal/notify、internal/service(純函式)、internal/config測試綠FCMPusher本身需真憑證/網路,改測純函式與介面串接;真裝置 E2E 待配 Firebase 專案啟用方式
Firebase Console → 服務帳戶 → 產生私鑰 JSON → 掛進容器 → 設
FCM_CREDENTIALS_FILE。未設=stub(本地開發不必配 Firebase)。🤖 Generated with Claude Code