diff --git a/app/src/main/java/com/codingwithmitch/cleannotes/business/domain/state/DataChannelManager.kt b/app/src/main/java/com/codingwithmitch/cleannotes/business/domain/state/DataChannelManager.kt index 53057b90..a48b8196 100644 --- a/app/src/main/java/com/codingwithmitch/cleannotes/business/domain/state/DataChannelManager.kt +++ b/app/src/main/java/com/codingwithmitch/cleannotes/business/domain/state/DataChannelManager.kt @@ -47,7 +47,6 @@ abstract class DataChannelManager { } } .launchIn(getChannelScope()) - } } diff --git a/app/src/main/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncDeletedNotes.kt b/app/src/main/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncDeletedNotes.kt index eaceb3c1..461dbe82 100644 --- a/app/src/main/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncDeletedNotes.kt +++ b/app/src/main/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncDeletedNotes.kt @@ -31,6 +31,7 @@ class SyncDeletedNotes( stateEvent = null ){ override suspend fun handleSuccess(resultObj: List): DataState>? { + printLogD("syncDeletedNotes", "deleted notes: ${resultObj.size}") return DataState.data( response = null, data = resultObj, @@ -40,6 +41,7 @@ class SyncDeletedNotes( } val notes = response.getResult()?.data?: ArrayList() + printLogD("syncDeletedNotes", "notes: ${notes.size}") val cacheResult = safeCacheCall(IO){ noteCacheDataSource.deleteNotes(notes) @@ -50,7 +52,7 @@ class SyncDeletedNotes( stateEvent = null ){ override suspend fun handleSuccess(resultObj: Int): DataState? { - printLogD("SyncNotes", + printLogD("syncDeletedNotes", "num deleted notes: ${resultObj}") return DataState.data( response = null, diff --git a/app/src/main/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncNotes.kt b/app/src/main/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncNotes.kt index 57e4086e..6438b0e8 100644 --- a/app/src/main/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncNotes.kt +++ b/app/src/main/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncNotes.kt @@ -10,6 +10,7 @@ import com.codingwithmitch.cleannotes.business.domain.util.DateUtil import com.codingwithmitch.cleannotes.business.data.util.safeApiCall import com.codingwithmitch.cleannotes.business.data.util.safeCacheCall import com.codingwithmitch.cleannotes.util.printLogD +import com.google.firebase.Timestamp import kotlinx.coroutines.* import kotlinx.coroutines.Dispatchers.IO @@ -110,8 +111,8 @@ class SyncNotes( cachedNote: Note, networkNote: Note ){ - val cacheUpdatedAt = cachedNote.updated_at - val networkUpdatedAt = networkNote.updated_at + val cacheUpdatedAt = dateUtil.convertStringDateToFirebaseTimestamp(cachedNote.updated_at) + val networkUpdatedAt = dateUtil.convertStringDateToFirebaseTimestamp(networkNote.updated_at) // update cache (network has newest data) if(networkUpdatedAt > cacheUpdatedAt){ diff --git a/app/src/main/java/com/codingwithmitch/cleannotes/framework/presentation/MainActivity.kt b/app/src/main/java/com/codingwithmitch/cleannotes/framework/presentation/MainActivity.kt index 6fcfecf8..afbd5e10 100644 --- a/app/src/main/java/com/codingwithmitch/cleannotes/framework/presentation/MainActivity.kt +++ b/app/src/main/java/com/codingwithmitch/cleannotes/framework/presentation/MainActivity.kt @@ -23,8 +23,7 @@ import com.codingwithmitch.cleannotes.util.TodoCallback import com.google.android.material.snackbar.BaseTransientBottomBar import com.google.android.material.snackbar.Snackbar import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.* import javax.inject.Inject diff --git a/app/src/test/java/com/codingwithmitch/cleannotes/business/interactors/notedetail/UpdateNoteTest.kt b/app/src/test/java/com/codingwithmitch/cleannotes/business/interactors/notedetail/UpdateNoteTest.kt index 76e3ec87..0ec945cd 100644 --- a/app/src/test/java/com/codingwithmitch/cleannotes/business/interactors/notedetail/UpdateNoteTest.kt +++ b/app/src/test/java/com/codingwithmitch/cleannotes/business/interactors/notedetail/UpdateNoteTest.kt @@ -69,10 +69,12 @@ class UpdateNoteTest { val randomNote = noteCacheDataSource.searchNotes("", "", 1) .get(0) - val updatedNote = noteFactory.createSingleNote( + val updatedNote = Note( id = randomNote.id, title = UUID.randomUUID().toString(), - body = UUID.randomUUID().toString() + body = UUID.randomUUID().toString(), + updated_at = dependencyContainer.dateUtil.getCurrentTimestamp(), + created_at = randomNote.created_at ) updateNote.updateNote( note = updatedNote, diff --git a/app/src/test/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncDeletedNotesTest.kt b/app/src/test/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncDeletedNotesTest.kt index a663933c..ffe84b7d 100644 --- a/app/src/test/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncDeletedNotesTest.kt +++ b/app/src/test/java/com/codingwithmitch/cleannotes/business/interactors/splash/SyncDeletedNotesTest.kt @@ -55,7 +55,8 @@ class SyncDeletedNotesTest { val notesToDelete: ArrayList = ArrayList() for(note in networkNotes){ notesToDelete.add(note) - noteNetworkDataSource.deleteNote(note.id) + noteNetworkDataSource.deleteNote(note.id) // delete from notes node + noteNetworkDataSource.insertDeletedNote(note) // insert into deletes node if(notesToDelete.size > 3){ break } diff --git a/app/src/test/java/com/codingwithmitch/cleannotes/di/DependencyContainer.kt b/app/src/test/java/com/codingwithmitch/cleannotes/di/DependencyContainer.kt index 46fade74..283ca549 100644 --- a/app/src/test/java/com/codingwithmitch/cleannotes/di/DependencyContainer.kt +++ b/app/src/test/java/com/codingwithmitch/cleannotes/di/DependencyContainer.kt @@ -39,14 +39,19 @@ class DependencyContainer { noteDataFactory.produceListOfNotes() ) } + val noteList = noteDataFactory.produceListOfNotes() noteFactory = NoteFactory(dateUtil) noteNetworkDataSource = FakeNoteNetworkDataSourceImpl( - notesData = notesData, + notesData = noteDataFactory.produceHashMapOfNotes( + noteList + ), deletedNotesData = HashMap(), dateUtil = dateUtil ) noteCacheDataSource = FakeNoteCacheDataSourceImpl( - notesData = notesData, + notesData = noteDataFactory.produceHashMapOfNotes( + noteList + ), dateUtil = dateUtil ) } diff --git a/buildSrc/build/libs/buildSrc.jar b/buildSrc/build/libs/buildSrc.jar index 6088cfc5..19cac0da 100644 Binary files a/buildSrc/build/libs/buildSrc.jar and b/buildSrc/build/libs/buildSrc.jar differ diff --git a/tests/firestore-debug.log b/tests/firestore-debug.log index b9e2388f..cbf5c43d 100644 --- a/tests/firestore-debug.log +++ b/tests/firestore-debug.log @@ -5,3 +5,47 @@ If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment Dev App Server is now running. +Jun 16, 2020 9:34:21 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead +INFO: Detected HTTP/2 connection. +Jun 16, 2020 9:34:21 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:21 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:22 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:22 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:22 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:23 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:23 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:23 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:23 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:25 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:25 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:25 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:25 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:45 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:45 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:46 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:46 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:46 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:46 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:48 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE +Jun 16, 2020 9:34:48 AM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt +WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE