-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from leandroBorgesFerreira/SavingLineEditionCo…
…rrectly Saving line edition correctly
- Loading branch information
Showing
7 changed files
with
135 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...sferreira/storyteller/manager/SaveNote.kt → ...ira/storyteller/manager/DocumentUpdate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package com.github.leandroborgesferreira.storyteller.manager | ||
|
||
import com.github.leandroborgesferreira.storyteller.model.document.Document | ||
import com.github.leandroborgesferreira.storyteller.model.story.StoryStep | ||
|
||
interface SaveNote { | ||
interface DocumentUpdate { | ||
suspend fun saveDocument(document: Document) | ||
|
||
suspend fun saveStoryStep(storyStep: StoryStep, position: Int, documentId: String) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...teller/src/main/java/com/github/leandroborgesferreira/storyteller/model/story/LastEdit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.github.leandroborgesferreira.storyteller.model.story | ||
|
||
import com.github.leandroborgesferreira.storyteller.model.document.Document | ||
|
||
/** | ||
* Last edition. This signs how the last edition in the [Document] was made and it allows the SDK | ||
* to react properly, for example saving just one line of change instead saving the whole document. | ||
*/ | ||
sealed class LastEdit { | ||
/** | ||
* No edition was make | ||
*/ | ||
object Nothing: LastEdit() | ||
|
||
/** | ||
* A whole edition was made like a line break (adding a new line) , a deletion | ||
* o a image upload between content. | ||
* In this case the whole document should be saved. | ||
* It is important to notice that when new content is added between content this will change all | ||
* the values of the positions, so it is necessary to save the whole document again. | ||
*/ | ||
object Whole: LastEdit() | ||
|
||
/** | ||
* A edition in the line was made, but the positions were not affected. In this case it is | ||
* possible to update just one line. | ||
*/ | ||
data class LineEdition(val position: Int, val storyStep: StoryStep): LastEdit() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters