File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
app/src/main/java/com/philkes/notallyx/presentation/activity/note Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff 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 ? ) {
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments