News for hackers. Stuff that matters.
Re:Why Discord Is Sticking with React Native by haney on Thursday July 26, 2018 @04:24PM (#17620666)
What tool/service/library are you using for OTA updates? Could you share any best practices around managing the roll out (do you push to everyone, a subset, etc.)?
Re:Why Discord Is Sticking with React Native by wdgz on Thursday July 26, 2018 @04:38PM (#17620818)
Hi! Not Fanghao but another Discord iOS engineer. We wrote our own library for OTA updates but React Native Code Push (https://github.com/Microsoft/react-native-code-push) is a pretty reasonable out of the box solution. Because our OTA solution is designed for hotfixing issues rather than feature releases we push to everyone, and we also have a flag that forces our users to relaunch the app if the bug is app breaking.
Re:Why Discord Is Sticking with React Native by saagarjha on Thursday July 26, 2018 @04:49PM (#17620965)
How do you comply with Apple's App Store Review Guidelines when using this (specifically, this clause):

2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps.

Also,

> we also have a flag that forces our users to relaunch the app if the bug is app breaking

How do you do this?

Re:Why Discord Is Sticking with React Native by victoriasun on Thursday July 26, 2018 @05:10PM (#17621160)
Apple allows updates to Javascript outside of the review process as long as it subscribes to certain guidelines (1), including but not limited to: not changing core feature functionality, being limited to bug fixes, and also that the app doesn't provide unlimited access to native SDK or system functions. React Native provides a limited API to js code so it's fine.

As far as your second question, we simply deploy store logic that loads a Modal telling our users that they must relaunch the app.

[1] https://microsoft.github.io/code-push/faq/index.html#1-does-...

Re:Why Discord Is Sticking with React Native by saagarjha on Thursday July 26, 2018 @05:21PM (#17621286)
How do you convey "relaunch the app" to your users? I'm sure many of them think that pressing the home button is the same as killing your app.
Re:Why Discord Is Sticking with React Native by victoriasun on Thursday July 26, 2018 @05:29PM (#17621379)
Since OTA updates can only impact JS, we can offer a button that essentially calls something like `window.refresh` and it reloads the JS bundle within the container. We actually recently leveraged ErrorBoundaries in React 16 to do something similar in our app as well.
Re:Why Discord Is Sticking with React Native by dfabulich on Friday July 27, 2018 @01:19AM (#17623629)
See section 4.7.

> Apps may contain or run code that is not embedded in the binary (e.g. HTML5-based games, bots, etc.), as long as [long list of requirements...]

Re:Why Discord Is Sticking with React Native by saagarjha on Friday July 27, 2018 @01:39AM (#17623699)
That doesn't quite answer the question like victoriasun did–you can execute code not in the binary (e.g. JavaScript), but it doesn't say that you can download new code and execute that.
Re:Why Discord Is Sticking with React Native by haney on Thursday July 26, 2018 @05:02PM (#17621103)
I've used code push before and didn't really love the lack of visibility into what was running on the other side, it also feels really risky to make it a core part of my app considering that microsoft has already changed direction on backend hosting for code push at least once.

Any chance you could share any info about the architecture design of your homegrown system? I've seen a few snippets where devs build their bundles and host them in s3, how complicated was it for you to roll your own OTA solution? Would you guys do it again or would you use Code Push?

Re:Why Discord Is Sticking with React Native by victoriasun on Thursday July 26, 2018 @07:21PM (#17622241)
Our architecture design is honestly pretty simple. Before the app fetches the JS bundle it checks a hash to see if it's on the right version, and if not, it fetches the other one instead. I honestly don't know enough about code push to speak to it, so I can't really answer this question. Generally speaking however, we try to be cognizant of increasing the amount of dependencies we have while still optimizing for speed.