Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#11: Re-implementation of version tracking #13

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

@shubertm shubertm temporarily deployed to Development February 27, 2023 13:15 — with GitHub Actions Inactive
@shubertm shubertm temporarily deployed to Development February 28, 2023 15:38 — with GitHub Actions Inactive
@kirillt kirillt changed the title Re-implementation of version tracking #11: Re-implementation of version tracking May 27, 2023
@kirillt
Copy link
Member

kirillt commented Sep 7, 2023

@kirillt kirillt temporarily deployed to Development September 13, 2023 15:30 — with GitHub Actions Inactive
@kirillt
Copy link
Member

kirillt commented Sep 13, 2023

I'm getting this crash right now:

Caused by: kotlin.UninitializedPropertyAccessException: lateinit property instance has not been initialized
	at space.taran.arkfilepicker.folders.FoldersRepo$Companion.getInstance(FoldersRepo.kt:249)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerViewModel.<init>(ArkFilePickerViewModel.kt:46)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerViewModelFactory.create(ArkFilePickerViewModel.kt:150)
	at androidx.lifecycle.ViewModelProvider$Factory.create(ViewModelProvider.kt:83)
	at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:187)
	at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:153)
	at androidx.lifecycle.ViewModelLazy.getValue(ViewModelLazy.kt:53)
	at androidx.lifecycle.ViewModelLazy.getValue(ViewModelLazy.kt:35)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerFragment.getViewModel(ArkFilePickerFragment.kt:74)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerFragment.getPages(ArkFilePickerFragment.kt:287)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerFragment.initUI(ArkFilePickerFragment.kt:126)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerFragment.onViewCreated(ArkFilePickerFragment.kt:89)
	at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3128)
	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:552)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1899)
	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1823)
	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1760)
	at androidx.fragment.app.FragmentController.execPendingActions(FragmentController.java:495)
	at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:312)
	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1488)
	at android.app.Activity.performResume(Activity.java:8197)
	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4814)
	... 13 more

@kirillt kirillt mentioned this pull request Sep 14, 2023
@shubertm
Copy link
Member Author

I'm getting this crash right now:

Caused by: kotlin.UninitializedPropertyAccessException: lateinit property instance has not been initialized
	at space.taran.arkfilepicker.folders.FoldersRepo$Companion.getInstance(FoldersRepo.kt:249)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerViewModel.<init>(ArkFilePickerViewModel.kt:46)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerViewModelFactory.create(ArkFilePickerViewModel.kt:150)
	at androidx.lifecycle.ViewModelProvider$Factory.create(ViewModelProvider.kt:83)
	at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:187)
	at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:153)
	at androidx.lifecycle.ViewModelLazy.getValue(ViewModelLazy.kt:53)
	at androidx.lifecycle.ViewModelLazy.getValue(ViewModelLazy.kt:35)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerFragment.getViewModel(ArkFilePickerFragment.kt:74)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerFragment.getPages(ArkFilePickerFragment.kt:287)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerFragment.initUI(ArkFilePickerFragment.kt:126)
	at space.taran.arkfilepicker.presentation.filepicker.ArkFilePickerFragment.onViewCreated(ArkFilePickerFragment.kt:89)
	at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3128)
	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:552)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1899)
	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1823)
	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1760)
	at androidx.fragment.app.FragmentController.execPendingActions(FragmentController.java:495)
	at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:312)
	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1488)
	at android.app.Activity.performResume(Activity.java:8197)
	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4814)
	... 13 more

This crash happens because filepicker changed, we have to initialise FoldersRepo during app creation.

@shubertm shubertm temporarily deployed to Development September 21, 2023 20:26 — with GitHub Actions Inactive
@shubertm shubertm temporarily deployed to Development September 27, 2023 11:26 — with GitHub Actions Inactive
@shubertm shubertm temporarily deployed to Development September 29, 2023 13:16 — with GitHub Actions Inactive
@kirillt
Copy link
Member

kirillt commented Oct 6, 2023

We should merge #18 first.

@kirillt
Copy link
Member

kirillt commented Nov 18, 2023

@ShubertMunthali we need to resolve conflicts before merging.

# Conflicts:
#	app/build.gradle
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/dev/arkbuilders/arkmemo/App.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/files/FilePicker.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/files/parsers/JsonParser.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/models/TextNote.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/activities/MainActivity.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/adapters/TextNotesListAdapter.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/dialogs/NoteDeleteDialogFragment.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/EditTextNotesFragment.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/SettingsFragment.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/TextNoteVersionsFragment.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/views/PathPreference.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/utils/ArkFiles.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/utils/Config.kt
#	app/src/main/java/space/taran/arkmemo/data/repo/notes/text/TextNotesRepo.kt
#	app/src/main/java/space/taran/arkmemo/data/viewmodels/EditTextNotesViewModel.kt
#	app/src/main/java/space/taran/arkmemo/data/viewmodels/TextNotesViewModel.kt
#	app/src/main/java/space/taran/arkmemo/preferences/MemoPreferences.kt
#	app/src/main/res/values/strings.xml
#	app/src/test/java/dev/arkbuilders/arkmemo/VersionStorageTest.kt
#	build.gradle
#	gradle/wrapper/gradle-wrapper.properties
#	settings.gradle
@kirillt
Copy link
Member

kirillt commented Dec 14, 2023

@ShubertMunthali sorry, we need update it again

@shubertm
Copy link
Member Author

@ShubertMunthali we need to resolve conflicts before merging.

Cool, I will resolve them

@shubertm
Copy link
Member Author

@ShubertMunthali sorry, we need update it again

Yes, I will update it

@kirillt
Copy link
Member

kirillt commented Dec 21, 2023

It works! I've checked both text notes and graphic notes. Versions are displayed correctly and forking functions correctly, too. This is really cool.

We have new reusable storage primitives in arklib-android, let's use them to reduce amount of code. See FileStorage arklib-android.

I think, it's possible to implement VersionStorage similarly to ScoreStorage. Scores storage is id-to-integer mapping, and versions storage is id-to-id. The code will be very similar to the scores storage.

Also, we should find another icon for forking feature, I'll ask our UX team.

@shubertm
Copy link
Member Author

You are right @kirillt
I think it will be efficient to just extract VeraionStorage to arklib-android now
I see that we may need it in Retouch soon

@kirillt
Copy link
Member

kirillt commented Dec 24, 2023

@ShubertMunthali it's OK to keep VersionStorage in this repo for the moment. More important is to derive it from ready-made base classes.

But yes, we'll move it eventually to arklib-android.

@shubertm
Copy link
Member Author

Alright @kirillt, so let's make important storage API from arklib-android public, I think we can make it internal after all storages are moved there

@kirillt
Copy link
Member

kirillt commented Dec 25, 2023

@ShubertMunthali yes, if our ready-made primitives can't be used to implement custom storages — this should be fixed. Because it would be great if 3rd party developers could write their own storages for their apps.

It's possible to compile arklib-android and inject the local version into the app. It would be easier for experimentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants