@@ -666,9 +666,7 @@ export const make = Effect.gen(function* () {
666666 Effect . map ( ( targets ) => {
667667 const currentTarget = targets . find ( ( row ) => row . device_id === input . target . device_id ) ;
668668 return currentTarget &&
669- expectedCurrentToken ( { target : currentTarget , kind : input . kind } ) === input . token &&
670- currentTarget . bundle_id === input . target . bundle_id &&
671- currentTarget . aps_environment === input . target . aps_environment
669+ expectedCurrentToken ( { target : currentTarget , kind : input . kind } ) === input . token
672670 ? currentTarget
673671 : null ;
674672 } ) ,
@@ -683,6 +681,7 @@ export const make = Effect.gen(function* () {
683681 "relay.delivery.kind" : input . kind ,
684682 ...( input . sourceJobId ? { "relay.delivery.job_id" : input . sourceJobId } : { } ) ,
685683 } ) ;
684+ let deliveryTarget = input . target ;
686685 const now = yield * DateTime . now ;
687686 const aggregate =
688687 input . aggregate === null ? null : sanitizeAgentActivityAggregateState ( input . aggregate ) ;
@@ -724,6 +723,7 @@ export const make = Effect.gen(function* () {
724723 } ) ;
725724 return staleJobResult ( { deviceId : input . target . device_id , kind : input . kind } ) ;
726725 }
726+ deliveryTarget = currentTarget ;
727727 if ( alert ) {
728728 const preferences = parsePreferences ( currentTarget . preferences_json ) ;
729729 const previousAggregate = parseAggregate ( currentTarget . last_aggregate_json ) ;
@@ -781,7 +781,7 @@ export const make = Effect.gen(function* () {
781781 ) ;
782782 const result = yield * apns
783783 . sendLiveActivityRequest ( {
784- credentials : credentialsForTarget ( config . apns , input . target ) ,
784+ credentials : credentialsForTarget ( config . apns , deliveryTarget ) ,
785785 request,
786786 issuedAtUnixSeconds : epochSeconds ,
787787 } )
@@ -847,6 +847,7 @@ export const make = Effect.gen(function* () {
847847 "relay.delivery.kind" : "push_notification" ,
848848 ...( input . sourceJobId ? { "relay.delivery.job_id" : input . sourceJobId } : { } ) ,
849849 } ) ;
850+ let deliveryTarget = input . target ;
850851 const now = yield * DateTime . now ;
851852 const epochSeconds = Math . floor ( now . epochMilliseconds / 1_000 ) ;
852853 const notification = sanitizeApnsNotificationPayload ( input . notification ) ;
@@ -916,6 +917,7 @@ export const make = Effect.gen(function* () {
916917 kind : "push_notification" ,
917918 } ) ;
918919 }
920+ deliveryTarget = currentTarget ;
919921 const preferences = parsePreferences ( currentTarget . preferences_json ) ;
920922 const alertAllowed =
921923 notification . phase !== undefined && notification . updatedAt !== undefined
@@ -937,7 +939,7 @@ export const make = Effect.gen(function* () {
937939 }
938940 const result = yield * apns
939941 . sendPushNotificationRequest ( {
940- credentials : credentialsForTarget ( config . apns , input . target ) ,
942+ credentials : credentialsForTarget ( config . apns , deliveryTarget ) ,
941943 request,
942944 issuedAtUnixSeconds : epochSeconds ,
943945 } )
0 commit comments