dfabulich
(Dan Fabulich)
2019 年3 月 1 日 22:26
1
我们公司拥有适用于 iOS 和 Android 的原生应用。我们的目标之一是让用户频繁返回我们的应用,并在其中花费大量时间。(应用商店似乎会优先推荐使用量高的应用。)
我们拥有一个相当完善的 Discourse 论坛,但目前我们只是从应用中链接到论坛网站。希望接收论坛推送通知的 iOS 用户需要单独下载 Discourse 应用。(Android 用户可以直接从网站接收推送通知,这很好,但在这种情况下,他们仍然在使用网站,而不是我们的应用。)
我们希望将 Discourse 论坛整合到现有的 iOS 和 Android 应用中,特别是允许用户在应用内接收论坛推送通知,而无需让用户下载单独的应用或离开我们的应用去使用论坛。(我设想实现方式类似于 Discourse iOS 应用,即使用 Web 视图。)
目前是否有办法实现类似的功能?(我猜可能没有?)
3 个赞
It is possible, but note:
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.
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 个赞
sam
(Sam Saffron)
2019 年3 月 3 日 22:47
3
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 个赞
dfabulich
(Dan Fabulich)
2019 年3 月 4 日 08:25
4
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.
Falco
(Falco)
2019 年3 月 4 日 15:47
6
It’s a bit involved, since you need the validation key, paying the Google fee, etc. But it does work.
1 个赞
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 个赞
PackElend
(Pack Elend)
2019 年7 月 28 日 19:47
8
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
sam
(Sam Saffron)
2020 年3 月 5 日 22:38
10
委托授权已上线,我们的新登录流程在应用端非常稳定。所有协议均已开源。
2 个赞
sam
(Sam Saffron)
2020 年3 月 6 日 00:42
12
这是我们当前的规范:
Discourse contains a system for generating API keys per user if a very specific protocol is followed. This feature facilitates “application” access to Discourse instances without needing to involve moderators.
High level description
At a high level:
Client (desktop app, browser plugin, mobile app) generates a private/public key pair and return url
Client redirects to a route on discourse giving discourse its public key
Discourse gets approval from user to use app
Discourse generat…
它确实可以做一些改进,因此欢迎对规范进行编辑。
官方实现是开源的,地址为:GitHub - discourse/DiscourseMobile: Discourse Mobile · GitHub
3 个赞
非常想知道这个最终效果如何。有人能够通过 webview 将 Discourse 嵌入到他们的移动应用程序中并利用通知吗?
sam
(Sam Saffron)
2022 年5 月 16 日 01:59
14
这种情况时有发生,我们为客户维护着一些白标应用程序。
不幸的是,走这条路的成本非常高。我想说……如果你每年有大约 2 万美元的预算用于构建/维护/调试,可以考虑走这条路。
2 个赞
我刚完成了一个这样的项目,但是的,公共存储库已过时。如果您希望我提供帮助,可以聘请我。
@sam 感谢您的提醒,我正要开始这个项目。
我很高兴地看到 discourse hub 似乎已经实现了这一点——为什么您预计成本会如此之高?我设想您只需要实现 webview 和身份验证,然后通知功能只是一个锦上添花的功能。这将是我现有应用程序的一个很棒的功能,我的团队以前做过 webview。
是不是有什么我没有预料到的事情会导致大量的工作/更新?
sam
(Sam Saffron)
2022 年5 月 17 日 00:13
17
历史上,我曾见过在微不足道的 Web 视图 Discourse Hub 上付出了多少努力。
表面上它“很简单”,但随后你需要担心 1000 个细节。
收缩底部的面板
iPhone 上的曲线
加载微调器
Web 视图的持续更新
Apple 安全检查和应用程序审批流程
复杂的调试……如果 Web 视图上发生某些事情而网站上没有呢?
这甚至不是一个详尽的列表,我相信 @pmusaraj 和 @kris.kotlarek 可以再列出 20 项。
应用程序很难做好,而且成本很高。如今,只有强有力的理由才能构建一个,那就是针对 iOS,而且这并非易事。
5 个赞
dfabulich
(Dan Fabulich)
2022 年5 月 17 日 00:19
18
我最初问这个问题是因为我想留住应用中的用户,因为我认为苹果和谷歌会为我带来免费流量。
在 Android 的“Chrome 自定义标签页”中,这项任务是否更容易(或更难)?
你们是否有可能为 iOS 提供一个包装了 WKWebView 的库来为我们解决这个问题?(通过实现 Discourse Hub,你们似乎已经完成了 90% 以上的工作。)
1 个赞
sam
(Sam Saffron)
2022 年5 月 17 日 00:23
19
我会说 Android 的难度是“不同”的。特别是当操作系统本身不提供原始功能时。当 PWA 在 Android 上表现如此出色时,很难证明在那里付出的努力是合理的。
我们使用 React Native 和组件来包装 WKWebView。复杂度依然存在,令人遗憾。从过去的经验来看,React Native 的更新也可能非常痛苦。
2 个赞
@sam 我之所以着手做这件事,主要是因为推送通知,而且我有一个现有的应用程序,可以轻松地让我的会员在同一个地方做多件事情(备考、在社区聊天、购物等)。
但是,听起来我可以在 PWA 中添加社区应用程序,并且他们可以收到推送通知和更新?PWA 会有推送通知吗?更新:在这里找到了答案,看起来不支持推送通知。
我正在进一步研究 PWA 选项 - 也许我甚至可以在我现有的原生应用程序中添加一个链接“加入社区讨论”,这将是下载 PWA 的正确链接?
谢谢!
James