メルカリ カウルの開発気になる?なら話そう!

E77b6a5f919f7366d94f21eee9a014f5?s=47 operandoOS
August 04, 2017

メルカリ カウルの開発気になる?なら話そう!

メルカリ カウルの開発 気になる?なら話そう!

shibuya.apk #17
https://shibuya-apk.connpass.com/event/62499/

E77b6a5f919f7366d94f21eee9a014f5?s=128

operandoOS

August 04, 2017
Tweet

Transcript

  1. ϝϧΧϦ Χ΢ϧͷ։ൃ
 ؾʹͳΔʁ
 ͳΒ࿩ͦ͏ʂ shibuya.apk #17

  2. About Me Shinobu Okano @operandoOS Mercari, Inc. Souzoh, Inc.

  3. None
  4. Πϯετʔϧ͍ͯͩ͘͠͞Ͷ

  5. Souzoh Android Talk https://mercari.connpass.com/ event/63552/

  6. Android ΞϓϦઃܭύλʔϯೖ໳ https://peaks.cc/archtecture_patterns

  7. https://peaks.cc/archtecture_patterns ߪೖక੾೔2017೥08݄04೔ 23:59

  8. ϦϦʔε·ͰͷಓͷΓ • 2݄͘Β͍͔Β࠷ॳͷAndroidΤϯδχΞ͕Χ΢ϧΛ ࡞Γ࢝ΊΔ • 3݄ͷத०͘Β͍͔Βࢲ͕ຊ֨తJOINͯ͠ಈ͖࢝ΊΔ • 5݄຤ʹ͸ग़ͤΔʁͱ͔ͦ͏͍͏ײ͡(͏Δ͓΅͑ • Ͱ͖Δ͔ͳʔ

  9. ๻͕Χ΢ϧʹJOINͯ͠࠷ॳʹ
 ΍ͬͨ͜ͱ • Crashlyticsͷಋೖ • Update Android Gradle Plugin 2.3.0

    • signingConfigͷઃఆ • Travis CIͷઃఆ • Fabric Betaͷઃఆ • CI͔ΒFabric Beta΁ͷΞοϓϩʔυ • dependency updatesͷ௥Ճ
  10. dependency updatesͷ௥Ճ Gradle PluginͱCIͱԶ https://www.slideshare.net/shinobuokano7/ gradle-pluginci-62464447

  11. ๻͕Χ΢ϧʹJOINͯ͠࠷ॳʹ
 ΍ͬͨ͜ͱ • ͛͢ʔࢧԉܥͷλεΫ͹͔ͬΓ • ͍΍·͋͜ʔΏʔͷ͸࠷ॳʹ͕ͬʂͱ΍Δ΄͏ ͕͍͍ͷͩΑ • ։ൃதͷΞϓϦ͕͍ͭͰ΋୭Ͱ΋ݟΕΔΑ͏ʹ ͢Δ

    • ೝࣝͷζϨΛͳ͘͢
  12. ͓ʁ͜Ε͸σεϚʔν͔ʁ

  13. ͦΜͳ͜ͱ͸ͳ͍ʂ

  14. Ͱ΋ݫ͍͠ͷͰ... • ϦϦʔεΰʔϧΛ໌֬ʹ͢Δ • Ͳ͜·Ͱ࣮૷ͨ͠ΒϦϦʔεͰ͖Δ͔ • ϦϦʔεʹ޲͚ͯద੾ͳϚΠϧετʔϯΛઃఆ͢Δ • ϚΠϧετʔϯ͕ऴΘͬͨΒΞϓϦͷ֬ೝձΛ͢Δ (͓͞ΘΓձ)

    • ϝϯόʔͱձ࿩͢Δ(15෼͘Β͍ͷ೔࣍ఆྫ)
  15. ΋ͬͱԿ͔޻෉͠ͳ͍ͱ։ൃεϐʔυ
 ग़ͤΜͧʁ

  16. ͜͏͍͏࣌ͦ͜
 ࣮ݧ(νϟϨϯδ)ͯ͠ΈΔ

  17. ࣮ݧͨ͜͠ͱ • ίʔυϨϏϡʔͷഇࢭ • શPull Request Self Merge • ϦϦʔε͔ͯ͠Β΋਺िؒίʔυϨϏϡʔҰ౓΋ͯ͠ͳ͔ͬͨ

    • ։ൃதͷྫ֎ΛSlackʹྲྀ͢ • ى͖ͨྫ֎Λᐆດͷ··ऴΘΒͤͳ͍ • etc.
  18. ίʔυϨϏϡʔͷഇࢭ • ೋਓͰAndroid։ൃͯ͠Δ͚Ͳͳͨ͘͠ • ਖ਼௚ίʔυϨϏϡʔΊΜͲͤ͘ʔ • ϨϏϡʔ͢Δ͘Β͍ͳΒίʔυॻ͜͏ͥʂ • ૣ͘ϦϦʔε͠Α͏ͥʂ

  19. ίʔυϨϏϡʔΛͳͨ͘͜͠ͱͰ • ϓϩμΫτΛૣ͘ϦϦʔε͢Δ͜ͱʹ͸ߩݙͰ͖ͨ • ୹ظతʹΤϯδχΞͷ੒௕Λ٘ਜ਼ʹ͢Δ • ίʔυͷ࣭Λ্͛Δɺ஌Βͳ͔ͬͨ͜ͱΛ஌Δతͳ໘ • ઃܭͲ͏ͳͷΑʁ •

    େࣄͳͱ͜Ζ͚ͩ࿩͠߹͑͹΄΅໰୊ͳ͍
  20. ઃܭ • ࠓ͸MVP(Model-View-Presenter) • ݩʑ͸MVVM • ʮMVPʹ͠Α͏ͥʂ͓Ε΍ͬͨ͜ͱͳ͍͚Ͳʂʯͱ్தͰ ࢲ͕ݴͬͯҠߦ • ݁ՌతʹMVPʹͯ͠ਖ਼ղͩͬͨͱࢥͬͯΔ

    • ͦΜͳʹ࿩͢͜ͱ͸ͳ͍...
  21. ίʔυϨϏϡʔΛ͠ͳͯ͘΋
 େৎ෉ͳ࢓૊Έ • QA͕खް͍ʂ • ϝϧΧϦ΋ι΢κ΢΋QA͕͍͢͝ʂ • ͓͞ΘΓձͰϝϯόʔʹ৮ͬͯ΋Β͏ • ྫ֎Λݟಀ͞ͳ͍ʂ

  22. ࠓ͸ίʔυϨϏϡʔ
 ͯ͠·͢ʂ

  23. ϦϦʔεલ ίʔυϨϏϡʔ • ϦϦʔε਺೔લʹޱ಄Ͱ·ͱΊͯPull RequestΛϨϏϡʔ͢Δ • 1ͭͷεΫϦʔϯ্Ͱ͋ʔͩ͜ʔͩ࿩͢ͷͰૣ͍ • ͪΐͬͱͨ͠Tips΋ͬ͘͞ͱݴ͍΍͍͢ •

    ࢀߟ) ίʔυϨϏϡʔΛձ࿩͠ͳ͕Βߦ͏औΓ૊Έ • http://developer.hatenastaff.com/entry/ 2017/06/23/100000
  24. Danger

  25. https://github.com/danger/danger http://danger.systems/ruby/

  26. Dangerͷಋೖ • ࡶʹ͍͏ͱίʔυϨϏϡʔɺPull RequestϨϏϡʔΛࣗಈԽ͢Δ • Ruby or JSͰࣗಈԽͷεΫϦϓτΛॻ͘ • εΫϦϓτ಺ͰPull

    Requestͷ৘ใ͕औΕΔͷͰࣗಈԽॻ͖΍͍͢ • CIʹ΋ಋೖ͠΍͍͢ • νΣοΫ͍ͨ͠ϓϩδΣΫτࣗମͷݴޠ͸ͳΜͰ΋͍͍
  27. Pull RequestͰ͜͏͍͏͜ͱ
 ͋ΔͰ͠ΐʁ • ࢓༷νέοτͷϦϯΫష͍ͬͯͩ͘͞ • ϚΠϧετʔϯ͚͍ͭͯͩ͘͞ • ϥϕϧ͚͍ͭͯͩ͘͞ •

    etc.
  28. ϨϏϡʔ͢Δଆ΋͞ΕΔଆ΋ ਏ͍

  29. Dangerʹ೚ͤΔ • ϚΠϧετʔϯ͕ઃఆ͞Εͯͳ͚Ε͹ίϝϯτ͢Δ • ϥϕϧ͕ઃఆ͞Εͯͳ͚Ε͹ίϝϯτ͢Δ • ϦϦʔεϒϥϯνͩͬͨΒϦϦʔεखॱίϝϯτ͢Δ • etc.

  30. Gemfile source 'https://rubygems.org' gem 'danger'

  31. has_milestone = github.pr_json["milestone"] != nil warn "͋ΕΕʁϚΠϧετʔϯ͕ઃఆ͞Εͯͳ͍Αʁ" unless has_milestone warn

    "WIPͳͷʁ͸΍͘ऴΘΔͱ͍͍Ͷʔʂ" if github.pr_title.include? "[WIP]" or github.pr_labels.include?("WIP") if github.branch_for_head.start_with?(“release/") then message "ҎԼͷWikiͷखॱʹैͬͯ҆શʹϦϦʔε͠Αʔ :rocket: \n<a href='Release WorkflowͷURL'>Release Workflow</a>” end if github.branch_for_head.start_with?("release/") then warn "mapping file͕มߋ͞Εͯͳ͍͚Ͳେৎ෉͔ͳʔʁ" unless git.diff_for_file("app/mapping/mapping.txt") end Dangerfile
  32. Dangerʹ೚ͤΔ

  33. DangerʹAndroid LintΛಋೖ͢Δ • ؆୯! • ͸΍͍ʂ • ΍͍͢ʂ • ͏·͍ʂ

    • ͏͍͟ʂ
  34. Gemfile source 'https://rubygems.org' gem 'danger' gem 'danger-android_lint'

  35. Dangerfile android_lint.gradle_task = "app:lintDebug" android_lint.report_file = 
 "app/build/reports/lint-results-debug.xml" android_lint.filtering =

    true android_lint.lint(inline_mode: true)
  36. PRʹ݁ՌΛίϝϯτͯ͘͠ΕΔ

  37. PRʹ݁ՌΛίϝϯτͯ͘͠ΕΔ

  38. https://github.com/operando/ AndroidDangerSample/ Sample Android + Travis CI + Danger

  39. DangerͰ͜Μͳ͜ͱ΋Ͱ͖ͦ͏ʂ • File DiffΛݟͯͲͷػೳʹӨڹ͢ΔPull Requestͳͷ͔ڭ͑ͯ͘ΕΔ • QAʹ΋ӨڹൣғΛ఻͑΍͘͢͢Δ • ӨڹൣғͷӕΛ͚ͭͳ͘͢Δʂʂ •

    ςετίʔυॻ͍ͨΒ๙Ίͯ͘ΕΔʂ • ϥϯμϜͰͱʹ͔͘๙Ίͯ͘ΕΔʂ • etc.
  40. ։ൃதͷྫ֎ΛSlackʹྲྀ͢ • CrashlyticsͷSlack࿈ܞͩͱNew Crash௨஌͸͘Δ • ͚ͩͲɺͦΕҎ߱ಉ͡ྫ֎͕ى͖ͯ΋௨஌͸͜ͳ͍ (͸ͣ) • ྫ֎͕ૹΔͨͼʹSlackʹ௨஌ͯ͠΄͍͠ʂ •

    ࣗ࡞͢Ε͹ͬ͘͞ͱͰ͖Δ
  41. ։ൃதͷྫ֎ΛSlackʹྲྀ͢

  42. ྫ֎ΛՄࢹԽͰ͖ͨʂ • νʔϜϝϯόʔͷखݩͰى͖ͨྫ֎͕͙͢ʹΘ͔ΔΑ͏ʹͳͬͨʂ • ى͖ͨྫ֎Λͦͷ··΄͓͍ͬͯͯɺ࣮͸…Έ͍ͨͳ͜ͱ͸
 ͳ͘ͳͬͨ • Slackʹྲྀͯ͠ΔͷͰΈΜͳݟ͑Δ • ͋ʔͦͷྫ֎ͳʔΘ͔Δʔͱ͍͏΍ͭΛҰॹʹ։ൃͯ͠Δϝϯόʔ

    ͕ىͯ͜͠ΔͱͳΜ͔Ұਓ͡Όͳ͍ײ͋ͬͯΑ͍☺ • ΄ͬ͜Γ͢Δ☺
  43. Crash-Free User • ॳճϦϦʔεͰΧϝϥͷ໰୊Ͱࠔͬͨ...
 (ϨϏϡʔͰ΋ݟ͔ͭΒͳ͍໰୊) • ϦϦʔεͨ࣍͠ͷ೔ʹݪҼಛఆͯ͠मਖ਼ • ͦΕҎ߱͸ 99.5%͘Β͍ҡ࣋ͯ͠Δ

    • Mobile Vision APIͷCamera͕ਏ͍...
  44. ͋ͱ͸ࡶʹ࣮૷ͷ࿩

  45. Լλϒ

  46. Լλϒ͑͑Ͱ☺

  47. Լλϒͷ࣮૷ • ࣗ࡞ Լλϒ(Not CustomView) + ViewPager • λϒ੾Γସ͑ͷදࣔ͸ViewPagerͷϖʔδΛ ੾Γସ͑Δ͚ͩͳͷͰૣ͍

    • View TreeΈͨΒϠόͦ͏͔ײ͡ʹͳͬͯΔͷ Ͱͥͻਅࣅͯ͠΄͍͠
  48. ͳΜͰBottomNavigationView ࢖Θͳ͍ͷʁ ԼλϒͷσβΠϯతͳࣄ৘Ͱ͢

  49. Լλϒ + ViewPager͕͜͜ਏ͍Α • ͦͦ͜͜ϝϞϦ΋࢖͏ • λϒͷ਺ͷPager͸ৗʹอ࣋(setOffscreenPageLimit) • λϒ੾Γସ͑ͨ࣌͠ͷToolbarͱ͔ͷ੍ޚ͕஍ຯʹେมͩͬͨ •

    BottomNavigationView࢖ͬͯ΋ಉ͡ʁ • ActivityΛอ࣋͠ͳ͍ʹऑ͍ • ஌Δ͔ • λϒؒͷεςʔλεಉظ • Static Subject͓͡͞Μ
  50. API • ΞϓϦ಺Ͱ͸Χ΢ϧ APIͱϝϧΧϦ API྆ํΛୟ࣮͘૷͕ ೖͬͯΔ • ϝϧΧϦ APIΛRetrofitʹ߹ΘͤΔͷ͕ۤ࿑ͨ͠… •

    Responseͷܕ͕͖ͬͪΓܾ·Βͳ͍ • MercariResponseConverterര஀ʂ • Χ΢ϧ API͸JSON RPC
  51. JSON RPC • JSRON RPC Clintࣗ࡞ͯ͠·͢ • JSRON RPC ClintͷίΞ෦෼͚ͩϥΠϒϥϦԽ

    • ޷͖ͳHttp Clientͱ߹Θͤͯ࢖͑ΔΑ͏ʹͯ͠Δ • ι΢κ΢ͷଞͷΞϓϦͰ΋࢖͑ΔΑ͏ʹ • ۀ຿࣌ؒதʹ͍ͬͨ͡Γͯ͠·͢s
  52. gummi https://github.com/operando/ gummi

  53. gummi • ࠷ۙ 2.0ग़͠·ͨ͠ • 1.0͸Χ΢ϧͰಋೖࡁΈͰͪΌΜͱಈ͍ͯΔ • 2.0͸…ࢼ͢PR͸ࣾ಺Ͱग़ͯ͠Δ • ͪΌΜͱಈ͍ͯΔͬΆ͍

    • ଟ෼େৎ෉ͩΖ͏...
  54. Guild • https://github.com/operando/Guild • Simple java tuples • JSON RPCͷResponseΛTupleͰϥοϓͯ͠Δ

  55. JSON-RPC-OkHttp-Logging- Interceptor • https://github.com/operando/JSON-RPC- OkHttp-Logging-Interceptor • Χ΢ϧͰ࢖͓͏ͱࢥͬͯ࡞͚ͬͨͲ
 ࢖ͬͯͳ͍ͬ͢...

  56. ผʑͷAPIΛ࣮ߦ͢Δͱ͍͏͜ͱ͸... • ผʑͷAPIୟ͘ͷͰ଴ͪ߹Θ͕ͤඞཁ • JSON RPC(Χ΢ϧ) + REST API(ϝϧΧϦ) •

    JSON RPC͚ͩͳΒ΄΅଴ͪ߹Θͤඞཁͳ͍ • API Clintͷ໭Γ͸RxJavaͷSingleʹ౷Ұ • ଴ͪ߹Θͤ͸Single.zip
  57. RxJava • ։ൃॳΊ͸RxJava 1ͩͬͨ • ్தͰRxJava 2ʹ͍͑΍ʂͰஔ͖׵͑ • ੾Γସ͑લʹRxJava 2ࣾ಺ษڧձΛ΍ͬͨ

    • ͦͷλΠϛϯάͰAPI Clintͷ໭Γ΋Single΁Ҡߦ
  58. RxJava1 → RxJava2΁ͷҠߦ

  59. RxJava1 → RxJava2΁ͷҠߦ ࢀߟ • http://in.fablic.co.jp/entry/ 2017/04/27/110000 • https://github.com/ReactiveX/RxJava/ wiki/What%27s-different-in-2.0

    • http://reactivex.io/RxJava/2.x/javadoc/
  60. ແݶͬΆ͍ViewPager • ࣮͸༗ݶͳ΍ʔͭʔͶ • RecyclerTabLayout͓ੈ࿩ʹͳΓ·ͨ͠ • https://github.com/nshmura/ RecyclerTabLayout • PagerAdapterͷcount্͛Ε͹͑͑Μ΍ʂ

  61. ๭ϑϦϚΞϓϦͷແݶͬΆ͍ ViewPager • εΫϩʔϧͯ͠ɺҰप͢ΔͱεΫϩʔϧ͕
 Ұ൪্ʹ໭ͬͯΔʂʁ • ݩʑݟͯͨ΋ͷ͕Θ͔Βͳ͍… • ͑ɺͳʹ͜Ε

  62. ϝϧΧϦɹΧ΢ϧͷແݶͬΆ͍ ViewPager • εΫϩʔϧͯ͠ɺҰप͖ͯͯ͠΋ಉ͡ঢ়ଶ͕อ࣋͞ΕͯΔʂʁ • Page͕ഁغ͞ΕΔ࣌ʹStateΛอ࣋͢Ε͹؆୯ • RecyclerViewͷҐஔ͸ LinearLayoutManager#findFirstVisibleItemPositionͰอ࣋ •

    LinearLayoutManager#scrollToPositionWithOffsetͰҐஔ Λ໭͢ • حົͳ࣮૷͚ͩͲϢʔβͷརศੑ͕༏Δ
  63. ͗͢ΐ͍

  64. Data Binding • ࢖ͬͯ·͢ • View΁ͷ൓өॲཧΛUtilతͳѻ͍Ͱ
 custom binding logicΛ࡞ͬͯΔ •

    XML಺ʹ৚݅ࣜ͸ॻ͔Εͯͳ͍ • Two-way bindingతͳػೳ͸࢖ͬͯͳ͍
  65. ΞϓϦ಺ͷը૾ • ΄΅Vector Drawable • Ϛδָ࠷ߴ • Ұ෦Ͱ͔͍ը૾͚ͩWebP

  66. ͜ͱΓΜ

  67. ͜ͱΓΜ...͜ͱΓΜ...͜ͱΓΜ...

  68. Java 8 Backport API • Lightweight-Stream-API • https://github.com/aNNiMON/Lightweight- Stream-API •

    StreamͱOptional͸Զʹ೚ͤΖʂ • Retrolambda • ThreeTen Android Backport
  69. Analytics • Firebase Analytics

  70. Push௨஌ • FCM + Firebase Notification • Firebase Notification͸ͪΌΜͱ
 υΩϡϝϯτಡΜͰ࣮૷ͨ͠ํ͕͍͍

  71. Crash Reporting • Crashlytics • Firebase Crash Reporting • Firebase

    Analyticsͷϩά͕ग़ΔͷͰͲΜͳ ߦಈΛͯ͠Ϋϥογϡͨ͠ͷ͔աఔ͕
 Θ͔ͬͯ࠷ߴ
  72. ϝϧΧϦͱͷؔΘΓ • ϝϧΧϦͱΧ΢ϧ͕࿈ܞ͢ΔͨΊʹϝϧΧϦଆʹ࣮૷͕ඞཁ • ͓ɺ͓Ε͕࣮૷͢Δʔʂʂ • ࣮૷͠·ͨ͠ʔ • ཉ͘͠ͳͬͨਓ͕࣮૷͢ΔελΠϧʂ •

    ࣮૷ͯ͠΋Β͏͜ͱ΋͋ΔΑ☺
  73. ·͋͜Μͳ΋Μ͔ͳ

  74. ࣭ٙԠ౴ͷ͕࣌ؒ͋Ε͹...

  75. Thanks!!