Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fast Prototypes using Kotlin_Native (and Flutter)

Fast Prototypes using Kotlin_Native (and Flutter)

Presented at Informal get-together of Kotlin developers in Berlin

https://www.meetup.com/kotlin-berlin/events/tvhffpyzcbwb/

JB Lorenzo

January 17, 2019
Tweet

More Decks by JB Lorenzo

Other Decks in Programming

Transcript

  1. Agenda • Who are we • Our story: what problem

    do I want to solve • Tools we used • The code! • Recap • Q&A
  2. We fuel local economies by making it super easy for

    anyone to buy or sell almost anything through our platforms
  3. We operate a network of market-leading trading platforms in over

    40 countries that are used by more than 350 million people every month
  4. Once upon a time… This is a story about how

    we made the OLX Group Product & Tech Conference app in record time.
  5. • We were only 4 engineers (or 3 and a

    half) • We had our ambitious priorities for the quarter • We didn't have much spare time • The VP of Engineer asked us to help with a new app
  6. • We were only 4 engineers (or 3 and a

    half) • We had our ambitious priorities for the quarter • We didn't have much spare time • The VP of Engineer asked us to help with a new app
  7. • We were only 4 engineers (or 3 and a

    half) • We had our ambitious priorities for the quarter • We didn't have much spare time • The VP of Engineer asked us to help with a new app
  8. • We were only 4 engineers (or 3 and a

    half) • We had our ambitious priorities for the quarter • We didn't have much spare time • The VP of Engineer asked us to help with a new app
  9. // GetSchedulesUseCase.kt class GetSchedulesUseCase(val repository: ConferenceRepository): UseCase<T, Input> { private

    val noFavoriteKeywords = listOf("coffee break", "lunch") override var disposeBag: Disposal = emptyArray<CancellableType>().toMutableList() override fun buildUseCaseObservable(params: Input): Observable<T> { return create { o -> FetchConferenceUseCase(repository).execute(Observer(onNext = { var schedules = emptyList<Map<String, String>>().toMutableList() it.talks.forEach { schedules.add(mapOf(...)) } o.onNext(schedules) }, onError = { o.onError(it) }), Unit)
  10. // GetSchedulesUseCase.kt class GetSchedulesUseCase(val repository: ConferenceRepository): UseCase<T, Input> { private

    val noFavoriteKeywords = listOf("coffee break", "lunch") override var disposeBag: Disposal = emptyArray<CancellableType>().toMutableList() override fun buildUseCaseObservable(params: Input): Observable<T> { return create { o -> FetchConferenceUseCase(repository).execute(Observer(onNext = { var schedules = emptyList<Map<String, String>>().toMutableList() it.talks.forEach { schedules.add(mapOf(...)) } o.onNext(schedules) }, onError = { o.onError(it) }), Unit)
  11. // GetSchedulesUseCase.kt class GetSchedulesUseCase(val repository: ConferenceRepository): UseCase<T, Input> { private

    val noFavoriteKeywords = listOf("coffee break", "lunch") override var disposeBag: Disposal = emptyArray<CancellableType>().toMutableList() override fun buildUseCaseObservable(params: Input): Observable<T> { return create { o -> FetchConferenceUseCase(repository).execute(Observer(onNext = { var schedules = emptyList<Map<String, String>>().toMutableList() it.talks.forEach { schedules.add(mapOf(...)) } o.onNext(schedules) }, onError = { o.onError(it) }), Unit)
  12. // GetSchedulesUseCase.kt class GetSchedulesUseCase(val repository: ConferenceRepository): UseCase<T, Input> { private

    val noFavoriteKeywords = listOf("coffee break", "lunch") override var disposeBag: Disposal = emptyArray<CancellableType>().toMutableList() override fun buildUseCaseObservable(params: Input): Observable<T> { return create { o -> FetchConferenceUseCase(repository).execute(Observer(onNext = { var schedules = emptyList<Map<String, String>>().toMutableList() it.talks.forEach { schedules.add(mapOf(...)) } o.onNext(schedules) }, onError = { o.onError(it) }), Unit)
  13. // MainActivity.kt import com.olxgroup.olxconf.domain.GetSchedulesUseCase val schedulesUseCase = GetSchedulesUseCase(repository) MethodChannel(flutterView, CHANNEL).setMethodCallHandler

    { call, result -> when (call.method) { "getSchedules" -> getSchedules(result) "getSpeakers" -> getSpeakers(result) "getInfo" -> getInfo(result) "launchMap" -> launchMap(result, call) } }
  14. // MainActivity.kt import com.olxgroup.olxconf.domain.GetSchedulesUseCase val schedulesUseCase = GetSchedulesUseCase(repository) MethodChannel(flutterView, CHANNEL).setMethodCallHandler

    { call, result -> when (call.method) { "getSchedules" -> getSchedules(result) "getSpeakers" -> getSpeakers(result) "getInfo" -> getInfo(result) "launchMap" -> launchMap(result, call) } }
  15. // MainActivity.kt import com.olxgroup.olxconf.domain.GetSchedulesUseCase val schedulesUseCase = GetSchedulesUseCase(repository) MethodChannel(flutterView, CHANNEL).setMethodCallHandler

    { call, result -> when (call.method) { "getSchedules" -> getSchedules(result) "getSpeakers" -> getSpeakers(result) "getInfo" -> getInfo(result) "launchMap" -> launchMap(result, call) } }
  16. // MainActivity.kt import com.olxgroup.olxconf.domain.GetSchedulesUseCase val schedulesUseCase = GetSchedulesUseCase(repository) MethodChannel(flutterView, CHANNEL).setMethodCallHandler

    { call, result -> when (call.method) { "getSchedules" -> getSchedules(result) "getSpeakers" -> getSpeakers(result) "getInfo" -> getInfo(result) "launchMap" -> launchMap(result, call) } }
  17. // AppDelegate.swift import OLXConfFramework let channel = FlutterMethodChannel.init(name: "/api", binaryMessenger:

    controller) channel.setMethodCallHandler({ (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in if call.method == "getSchedules" { self.getSchedules(result) } else if call.method == "getSpeakers" { self.getSpeakers(result) } else if call.method == "getInfo" { self.getInfo(result) } else if call.method == "launchMap" { self.launchMap(call, result) } });
  18. // AppDelegate.swift import OLXConfFramework let channel = FlutterMethodChannel.init(name: "/api", binaryMessenger:

    controller) channel.setMethodCallHandler({ (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in if call.method == "getSchedules" { self.getSchedules(result) } else if call.method == "getSpeakers" { self.getSpeakers(result) } else if call.method == "getInfo" { self.getInfo(result) } else if call.method == "launchMap" { self.launchMap(call, result) } });
  19. // AppDelegate.swift import OLXConfFramework let channel = FlutterMethodChannel.init(name: "/api", binaryMessenger:

    controller) channel.setMethodCallHandler({ (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in if call.method == "getSchedules" { self.getSchedules(result) } else if call.method == "getSpeakers" { self.getSpeakers(result) } else if call.method == "getInfo" { self.getInfo(result) } else if call.method == "launchMap" { self.launchMap(call, result) } });
  20. // AppDelegate.swift import OLXConfFramework let channel = FlutterMethodChannel.init(name: "/api", binaryMessenger:

    controller) channel.setMethodCallHandler({ (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in if call.method == "getSchedules" { self.getSchedules(result) } else if call.method == "getSpeakers" { self.getSpeakers(result) } else if call.method == "getInfo" { self.getInfo(result) } else if call.method == "launchMap" { self.launchMap(call, result) } });
  21. • Flutter is awesome for fast prototypes • Flutter and

    Kotlin/Native are still in beta but is usable already though with some limitations • Kotlin/Native works well to reduce the amount of platform specific code • Some glue code needs to be written to pass around/serialize objects • Don’t be afraid to try out new technologies (but …)
  22. • Flutter is awesome for fast prototypes • Flutter and

    Kotlin/Native are still in beta but is usable already though with some limitations • Kotlin/Native works well to reduce the amount of platform specific code • Some glue code needs to be written to pass around/serialize objects • Don’t be afraid to try out new technologies (but …)
  23. • Flutter is awesome for fast prototypes • Flutter and

    Kotlin/Native are still in beta but is usable already though with some limitations • Kotlin/Native works well to reduce the amount of platform specific code • Some glue code needs to be written to pass around/serialize objects • Don’t be afraid to try out new technologies (but …)
  24. • Flutter is awesome for fast prototypes • Flutter and

    Kotlin/Native are still in beta but is usable already though with some limitations • Kotlin/Native works well to reduce the amount of platform specific code • Some glue code needs to be written to pass around/serialize objects • Don’t be afraid to try out new technologies (but …)
  25. • Flutter is awesome for fast prototypes • Flutter and

    Kotlin/Native are still in beta but is usable already though with some limitations • Kotlin/Native works well to reduce the amount of platform specific code • Some glue code needs to be written to pass around/serialize objects • Don’t be afraid to try out new technologies (but …)