Embed Discourse in a native app?

Our company has native apps for iOS and Android. One of our goals is to bring people back to our apps frequently, and to spend a lot of time in our apps. (The app stores seem to prioritize apps that get a lot of usage.)

We have a pretty solid Discourse forum, but currently we just link out to the forum’s website from the app. iOS users who want to receive forum push notifications then have to download the Discourse app separately. (Android users can receive push notifications directly from the website, which is great, but in that case, they’re still using the website, and not our app.)

We’d like to make the Discourse forum a part of our existing iOS and Android apps, and especially to allow users to receive forum push notifications in our apps, without forcing people to download a separate app or to leave our app to use the forum. (I’m imagining that the implementation would be a web view, much like the Discourse iOS app.)

Is there a way to do something like this today? (I’m guessing not?)

3 Me gusta

It is possible, but note:

  1. You will have cookie / login problems at the moment, particularly on iOS, due to the way embedded Safari is currently working in iOS 12 and beyond.

  2. You could certainly consume the Discourse API in the native apps to grab Discourse notifications.

A full in-app webview will be more complicated than simply linking out, and implies more developer support for the native apps.

@sam may have other thoughts.

3 Me gusta

On Android the story is quite simple, spinning up a Chrome Custom Tab is super easy and it shares authentication with Chrome. Only big downside and reason our Android team members avoid using the Android app (and that we are considering killing the Android app) is cause opening a Chrome Tab is slow compared to PWA, so people prefer the PWA.

Being Android though you could possibly automate creating the PWA link and all that Jazz from your app which may be interesting.

On iOS the story is more complex due to Apple bugs.

We have the user API key system @pmusaraj will be working on improving per: Delegated authentication for Discourse Mobile app (which also includes adding documentation)

My recommendation here for you @dfabulich is to hold tight for a month or 2 while we redo our protocol and improve documentation.

8 Me gusta

How would push notifications work in this story? Would I have to poll? (I’d rather do proper remote pushes.)

I read somewhere that Chrome 72 now support Trusted web activities , which means you can now distribute PWAs in the Google play store. If it works well I think you will have more reason to kill the Android app.

It’s a bit involved, since you need the validation key, paying the Google fee, etc. But it does work.

1 me gusta

Let me give one good reason not to: some people do not have a Google account and won’t have one. If the app would be distributed over F-Droid, it would be fine, but forcing people into Google is not a friendly move.

2 Me gusta

As long as you ensure that it works with Firefox as well is can also solve

Discourse as an open source application should always prefer open source solutions

Checking back in on this! What’s the story here?

Delegated auth is in, and our new login flow is pretty rock solid on the app. The protocols are all open.

2 Me gusta

Can you give me a pointer to documentation on this?

1 me gusta

This is our current spec:

It could certainly use an improvement or 2 so edits on it totally welcome.

Canonical implementation is open source and available at: GitHub - discourse/DiscourseMobile: Discourse Mobile

3 Me gusta

Tengo mucha curiosidad por saber dónde ha llegado esto. ¿Alguien ha podido incrustar Discourse en su aplicación móvil a través de webview y aprovechar las notificaciones?

Esto sucede de vez en cuando, mantenemos un puñado de aplicaciones de marca blanca para los clientes.

Desafortunadamente, el costo de seguir este camino es enorme. Yo diría… considere seguir este camino si tiene un presupuesto de alrededor de 20.000 USD al año para construir/mantener/depurar.

2 Me gusta

He estado trabajando en un proyecto así, pero sí, el repositorio público está desactualizado. Si quieres que te ayude, puedes contratarme.

@sam gracias por las palabras de precaución, ya que estoy a punto de embarcarme en este proyecto.

Me animó ver que el centro de discusión parece hacer esto, ¿por qué anticipas un costo tan alto? Imaginé que solo necesitas hacer que funcionen la vista web y la autenticación, luego las notificaciones son algo bueno de tener. Esta sería una característica increíble para agregar a mi aplicación ya existente, mi equipo ha trabajado con vistas web anteriormente.

¿Hay algo que no estoy anticipando que causará mucho trabajo / actualizaciones?

Históricamente, he visto cuánto esfuerzo se ha dedicado a la trivial vista web de Discourse Hub.
En la superficie es “fácil”, pero luego debes preocuparte por 1000 pequeños detalles.

  • Panel de reducción en la parte inferior
  • La curva en el iPhone
  • Indicadores de carga
  • Actualizaciones constantes de la vista web
  • Verificaciones de seguridad de Apple y proceso de aprobación de la aplicación
  • Depuración compleja … ¿y si algo sucede en la vista web y no en el sitio?

Esta ni siquiera es una lista exhaustiva, estoy seguro de que @pmusaraj y @kris.kotlarek pueden sacar otros 20 elementos.
Las aplicaciones son muy difíciles de hacer bien y muy caras. Hoy en día, la única justificación sólida para crear una es para iOS y no es un viaje fácil.

5 Me gusta

Hice esta pregunta originalmente porque quería retener usuarios en mi aplicación, ya que creo que Apple y Google me enviarán tráfico gratuito.

¿Es esta tarea más fácil (o más difícil) en una “Chrome Custom Tab” para Android?

¿Es plausible que ofrezcan una biblioteca para iOS que envuelva un WKWebView y resuelva este problema por nosotros? (Parece que ya han manejado más del 90% del trabajo al implementar Discourse Hub).

1 me gusta

Diría que Android es difícil de una manera “diferente”. Especialmente porque el propio sistema operativo no proporciona las primitivas. Es muy difícil justificar el esfuerzo allí cuando la PWA es simplemente muy buena en Android.

Usamos React Native y componentes para envolver WKWebView. La complejidad lamentablemente permanece. Las actualizaciones de React Native también pueden ser bastante dolorosas de superar por experiencia.

2 Me gusta

@sam mi justificación para embarcarme en esto es realmente en torno a las notificaciones push, y también porque tengo una aplicación existente que permitiría fácilmente a mis miembros hacer varias cosas en el mismo lugar (estudiar para su examen, chatear en la comunidad, comprar, etc.).

Pero, ¿parece que podría hacer que agreguen la aplicación comunitaria como una PWA, y podrían recibir notificaciones push y actualizaciones? ¿Tendría la PWA notificaciones push? Actualización: encontré la respuesta aquí, parece que no admite notificaciones push.

Estoy investigando más a fondo la opción de PWA. ¿Quizás incluso podría agregar un enlace a “Únete a la discusión de la comunidad” en mi aplicación nativa existente, y ese sería el enlace correcto para descargar la PWA?

¡Gracias!
James