Skip to content

Commit

Permalink
moved FrameSaveManager creation to Service
Browse files Browse the repository at this point in the history
  • Loading branch information
mzorz committed Mar 18, 2020
1 parent 6b4dcbd commit 51ae33c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import com.automattic.portkey.BuildConfig
import com.automattic.portkey.R
import com.automattic.portkey.compose.emoji.EmojiPickerFragment
import com.automattic.portkey.compose.emoji.EmojiPickerFragment.EmojiListener
import com.automattic.portkey.compose.frame.FrameSaveManager
import com.automattic.portkey.compose.frame.FrameSaveService
import com.automattic.portkey.compose.frame.FrameSaveService.StorySaveResult
import com.automattic.portkey.compose.photopicker.MediaBrowserType
Expand Down Expand Up @@ -136,10 +135,7 @@ class ComposeLoopFrameActivity : AppCompatActivity(), OnStoryFrameSelectorTapped
Log.d("ComposeLoopFrame", "onServiceConnected()")
val binder = service as FrameSaveService.FrameSaveServiceBinder
frameSaveService = binder.getService()
frameSaveService.saveStoryFrames(0,
FrameSaveManager(photoEditor),
StoryRepository.getImmutableCurrentStoryFrames()
)
frameSaveService.saveStoryFrames(0, photoEditor, StoryRepository.getImmutableCurrentStoryFrames())
saveServiceBound = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.os.Build
import android.os.IBinder
import android.util.Log
import android.webkit.MimeTypeMap
import com.automattic.photoeditor.PhotoEditor
import com.automattic.portkey.compose.story.StoryFrameItem
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -51,9 +52,9 @@ class FrameSaveService : Service() {
return START_NOT_STICKY
}

fun saveStoryFrames(storyIndex: Int, frameSaveManager: FrameSaveManager, frames: List<StoryFrameItem>) {
fun saveStoryFrames(storyIndex: Int, photoEditor: PhotoEditor, frames: List<StoryFrameItem>) {
this.storyIndex = storyIndex
this.frameSaveManager = frameSaveManager
this.frameSaveManager = FrameSaveManager(photoEditor)
CoroutineScope(Dispatchers.Default).launch {
saveStoryFramesAndDispatchNewFileBroadcast(frameSaveManager, frames)
stopSelf()
Expand Down

0 comments on commit 51ae33c

Please sign in to comment.