Skip to content

feat: add download data empty state button to keyboard (#627)#629

Open
prince-0408 wants to merge 2 commits intoscribe-org:mainfrom
prince-0408:fix-issue-627-download-data-empty-state
Open

feat: add download data empty state button to keyboard (#627)#629
prince-0408 wants to merge 2 commits intoscribe-org:mainfrom
prince-0408:fix-issue-627-download-data-empty-state

Conversation

@prince-0408
Copy link
Copy Markdown
Contributor

Description

Closes #627

This PR implements the empty state for Scribe keyboards when the keyboard
has been installed but language data has not yet been downloaded. A blue
"Please download language data" button now appears at the top of the
keyboard, matching the Figma design. Tapping the button opens the Scribe
app and navigates directly to the Download Data screen.

Changes Made

Keyboards/KeyboardsBase/KeyboardViewController.swift

  • Added downloadDataBtn (UIButton?) property to hold a reference to
    the empty state button
  • Added hasLanguageData() — checks if the language SQLite file exists
    in the shared app group container (group.be.scri.userDefaultsContainer)
  • Added showDownloadDataBtn() — creates and lays out the blue CTA button
    pinned to the top of the keyboard view using Auto Layout
  • Added conditionallyShowDownloadDataBtn() — shows or hides the button
    based on data availability; only shown in .idle command state, hidden
    during translate / conjugate / plural / displayInformation states
  • Added openScribeApp() — uses the UIResponder chain to open the
    scribe:// URL scheme, directing the user to the Scribe app download screen
  • Called conditionallyShowDownloadDataBtn() at the end of loadKeys()
    so it re-evaluates on every keyboard load

Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift

  • Added downloadDataMsg variable with default English fallback:
    "Please download language data"

Language Interface Variables (11 keyboards)

Added localized downloadDataMsg to each keyboard's layout function:

Language Message
English Please download language data
German Bitte Sprachdaten herunterladen
French Veuillez télécharger les données linguistiques
Spanish Por favor descarga los datos del idioma
Italian Scarica i dati della lingua
Portuguese Por favor baixe os dados do idioma
Russian Загрузите языковые данные
Swedish Ladda ner språkdata
Norwegian Last ned språkdata
Hebrew אנא הורד נתוני שפה
Indonesian Unduh data bahasa

Scribe/Info.plist

  • Registered the scribe:// custom URL scheme (CFBundleURLSchemes) so
    the Scribe app can be opened from the keyboard extension

Scribe/AppDelegate.swift

  • Added application(_:open:options:) handler for the scribe:// URL scheme
  • Posts the existing NavigateToDownloadScreen notification which
    InstallationVC already listens for and handles by pushing
    DownloadDataScreen

Testing

  • Install a Scribe keyboard without downloading data — blue button
    appears at top of keyboard
  • Tap the button — Scribe app opens on the Download Data screen
  • Download language data in the app — switch back to keyboard,
    button is gone
  • Trigger a Scribe command (translate/conjugate/plural) — button
    is hidden during command mode
  • Test on all 11 supported languages — localized message appears
    correctly

Notes

  • The UIResponder chain URL trick works on a real device. In the
    simulator the button visibility can be tested but the tap-to-open
    behaviour requires a physical device
  • RequestsOpenAccess remains false in the keyboard extension —
    the responder chain approach does not require full access

@github-actions
Copy link
Copy Markdown

Thank you for the pull request! 💙

The Scribe-iOS team will do our best to address your contribution as soon as we can. If you're not already a member of our public Matrix community, please consider joining! We'd suggest that you use the Element client as well as Element X for a mobile app, and definitely join the General and iOS rooms once you're in. Also consider attending our bi-weekly Saturday dev syncs. It'd be great to meet you 😊

Note

Scribe uses Conventional Comments in reviews to make sure that communication is as clear as possible.

@github-actions
Copy link
Copy Markdown

Maintainer Checklist

The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

  • Tests for changes have been written and the CI unit test, linting and formatting workflows within the PR checks do not indicate new errors in the files changed

  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@andrewtavis
Copy link
Copy Markdown
Member

Thanks for this, @prince-0408! Sorry to ask you to do a bunch of reformatting, but then it'll only be done this once :) Can you switch this over to four spaces to match the new style?

When a Scribe keyboard is installed but language data has not been
downloaded yet, a blue 'Please download language data' button now
appears at the top of the keyboard. Tapping it opens the Scribe app
and navigates directly to the Download Data screen.

Changes:
- KeyboardViewController.swift
  - Added downloadDataBtn (UIButton?) property
  - Added hasLanguageData() to check if the language SQLite file
    exists in the shared app group container
  - Added showDownloadDataBtn() to create and layout the blue CTA
    button at the top of the keyboard view
  - Added conditionallyShowDownloadDataBtn() to show/hide the button
    based on data availability and current command state (only shown
    in .idle state, hidden during translate/conjugate/plural/info)
  - Added openScribeApp() using the UIResponder chain to open the
    scribe:// URL scheme and direct the user to the download screen
  - Called conditionallyShowDownloadDataBtn() at the end of loadKeys()
  - Button is also hidden during displayInformation state

- CommandVariables.swift
  - Added downloadDataMsg variable with default English fallback text
    'Please download language data'

- Language interface variables (all 11 keyboards)
  - ENInterfaceVariables: 'Please download language data'
  - DEInterfaceVariables: 'Bitte Sprachdaten herunterladen'
  - FRInterfaceVariables: 'Veuillez télécharger les données linguistiques'
  - ESInterfaceVariables: 'Por favor descarga los datos del idioma'
  - ITInterfaceVariables: 'Scarica i dati della lingua'
  - PTInterfaceVariables: 'Por favor baixe os dados do idioma'
  - RUInterfaceVariables: 'Загрузите языковые данные'
  - SVInterfaceVariables: 'Ladda ner språkdata'
  - NBInterfaceVariables: 'Last ned språkdata'
  - HEInterfaceVariables: 'אנא הורד נתוני שפה'
  - IDInterfaceVariables: 'Unduh data bahasa'

- Scribe/Info.plist
  - Registered scribe:// URL scheme (CFBundleURLSchemes) so the app
    can be opened from the keyboard extension

- Scribe/AppDelegate.swift
  - Added application(_:open:options:) handler for the scribe:// URL
  - Posts NavigateToDownloadScreen notification which InstallationVC
    already handles to push the DownloadDataScreen

Closes scribe-org#627
@prince-0408 prince-0408 force-pushed the fix-issue-627-download-data-empty-state branch from a5d3c37 to 319c81e Compare March 24, 2026 22:08
@prince-0408
Copy link
Copy Markdown
Contributor Author

prince-0408 commented Mar 24, 2026

Done! @andrewtavis
I have now updated my work to match the version of the main branch. I changed everything to use four spaces for indentation. I'm glad I could make things consistent. It's no problem all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add button to top of keyboard directing user to download screen when no data is downloaded

2 participants