Installed app: offline squawks and pre-flight pages, push notifications, shortcuts

Offline
- Flights and squawks saved offline are tagged with their user and only sent
  while that user is signed in; storage is made persistent; Background Sync
  sends them with the app closed (Chromium); unsent count on the app badge
- Report Squawk works offline (photos included, one-time key like flights)
- The Fleet page and, for each of your aircraft, the Overview, W&B, Log
  Flight and Report Squawk pages and photo are saved ahead of time, so the
  app opens and works without signal; copies say when they were saved
- Sign-out clears saved forms, pages and photos (asks first if items wait)
- Offline page rendered by Rails (localized, follows the theme, no inline
  script); service worker version follows the build

Install and notify
- Web Push (web-push gem, VAPID keys from env or storage/vapid_keys.json):
  grounding squawks, newly overdue items (daily, once each), signing
  requests; per-device on/off and test in Profile -> This device; only
  browser push service endpoints accepted
- Manifest shortcuts (Log Flight, Report Squawk via /go/...), lang and
  localized description; install help on Profile; reload notice after a
  release

Also
- Dockerfile: libssl-dev in the build stage (openssl gem); lockfile checksums
- Leftover English and %{_} interpolation names from the localization pass
- Guide and README updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-13 22:39:42 -05:00
1 parent 89ed0a76f9
commit 8d5f57da81
54 files changed
+1217 -203

No files matched your search

@@ -0,0 +1,21 @@
class AddPushAndOfflineSquawks < ActiveRecord::Migration[8.1]
def change
# Web Push subscriptions: one per browser or installed app a user turned notifications on in.
create_table :push_subscriptions do |t|
t.references :user, null: false, foreign_key: true
t.text :endpoint, null: false
t.string :p256dh, null: false
t.string :auth, null: false
t.string :user_agent
t.timestamps
end
add_index :push_subscriptions, :endpoint, unique: true
# Squawks reported offline are sent later with a one-time key, like flights.
add_column :squawks, :client_key, :string
add_index :squawks, [ :aircraft_id, :client_key ], unique: true
# Overdue items owners were already notified about (so each is sent once).
add_column :aircraft, :notified_issue_keys, :json, null: false, default: []
end
end
Generated
+17 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.1].define(version: 2026_11_12_030000) do
ActiveRecord::Schema[8.1].define(version: 2026_11_13_010000) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
@@ -150,6 +150,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_11_12_030000) do
t.string "ad_watch_terms"
t.datetime "ad_watch_checked_at"
t.date "electronic_records_since"
t.json "notified_issue_keys", default: [], null: false
end
create_table "aircraft_airworthiness_directives", id: false, force: :cascade do |t|
@@ -695,6 +696,18 @@ ActiveRecord::Schema[8.1].define(version: 2026_11_12_030000) do
t.index ["number"], name: "index_procedures_revisions_on_number", unique: true
end
create_table "push_subscriptions", force: :cascade do |t|
t.integer "user_id", null: false
t.text "endpoint", null: false
t.string "p256dh", null: false
t.string "auth", null: false
t.string "user_agent"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["endpoint"], name: "index_push_subscriptions_on_endpoint", unique: true
t.index ["user_id"], name: "index_push_subscriptions_on_user_id"
end
create_table "record_versions", force: :cascade do |t|
t.integer "aircraft_id"
t.string "item_type", null: false
@@ -788,6 +801,8 @@ ActiveRecord::Schema[8.1].define(version: 2026_11_12_030000) do
t.string "deferral_action"
t.text "deferral_notes"
t.integer "logbook_entry_id"
t.string "client_key"
t.index ["aircraft_id", "client_key"], name: "index_squawks_on_aircraft_id_and_client_key", unique: true
t.index ["aircraft_id"], name: "index_squawks_on_aircraft_id"
t.index ["component_id"], name: "index_squawks_on_component_id"
t.index ["logbook_entry_id"], name: "index_squawks_on_logbook_entry_id"
@@ -907,6 +922,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_11_12_030000) do
add_foreign_key "oil_analyses", "aircraft"
add_foreign_key "oil_analyses", "components"
add_foreign_key "procedures_revisions", "users", column: "adopted_by_id", on_delete: :nullify
add_foreign_key "push_subscriptions", "users"
add_foreign_key "sessions", "users"
add_foreign_key "share_tokens", "aircraft"
add_foreign_key "share_tokens", "users", column: "created_by_id", on_delete: :nullify