Skip to content

Commit

Permalink
creating a new FrameSaveManager on each Service bind call given Frame…
Browse files Browse the repository at this point in the history
…SaveManager is itself a CoorutineScope that gets definitively cancelled when the Service is destroyed
  • Loading branch information
mzorz committed Mar 18, 2020
1 parent 3e1067a commit 509b99b
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class ComposeLoopFrameActivity : AppCompatActivity(), OnStoryFrameSelectorTapped
private var isEditingText: Boolean = false

private lateinit var storyViewModel: StoryViewModel
private lateinit var frameSaveManager: FrameSaveManager
private lateinit var transition: LayoutTransition

private lateinit var frameSaveService: FrameSaveService
Expand All @@ -140,7 +139,10 @@ class ComposeLoopFrameActivity : AppCompatActivity(), OnStoryFrameSelectorTapped
Log.d("ComposeLoopFrame", "onServiceConnected()")
val binder = service as FrameSaveService.FrameSaveServiceBinder
frameSaveService = binder.getService()
frameSaveService.saveStoryFrames(0, frameSaveManager, StoryRepository.getImmutableCurrentStoryFrames())
frameSaveService.saveStoryFrames(0,
FrameSaveManager(photoEditor),
StoryRepository.getImmutableCurrentStoryFrames()
)
saveServiceBound = true
}

Expand Down Expand Up @@ -231,8 +233,6 @@ class ComposeLoopFrameActivity : AppCompatActivity(), OnStoryFrameSelectorTapped
}
})

frameSaveManager = FrameSaveManager(photoEditor)

backgroundSurfaceManager = BackgroundSurfaceManager(
savedInstanceState,
lifecycle,
Expand Down Expand Up @@ -324,7 +324,6 @@ class ComposeLoopFrameActivity : AppCompatActivity(), OnStoryFrameSelectorTapped

override fun onDestroy() {
doUnbindService()
frameSaveManager.onCancel()
EventBus.getDefault().unregister(this)
super.onDestroy()
}
Expand Down

0 comments on commit 509b99b

Please sign in to comment.