feat(push): bundle a custom notification sound (notif.wav) for chat + calls

Notifications were silent despite the payload requesting sound:'default' and correct
device settings. Ship an explicit tone: a generated PCM .wav is bundled into the app
(ios-patch.sh copies it in; add-share-extension.rb adds it to the App target's Copy
Bundle Resources, tolerantly) and the server now sends sound:'notif.wav'. Part of the
consolidated iOS build alongside the background-audio + call-push + AppDelegate fixes.

Only affects iOS-native-app tokens (currently just the one test device); web push
ignores the field. Needs a fresh Codemagic build for the bundled file to exist.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-27 23:03:45 +05:30
parent 5a1ce5fdba
commit 37e58f6087
4 changed files with 31 additions and 1 deletions
+20
View File
@@ -112,5 +112,25 @@ appex = ext.product_reference
build_file = embed.add_file_reference(appex)
build_file.settings = { 'ATTRIBUTES' => ['RemoveHeadersOnCopy'] }
# ── Bundle the custom notification sound (notif.wav) into the App target ─────────────────────────────
# ios-patch.sh copied it to App/App/notif.wav. Add it as a resource so it ships in the bundle root where
# APNs can find it (the server sends sound:'notif.wav'). Tolerant: never fail the build over the sound.
begin
snd_path = File.join(APP_DIR, 'App', 'notif.wav')
if File.exist?(snd_path)
grp = project.main_group.find_subpath('App', false) || project.main_group
already = app.resources_build_phase.files.any? { |bf| bf.file_ref && bf.file_ref.respond_to?(:display_name) && bf.file_ref.display_name == 'notif.wav' }
unless already
snd_ref = grp.new_reference(snd_path)
app.resources_build_phase.add_file_reference(snd_ref)
end
puts "Notification sound bundled into App resources: notif.wav"
else
puts " (notif.wav not in project — sound not bundled)"
end
rescue => e
puts " (notif.wav bundling skipped: #{e.message})"
end
project.save
puts "Share Extension injected: #{EXT_NAME} (#{EXT_BUNDLE}) embedded in #{APP_TARGET}"