[Feature] Make iOS firebase dependency optional

Aperta
#1,430 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
dart, firebase, flutter
Ambito
backend, mobile

Direzione di ricerca

Start with packages/stream_video_push_notification/lib/src/stream_video_push_provider.dart, especially the Firebase use around the line linked in the issue, and compare the iOS token-retrieval approach in stream-video-swift. The issue outlines several possible solutions, but choosing among them and avoiding iOS Firebase dependencies while preserving Android behavior requires design and platform-specific investigation. Done means the chosen approach makes Firebase optional for iOS without breaking APNs registration or Android push notifications.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When using StreamVideoPushProvider.apn for iosPushProvider, technically the firebase SDK would not be needed.

Pulling in the Firebase dependency on iOS has the following downsides:

  • app binary size increases by 13.6MB. Thats almost 20% for my app, and it basically doubles the advertised required size for the Stream Video Flutter SDK (ios:stream_video + ios:stream_video_flutter + stream_video_push_notification = ~11.9MB, according to https://github.com/GetStream/stream-video-flutter/blob/main/README.md )
  • data is sent to Google unnecessarily (data minimization, data privacy issue)
  • stream_video_flutter requires iOS 14, firebase_core iOS 15. Not a big issue currently, as every iOS 14 device can upgrade to 15. But in the future, firebase_core could dictate a minimum supported iOS version that would exclude some older devices that otherwise would be compatible with stream_video_flutter

Context

The stream_video_push_notification package currently only uses firebase in one place on iOS:
https://github.com/GetStream/stream-video-flutter/blob/dfcaffbc07e4a8c494d1c5c733ebc8079d9455bc/packages/stream_video_push_notification/lib/src/stream_video_push_provider.dart#L88
This is only needed if StreamVideoPushNotificationManager.registerApnDeviceToken is set to true to enable missed call notifications. (It’s currently also called in an unneeded case, see https://github.com/GetStream/stream-video-flutter/issues/1428)

This could easily be moved to a native swift implementation (the voip-token retrieval already is in swift) and make the iOS platform package free of the firebase dependency.

However, because the stream_video_push_notification still needs the firebase_core and firebase_messaging packages for Android, an iOS build still would pull in the entire native firebase_messaging SDK for iOS.


Possible Solutions

Solution A

Adding an apnTokenProvider param to StreamVideoPushNotificationManager.create and use it with a push token already present from another SDK (eg. push or OneSignal SDK).
I’ve implemented and tested that here and can send a PR for it: https://github.com/bbjay/stream-video-flutter/pull/1
(this also includes a fix for https://github.com/GetStream/stream-video-flutter/issues/1428, which otherwise would produce an error)

To get rid of the native firebase_messaging SDK for iOS, I’ve made an android-only flutterfire fork which does not pull in any native ios dependecies and use it with dependency_overrides:
https://github.com/bbjay/flutterfire/tree/android-only
and its diff:
https://github.com/bbjay/flutterfire/pull/1/changes

The fork only changed a few lines in pubspec.yaml and should be easily maintainable.

Solution B

getAPNToken() backed by a native swift implementation (copy it form stream-video-swift, which also does not have a firebase dependency)

This would still need the android-only flutterfire fork.

Solution C

Getting rid of the flutter firebase package dependency entirely in stream_video_push_notification does seem like a non-trivial task. It would involve moving the firebase dependency to the android native side (build.gradle), handle events there and forward them to the flutter side.

Lingua principale
Dart
Stelle
79
Fork
55
Merge medio
2g 11h
PR unite (30g)
143

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GetStream/stream-video-flutter

Tutte le issue di GetStream/stream-video-flutter

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.