Skip to content

Commit cf0bb64

Browse files
committed
Fix EditTextPlainActivity convertToTextNote id
1 parent 3e16854 commit cf0bb64

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@ abstract class EditActivity(private val type: Type) :
176176
}
177177
}
178178

179-
open suspend fun saveNote(checkAutoSave: Boolean = true) {
179+
open suspend fun saveNote(checkAutoSave: Boolean = true): Long {
180180
updateModel()
181-
notallyModel.saveNote(checkAutoSave)
182-
WidgetProvider.sendBroadcast(application, longArrayOf(notallyModel.id))
181+
return notallyModel.saveNote(checkAutoSave).also {
182+
WidgetProvider.sendBroadcast(application, longArrayOf(it))
183+
}
183184
}
184185

185186
override fun onCreate(savedInstanceState: Bundle?) {

app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditTextPlainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ class EditTextPlainActivity : EditActivity(Type.NOTE) {
226226
private fun convertToTextNote() {
227227
lifecycleScope.launch {
228228
// Save the current note
229-
saveNote(checkAutoSave = false)
229+
val noteId = saveNote(checkAutoSave = false)
230230

231231
// Create a new intent to open the note in EditNoteActivity
232232
val intent = Intent(this@EditTextPlainActivity, EditNoteActivity::class.java)
233-
intent.putExtra(EXTRA_SELECTED_BASE_NOTE, notallyModel.id)
233+
intent.putExtra(EXTRA_SELECTED_BASE_NOTE, noteId)
234234
startActivity(intent)
235235
finish()
236236
}

0 commit comments

Comments
 (0)