Remote-Text / remote-text-ios-client

The iOS/iPadOS app for Remote Text
1 stars 0 forks source link

Re-architecture app, add "Save & Preview" (and similar) buttons #9

Closed Samasaur1 closed 1 year ago

Samasaur1 commented 1 year ago

Closes #7.

Rather than the navigational hodgepodge that the app is currently, this PR refactors it to be data-based. There is now a stack of ContentView.Navigation enums, which directly represent the contents of the navigation stack. This allows functionality such as swapping from the file creation view to the file editing view[^1], supporting a "Save & Preview" button (by pushing another view onto the stack programmatically), and more.

Making use of this new functionality, in the "Create New File" view, users now have the option to create the file and preview it immediately, create the file and jump to the editor, or create the file and close it. Likewise, in the file editor view, while the behavior remains to have only a "Preview" button when no changes have been made, if the file has been changed there are options to save and preview, save and continue working, or save and close.

[^1]: Note that this currently animates strangely. It may actually be best to have the file creation and file editing views be the same view in code, determined by a @State boolean. Further investigation is required.