Slide 1

Slide 1 text

AbemaTV, Inc. All Rights Reserved AbemaTV, Inc. All Rights Reserved 1 AndroidΞϓϦͰɺ 
 ҆ఆͯ͠ಈ࡞ͤ͞ ܧଓతʹ։ൃ͢ΔͨΊʹɺ 
 ઃܭͷݪଇΛར༻ͯ͠ɺ 
 ։ൃͨ͠࿩ 2023 March 16th גࣜձࣾαΠόʔΤʔδΣϯτ takahirom(@new_runnable)

Slide 2

Slide 2 text

AbemaTV, Inc. All Rights Reserved ࣗݾ঺հ 2 ໟडਸ༸ (ΊΜ͡Ύ͔ͨͻΖ ͱಡΈ·͢) takahiromͱ͍͏໊લͰΑ͘Qiitaॻ͍ͨΓOSS ࡞ͬͨΓ͍ͯ͠·͢ɻ ABEMAɺAndroidΤϯδχΞ 
 CyberAgent Developer Expert Google Developers Expert for Android DroidKaigi Co-Organizer, App Leader

Slide 3

Slide 3 text

AbemaTV, Inc. All Rights Reserved ࠓճ঺հ͢Δ࣮૷Λಋೖͨ͠ը໘ 3 ػೳ ● ์ૹͷࢹௌ ● ௥͔͚ͬ࠶ੜͷࢹௌ ● ݟಀ͠഑৴ࢹௌ ● ϚϧνΞϯάϧ ● ίϝϯτ ● ͳͲ FIFA ϫʔϧυΧοϓ Χλʔϧ 2022 ޙ΋ɺ 
 ܧଓͯ͠ར༻͍ͯ͘͠ը໘ FIFA ϫʔϧυΧοϓ Χλʔϧ 2022 ʹ޲͚ͯ৽ن Ͱ࡞੒ͨ͠ը໘ ABEMAͰFIFA ϫʔϧυΧοϓΛࢹௌ͢Δํ๏͸ʁϚϧνΞϯάϧɺݟಀ͠഑৴ɺ௥͔͚ͬ࠶ੜͳͲศརͳػೳΛ͝঺հ https://times.abema.tv/fifaworldcup/articles/-/10036755 “ABEMAͰϫʔϧυΧοϓ2022Λࢹௌ͢Δํ๏ʂྉۚ͸͍͘Βʁ࿥ը͸Ͱ͖Δʁ”ΑΓ https://times.abema.tv/fifaworldcup/articles/-/10048409

Slide 4

Slide 4 text

AbemaTV, Inc. All Rights Reserved ࠓճͷ“ઃܭͷݪଇ”ͱ͸ 4 AndroidͷެࣜαΠτʹ 
 AndroidͷΞϓϦͷઃܭΨΠυ͕͋Γɺ ͦͷதʹ͍͔ͭ͘ݪଇ͕ࡌ͍ͬͯͯɺ ͦΕΛࢀߟʹ͠ͳ͕Β ABEMAͰͲ͏࡞ͬͨͷ͔Λઆ໌͍͖ͯ͠· ͢ɻ ͢΂ͯͷΞϓϦͰ࢖͑Δ΋ͷͰ͸ͳ͘ɺ 
 վળ఺͕·ͩ·ͩ͋Δͱࢥ͏ͷͰɺ 
 ͜͏͍͏΍Γํ΋͋Δͷ͔ͱ͍͏͙Β͍Ͱײ͡ Ͱݟ͍͚ͯͨͩΔͱΑ͍͔΋͠Ε·ͤΜɻ Android DevelopersͷGuide to app architectureͳͲʹ 
 ܝࡌ͞Ε͍ͯΔ΋ͷ Guide to app architecture https://developer.android.com/topic/architecture

Slide 5

Slide 5 text

AbemaTV, Inc. All Rights Reserved Single Source of Truth 5

Slide 6

Slide 6 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 https://developer.android.com/topic/architecture#single-source-of-truth

Slide 7

Slide 7 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 8

Slide 8 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ ● ϙΠϯτ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 9

Slide 9 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ ● ϙΠϯτ ○ SSoT͸σʔλͷΦʔφʔ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 10

Slide 10 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ ● ϙΠϯτ ○ SSoT͸σʔλͷΦʔφʔ ○ SSoT͚͕ͩσʔλΛมߋͰ͖Δ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 11

Slide 11 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ ● ϙΠϯτ ○ SSoT͸σʔλͷΦʔφʔ ○ SSoT͚͕ͩσʔλΛมߋͰ͖Δ ○ SSoT͸ImmutableͳσʔλΛެ։͢Δ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 12

Slide 12 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ ● ϙΠϯτ ○ SSoT͸σʔλͷΦʔφʔ ○ SSoT͚͕ͩσʔλΛมߋͰ͖Δ ○ SSoT͸ImmutableͳσʔλΛެ։͢Δ ○ SSoT͸֎͔ΒσʔλΛมߋՄೳͳؔ਺͔ ΠϕϯτΛड͚औΔ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 13

Slide 13 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ ● ϙΠϯτ ○ SSoT͸σʔλͷΦʔφʔ ○ SSoT͚͕ͩσʔλΛมߋͰ͖Δ ○ SSoT͸ImmutableͳσʔλΛެ։͢Δ ○ SSoT͸֎͔ΒσʔλΛมߋՄೳͳؔ਺͔ ΠϕϯτΛड͚औΔ ● σʔλͷूத؅ཧ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 14

Slide 14 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ ● ϙΠϯτ ○ SSoT͸σʔλͷΦʔφʔ ○ SSoT͚͕ͩσʔλΛมߋͰ͖Δ ○ SSoT͸ImmutableͳσʔλΛެ։͢Δ ○ SSoT͸֎͔ΒσʔλΛมߋՄೳͳؔ਺͔ ΠϕϯτΛड͚औΔ ● σʔλͷूத؅ཧ ● ଞͷͱ͜Ζ͔Βσʔλ͕มߋ͞Εͳ ͍Α͏ʹอޢ͢Δ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 15

Slide 15 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦Λ ࢀর Single Source of Truth(SSoT)ͱ͸ 6 ● Guide to app architectureͷCommon architectural principlesͷҰͭ ● ϙΠϯτ ○ SSoT͸σʔλͷΦʔφʔ ○ SSoT͚͕ͩσʔλΛมߋͰ͖Δ ○ SSoT͸ImmutableͳσʔλΛެ։͢Δ ○ SSoT͸֎͔ΒσʔλΛมߋՄೳͳؔ਺͔ ΠϕϯτΛड͚औΔ ● σʔλͷूத؅ཧ ● ଞͷͱ͜Ζ͔Βσʔλ͕มߋ͞Εͳ ͍Α͏ʹอޢ͢Δ ● σʔλ΁ͷมߋ͕௥੻ՄೳʹͳΔ https://developer.android.com/topic/architecture#single-source-of-truth

Slide 16

Slide 16 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺1 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 7 fun playIfNeeded() { if(!isResumed) return if(!player.isPlaying()) return if(!viewModel.isAuthorized()) { // Ͳ͔͜Ͱ·ͨplayIfNeededΛ // ݺͿඞཁ͕͋Δ requestAuthorize() return } if(!viewModel.isUserPaused()) { return } player.play() } ΠϕϯτϕʔεͰಈ͘ίʔυͷྫ

Slide 17

Slide 17 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺1 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 7 ● ΠϕϯτϕʔεͰίʔυ͕ಈ͘Α͏ʹͳ͍ͬͯͯSSoT͕ͳ͔ͬͨ fun playIfNeeded() { if(!isResumed) return if(!player.isPlaying()) return if(!viewModel.isAuthorized()) { // Ͳ͔͜Ͱ·ͨplayIfNeededΛ // ݺͿඞཁ͕͋Δ requestAuthorize() return } if(!viewModel.isUserPaused()) { return } player.play() } ΠϕϯτϕʔεͰಈ͘ίʔυͷྫ

Slide 18

Slide 18 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺1 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 7 ● ΠϕϯτϕʔεͰίʔυ͕ಈ͘Α͏ʹͳ͍ͬͯͯSSoT͕ͳ͔ͬͨ ○ ྫ͑͹ɺplayIfNeeded()ΛݺΜͩΒதͰ࠶ੜՄೳ͔Λ൑ఆͯ͠࠶ ੜ͢ΔͳͲɻ fun playIfNeeded() { if(!isResumed) return if(!player.isPlaying()) return if(!viewModel.isAuthorized()) { // Ͳ͔͜Ͱ·ͨplayIfNeededΛ // ݺͿඞཁ͕͋Δ requestAuthorize() return } if(!viewModel.isUserPaused()) { return } player.play() } ΠϕϯτϕʔεͰಈ͘ίʔυͷྫ

Slide 19

Slide 19 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺1 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 7 ● ΠϕϯτϕʔεͰίʔυ͕ಈ͘Α͏ʹͳ͍ͬͯͯSSoT͕ͳ͔ͬͨ ○ ྫ͑͹ɺplayIfNeeded()ΛݺΜͩΒதͰ࠶ੜՄೳ͔Λ൑ఆͯ͠࠶ ੜ͢ΔͳͲɻ ○ ద੾ͳλΠϛϯάͰ͜ΕΛݺ͹ͳ͍ͱ࠶ੜ͞Εͳ͔ͬͨΓ͢ Δɻ fun playIfNeeded() { if(!isResumed) return if(!player.isPlaying()) return if(!viewModel.isAuthorized()) { // Ͳ͔͜Ͱ·ͨplayIfNeededΛ // ݺͿඞཁ͕͋Δ requestAuthorize() return } if(!viewModel.isUserPaused()) { return } player.play() } ΠϕϯτϕʔεͰಈ͘ίʔυͷྫ

Slide 20

Slide 20 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺1 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 7 ● ΠϕϯτϕʔεͰίʔυ͕ಈ͘Α͏ʹͳ͍ͬͯͯSSoT͕ͳ͔ͬͨ ○ ྫ͑͹ɺplayIfNeeded()ΛݺΜͩΒதͰ࠶ੜՄೳ͔Λ൑ఆͯ͠࠶ ੜ͢ΔͳͲɻ ○ ద੾ͳλΠϛϯάͰ͜ΕΛݺ͹ͳ͍ͱ࠶ੜ͞Εͳ͔ͬͨΓ͢ Δɻ ○ ϓϨΠϠʔͷঢ়ଶͷSSoT͸Ͳ͜ͳͷ͔ෆ໌ͩͬͨɻViewʁ PlayerʁViewModelʁ fun playIfNeeded() { if(!isResumed) return if(!player.isPlaying()) return if(!viewModel.isAuthorized()) { // Ͳ͔͜Ͱ·ͨplayIfNeededΛ // ݺͿඞཁ͕͋Δ requestAuthorize() return } if(!viewModel.isUserPaused()) { return } player.play() } ΠϕϯτϕʔεͰಈ͘ίʔυͷྫ

Slide 21

Slide 21 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺2 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 8 ViewModel಺Ͱ੔߹ੑΛऔΔͷ͕೉͍͠ྫ class ViewModel { val shouldPlay = MutableStateFlow(false) val authorized = MutableStateFlow(false) val isResumed = MutableStateFlow(false) private fun authorized() { authorized.value = true if (isResumed.value) { shouldPlay.value = true } } fun onResume() { isResumed.value = true if (authorized.value) { shouldPlay.value = true } } } ※UI states: single stream or multiple streams? https://developer.android.com/topic/architecture/ui-layer

Slide 22

Slide 22 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺2 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 8 ● ੔߹ੑ ViewModel಺Ͱ੔߹ੑΛऔΔͷ͕೉͍͠ྫ class ViewModel { val shouldPlay = MutableStateFlow(false) val authorized = MutableStateFlow(false) val isResumed = MutableStateFlow(false) private fun authorized() { authorized.value = true if (isResumed.value) { shouldPlay.value = true } } fun onResume() { isResumed.value = true if (authorized.value) { shouldPlay.value = true } } } ※UI states: single stream or multiple streams? https://developer.android.com/topic/architecture/ui-layer

Slide 23

Slide 23 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺2 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 8 ● ੔߹ੑ ○ ViewModelͷ͍ΖΜͳؔ਺͔Β͍Ζ͍Ζͳঢ়ଶΛ ͍͡ΔͷͰ੔߹ੑΛऔΔͷ͕೉͔ͬͨ͠ɻ ViewModel಺Ͱ੔߹ੑΛऔΔͷ͕೉͍͠ྫ class ViewModel { val shouldPlay = MutableStateFlow(false) val authorized = MutableStateFlow(false) val isResumed = MutableStateFlow(false) private fun authorized() { authorized.value = true if (isResumed.value) { shouldPlay.value = true } } fun onResume() { isResumed.value = true if (authorized.value) { shouldPlay.value = true } } } ※UI states: single stream or multiple streams? https://developer.android.com/topic/architecture/ui-layer

Slide 24

Slide 24 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺2 Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 8 ● ੔߹ੑ ○ ViewModelͷ͍ΖΜͳؔ਺͔Β͍Ζ͍Ζͳঢ়ଶΛ ͍͡ΔͷͰ੔߹ੑΛऔΔͷ͕೉͔ͬͨ͠ɻ ○ ύϑΥʔϚϯεͳͲͷӨڹ͕͋·Γͳͦ͞͏ͳͱ ͜ΖͰɺؔ࿈͋Δ΋ͷʹؔͯ͠͸੔߹ੑͷ؍఺͔ ΒUiModel͸Ͱ͖Δ͚ͩҰ͕͍͍ͭ (※) ViewModel಺Ͱ੔߹ੑΛऔΔͷ͕೉͍͠ྫ class ViewModel { val shouldPlay = MutableStateFlow(false) val authorized = MutableStateFlow(false) val isResumed = MutableStateFlow(false) private fun authorized() { authorized.value = true if (isResumed.value) { shouldPlay.value = true } } fun onResume() { isResumed.value = true if (authorized.value) { shouldPlay.value = true } } } ※UI states: single stream or multiple streams? https://developer.android.com/topic/architecture/ui-layer

Slide 25

Slide 25 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 9

Slide 26

Slide 26 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 9 ● buildUiModel(stateFlow1, stateFlow2, block: (T1, T2) -> R): StateFlow ͱ͍͏ 
 ؔ਺Λఆٛͨ͠ɻ

Slide 27

Slide 27 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 9 ● buildUiModel(stateFlow1, stateFlow2, block: (T1, T2) -> R): StateFlow ͱ͍͏ 
 ؔ਺Λఆٛͨ͠ɻ ○ StateFlowΛ࡞Δؔ਺ɻ

Slide 28

Slide 28 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 9 ● buildUiModel(stateFlow1, stateFlow2, block: (T1, T2) -> R): StateFlow ͱ͍͏ 
 ؔ਺Λఆٛͨ͠ɻ ○ StateFlowΛ࡞Δؔ਺ɻ ○ ViewModelͷதͰ࢖͏ɻ

Slide 29

Slide 29 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 9 ● buildUiModel(stateFlow1, stateFlow2, block: (T1, T2) -> R): StateFlow ͱ͍͏ 
 ؔ਺Λఆٛͨ͠ɻ ○ StateFlowΛ࡞Δؔ਺ɻ ○ ViewModelͷதͰ࢖͏ɻ ○ த਎͸جຊతʹ͸Flowͷcombine()͕ͩɺॳظ஋ΛଞͷStateFlow͔ΒblockΛݺͼ ग़ͯ͠ɺܭࢉ͢Δ৔ॴΛҰͭʹͰ͖ΔΑ͏ʹͨ͠ɻ

Slide 30

Slide 30 text

AbemaTV, Inc. All Rights Reserved buildUiModel()ͷఆٛ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 10 fun ViewModel.buildUiModel( flow: StateFlow, flow2: StateFlow, flow3: StateFlow, transform: (T1, T2, T3) -> R, ): StateFlow = combine( flow = flow, flow2 = flow2, flow3 = flow3, transform = transform ).stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), initialValue = transform( flow.value, flow2.value, flow3.value ) )

Slide 31

Slide 31 text

AbemaTV, Inc. All Rights Reserved buildUiModel()ͷఆٛ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 10 fun ViewModel.buildUiModel( flow: StateFlow, flow2: StateFlow, flow3: StateFlow, transform: (T1, T2, T3) -> R, ): StateFlow = combine( flow = flow, flow2 = flow2, flow3 = flow3, transform = transform ).stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), initialValue = transform( flow.value, flow2.value, flow3.value ) ) ͜͜Ͱॳظ஋Λܭࢉͯ͠͠·͏ Ҿ਺͕͢΂ͯStateFlowͳͷͰɺ͜Ε ͕ՄೳʹͳΔɻ

Slide 32

Slide 32 text

AbemaTV, Inc. All Rights Reserved private val productPlaybackStateFlow: StateFlow = buildUiModel( isScreenVisibleStateFlow, isUserPausedStateFlow, isAuthorizedStateFlow ) { screenVisible, userPaused, authorized -> if(!authorized) { ProductPlaybackState.ShouldStop }else if (userPaused || !screenVisible) { ProductPlaybackState.ShouldPause } else { ProductPlaybackState.ShouldPlay } } ྫ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 11

Slide 33

Slide 33 text

AbemaTV, Inc. All Rights Reserved private val productPlaybackStateFlow: StateFlow = buildUiModel( isScreenVisibleStateFlow, isUserPausedStateFlow, isAuthorizedStateFlow ) { screenVisible, userPaused, authorized -> if(!authorized) { ProductPlaybackState.ShouldStop }else if (userPaused || !screenVisible) { ProductPlaybackState.ShouldPause } else { ProductPlaybackState.ShouldPlay } } ྫ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 11 immutableͳσʔλΛ 
 ࣋ͭStateFlow

Slide 34

Slide 34 text

AbemaTV, Inc. All Rights Reserved private val productPlaybackStateFlow: StateFlow = buildUiModel( isScreenVisibleStateFlow, isUserPausedStateFlow, isAuthorizedStateFlow ) { screenVisible, userPaused, authorized -> if(!authorized) { ProductPlaybackState.ShouldStop }else if (userPaused || !screenVisible) { ProductPlaybackState.ShouldPause } else { ProductPlaybackState.ShouldPlay } } ྫ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 11 buildUiModel() immutableͳσʔλΛ 
 ࣋ͭStateFlow

Slide 35

Slide 35 text

AbemaTV, Inc. All Rights Reserved private val productPlaybackStateFlow: StateFlow = buildUiModel( isScreenVisibleStateFlow, isUserPausedStateFlow, isAuthorizedStateFlow ) { screenVisible, userPaused, authorized -> if(!authorized) { ProductPlaybackState.ShouldStop }else if (userPaused || !screenVisible) { ProductPlaybackState.ShouldPause } else { ProductPlaybackState.ShouldPlay } } ྫ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 11 buildUiModel() immutableͳσʔλΛ 
 ࣋ͭStateFlow ଞͷStateFlowΛҾ਺ʹऔΔͷͰ ωετͯ͠ఆٛ΋Ͱ͖Δ

Slide 36

Slide 36 text

AbemaTV, Inc. All Rights Reserved private val productPlaybackStateFlow: StateFlow = buildUiModel( isScreenVisibleStateFlow, isUserPausedStateFlow, isAuthorizedStateFlow ) { screenVisible, userPaused, authorized -> if(!authorized) { ProductPlaybackState.ShouldStop }else if (userPaused || !screenVisible) { ProductPlaybackState.ShouldPause } else { ProductPlaybackState.ShouldPlay } } ྫ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 11 buildUiModel() ॳظ஋͕ϩδοΫʹΑͬͯܭࢉ͞ ΕΔͨΊɺࢦఆ͢Δඞཁ͕ͳ͘ɺ ͜ͷϩδοΫ͕஋Λ࡞ΔSSoTʹ ͳ͍ͬͯΔ immutableͳσʔλΛ 
 ࣋ͭStateFlow ଞͷStateFlowΛҾ਺ʹऔΔͷͰ ωετͯ͠ఆٛ΋Ͱ͖Δ

Slide 37

Slide 37 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12

Slide 38

Slide 38 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ

Slide 39

Slide 39 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ ○ buildUiModel()ͷҾ਺͕ଟ͘ͳΓ͗͢Δɺͭ·Γ͏·͘෼཭Ͱ͖͍ͯͳ͍ύλʔϯ͕͋ͬͨɻ

Slide 40

Slide 40 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ ○ buildUiModel()ͷҾ਺͕ଟ͘ͳΓ͗͢Δɺͭ·Γ͏·͘෼཭Ͱ͖͍ͯͳ͍ύλʔϯ͕͋ͬͨɻ ■ 9ݸҎ্͸૿΍͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺωετͯ͠͏·͘࡞ΕΔΑ͏ʹͨ͠ɻ

Slide 41

Slide 41 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ ○ buildUiModel()ͷҾ਺͕ଟ͘ͳΓ͗͢Δɺͭ·Γ͏·͘෼཭Ͱ͖͍ͯͳ͍ύλʔϯ͕͋ͬͨɻ ■ 9ݸҎ্͸૿΍͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺωετͯ͠͏·͘࡞ΕΔΑ͏ʹͨ͠ɻ ○ ͋Δσʔλʹର͢ΔҰ؏ੑ͸อͪ΍͍͕͢ɺྫ͑͹API͔ΒԿ͔Λऔಘͨ͋͠ͱʹԿΛॻ͖׵͑Δͷ͔ɺͲ͏Ξϓ ϦέʔγϣϯʹӨڹΛ༩͑Δͷ͔ͷॲཧ͸ٯʹ௥͍ʹ͘͘ͳΔ͔΋͠Εͳ͍ɻ

Slide 42

Slide 42 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ ○ buildUiModel()ͷҾ਺͕ଟ͘ͳΓ͗͢Δɺͭ·Γ͏·͘෼཭Ͱ͖͍ͯͳ͍ύλʔϯ͕͋ͬͨɻ ■ 9ݸҎ্͸૿΍͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺωετͯ͠͏·͘࡞ΕΔΑ͏ʹͨ͠ɻ ○ ͋Δσʔλʹର͢ΔҰ؏ੑ͸อͪ΍͍͕͢ɺྫ͑͹API͔ΒԿ͔Λऔಘͨ͋͠ͱʹԿΛॻ͖׵͑Δͷ͔ɺͲ͏Ξϓ ϦέʔγϣϯʹӨڹΛ༩͑Δͷ͔ͷॲཧ͸ٯʹ௥͍ʹ͘͘ͳΔ͔΋͠Εͳ͍ɻ ■ ͜Ε͸τϨʔυΦϑͱͯ͠ड͚ೖΕ͍ͯΔɻ

Slide 43

Slide 43 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ ○ buildUiModel()ͷҾ਺͕ଟ͘ͳΓ͗͢Δɺͭ·Γ͏·͘෼཭Ͱ͖͍ͯͳ͍ύλʔϯ͕͋ͬͨɻ ■ 9ݸҎ্͸૿΍͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺωετͯ͠͏·͘࡞ΕΔΑ͏ʹͨ͠ɻ ○ ͋Δσʔλʹର͢ΔҰ؏ੑ͸อͪ΍͍͕͢ɺྫ͑͹API͔ΒԿ͔Λऔಘͨ͋͠ͱʹԿΛॻ͖׵͑Δͷ͔ɺͲ͏Ξϓ ϦέʔγϣϯʹӨڹΛ༩͑Δͷ͔ͷॲཧ͸ٯʹ௥͍ʹ͘͘ͳΔ͔΋͠Εͳ͍ɻ ■ ͜Ε͸τϨʔυΦϑͱͯ͠ड͚ೖΕ͍ͯΔɻ ● ୅ସखஈ

Slide 44

Slide 44 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ ○ buildUiModel()ͷҾ਺͕ଟ͘ͳΓ͗͢Δɺͭ·Γ͏·͘෼཭Ͱ͖͍ͯͳ͍ύλʔϯ͕͋ͬͨɻ ■ 9ݸҎ্͸૿΍͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺωετͯ͠͏·͘࡞ΕΔΑ͏ʹͨ͠ɻ ○ ͋Δσʔλʹର͢ΔҰ؏ੑ͸อͪ΍͍͕͢ɺྫ͑͹API͔ΒԿ͔Λऔಘͨ͋͠ͱʹԿΛॻ͖׵͑Δͷ͔ɺͲ͏Ξϓ ϦέʔγϣϯʹӨڹΛ༩͑Δͷ͔ͷॲཧ͸ٯʹ௥͍ʹ͘͘ͳΔ͔΋͠Εͳ͍ɻ ■ ͜Ε͸τϨʔυΦϑͱͯ͠ड͚ೖΕ͍ͯΔɻ ● ୅ସखஈ ○ Cash AppͷMoleculeͰ΋ྑ͔ͬͨɻ

Slide 45

Slide 45 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ ○ buildUiModel()ͷҾ਺͕ଟ͘ͳΓ͗͢Δɺͭ·Γ͏·͘෼཭Ͱ͖͍ͯͳ͍ύλʔϯ͕͋ͬͨɻ ■ 9ݸҎ্͸૿΍͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺωετͯ͠͏·͘࡞ΕΔΑ͏ʹͨ͠ɻ ○ ͋Δσʔλʹର͢ΔҰ؏ੑ͸อͪ΍͍͕͢ɺྫ͑͹API͔ΒԿ͔Λऔಘͨ͋͠ͱʹԿΛॻ͖׵͑Δͷ͔ɺͲ͏Ξϓ ϦέʔγϣϯʹӨڹΛ༩͑Δͷ͔ͷॲཧ͸ٯʹ௥͍ʹ͘͘ͳΔ͔΋͠Εͳ͍ɻ ■ ͜Ε͸τϨʔυΦϑͱͯ͠ड͚ೖΕ͍ͯΔɻ ● ୅ସखஈ ○ Cash AppͷMoleculeͰ΋ྑ͔ͬͨɻ ■ ͜ΕΛ࢖͏ͱJetpack ComposeΛ࢖ͬͯStateFlowΛ࡞ΕΔɻ

Slide 46

Slide 46 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Single Source of Truth(SSoT)ΛͲ͏࢖͔ͬͨ 12 ● τϨʔυΦϑ ○ buildUiModel()ͷҾ਺͕ଟ͘ͳΓ͗͢Δɺͭ·Γ͏·͘෼཭Ͱ͖͍ͯͳ͍ύλʔϯ͕͋ͬͨɻ ■ 9ݸҎ্͸૿΍͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺωετͯ͠͏·͘࡞ΕΔΑ͏ʹͨ͠ɻ ○ ͋Δσʔλʹର͢ΔҰ؏ੑ͸อͪ΍͍͕͢ɺྫ͑͹API͔ΒԿ͔Λऔಘͨ͋͠ͱʹԿΛॻ͖׵͑Δͷ͔ɺͲ͏Ξϓ ϦέʔγϣϯʹӨڹΛ༩͑Δͷ͔ͷॲཧ͸ٯʹ௥͍ʹ͘͘ͳΔ͔΋͠Εͳ͍ɻ ■ ͜Ε͸τϨʔυΦϑͱͯ͠ड͚ೖΕ͍ͯΔɻ ● ୅ସखஈ ○ Cash AppͷMoleculeͰ΋ྑ͔ͬͨɻ ■ ͜ΕΛ࢖͏ͱJetpack ComposeΛ࢖ͬͯStateFlowΛ࡞ΕΔɻ ■ ͦΕͧΕͷίϯϙʔωϯτͷUiModelͷ࡞੒ͳͲΛɺؔ਺ʹ੾Γग़͍͕ͨ͠ɺͦ͏ͯ͠େ͖͘ͳ͍ͬͯͬ ͨͱ͖ʹύϑΥʔϚϯε͕Ͳ͏ͳͷ͔ͳͲɺݒ೦͕͋Γ࠾༻Ͱ͖ͳ͔ͬͨɻ(ѱ͍Θ͚Ͱ͸ͳ͘ଌΕ͍ͯ ͳ͍͚ͩͰ͢ɻ)

Slide 47

Slide 47 text

AbemaTV, Inc. All Rights Reserved Unidirectional Data Flow 13

Slide 48

Slide 48 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦ Λࢀর Unidirectional Data Flow(UDF)ͱ͸ 14 https://developer.android.com/topic/architecture#unidirectional-data-flow

Slide 49

Slide 49 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦ Λࢀর Unidirectional Data Flow(UDF)ͱ͸ 14 ● Guide to App Architectureͷ Common architectural principlesͷҰ ͭ https://developer.android.com/topic/architecture#unidirectional-data-flow

Slide 50

Slide 50 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦ Λࢀর Unidirectional Data Flow(UDF)ͱ͸ 14 ● Guide to App Architectureͷ Common architectural principlesͷҰ ͭ ● ϙΠϯτ https://developer.android.com/topic/architecture#unidirectional-data-flow

Slide 51

Slide 51 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦ Λࢀর Unidirectional Data Flow(UDF)ͱ͸ 14 ● Guide to App Architectureͷ Common architectural principlesͷҰ ͭ ● ϙΠϯτ ○ State͕Ұํ޲ʹྲྀΕɺ 
 Event͕ٯଆʹྲྀΕΔɻ https://developer.android.com/topic/architecture#unidirectional-data-flow

Slide 52

Slide 52 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦ Λࢀর Unidirectional Data Flow(UDF)ͱ͸ 14 ● Guide to App Architectureͷ Common architectural principlesͷҰ ͭ ● ϙΠϯτ ○ State͕Ұํ޲ʹྲྀΕɺ 
 Event͕ٯଆʹྲྀΕΔɻ ● SSoTʹΑͬͯಘΒΕΔརӹɻ https://developer.android.com/topic/architecture#unidirectional-data-flow

Slide 53

Slide 53 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersʹ͋Δઃܭ֓೦ Λࢀর Unidirectional Data Flow(UDF)ͱ͸ 14 ● Guide to App Architectureͷ Common architectural principlesͷҰ ͭ ● ϙΠϯτ ○ State͕Ұํ޲ʹྲྀΕɺ 
 Event͕ٯଆʹྲྀΕΔɻ ● SSoTʹΑͬͯಘΒΕΔརӹɻ ● Ұ؏ੑɺޡΓΛݮΒ͢ɺσόοάΛָ ʹ͢Δ https://developer.android.com/topic/architecture#unidirectional-data-flow

Slide 54

Slide 54 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 15

Slide 55

Slide 55 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 15 ● Fragment΍RecyclerViewͷΞΠςϜ·Ͱɺ͞ ·͟·ͳͱ͜Ζʹಉ͡ViewModel͕Ͱͯ͘Δ࣮ ૷ʹͳ͍ͬͯͯσʔλͷྲྀΕ͕౷Ұ͞Ε͍ͯͳ ͔ͬͨɻ͜ΕʹΑΓɺσόοάͳͲ͕೉͘͠ͳ ΔͳͲ͕ൃੜ͍ͯͨ͠ɻ

Slide 56

Slide 56 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 16

Slide 57

Slide 57 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 16 ● ৽͍͠Jetpack Compose ͔ ࣮੷ͷAndroid View ͔ɺͲͪΒΛ࢖͏͔ɻ

Slide 58

Slide 58 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 16 ● ৽͍͠Jetpack Compose ͔ ࣮੷ͷAndroid View ͔ɺͲͪΒΛ࢖͏͔ɻ ○ ΋͠ऴ൫ʹக໋తͳ໰୊͕ݟ͔ͭΔͱऔΓฦ͕͔ͭ͠ͳ͔ͬͨͷͰɺ 
 දࣔͷج൫ͱͳΔ෦෼ʹ͸ΞϓϦ಺Ͱ࣮੷ͷ͋ΔAndroid ViewΛ࢖͍ͨ ͔ͬͨɻ

Slide 59

Slide 59 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 16 ● ৽͍͠Jetpack Compose ͔ ࣮੷ͷAndroid View ͔ɺͲͪΒΛ࢖͏͔ɻ ○ ΋͠ऴ൫ʹக໋తͳ໰୊͕ݟ͔ͭΔͱऔΓฦ͕͔ͭ͠ͳ͔ͬͨͷͰɺ 
 දࣔͷج൫ͱͳΔ෦෼ʹ͸ΞϓϦ಺Ͱ࣮੷ͷ͋ΔAndroid ViewΛ࢖͍ͨ ͔ͬͨɻ ○ ࠓޙͷJetpack Composeͱͷޓ׵ੑΛͲ͏୲อ͢Δ͔ʁ

Slide 60

Slide 60 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 17 class ViewBinder( private val binding: PlayerBinding, onUserPlayerPaused: () -> Unit ) { fun apply(uiModel: PlayerUiModel) { binding.title.text = uiModel.title binding.pauseButton.setOnClickListener { onUserPlayerPaused() } } }

Slide 61

Slide 61 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 17 ● ViewBinderͱ͍͏ΫϥεΛఆٛͨ͠ɻ class ViewBinder( private val binding: PlayerBinding, onUserPlayerPaused: () -> Unit ) { fun apply(uiModel: PlayerUiModel) { binding.title.text = uiModel.title binding.pauseButton.setOnClickListener { onUserPlayerPaused() } } }

Slide 62

Slide 62 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 17 ● ViewBinderͱ͍͏ΫϥεΛఆٛͨ͠ɻ ○ ͜ͷΫϥεʹ͸Ҿ਺ʹViewModelͳͲ Λ౉͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺView ͸جຊతʹ͸͜ͷதͰมߋΛՃ͑Δɻ class ViewBinder( private val binding: PlayerBinding, onUserPlayerPaused: () -> Unit ) { fun apply(uiModel: PlayerUiModel) { binding.title.text = uiModel.title binding.pauseButton.setOnClickListener { onUserPlayerPaused() } } }

Slide 63

Slide 63 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 17 ● ViewBinderͱ͍͏ΫϥεΛఆٛͨ͠ɻ ○ ͜ͷΫϥεʹ͸Ҿ਺ʹViewModelͳͲ Λ౉͞ͳ͍ͱ͍͏੍໿Λ͚ͭͯɺView ͸جຊతʹ͸͜ͷதͰมߋΛՃ͑Δɻ ○ Jetpack ComposeʹҠߦ͠ऴΘΕ͹ফ ͤΔΫϥεɻ class ViewBinder( private val binding: PlayerBinding, onUserPlayerPaused: () -> Unit ) { fun apply(uiModel: PlayerUiModel) { binding.title.text = uiModel.title binding.pauseButton.setOnClickListener { onUserPlayerPaused() } } }

Slide 64

Slide 64 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 18 class ViewBinder( private val binding: PlayerBinding, onUserPlayerPaused: () -> Unit ) { fun apply(uiModel: PlayerUiModel) { binding.title.text = uiModel.title binding.pauseButton.setOnClickListener { onUserPlayerPaused() } } } ͨͩͷγϯϓϧͳΫϥε

Slide 65

Slide 65 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 18 class ViewBinder( private val binding: PlayerBinding, onUserPlayerPaused: () -> Unit ) { fun apply(uiModel: PlayerUiModel) { binding.title.text = uiModel.title binding.pauseButton.setOnClickListener { onUserPlayerPaused() } } } ݺͼݩ͔Βσʔλ͕౉͞ΕΔ buildUiModel()ʹΑͬͯ౷߹͞Εͨ UiModel͕౉ͬͯ͘ΔͷͰɺ apply()ؔ਺͸ҰͭͷΈʹͳΓγϯϓϧ ͨͩͷγϯϓϧͳΫϥε

Slide 66

Slide 66 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 18 class ViewBinder( private val binding: PlayerBinding, onUserPlayerPaused: () -> Unit ) { fun apply(uiModel: PlayerUiModel) { binding.title.text = uiModel.title binding.pauseButton.setOnClickListener { onUserPlayerPaused() } } } ݺͼݩ͔Βσʔλ͕౉͞ΕΔ ݺͼݩʹΠϕϯτΛ౉͢ buildUiModel()ʹΑͬͯ౷߹͞Εͨ UiModel͕౉ͬͯ͘ΔͷͰɺ apply()ؔ਺͸ҰͭͷΈʹͳΓγϯϓϧ ͨͩͷγϯϓϧͳΫϥε

Slide 67

Slide 67 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 19

Slide 68

Slide 68 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 19 →

Slide 69

Slide 69 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20

Slide 70

Slide 70 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20 ● τϨʔυΦϑ

Slide 71

Slide 71 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20 ● τϨʔυΦϑ ○ ViewBinderͱ͍͏ଘࡏࣗମ͕ೃછΈ͕ͳ͍ͷͰֶशίετ্͕͕Δɻ

Slide 72

Slide 72 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20 ● τϨʔυΦϑ ○ ViewBinderͱ͍͏ଘࡏࣗମ͕ೃછΈ͕ͳ͍ͷͰֶशίετ্͕͕Δɻ ○ ViewBinderΫϥεͷҾ਺͕Πϕϯτͷ਺͚ͩͰ͖ΔͷͰଟ͘ͳΓ͕ͪ

Slide 73

Slide 73 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20 ● τϨʔυΦϑ ○ ViewBinderͱ͍͏ଘࡏࣗମ͕ೃછΈ͕ͳ͍ͷͰֶशίετ্͕͕Δɻ ○ ViewBinderΫϥεͷҾ਺͕Πϕϯτͷ਺͚ͩͰ͖ΔͷͰଟ͘ͳΓ͕ͪ ■ → ໊લ෇͖Ҿ਺ʹͳΓɺ௥͍΍͍͢ͷͰɺͦ͜·Ͱͷ໰୊ʹ͸ͳΒͳ͍͸ͣɻ

Slide 74

Slide 74 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20 ● τϨʔυΦϑ ○ ViewBinderͱ͍͏ଘࡏࣗମ͕ೃછΈ͕ͳ͍ͷͰֶशίετ্͕͕Δɻ ○ ViewBinderΫϥεͷҾ਺͕Πϕϯτͷ਺͚ͩͰ͖ΔͷͰଟ͘ͳΓ͕ͪ ■ → ໊લ෇͖Ҿ਺ʹͳΓɺ௥͍΍͍͢ͷͰɺͦ͜·Ͱͷ໰୊ʹ͸ͳΒͳ͍͸ͣɻ ○ ViewBinderͷதʹ͸View͚ͩͰͳ͘Compose΋ೖ͍ͬͯͨͷͰɺComposeͰ͸஋Λ౉͢ͱ͖ʹStateFlowΛ౉͢ඞཁ͕͋ͬ ͕ͨStateFlow΋ViewBinderʹ౉͢ඞཁ͕͋ͬͨͷͰɺͦΕʹΑͬͯదԠํ๏͕෼ࢄͯ͠͠·͍ͬͯͨɻ

Slide 75

Slide 75 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20 ● τϨʔυΦϑ ○ ViewBinderͱ͍͏ଘࡏࣗମ͕ೃછΈ͕ͳ͍ͷͰֶशίετ্͕͕Δɻ ○ ViewBinderΫϥεͷҾ਺͕Πϕϯτͷ਺͚ͩͰ͖ΔͷͰଟ͘ͳΓ͕ͪ ■ → ໊લ෇͖Ҿ਺ʹͳΓɺ௥͍΍͍͢ͷͰɺͦ͜·Ͱͷ໰୊ʹ͸ͳΒͳ͍͸ͣɻ ○ ViewBinderͷதʹ͸View͚ͩͰͳ͘Compose΋ೖ͍ͬͯͨͷͰɺComposeͰ͸஋Λ౉͢ͱ͖ʹStateFlowΛ౉͢ඞཁ͕͋ͬ ͕ͨStateFlow΋ViewBinderʹ౉͢ඞཁ͕͋ͬͨͷͰɺͦΕʹΑͬͯదԠํ๏͕෼ࢄͯ͠͠·͍ͬͯͨɻ ■ → ͏·͘StateFlowͷΈͰಈ͔͢Α͏ʹ͢ΔͳͲͷ࢓૊Έ͕ඞཁɻ

Slide 76

Slide 76 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20 ● τϨʔυΦϑ ○ ViewBinderͱ͍͏ଘࡏࣗମ͕ೃછΈ͕ͳ͍ͷͰֶशίετ্͕͕Δɻ ○ ViewBinderΫϥεͷҾ਺͕Πϕϯτͷ਺͚ͩͰ͖ΔͷͰଟ͘ͳΓ͕ͪ ■ → ໊લ෇͖Ҿ਺ʹͳΓɺ௥͍΍͍͢ͷͰɺͦ͜·Ͱͷ໰୊ʹ͸ͳΒͳ͍͸ͣɻ ○ ViewBinderͷதʹ͸View͚ͩͰͳ͘Compose΋ೖ͍ͬͯͨͷͰɺComposeͰ͸஋Λ౉͢ͱ͖ʹStateFlowΛ౉͢ඞཁ͕͋ͬ ͕ͨStateFlow΋ViewBinderʹ౉͢ඞཁ͕͋ͬͨͷͰɺͦΕʹΑͬͯదԠํ๏͕෼ࢄͯ͠͠·͍ͬͯͨɻ ■ → ͏·͘StateFlowͷΈͰಈ͔͢Α͏ʹ͢ΔͳͲͷ࢓૊Έ͕ඞཁɻ ○ ࡉ͔͍஋ͷมԽͰ͢΂ͯΛViewBinder.apply()ͰViewʹదԠ͠௚͢ͷͰύϑΥʔϚϯεతʹ·ͣͦ͏Ͱ͸ʁ

Slide 77

Slide 77 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 20 ● τϨʔυΦϑ ○ ViewBinderͱ͍͏ଘࡏࣗମ͕ೃછΈ͕ͳ͍ͷͰֶशίετ্͕͕Δɻ ○ ViewBinderΫϥεͷҾ਺͕Πϕϯτͷ਺͚ͩͰ͖ΔͷͰଟ͘ͳΓ͕ͪ ■ → ໊લ෇͖Ҿ਺ʹͳΓɺ௥͍΍͍͢ͷͰɺͦ͜·Ͱͷ໰୊ʹ͸ͳΒͳ͍͸ͣɻ ○ ViewBinderͷதʹ͸View͚ͩͰͳ͘Compose΋ೖ͍ͬͯͨͷͰɺComposeͰ͸஋Λ౉͢ͱ͖ʹStateFlowΛ౉͢ඞཁ͕͋ͬ ͕ͨStateFlow΋ViewBinderʹ౉͢ඞཁ͕͋ͬͨͷͰɺͦΕʹΑͬͯదԠํ๏͕෼ࢄͯ͠͠·͍ͬͯͨɻ ■ → ͏·͘StateFlowͷΈͰಈ͔͢Α͏ʹ͢ΔͳͲͷ࢓૊Έ͕ඞཁɻ ○ ࡉ͔͍஋ͷมԽͰ͢΂ͯΛViewBinder.apply()ͰViewʹదԠ͠௚͢ͷͰύϑΥʔϚϯεతʹ·ͣͦ͏Ͱ͸ʁ ■ → (࣍ϖʔδ)

Slide 78

Slide 78 text

AbemaTV, Inc. All Rights Reserved ύϑΥʔϚϯεతʹ·ͣͦ͏ͱ͍͏࿩ Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 21 ViewBinder.apply()Λେ͖ͳ୯ҐͰ૸ΒͤΔͱɺ 
 ྫ͑͹TextView͕தʹ͋Δͱɺ 
 wrap_contentͷ৔߹͸ಉ͡ςΩετͰ΋ requestLayout()͕૸ΓશମΛϨΠΞ΢τ͠௚͢ → ԿΒ͔ͷࠩ෼ߋ৽͕ඞཁͦ͏ fun apply(uiModel: PlayerUiModel) { binding.title.text = uiModel.title … } textView.setText()͔ΒrequestLayout()͕ݺ͹Ε͍ͯΔྫ

Slide 79

Slide 79 text

AbemaTV, Inc. All Rights Reserved ύϑΥʔϚϯεʹؔͯ͠ɺJetpack Compose͕಺෦తʹߦ͍ͬͯΔΞϓϩʔν Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 22

Slide 80

Slide 80 text

AbemaTV, Inc. All Rights Reserved ύϑΥʔϚϯεʹؔͯ͠ɺJetpack Compose͕಺෦తʹߦ͍ͬͯΔΞϓϩʔν Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 22 ● Jetpack ComposeͰ͸ঢ়ଶΛComposableؔ਺ຖʹ͍࣋ͬͯͯ(SlotTable)ɺؔ਺ͷҾ਺͕มΘͬͨ࣌ͷΈؔ਺தͷॲཧΛ ߦ͏ɻ(͍ΘΏΔdonut-hole skipping)

Slide 81

Slide 81 text

AbemaTV, Inc. All Rights Reserved ύϑΥʔϚϯεʹؔͯ͠ɺJetpack Compose͕಺෦తʹߦ͍ͬͯΔΞϓϩʔν Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 22 ● Jetpack ComposeͰ͸ঢ়ଶΛComposableؔ਺ຖʹ͍࣋ͬͯͯ(SlotTable)ɺؔ਺ͷҾ਺͕มΘͬͨ࣌ͷΈؔ਺தͷॲཧΛ ߦ͏ɻ(͍ΘΏΔdonut-hole skipping) inline fun View.updateTag( @IdRes tagId: Int, value: T, onUpdate: (old: T?, new: T) -> Unit ) { val old: T? = getTag(tagId) as? T if (old != value) { setTag(tagId, value) onUpdate(old, value) } }

Slide 82

Slide 82 text

AbemaTV, Inc. All Rights Reserved ύϑΥʔϚϯεʹؔͯ͠ɺJetpack Compose͕಺෦తʹߦ͍ͬͯΔΞϓϩʔν Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 22 ● Jetpack ComposeͰ͸ঢ়ଶΛComposableؔ਺ຖʹ͍࣋ͬͯͯ(SlotTable)ɺؔ਺ͷҾ਺͕มΘͬͨ࣌ͷΈؔ਺தͷॲཧΛ ߦ͏ɻ(͍ΘΏΔdonut-hole skipping) inline fun View.updateTag( @IdRes tagId: Int, value: T, onUpdate: (old: T?, new: T) -> Unit ) { val old: T? = getTag(tagId) as? T if (old != value) { setTag(tagId, value) onUpdate(old, value) } } ● ͜ΕΛٖࣅతʹViewͰ΋Ͱ͖ͳ͍͔ʁ

Slide 83

Slide 83 text

AbemaTV, Inc. All Rights Reserved ύϑΥʔϚϯεʹؔͯ͠ɺJetpack Compose͕಺෦తʹߦ͍ͬͯΔΞϓϩʔν Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 22 ● Jetpack ComposeͰ͸ঢ়ଶΛComposableؔ਺ຖʹ͍࣋ͬͯͯ(SlotTable)ɺؔ਺ͷҾ਺͕มΘͬͨ࣌ͷΈؔ਺தͷॲཧΛ ߦ͏ɻ(͍ΘΏΔdonut-hole skipping) inline fun View.updateTag( @IdRes tagId: Int, value: T, onUpdate: (old: T?, new: T) -> Unit ) { val old: T? = getTag(tagId) as? T if (old != value) { setTag(tagId, value) onUpdate(old, value) } } ● ͜ΕΛٖࣅతʹViewͰ΋Ͱ͖ͳ͍͔ʁ ○ View.updateTag { }ͱ͍͏ؔ਺Λ࡞੒

Slide 84

Slide 84 text

AbemaTV, Inc. All Rights Reserved ύϑΥʔϚϯεʹؔͯ͠ɺJetpack Compose͕಺෦తʹߦ͍ͬͯΔΞϓϩʔν Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 22 ● Jetpack ComposeͰ͸ঢ়ଶΛComposableؔ਺ຖʹ͍࣋ͬͯͯ(SlotTable)ɺؔ਺ͷҾ਺͕มΘͬͨ࣌ͷΈؔ਺தͷॲཧΛ ߦ͏ɻ(͍ΘΏΔdonut-hole skipping) inline fun View.updateTag( @IdRes tagId: Int, value: T, onUpdate: (old: T?, new: T) -> Unit ) { val old: T? = getTag(tagId) as? T if (old != value) { setTag(tagId, value) onUpdate(old, value) } } ● ͜ΕΛٖࣅతʹViewͰ΋Ͱ͖ͳ͍͔ʁ ○ View.updateTag { }ͱ͍͏ؔ਺Λ࡞੒ ■ Viewͷอ࣋͢ΔtagΛར༻ͯ͠ 
 ࠩ෼͕͋Ε͹౉͞Εͨؔ਺ΛݺͿ

Slide 85

Slide 85 text

AbemaTV, Inc. All Rights Reserved ύϑΥʔϚϯεʹؔͯ͠ɺJetpack Compose͕಺෦తʹߦ͍ͬͯΔΞϓϩʔν Unidirectional Data Flow(UDF)ΛͲ͏࢖͔ͬͨ 22 ● Jetpack ComposeͰ͸ঢ়ଶΛComposableؔ਺ຖʹ͍࣋ͬͯͯ(SlotTable)ɺؔ਺ͷҾ਺͕มΘͬͨ࣌ͷΈؔ਺தͷॲཧΛ ߦ͏ɻ(͍ΘΏΔdonut-hole skipping) inline fun View.updateTag( @IdRes tagId: Int, value: T, onUpdate: (old: T?, new: T) -> Unit ) { val old: T? = getTag(tagId) as? T if (old != value) { setTag(tagId, value) onUpdate(old, value) } } ● ͜ΕΛٖࣅతʹViewͰ΋Ͱ͖ͳ͍͔ʁ ○ View.updateTag { }ͱ͍͏ؔ਺Λ࡞੒ ■ Viewͷอ࣋͢ΔtagΛར༻ͯ͠ 
 ࠩ෼͕͋Ε͹౉͞Εͨؔ਺ΛݺͿ ■ ͜ΕΛViewBinder.apply()ͷதͰɺ 
 ར༻͍ͯ͘͜͠ͱͰղܾɻ

Slide 86

Slide 86 text

AbemaTV, Inc. All Rights Reserved ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍ 23

Slide 87

Slide 87 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersͷ Recommendations for Android architectureΑΓ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ͱ͸ 24 https://developer.android.com/topic/architecture/ recommendations?hl=en

Slide 88

Slide 88 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersͷ Recommendations for Android architectureΑΓ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ͱ͸ 24 ● UI layerʹ͋Δ߲໨ͰɺStrongly recommended https://developer.android.com/topic/architecture/ recommendations?hl=en

Slide 89

Slide 89 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersͷ Recommendations for Android architectureΑΓ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ͱ͸ 24 ● UI layerʹ͋Δ߲໨ͰɺStrongly recommended ● ϙΠϯτ https://developer.android.com/topic/architecture/ recommendations?hl=en

Slide 90

Slide 90 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersͷ Recommendations for Android architectureΑΓ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ͱ͸ 24 ● UI layerʹ͋Δ߲໨ͰɺStrongly recommended ● ϙΠϯτ ○ UIͷΞΫγϣϯ͸ΠϕϯτͰ͸ͳ ͘ɺUI StateͷΞοϓσʔτʹ ΑͬͯߦΘΕΔ΂͖ɻ https://developer.android.com/topic/architecture/ recommendations?hl=en

Slide 91

Slide 91 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersͷ Recommendations for Android architectureΑΓ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ͱ͸ 24 ● UI layerʹ͋Δ߲໨ͰɺStrongly recommended ● ϙΠϯτ ○ UIͷΞΫγϣϯ͸ΠϕϯτͰ͸ͳ ͘ɺUI StateͷΞοϓσʔτʹ ΑͬͯߦΘΕΔ΂͖ɻ ● Πϕϯτ͕࠶ݱՄೳʹͳΔɻ https://developer.android.com/topic/architecture/ recommendations?hl=en

Slide 92

Slide 92 text

AbemaTV, Inc. All Rights Reserved ϝϦοτ Android Developersͷ Recommendations for Android architectureΑΓ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ͱ͸ 24 ● UI layerʹ͋Δ߲໨ͰɺStrongly recommended ● ϙΠϯτ ○ UIͷΞΫγϣϯ͸ΠϕϯτͰ͸ͳ ͘ɺUI StateͷΞοϓσʔτʹ ΑͬͯߦΘΕΔ΂͖ɻ ● Πϕϯτ͕࠶ݱՄೳʹͳΔɻ ● UIΞΫγϣϯ͕ࣦΘΕͳ͍͜ͱ͕อূ ͞ΕΔɻ https://developer.android.com/topic/architecture/ recommendations?hl=en

Slide 93

Slide 93 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 25

Slide 94

Slide 94 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 25 ● collect{}ͷλΠϛϯάͳͲͰɺSharedFlowΛ࢖͏ίʔυͰόά͕ى͖Δ͜ͱ͕ ͋ͬͨɻ

Slide 95

Slide 95 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 25 ● collect{}ͷλΠϛϯάͳͲͰɺSharedFlowΛ࢖͏ίʔυͰόά͕ى͖Δ͜ͱ͕ ͋ͬͨɻ ○ ྫ͑͹ɺreplay=0ͷ৔߹ɺrepeatOnLifecycle(Lifecycle.State.STARTED)ͳ ͲΛ࢖͍ͬͯͯɺΠϕϯτ͕STARTEDҎલʹૹΒΕΔͱফ͑ΔͳͲ

Slide 96

Slide 96 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 25 ● collect{}ͷλΠϛϯάͳͲͰɺSharedFlowΛ࢖͏ίʔυͰόά͕ى͖Δ͜ͱ͕ ͋ͬͨɻ ○ ྫ͑͹ɺreplay=0ͷ৔߹ɺrepeatOnLifecycle(Lifecycle.State.STARTED)ͳ ͲΛ࢖͍ͬͯͯɺΠϕϯτ͕STARTEDҎલʹૹΒΕΔͱফ͑ΔͳͲ ● ·ͨɺςετͩͱFake͕ૣ͘σʔλΛฦ͢ӨڹͰɺࢠͷFragmentͰσʔλΛड ͚औΔલʹSharedFlow͕ൃՐ͢ΔͳͲςετ΋೉͍͠ύλʔϯ͕͋Δ

Slide 97

Slide 97 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 26 RequestStateͱ͍͏ΦϒδΣΫτΛ࡞ΔΑ͏ʹͯ͠ɺ͜ΕΛStateFlowͱ͠ ͯViewModelͰ࣋ͬͯॻ͖׵͑ΔΑ͏ʹͨ͠ɻ࠷ऴతʹ͸buildUiModel()ʹ Αͬͯ͜Ε΋UiModelͷҰͭͷཁૉͱͯ͠ೖΔɻ

Slide 98

Slide 98 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 27 // ViewBinder.apply()ͷத if (alertRequestStates.showPlaybackErrorAlertRequestState.isRequested()) { onShowPlaybackErrorAlert() showSnackbar(message) } // ViewModel val showPlaybackErrorAlertRequestState = MutableStateFlow(RequestState.NotRequested) fun hoge() { try { ... } catch(e: PlaybackError) { showPlaybackErrorAlertRequestState.value = RequestState.Requested(PlaybackErrorAlert) } } fun onShowPlaybackErrorAlert() { showPlaybackErrorAlertRequestState.value = RequestState.NotRequested }

Slide 99

Slide 99 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 27 // ViewBinder.apply()ͷத if (alertRequestStates.showPlaybackErrorAlertRequestState.isRequested()) { onShowPlaybackErrorAlert() showSnackbar(message) } // ViewModel val showPlaybackErrorAlertRequestState = MutableStateFlow(RequestState.NotRequested) fun hoge() { try { ... } catch(e: PlaybackError) { showPlaybackErrorAlertRequestState.value = RequestState.Requested(PlaybackErrorAlert) } } fun onShowPlaybackErrorAlert() { showPlaybackErrorAlertRequestState.value = RequestState.NotRequested } ᶃ StateFlowΛఆٛ

Slide 100

Slide 100 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 27 // ViewBinder.apply()ͷத if (alertRequestStates.showPlaybackErrorAlertRequestState.isRequested()) { onShowPlaybackErrorAlert() showSnackbar(message) } // ViewModel val showPlaybackErrorAlertRequestState = MutableStateFlow(RequestState.NotRequested) fun hoge() { try { ... } catch(e: PlaybackError) { showPlaybackErrorAlertRequestState.value = RequestState.Requested(PlaybackErrorAlert) } } fun onShowPlaybackErrorAlert() { showPlaybackErrorAlertRequestState.value = RequestState.NotRequested } ᶃ StateFlowΛఆٛ ᶄ RequestedΛηοτ

Slide 101

Slide 101 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 27 // ViewBinder.apply()ͷத if (alertRequestStates.showPlaybackErrorAlertRequestState.isRequested()) { onShowPlaybackErrorAlert() showSnackbar(message) } // ViewModel val showPlaybackErrorAlertRequestState = MutableStateFlow(RequestState.NotRequested) fun hoge() { try { ... } catch(e: PlaybackError) { showPlaybackErrorAlertRequestState.value = RequestState.Requested(PlaybackErrorAlert) } } fun onShowPlaybackErrorAlert() { showPlaybackErrorAlertRequestState.value = RequestState.NotRequested } ᶃ StateFlowΛఆٛ ᶄ RequestedΛηοτ ᶅ Requestedʹͳͬͨ΋ͷΛ ফඅ͢Δ

Slide 102

Slide 102 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 27 // ViewBinder.apply()ͷத if (alertRequestStates.showPlaybackErrorAlertRequestState.isRequested()) { onShowPlaybackErrorAlert() showSnackbar(message) } // ViewModel val showPlaybackErrorAlertRequestState = MutableStateFlow(RequestState.NotRequested) fun hoge() { try { ... } catch(e: PlaybackError) { showPlaybackErrorAlertRequestState.value = RequestState.Requested(PlaybackErrorAlert) } } fun onShowPlaybackErrorAlert() { showPlaybackErrorAlertRequestState.value = RequestState.NotRequested } ᶃ StateFlowΛఆٛ ᶄ RequestedΛηοτ ᶅ Requestedʹͳͬͨ΋ͷΛ ফඅ͢Δ ᶆ NotRequestedʹ໭͢

Slide 103

Slide 103 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28

Slide 104

Slide 104 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28 ● τϨʔυΦϑ

Slide 105

Slide 105 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28 ● τϨʔυΦϑ ○ ίʔυ͕૿͑Δมߋɻ

Slide 106

Slide 106 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28 ● τϨʔυΦϑ ○ ίʔυ͕૿͑Δมߋɻ ■ ϘΠϥʔϓϨʔτͬΆ͍ײ͡͸͋ΔͷͰɺͲͷStateΛม͍͑ͯΔ͔ͳͲҙਤͨ͠มߋͳͷ͔Ͳ͏͔͸Ϩ Ϗϡʔ͢Δඞཁ͕͋Δɻ

Slide 107

Slide 107 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28 ● τϨʔυΦϑ ○ ίʔυ͕૿͑Δมߋɻ ■ ϘΠϥʔϓϨʔτͬΆ͍ײ͡͸͋ΔͷͰɺͲͷStateΛม͍͑ͯΔ͔ͳͲҙਤͨ͠มߋͳͷ͔Ͳ͏͔͸Ϩ Ϗϡʔ͢Δඞཁ͕͋Δɻ ■ ୅ΘΓʹϓϨΠϠʔͷStateͳͲͰ͸໌֬ʹSingle Source of Truth͕࡞ΒΕͨͨΊɺ໌Β͔ʹ؅ཧ͠΍͘͢ ͳͬͨײ͕͋͡Δɻ

Slide 108

Slide 108 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28 ● τϨʔυΦϑ ○ ίʔυ͕૿͑Δมߋɻ ■ ϘΠϥʔϓϨʔτͬΆ͍ײ͡͸͋ΔͷͰɺͲͷStateΛม͍͑ͯΔ͔ͳͲҙਤͨ͠มߋͳͷ͔Ͳ͏͔͸Ϩ Ϗϡʔ͢Δඞཁ͕͋Δɻ ■ ୅ΘΓʹϓϨΠϠʔͷStateͳͲͰ͸໌֬ʹSingle Source of Truth͕࡞ΒΕͨͨΊɺ໌Β͔ʹ؅ཧ͠΍͘͢ ͳͬͨײ͕͋͡Δɻ ■ ίʔυͷ౷Ұײ͸Ͱ͖ͨɻComposeͷLaunchedEffect()ͳͲʹ΋ޓ׵ੑ͕͋Δ͸ͣɻ

Slide 109

Slide 109 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28 ● τϨʔυΦϑ ○ ίʔυ͕૿͑Δมߋɻ ■ ϘΠϥʔϓϨʔτͬΆ͍ײ͡͸͋ΔͷͰɺͲͷStateΛม͍͑ͯΔ͔ͳͲҙਤͨ͠มߋͳͷ͔Ͳ͏͔͸Ϩ Ϗϡʔ͢Δඞཁ͕͋Δɻ ■ ୅ΘΓʹϓϨΠϠʔͷStateͳͲͰ͸໌֬ʹSingle Source of Truth͕࡞ΒΕͨͨΊɺ໌Β͔ʹ؅ཧ͠΍͘͢ ͳͬͨײ͕͋͡Δɻ ■ ίʔυͷ౷Ұײ͸Ͱ͖ͨɻComposeͷLaunchedEffect()ͳͲʹ΋ޓ׵ੑ͕͋Δ͸ͣɻ ● ୅ସखஈ

Slide 110

Slide 110 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28 ● τϨʔυΦϑ ○ ίʔυ͕૿͑Δมߋɻ ■ ϘΠϥʔϓϨʔτͬΆ͍ײ͡͸͋ΔͷͰɺͲͷStateΛม͍͑ͯΔ͔ͳͲҙਤͨ͠มߋͳͷ͔Ͳ͏͔͸Ϩ Ϗϡʔ͢Δඞཁ͕͋Δɻ ■ ୅ΘΓʹϓϨΠϠʔͷStateͳͲͰ͸໌֬ʹSingle Source of Truth͕࡞ΒΕͨͨΊɺ໌Β͔ʹ؅ཧ͠΍͘͢ ͳͬͨײ͕͋͡Δɻ ■ ίʔυͷ౷Ұײ͸Ͱ͖ͨɻComposeͷLaunchedEffect()ͳͲʹ΋ޓ׵ੑ͕͋Δ͸ͣɻ ● ୅ସखஈ ○ UiModelʹมߋ͢ΔͨΊͷϥϜμΛ౉͢Α͏ͳ΍Γํ΋ࢼͯ͠Έͯ΋ྑ͍͔΋͠Εͳ͍ɻ˞

Slide 111

Slide 111 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍”ΛͲ͏࢖͔ͬͨ 28 ● τϨʔυΦϑ ○ ίʔυ͕૿͑Δมߋɻ ■ ϘΠϥʔϓϨʔτͬΆ͍ײ͡͸͋ΔͷͰɺͲͷStateΛม͍͑ͯΔ͔ͳͲҙਤͨ͠มߋͳͷ͔Ͳ͏͔͸Ϩ Ϗϡʔ͢Δඞཁ͕͋Δɻ ■ ୅ΘΓʹϓϨΠϠʔͷStateͳͲͰ͸໌֬ʹSingle Source of Truth͕࡞ΒΕͨͨΊɺ໌Β͔ʹ؅ཧ͠΍͘͢ ͳͬͨײ͕͋͡Δɻ ■ ίʔυͷ౷Ұײ͸Ͱ͖ͨɻComposeͷLaunchedEffect()ͳͲʹ΋ޓ׵ੑ͕͋Δ͸ͣɻ ● ୅ସखஈ ○ UiModelʹมߋ͢ΔͨΊͷϥϜμΛ౉͢Α͏ͳ΍Γํ΋ࢼͯ͠Έͯ΋ྑ͍͔΋͠Εͳ͍ɻ˞ ※ https://developer.android.com/topic/architecture/ui-layer/events#recyclerview-events

Slide 112

Slide 112 text

AbemaTV, Inc. All Rights Reserved ςετͰ͸Ͱ͖Δ͚ͩ ຊ෺ͷΦϒδΣΫτΛ࢖͏ 29

Slide 113

Slide 113 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ϝϦοτ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 114

Slide 114 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ϝϦοτ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 115

Slide 115 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ○ ຊ෺ͷΦϒδΣΫτ ϝϦοτ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 116

Slide 116 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ○ ຊ෺ͷΦϒδΣΫτ ○ ϥΠϒϥϦ͕ఏڙ͢ΔFake ϝϦοτ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 117

Slide 117 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ○ ຊ෺ͷΦϒδΣΫτ ○ ϥΠϒϥϦ͕ఏڙ͢ΔFake ○ Mock ϝϦοτ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 118

Slide 118 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ○ ຊ෺ͷΦϒδΣΫτ ○ ϥΠϒϥϦ͕ఏڙ͢ΔFake ○ Mock ● (ύϑΥʔϚϯεͳͲͷཁ݅ʹΑΓม ΘΔɻ) ϝϦοτ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 119

Slide 119 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ○ ຊ෺ͷΦϒδΣΫτ ○ ϥΠϒϥϦ͕ఏڙ͢ΔFake ○ Mock ● (ύϑΥʔϚϯεͳͲͷཁ݅ʹΑΓม ΘΔɻ) ϝϦοτ ● ຊ෺ͷΦϒδΣΫτ͸ຊ౰ͷ໰୊ΛΩϟον͢Δ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 120

Slide 120 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ○ ຊ෺ͷΦϒδΣΫτ ○ ϥΠϒϥϦ͕ఏڙ͢ΔFake ○ Mock ● (ύϑΥʔϚϯεͳͲͷཁ݅ʹΑΓม ΘΔɻ) ϝϦοτ ● ຊ෺ͷΦϒδΣΫτ͸ຊ౰ͷ໰୊ΛΩϟον͢Δ ● ಉ͡ΧόϨοδʹରͯ͠ɺগͳ͍ςετίʔυͰྑ͘ͳ Δ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 121

Slide 121 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ○ ຊ෺ͷΦϒδΣΫτ ○ ϥΠϒϥϦ͕ఏڙ͢ΔFake ○ Mock ● (ύϑΥʔϚϯεͳͲͷཁ݅ʹΑΓม ΘΔɻ) ϝϦοτ ● ຊ෺ͷΦϒδΣΫτ͸ຊ౰ͷ໰୊ΛΩϟον͢Δ ● ಉ͡ΧόϨοδʹରͯ͠ɺগͳ͍ςετίʔυͰྑ͘ͳ Δ ● ςετ͕ࣦഊ͢Δͱ͖͸ຊ౰ͷ໰୊Λर͍ͬͯΔՄೳੑ ͕ߴ͘ͳΔ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 122

Slide 122 text

AbemaTV, Inc. All Rights Reserved GoogleͷDIϥΠϒϥϦ Dagger Hiltͷ υΩϡϝϯτͷHilt Testing PhilosophyΑΓ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ 30 ● ҎԼͷॱ൪Ͱ࢖͏ ○ ຊ෺ͷΦϒδΣΫτ ○ ϥΠϒϥϦ͕ఏڙ͢ΔFake ○ Mock ● (ύϑΥʔϚϯεͳͲͷཁ݅ʹΑΓม ΘΔɻ) ϝϦοτ ● ຊ෺ͷΦϒδΣΫτ͸ຊ౰ͷ໰୊ΛΩϟον͢Δ ● ಉ͡ΧόϨοδʹରͯ͠ɺগͳ͍ςετίʔυͰྑ͘ͳ Δ ● ςετ͕ࣦഊ͢Δͱ͖͸ຊ౰ͷ໰୊Λर͍ͬͯΔՄೳੑ ͕ߴ͘ͳΔ ● Ϣʔβʔ͔Βͷ؍఺Ͱςετ͠΍͍͢ https://dagger.dev/hilt/testing-philosophy.html ΑΓ

Slide 123

Slide 123 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 31 ※ʮFIFA ϫʔϧυΧοϓ Χλʔϧ 2022ʯΛશ64ࢼ߹ແྉੜதܧ͢ΔʮABEMAʯ͕αοΧʔͷ ৽͍͠ࢹௌମݧΛଅਐ͢Δ৽ػೳΛൃදɺແྉͷʮݟಀ͠ϑϧϚον഑৴ʯ΍ʮϋΠϥΠτө૾ʯ ͳͲɺ11݄20೔ʢ೔ʣ։ນͱಉ࣌ʹఏڙ։࢝ https://www.cyberagent.co.jp/news/detail/id=28189

Slide 124

Slide 124 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 31 ● ࠓճͷ࣮૷Ͱ͸ը໘ͷঢ়ଶ͚ͩͰ΋ɺ์ૹͷ଴ػɺ์ૹͷ ࢹௌɺ௥͔͚ͬ࠶ੜͷࢹௌɺݟಀ͠഑৴ͷࢹௌ˞͕͋Γɺ ์ૹͷऴྃɺ։࢝ΛखಈͰςετ͢Δʹ͸ࣗ෼Ͱ൪૊Λฤ ੒ͯ͠ɺ์ૹ࣌ؒ·Ͱ଴ͬͨΓɺ์ૹऴྃΛ଴ͬͨΓ͢Δ ඞཁ͕͋Δɻ ※ʮFIFA ϫʔϧυΧοϓ Χλʔϧ 2022ʯΛશ64ࢼ߹ແྉੜதܧ͢ΔʮABEMAʯ͕αοΧʔͷ ৽͍͠ࢹௌମݧΛଅਐ͢Δ৽ػೳΛൃදɺແྉͷʮݟಀ͠ϑϧϚον഑৴ʯ΍ʮϋΠϥΠτө૾ʯ ͳͲɺ11݄20೔ʢ೔ʣ։ນͱಉ࣌ʹఏڙ։࢝ https://www.cyberagent.co.jp/news/detail/id=28189

Slide 125

Slide 125 text

AbemaTV, Inc. All Rights Reserved ΋ͱ΋ͱͷ࣮૷ͷ໰୊఺ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 31 ● ࠓճͷ࣮૷Ͱ͸ը໘ͷঢ়ଶ͚ͩͰ΋ɺ์ૹͷ଴ػɺ์ૹͷ ࢹௌɺ௥͔͚ͬ࠶ੜͷࢹௌɺݟಀ͠഑৴ͷࢹௌ˞͕͋Γɺ ์ૹͷऴྃɺ։࢝ΛखಈͰςετ͢Δʹ͸ࣗ෼Ͱ൪૊Λฤ ੒ͯ͠ɺ์ૹ࣌ؒ·Ͱ଴ͬͨΓɺ์ૹऴྃΛ଴ͬͨΓ͢Δ ඞཁ͕͋Δɻ ● ViewModelɺUseCaseͳͲݸผʹࡉ͔͘ςετΛॻ͍͍ͯ ͯɺ࣮ࡍͷ໰୊ΛΩϟον͠ʹ͘͘ɺࡉ͔͍ϓϩύςΟ͕ ૿͑ΔͳͲͰςετ͕յΕͨΓվमΛೖΕΔࣄ͕ଟ͔ͬ ͨɻ ※ʮFIFA ϫʔϧυΧοϓ Χλʔϧ 2022ʯΛશ64ࢼ߹ແྉੜதܧ͢ΔʮABEMAʯ͕αοΧʔͷ ৽͍͠ࢹௌମݧΛଅਐ͢Δ৽ػೳΛൃදɺແྉͷʮݟಀ͠ϑϧϚον഑৴ʯ΍ʮϋΠϥΠτө૾ʯ ͳͲɺ11݄20೔ʢ೔ʣ։ນͱಉ࣌ʹఏڙ։࢝ https://www.cyberagent.co.jp/news/detail/id=28189

Slide 126

Slide 126 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32

Slide 127

Slide 127 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32 Robolectric + Dagger HiltͰςετΛ࣮૷͢Δ

Slide 128

Slide 128 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32 Robolectric + Dagger HiltͰςετΛ࣮૷͢Δ ● Robolectric

Slide 129

Slide 129 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32 Robolectric + Dagger HiltͰςετΛ࣮૷͢Δ ● Robolectric ○ ͭ·Γ࣮ߦ؀ڥ͸࣮ػͰ͸ͳ͘JVM্Ͱಈ͔͢ςε τɻEspressoͱಉ͡ςετίʔυͰςετΛॻ͚Δɻ

Slide 130

Slide 130 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32 Robolectric + Dagger HiltͰςετΛ࣮૷͢Δ ● Robolectric ○ ͭ·Γ࣮ߦ؀ڥ͸࣮ػͰ͸ͳ͘JVM্Ͱಈ͔͢ςε τɻEspressoͱಉ͡ςετίʔυͰςετΛॻ͚Δɻ ○ UIʹؔͯ͠ຊ෺ͷΦϒδΣΫτͰ͸ͳ͘ͳΔ͕ɺςε τͷ҆ఆੑΛ֬อ͢ΔͨΊ

Slide 131

Slide 131 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32 Robolectric + Dagger HiltͰςετΛ࣮૷͢Δ ● Robolectric ○ ͭ·Γ࣮ߦ؀ڥ͸࣮ػͰ͸ͳ͘JVM্Ͱಈ͔͢ςε τɻEspressoͱಉ͡ςετίʔυͰςετΛॻ͚Δɻ ○ UIʹؔͯ͠ຊ෺ͷΦϒδΣΫτͰ͸ͳ͘ͳΔ͕ɺςε τͷ҆ఆੑΛ֬อ͢ΔͨΊ ● Hilt

Slide 132

Slide 132 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32 Robolectric + Dagger HiltͰςετΛ࣮૷͢Δ ● Robolectric ○ ͭ·Γ࣮ߦ؀ڥ͸࣮ػͰ͸ͳ͘JVM্Ͱಈ͔͢ςε τɻEspressoͱಉ͡ςετίʔυͰςετΛॻ͚Δɻ ○ UIʹؔͯ͠ຊ෺ͷΦϒδΣΫτͰ͸ͳ͘ͳΔ͕ɺςε τͷ҆ఆੑΛ֬อ͢ΔͨΊ ● Hilt ○ ΞϓϦ಺ͰAPI͚ͩFakeʹஔ͖׵͑Λߦ͏

Slide 133

Slide 133 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32 Robolectric + Dagger HiltͰςετΛ࣮૷͢Δ ● Robolectric ○ ͭ·Γ࣮ߦ؀ڥ͸࣮ػͰ͸ͳ͘JVM্Ͱಈ͔͢ςε τɻEspressoͱಉ͡ςετίʔυͰςετΛॻ͚Δɻ ○ UIʹؔͯ͠ຊ෺ͷΦϒδΣΫτͰ͸ͳ͘ͳΔ͕ɺςε τͷ҆ఆੑΛ֬อ͢ΔͨΊ ● Hilt ○ ΞϓϦ಺ͰAPI͚ͩFakeʹஔ͖׵͑Λߦ͏ ■ Dagger HiltͷTestInstallIn()Λ࢖ͬͯAPI͚ͩஔ ͖׵͑Δɻ

Slide 134

Slide 134 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 32 Robolectric + Dagger HiltͰςετΛ࣮૷͢Δ ● Robolectric ○ ͭ·Γ࣮ߦ؀ڥ͸࣮ػͰ͸ͳ͘JVM্Ͱಈ͔͢ςε τɻEspressoͱಉ͡ςετίʔυͰςετΛॻ͚Δɻ ○ UIʹؔͯ͠ຊ෺ͷΦϒδΣΫτͰ͸ͳ͘ͳΔ͕ɺςε τͷ҆ఆੑΛ֬อ͢ΔͨΊ ● Hilt ○ ΞϓϦ಺ͰAPI͚ͩFakeʹஔ͖׵͑Λߦ͏ ■ Dagger HiltͷTestInstallIn()Λ࢖ͬͯAPI͚ͩஔ ͖׵͑Δɻ ■ ͜ΕʹΑΓ΄ͱΜͲͷ࣮૷͕ຊ෺ͷΦϒδΣΫ τͱͳΔ

Slide 135

Slide 135 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 33

Slide 136

Slide 136 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 33 ௚઀View΍APIͷϨεϙϯεͳͲʹґଘ͢Δςε τΛॻ͘ͱมߋʹऑ͘ͳΔͷͰ͸ʁ 
 ྫ͑͹λΠτϧͷViewͷIDॻ͖׵͑ͨΒશ෦ͷς ετॻ͖௚͢ͷʁ

Slide 137

Slide 137 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 33 ௚઀View΍APIͷϨεϙϯεͳͲʹґଘ͢Δςε τΛॻ͘ͱมߋʹऑ͘ͳΔͷͰ͸ʁ 
 ྫ͑͹λΠτϧͷViewͷIDॻ͖׵͑ͨΒશ෦ͷς ετॻ͖௚͢ͷʁ ● → Robot PatternΛ࢖͏ɻ͜Ε͸ςετ ͷ”what”ͱ”how”Λ෼཭͢Δ˞

Slide 138

Slide 138 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 33 ௚઀View΍APIͷϨεϙϯεͳͲʹґଘ͢Δςε τΛॻ͘ͱมߋʹऑ͘ͳΔͷͰ͸ʁ 
 ྫ͑͹λΠτϧͷViewͷIDॻ͖׵͑ͨΒશ෦ͷς ετॻ͖௚͢ͷʁ ● → Robot PatternΛ࢖͏ɻ͜Ε͸ςετ ͷ”what”ͱ”how”Λ෼཭͢Δ˞ ※ https://jakewharton.com/testing-robots/ΑΓ

Slide 139

Slide 139 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 34 @Test fun shouldPlayButtonVisibleWhenFinishingProgram() { robot { setupServer(NotProgramStartedPattern) launchScreen() // ൪૊ऴྃ·Ͱ଴ͭ(TestCoroutineSchedulerΛ͍͡Δ) waitForFinishingProgram() checkPlayButtonVisible() } }

Slide 140

Slide 140 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 34 @Test fun shouldPlayButtonVisibleWhenFinishingProgram() { robot { setupServer(NotProgramStartedPattern) launchScreen() // ൪૊ऴྃ·Ͱ଴ͭ(TestCoroutineSchedulerΛ͍͡Δ) waitForFinishingProgram() checkPlayButtonVisible() } } robot{}Ͱғͬͯɺςετͷ”how”͸ robotʹ΍ͬͯ΋Β͏

Slide 141

Slide 141 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 34 @Test fun shouldPlayButtonVisibleWhenFinishingProgram() { robot { setupServer(NotProgramStartedPattern) launchScreen() // ൪૊ऴྃ·Ͱ଴ͭ(TestCoroutineSchedulerΛ͍͡Δ) waitForFinishingProgram() checkPlayButtonVisible() } } APIηοτΞοϓ͸͋Δ͕ɺ௚઀Ϩε ϙϯεΛࢦఆͨ͠Γ͠ͳ͍ (Robotʹ΍ͬͯ΋Β͏) robot{}Ͱғͬͯɺςετͷ”how”͸ robotʹ΍ͬͯ΋Β͏

Slide 142

Slide 142 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 34 @Test fun shouldPlayButtonVisibleWhenFinishingProgram() { robot { setupServer(NotProgramStartedPattern) launchScreen() // ൪૊ऴྃ·Ͱ଴ͭ(TestCoroutineSchedulerΛ͍͡Δ) waitForFinishingProgram() checkPlayButtonVisible() } } APIηοτΞοϓ͸͋Δ͕ɺ௚઀Ϩε ϙϯεΛࢦఆͨ͠Γ͠ͳ͍ (Robotʹ΍ͬͯ΋Β͏) ViewͷνΣοΫ͸͋Δ͕௚઀IDΛݟͨ Γ͠ͳ͍ (Robotʹ΍ͬͯ΋Β͏) robot{}Ͱғͬͯɺςετͷ”how”͸ robotʹ΍ͬͯ΋Β͏

Slide 143

Slide 143 text

AbemaTV, Inc. All Rights Reserved Robotͷ࣮૷͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 35 @Inject lateinit val robot: Robot @Test fun test() { robot { hoge() } } class Robot { operator fun invoke(block: Robot.() -> Unit) { runTest{ block() } } fun hoge() {...} }

Slide 144

Slide 144 text

AbemaTV, Inc. All Rights Reserved Ͳ͏͔ͨ͠ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 36 @Test fun shouldPlayButtonVisibleWhenFinishingProgram() { robot { setupServer(NotProgramStartedPattern) launchScreen() // ൪૊ऴྃ·Ͱ଴ͭ waitForFinishingProgram() checkPlayButtonVisible() } } ςετͷ 
 ”What = ԿΛ͢Δ͔”ͱ”How = Ͳ͏΍ͬͯ΍Δ͔” Λ෼཭͢Δͷ͕Robot Patternɻ ςετ΋ΞϓϦͱಉ͡Α͏ʹઃܭ͢Δɻ

Slide 145

Slide 145 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37

Slide 146

Slide 146 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ

Slide 147

Slide 147 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ

Slide 148

Slide 148 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ

Slide 149

Slide 149 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ ● → ςετͰ͸ϩάϥΠϒϥϦ͕println()ʹϩάΛग़͢Α͏ʹTest RuleΛ࡞ͬͯͦΕΛ࢖͏

Slide 150

Slide 150 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ ● → ςετͰ͸ϩάϥΠϒϥϦ͕println()ʹϩάΛग़͢Α͏ʹTest RuleΛ࡞ͬͯͦΕΛ࢖͏ ● → ύϑΥʔϚϯε؍఺ͰTimberCompat.d{} ͷΑ͏ͳܗͷؔ਺Λ༻ҙͯ͠ɺຊ൪Ͱ͸ϥϜμ಺Λ࣮ߦ͠ͳ͍͜ͱͰɺ toString()Λຊ൪Ͱ࣮ߦ͠ͳ͍Α͏ʹ͢Δɻ

Slide 151

Slide 151 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ ● → ςετͰ͸ϩάϥΠϒϥϦ͕println()ʹϩάΛग़͢Α͏ʹTest RuleΛ࡞ͬͯͦΕΛ࢖͏ ● → ύϑΥʔϚϯε؍఺ͰTimberCompat.d{} ͷΑ͏ͳܗͷؔ਺Λ༻ҙͯ͠ɺຊ൪Ͱ͸ϥϜμ಺Λ࣮ߦ͠ͳ͍͜ͱͰɺ toString()Λຊ൪Ͱ࣮ߦ͠ͳ͍Α͏ʹ͢Δɻ ○ Robolectricͩͱɺը໘ݟΕͳ͍ͷͰɺ΋͠ςετಈ͍ͯ΋ɺݟ͑ͳ͍ͷͰಈ͍͍ͯΔͷ͔Α͘෼͔Βͳ͍ɻෆ҆ɻ

Slide 152

Slide 152 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ ● → ςετͰ͸ϩάϥΠϒϥϦ͕println()ʹϩάΛग़͢Α͏ʹTest RuleΛ࡞ͬͯͦΕΛ࢖͏ ● → ύϑΥʔϚϯε؍఺ͰTimberCompat.d{} ͷΑ͏ͳܗͷؔ਺Λ༻ҙͯ͠ɺຊ൪Ͱ͸ϥϜμ಺Λ࣮ߦ͠ͳ͍͜ͱͰɺ toString()Λຊ൪Ͱ࣮ߦ͠ͳ͍Α͏ʹ͢Δɻ ○ Robolectricͩͱɺը໘ݟΕͳ͍ͷͰɺ΋͠ςετಈ͍ͯ΋ɺݟ͑ͳ͍ͷͰಈ͍͍ͯΔͷ͔Α͘෼͔Βͳ͍ɻෆ҆ɻ ■ → Roborazziͱ͍͏ՄࢹԽϥΠϒϥϦΛ࠷ۙ࡞ͬͨͷͰ࢖ͬͯݟ͍ͯͩ͘͞

Slide 153

Slide 153 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ ● → ςετͰ͸ϩάϥΠϒϥϦ͕println()ʹϩάΛग़͢Α͏ʹTest RuleΛ࡞ͬͯͦΕΛ࢖͏ ● → ύϑΥʔϚϯε؍఺ͰTimberCompat.d{} ͷΑ͏ͳܗͷؔ਺Λ༻ҙͯ͠ɺຊ൪Ͱ͸ϥϜμ಺Λ࣮ߦ͠ͳ͍͜ͱͰɺ toString()Λຊ൪Ͱ࣮ߦ͠ͳ͍Α͏ʹ͢Δɻ ○ Robolectricͩͱɺը໘ݟΕͳ͍ͷͰɺ΋͠ςετಈ͍ͯ΋ɺݟ͑ͳ͍ͷͰಈ͍͍ͯΔͷ͔Α͘෼͔Βͳ͍ɻෆ҆ɻ ■ → Roborazziͱ͍͏ՄࢹԽϥΠϒϥϦΛ࠷ۙ࡞ͬͨͷͰ࢖ͬͯݟ͍ͯͩ͘͞ ○ Robolectric͸ActivityؒͷҠಈ͸ςετͰ͖ͳ͍ɻ

Slide 154

Slide 154 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ ● → ςετͰ͸ϩάϥΠϒϥϦ͕println()ʹϩάΛग़͢Α͏ʹTest RuleΛ࡞ͬͯͦΕΛ࢖͏ ● → ύϑΥʔϚϯε؍఺ͰTimberCompat.d{} ͷΑ͏ͳܗͷؔ਺Λ༻ҙͯ͠ɺຊ൪Ͱ͸ϥϜμ಺Λ࣮ߦ͠ͳ͍͜ͱͰɺ toString()Λຊ൪Ͱ࣮ߦ͠ͳ͍Α͏ʹ͢Δɻ ○ Robolectricͩͱɺը໘ݟΕͳ͍ͷͰɺ΋͠ςετಈ͍ͯ΋ɺݟ͑ͳ͍ͷͰಈ͍͍ͯΔͷ͔Α͘෼͔Βͳ͍ɻෆ҆ɻ ■ → Roborazziͱ͍͏ՄࢹԽϥΠϒϥϦΛ࠷ۙ࡞ͬͨͷͰ࢖ͬͯݟ͍ͯͩ͘͞ ○ Robolectric͸ActivityؒͷҠಈ͸ςετͰ͖ͳ͍ɻ ■ FragmentͳΒOK

Slide 155

Slide 155 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ ● → ςετͰ͸ϩάϥΠϒϥϦ͕println()ʹϩάΛग़͢Α͏ʹTest RuleΛ࡞ͬͯͦΕΛ࢖͏ ● → ύϑΥʔϚϯε؍఺ͰTimberCompat.d{} ͷΑ͏ͳܗͷؔ਺Λ༻ҙͯ͠ɺຊ൪Ͱ͸ϥϜμ಺Λ࣮ߦ͠ͳ͍͜ͱͰɺ toString()Λຊ൪Ͱ࣮ߦ͠ͳ͍Α͏ʹ͢Δɻ ○ Robolectricͩͱɺը໘ݟΕͳ͍ͷͰɺ΋͠ςετಈ͍ͯ΋ɺݟ͑ͳ͍ͷͰಈ͍͍ͯΔͷ͔Α͘෼͔Βͳ͍ɻෆ҆ɻ ■ → Roborazziͱ͍͏ՄࢹԽϥΠϒϥϦΛ࠷ۙ࡞ͬͨͷͰ࢖ͬͯݟ͍ͯͩ͘͞ ○ Robolectric͸ActivityؒͷҠಈ͸ςετͰ͖ͳ͍ɻ ■ FragmentͳΒOK ● ୅ସखஈ

Slide 156

Slide 156 text

AbemaTV, Inc. All Rights Reserved τϨʔυΦϑ͸ʁ୅ସखஈ͸ʁ “ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏”ΛͲ͏࢖͔ͬͨ 37 ● τϨʔυΦϑ ○ ςετͰ໰୊͕͋Δͱ͖ʹݪҼ͕෼͔Δ·Ͱʹ͕͔͔࣌ؒΔɻ ■ → ׂͱࡉ͔Ίʹϝιουͷݺͼग़͠ͱ͔ͷϩάΛೖΕΔɻ ● → ςετͰ͸ϩάϥΠϒϥϦ͕println()ʹϩάΛग़͢Α͏ʹTest RuleΛ࡞ͬͯͦΕΛ࢖͏ ● → ύϑΥʔϚϯε؍఺ͰTimberCompat.d{} ͷΑ͏ͳܗͷؔ਺Λ༻ҙͯ͠ɺຊ൪Ͱ͸ϥϜμ಺Λ࣮ߦ͠ͳ͍͜ͱͰɺ toString()Λຊ൪Ͱ࣮ߦ͠ͳ͍Α͏ʹ͢Δɻ ○ Robolectricͩͱɺը໘ݟΕͳ͍ͷͰɺ΋͠ςετಈ͍ͯ΋ɺݟ͑ͳ͍ͷͰಈ͍͍ͯΔͷ͔Α͘෼͔Βͳ͍ɻෆ҆ɻ ■ → Roborazziͱ͍͏ՄࢹԽϥΠϒϥϦΛ࠷ۙ࡞ͬͨͷͰ࢖ͬͯݟ͍ͯͩ͘͞ ○ Robolectric͸ActivityؒͷҠಈ͸ςετͰ͖ͳ͍ɻ ■ FragmentͳΒOK ● ୅ସखஈ ○ ࠓճ͸ΞϓϦ಺ΛͳΔ΂͘౷߹ͨ͠ςετΛߦ͍ͬͯͨɻཧ૝తʹ͸E2E΋΍͍ͬͯ͘΂͖Ͱ͸͋Δ͕Ͳ͏͍͔ͯ͘͠ɻ

Slide 157

Slide 157 text

AbemaTV, Inc. All Rights Reserved ·ͱΊ 38

Slide 158

Slide 158 text

AbemaTV, Inc. All Rights Reserved ·ͱΊ 38 ● ҎԼͷݪଇΛར༻ͯ͠վળ͠ɺৼΓฦΓΛ͍͖ͯ͠·ͨ͠ɻ

Slide 159

Slide 159 text

AbemaTV, Inc. All Rights Reserved ·ͱΊ 38 ● ҎԼͷݪଇΛར༻ͯ͠վળ͠ɺৼΓฦΓΛ͍͖ͯ͠·ͨ͠ɻ ○ Single Source of Truth

Slide 160

Slide 160 text

AbemaTV, Inc. All Rights Reserved ·ͱΊ 38 ● ҎԼͷݪଇΛར༻ͯ͠վળ͠ɺৼΓฦΓΛ͍͖ͯ͠·ͨ͠ɻ ○ Single Source of Truth ○ Unidirectional Data Flow

Slide 161

Slide 161 text

AbemaTV, Inc. All Rights Reserved ·ͱΊ 38 ● ҎԼͷݪଇΛར༻ͯ͠վળ͠ɺৼΓฦΓΛ͍͖ͯ͠·ͨ͠ɻ ○ Single Source of Truth ○ Unidirectional Data Flow ○ ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍

Slide 162

Slide 162 text

AbemaTV, Inc. All Rights Reserved ·ͱΊ 38 ● ҎԼͷݪଇΛར༻ͯ͠վળ͠ɺৼΓฦΓΛ͍͖ͯ͠·ͨ͠ɻ ○ Single Source of Truth ○ Unidirectional Data Flow ○ ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍ ○ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏

Slide 163

Slide 163 text

AbemaTV, Inc. All Rights Reserved ·ͱΊ 38 ● ҎԼͷݪଇΛར༻ͯ͠վળ͠ɺৼΓฦΓΛ͍͖ͯ͠·ͨ͠ɻ ○ Single Source of Truth ○ Unidirectional Data Flow ○ ViewModel͔ΒUIʹΠϕϯτΛૹΒͳ͍ ○ ςετͰ͸Ͱ͖Δ͚ͩຊ෺ͷΦϒδΣΫτΛ࢖͏ ● ͜ͷΑ͏ͳ͞·͟·ͳऔΓ૊Έʹ͸ɺਖ਼ղ͸ͳ͍औΓ૊Έͩͱࢥ͍ͬͯΔΜͰ͕͢ɺΞ΢τ ϓοτͯ͠ɺؒҧ͍ͬͯͨΓɺࢹ఺ͱͯ͠ൈ͚͍ͯΔͱ͜ΖͳͲ͕͋Ε͹ɺϑΟʔυόοΫͳ Ͳ͔Βؾ͖ͮΛಘͨΓ͠ͳ͕Βվળ͍͚ͯ͠Δͱ͍͍ͳͱࢥ͍ͬͯ·͢ɻ

Slide 164

Slide 164 text

AbemaTV, Inc. All Rights Reserved Special thanks 39 ● ։ൃɾϨϏϡʔΛҰॹʹͯ͘͠Εͨ ○ @fuji_kinaga ͞Μ ○ ଞABEMA NativeνʔϜͷօ͞Μ

Slide 165

Slide 165 text

AbemaTV, Inc. All Rights Reserved