Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate runtime from Cordova to Capacitor #805

Open
65 of 73 tasks
graphefruit opened this issue Oct 4, 2024 · 1 comment
Open
65 of 73 tasks

Migrate runtime from Cordova to Capacitor #805

graphefruit opened this issue Oct 4, 2024 · 1 comment

Comments

@graphefruit
Copy link
Owner

graphefruit commented Oct 4, 2024

Motivation

At least from my outsider's perspective, the Cordova ecosystem is looking more and more abandoned. Most plugins haven't been updated in years, with issues piling up in the respective repositories. This is an issue, as modern mobile platforms evolve rapidly and always require app developers to adapt to new guidelines and restrictions, especially regarding permissions and privacy.

It looks like the Ionic people moved on to create https://capacitorjs.com/, which aims to make native integrations a bit easier while also modernizing the ecosystem (at least that's what Ionic says, see https://ionic.io/resources/articles/capacitor-vs-cordova-modern-hybrid-app-development).

This draft PR is a proof of concept on what a Capacitor migration could look like. Specifically, it demonstrates that existing Cordova plugins can still be used just fine. If the migration works out well, it might be worth it to eventually migrate away from all Cordova plugins, but this is not necessary in the first step.

If you want to take a look at the changes in this PR, I recommend going commit by commit. I try to create isolated, understandable commits. Looking at the commits in order will be much easier than trying to understand the huge diff.

State of this PR

First things first: This is currently in the draft/proof of concept stage!
This state isn't intended to be mergeable just yet, I just want to be able to get some early feedback.

The second important caveat: I don't have a Mac and can't test or otherwise work on iOS builds. I need assistance from someone with access to a Mac and an iPhone.

To-Do list

This is the current To-Do list I'm working with. As this is still in a very early stage, it will change and things will be added to it.

Android

First steps

  • Get the app to build
  • Change scheme/hostname/origin, so no data loss occurs when upgrading from a Cordova build to a Capacitor build

Test plugin functionality

  • Barcode / QR code scanner
  • Beanconqueror links
  • Camera
  • Geolocation
  • Bluetooth LE devices
  • File Handling (File import/export, Visualizer upload, automatic backup/restore, ...)
  • Special HTTP integrations
    • SanremoYOUDevice
    • XeniaDevice
  • What additional special functionality did I forget?

iOS

General Setup

As I don't have access to a Mac, I can only guess what needs to be done here:

  • Initialize the project
ionic capacitor add ios
npx @capacitor/assets generate --ios

First steps

  • Get the app to build
  • Check scheme/hostname/origin, so no data loss occurs when upgrading from a Cordova build to a Capacitor build

Metadata files

Test plugin functionality

  • Barcode / QR code scanner
  • Beanconqueror links
  • Camera
  • Geolocation
  • Bluetooth LE devices
  • File Handling (File import/export, Visualizer upload, automatic backup/restore, ...)
  • Special HTTP integrations
    • SanremoYOUDevice
    • XeniaDevice
  • What additional special functionality did I forget?

Cordova Plugins

Cordova Plugins to replace in this first step

Cordova Plugins to specifically not replace in this first step

  • cordova-plugin-ble-central
    • Way too complex to attempt to replace this in the first step. Also, I don't have any Bluetooth devices to test
  • ionic-plugin-deeplinks
    • Replaced by native capacitor

Cordova Plugins to still decide the fate of

  • cordova-plugin-3dtouch
    • Used on iOS only, I don't know what this is for
      -> Made it native directly.
  • File handling and file choosers (Probably not necessary to migrate in the first step)
    • cordova-plugin-filechooser
      • Used on Android only
    • cordova-plugin-filepicker
      • Used on iOS only
  • [/] cordova-plugin-health
    -> Actually not possible, the capacitor-healthkit not supports capacitor 6.X
  • cordova-plugin-insomnia
  • cordova-plugin-nativestorage
  • cordova-sqlite-storage
  • skwas-cordova-plugin-datetimepicker

General

  • Rewrite most of the file system handling to clean it up, mainly:
    • UIFileHelper
    • UIExportImportHelper
      • This could be cleaner, but it's already a lot better and works in my testing. More refactoring can be done at a later point
  • Review all TODO Capacitor migration I left during the migration
  • A lot of testing when the PR gets more mature to make sure nothing breaks
  • Add a proof of concept for using custom native code to do stuff we couldn't do before

Explicit Check:

  • Check if bluetooth permissions need to be added in android manifest

Extra todo:

  • Update to Ionic 8
  • Update to latest Angular
  • Somehow a build script for iOS / Android.
    Specially for Android referencing: ionic cordova build --prod --release (--release was the bundled version)
graphefruit added a commit that referenced this issue Oct 4, 2024
graphefruit added a commit that referenced this issue Oct 4, 2024
graphefruit added a commit that referenced this issue Oct 5, 2024
graphefruit added a commit that referenced this issue Oct 5, 2024
graphefruit added a commit that referenced this issue Oct 5, 2024
graphefruit added a commit that referenced this issue Oct 5, 2024
@RagingCactus
Copy link
Collaborator

I'll take a look at the Android permissions for Bluetooth in the manifest. However, I can't test the connection as I have no BLE coffee devices.

@RagingCactus RagingCactus changed the title Merge to capacitor Migrate runtime from Cordova to Capacitor Oct 5, 2024
graphefruit added a commit that referenced this issue Oct 5, 2024
graphefruit added a commit that referenced this issue Oct 5, 2024
…so we need to force legacy-peer-deps for ag-virtual scroll
graphefruit added a commit that referenced this issue Oct 5, 2024
…so we need to force legacy-peer-deps for ag-virtual scroll
graphefruit added a commit that referenced this issue Oct 5, 2024
…so we need to force legacy-peer-deps for ag-virtual scroll
graphefruit added a commit that referenced this issue Oct 5, 2024
…ath, because android doesn't resolve path sometimes with names
graphefruit added a commit that referenced this issue Oct 5, 2024
graphefruit added a commit that referenced this issue Oct 5, 2024
graphefruit added a commit that referenced this issue Oct 6, 2024
graphefruit added a commit that referenced this issue Oct 6, 2024
graphefruit added a commit that referenced this issue Oct 6, 2024
graphefruit added a commit that referenced this issue Oct 6, 2024
graphefruit added a commit that referenced this issue Oct 13, 2024
…pi requests (don't use fetch() if performance is needed). Addded permission for android for bleutooth

#808 - Added bean sort/filter for bean selection
#809 - added ios dark mode icon
#504 - Added NFC-Support to write tags
#810 - Added qr code to start brew
graphefruit added a commit that referenced this issue Oct 13, 2024
graphefruit added a commit that referenced this issue Oct 13, 2024
graphefruit added a commit that referenced this issue Oct 13, 2024
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

No branches or pull requests

2 participants