![]() ![]() In the app, the transformer handles subscribeOn and observeOn. We inject an Observable.Transformer with dagger. The unit tests for the presenters mock the UiInterface and verify that methods you expect to be called actually are. So, for example, to load the list of parties, the activity will call callRefreshPartyList(), which loads the data in a different thread, then calls refreshPartyList() on the UiInterface instance (which is the Activity or ViewController). NEW CASE CLICKER CODES AUGEST 2017 CODEThe presenter code can interact with the view by way of UiInterface. Looking at PartyListPresenter, you’ll see methods that interact with the data model, and an interface, UiInterface, which is implemented by PartyListActivity on Android, and PartyListViewController on iOS. In the package you’ll find the 2 presenters, but also some related Dagger code, and a CrashReporter interface. That could be rolled into RX, but I wanted to make things more difficult. There’s also a Runnable for some background processing. In the package, there’s a sqlite open helper (DatabaseHelper) which manages basic data interaction, an interface for those methods (DataProvider), and data objects used by the orm. NEW CASE CLICKER CODES AUGEST 2017 ANDROIDSo, MVP architecture with unit tests, running on Android and iOS. ![]() On iOS, there are 2 equivalent UIViewController classes that talk to the same presenter classes. On Android there are 2 Activity classes that point at two Presenters. There’s a set of unit tests that individually test the database logic, and presenter coordination. The threading and logic is managed in presenters, in a rough approximation of MVP. The data is kept in sqlite, retrieved in a background thread. On the “party” page, you can add or remove people. There’s a list of “parties”, and a edit box and button to create a new one. This is not to say that Party Clicker is elegant or useful, but it’s dead simple to understand. The public example was our Droidcon app, but it’s a tech stew where we’ve been testing all kinds of weird shit. You can use the exact same code, using best practices”. I’ve had discussions with folks, and I point out “yeah, use this. Recently I’ve seen some talks about how iOS and Android are pretty similar, and how teams working on the same product can explore using similar best-practice architectures for their logic. Given the right kinds of apps, you can share lots more code, lots more quickly, with lots less risk. Their innards, and the things their apps do, are far more similar in practice than, say, what web apps for the same “product” generally do *. Lots of the same things with different names. Under the hood, iOS and Android are pretty similar beasts. It’s a toolset for J2objc for sharing your Android code in iOS apps. ![]() ![]() Doppl is: a Gradle plugin, a bunch of iOS implementations of “Android” stuff, and a dependency standard. It works well but does not provide a build system familiar to Android developers, does not implement very much of the Android platform, and does not provide a structured method of distributing dependencies (outside of the fixed set). To review, J2objc makes Objective-C from Java. Since there’s no 3rd platform, your shared code dev time shouldn’t be affected. Minimal ecosystem risk.Ī: All the time you would’ve spent re-coding on iOS. Q: How much will this platform affect your risk?Ī: Minimal runtime risk (zero on Android). The dimensions you have to consider are varied and go way beyond the scope of this post. Sharing code should reduce development effort, bugs, and feature drift between platforms. In the meantime, I’ve built a simple sample app to demonstrate the what and why in a more concrete manner. Pretty soon we’ll be pushing out a public release. If you’d like to read more about what this is, see here. We’ve been doing some chatting and client work with Doppl/J2objc ( interesting stuff). (Crosspost from usual, release takes longer than planned. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |