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

Refactor details screen #1401

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c18a32e
Refactor details screen - first batch
patrickunterwegs May 8, 2024
4066026
Location done
patrickunterwegs May 14, 2024
279a31e
removed Jtx20009ReleaseInfoDialog.kt obsolete release info dialog
patrickunterwegs May 14, 2024
398d3a5
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs May 15, 2024
b263bfd
Refactored recurring element
patrickunterwegs May 18, 2024
50caffe
comments done
patrickunterwegs May 19, 2024
443f433
summary and description done
patrickunterwegs May 20, 2024
c0c396e
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs May 24, 2024
39260a9
updated comments card
patrickunterwegs May 25, 2024
4088e6a
allways show showAllOptions button and last edited info
patrickunterwegs May 25, 2024
e24d8cc
minor adaption in description field
patrickunterwegs May 26, 2024
4a786c7
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs May 26, 2024
c111d0e
status classification priority done
patrickunterwegs May 26, 2024
25199ef
removed edit mode variable from bottom app bar
patrickunterwegs May 26, 2024
986e3eb
Moved also revert option to menu
patrickunterwegs May 26, 2024
21e0a64
Categories and Resources done (moved to dialog)
patrickunterwegs May 26, 2024
e6a56b9
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs Jun 2, 2024
6d7d31f
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs Jun 5, 2024
1ca9be7
Update .gitignore
patrickunterwegs Jun 5, 2024
50b1f34
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs Jun 8, 2024
86fce17
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs Jun 8, 2024
8fede6d
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs Jun 9, 2024
9aed94b
improved menu
patrickunterwegs Jun 9, 2024
9206eed
Removed more editMode conditions
patrickunterwegs Jun 9, 2024
ca7fadd
edit summary/description/recur when added
patrickunterwegs Jun 14, 2024
efbe239
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs Jun 15, 2024
e94778d
refactored fetching collections to only observe in composable
patrickunterwegs Jun 15, 2024
4982097
refactored long-click to select instead of edit
patrickunterwegs Jun 15, 2024
99bc13d
removed unused variable
patrickunterwegs Jun 16, 2024
ce603b2
fetch count more efficiently
patrickunterwegs Jun 16, 2024
918b5ad
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs Jul 13, 2024
6636409
Attendees done
patrickunterwegs Jul 13, 2024
ded6cab
Refactored dates fields
patrickunterwegs Jul 14, 2024
012ce6b
Refactored status, classification, priority
patrickunterwegs Jul 14, 2024
73acc8f
Put DetailScreenSection Icons into enum
patrickunterwegs Jul 17, 2024
93e7188
Merge branch 'develop' into 1400-feature-refactor-details-screen-merg…
patrickunterwegs Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 71 additions & 9 deletions app/src/main/java/at/techbee/jtx/database/ICalDatabaseDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import at.techbee.jtx.database.properties.COLUMN_ATTACHMENT_ICALOBJECT_ID
import at.techbee.jtx.database.properties.COLUMN_ATTACHMENT_ID
import at.techbee.jtx.database.properties.COLUMN_ATTACHMENT_URI
import at.techbee.jtx.database.properties.COLUMN_ATTENDEE_ICALOBJECT_ID
import at.techbee.jtx.database.properties.COLUMN_ATTENDEE_ID
import at.techbee.jtx.database.properties.COLUMN_CATEGORY_ICALOBJECT_ID
import at.techbee.jtx.database.properties.COLUMN_CATEGORY_TEXT
import at.techbee.jtx.database.properties.COLUMN_COMMENT_ICALOBJECT_ID
Expand Down Expand Up @@ -98,6 +99,14 @@ interface ICalDatabaseDao {
@Query("SELECT DISTINCT $COLUMN_RESOURCE_TEXT FROM $TABLE_NAME_RESOURCE WHERE $COLUMN_RESOURCE_ICALOBJECT_ID IN (SELECT $COLUMN_ID FROM $TABLE_NAME_ICALOBJECT WHERE $COLUMN_DELETED = 0) GROUP BY $COLUMN_RESOURCE_TEXT ORDER BY count(*) DESC, $COLUMN_RESOURCE_TEXT ASC")
fun getAllResourcesAsText(): LiveData<List<String>>

/**
* Retrieve an list of all Attendees as a LiveData-List
* @return a list of [Attendee]
*/
@Query("SELECT * FROM $TABLE_NAME_ATTENDEE WHERE $COLUMN_ATTENDEE_ICALOBJECT_ID IN (SELECT $COLUMN_ID FROM $TABLE_NAME_ICALOBJECT WHERE $COLUMN_DELETED = 0) ORDER BY $COLUMN_ATTENDEE_ID DESC")
fun getAllAttendees(): LiveData<List<Attendee>>


/**
* Retrieve an list of all DISTINCT Colors for ICalObjects as Int in a LiveData object
*/
Expand Down Expand Up @@ -126,17 +135,16 @@ interface ICalDatabaseDao {
*
* @return a list of [Collection] as LiveData<List<ICalCollection>>
*/
@Query("SELECT * FROM $TABLE_NAME_COLLECTION WHERE $COLUMN_COLLECTION_READONLY = 0 AND ($COLUMN_COLLECTION_SUPPORTSVJOURNAL = 1 OR $COLUMN_COLLECTION_SUPPORTSVTODO = 1) ORDER BY $COLUMN_COLLECTION_ACCOUNT_NAME ASC")
fun getAllWriteableCollections(): LiveData<List<ICalCollection>>
@Query("SELECT * FROM $TABLE_NAME_COLLECTION WHERE $COLUMN_COLLECTION_READONLY = 0 AND ($COLUMN_COLLECTION_SUPPORTSVJOURNAL = :supportsVJOURNAL OR $COLUMN_COLLECTION_SUPPORTSVTODO = :supportsVTODO) ORDER BY $COLUMN_COLLECTION_ACCOUNT_NAME ASC")
fun getAllWriteableCollections(supportsVTODO: Boolean, supportsVJOURNAL: Boolean): LiveData<List<ICalCollection>>

/**
* Retrieve an list of all Collections ([Collection]) that have entries for a given module as a LiveData-List
* @param module (Module.name) for which there are existing entries for a collection
* @return a list of [Collection] as LiveData<List<ICalCollection>>
*/
@Transaction
@Query("SELECT $TABLE_NAME_COLLECTION.* FROM $TABLE_NAME_COLLECTION WHERE $TABLE_NAME_COLLECTION.$COLUMN_COLLECTION_ID IN (SELECT $TABLE_NAME_ICALOBJECT.$COLUMN_ICALOBJECT_COLLECTIONID FROM $TABLE_NAME_ICALOBJECT WHERE $COLUMN_MODULE = :module) ORDER BY $COLUMN_COLLECTION_ACCOUNT_NAME ASC")
fun getAllCollections(module: String): LiveData<List<ICalCollection>>
@Query("SELECT * FROM $TABLE_NAME_COLLECTION WHERE $COLUMN_COLLECTION_SUPPORTSVTODO = :supportsVTODO OR $COLUMN_COLLECTION_SUPPORTSVJOURNAL = :supportsVJOURNAL ORDER BY $COLUMN_COLLECTION_ACCOUNT_NAME ASC")
fun getAllCollections(supportsVTODO: Boolean, supportsVJOURNAL: Boolean): LiveData<List<ICalCollection>>


/**
Expand Down Expand Up @@ -233,12 +241,15 @@ interface ICalDatabaseDao {
fun getCount(): Int

/**
* Retrieve the number of items in the table of [ICal4List] for a specific module as Int.
* @param
* Retrieve the number of iCalObjects that are not deleted,
* that don't have an RRULE
* and that are not present in related to (meaning they are not sub-entries)
* for a specific module
* @param [module]
* @return Int with the total number of [ICal4List] in the table for the given module.
*/
@Query("SELECT count(*) FROM $VIEW_NAME_ICAL4LIST WHERE $COLUMN_MODULE = :module AND $VIEW_NAME_ICAL4LIST.isChildOfTodo = 0 AND $VIEW_NAME_ICAL4LIST.isChildOfJournal = 0 AND $VIEW_NAME_ICAL4LIST.isChildOfNote = 0 ")
fun getICal4ListCount(module: String): LiveData<Int?>
@Query("SELECT count(*) FROM $TABLE_NAME_ICALOBJECT WHERE $COLUMN_MODULE = :module AND $COLUMN_RRULE IS NULL AND $COLUMN_DELETED = 0 AND $TABLE_NAME_ICALOBJECT.$COLUMN_ID NOT IN (SELECT $TABLE_NAME_RELATEDTO.$COLUMN_RELATEDTO_ICALOBJECT_ID FROM $TABLE_NAME_RELATEDTO)")
fun getCount4List(module: String): LiveData<Int?>

/**
* Retrieve an [ICalObject] by Id as LiveData
Expand Down Expand Up @@ -1554,6 +1565,57 @@ iCalObject.percent != 100
}
}


@Transaction
suspend fun updateCategories(iCalObjectId: Long, uid: String, categories: List<Category>) {

deleteCategories(iCalObjectId)
categories.forEach { it.icalObjectId = iCalObjectId }
upsertCategories(categories)
updateSetDirty(iCalObjectId)
makeSeriesDirty(uid)
}

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun upsertCategories(categories: List<Category>)


@Transaction
suspend fun updateResources(iCalObjectId: Long, uid: String, resources: List<Resource>) {
deleteResources(iCalObjectId)
resources.forEach { it.icalObjectId = iCalObjectId }
upsertResources(resources)
updateSetDirty(iCalObjectId)
makeSeriesDirty(uid)
}

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun upsertResources(resources: List<Resource>)

@Transaction
suspend fun updateAttendees(iCalObjectId: Long, uid: String, attendees: List<Attendee>) {
deleteAttendees(iCalObjectId)
attendees.forEach { it.icalObjectId = iCalObjectId }
upsertAttendees(attendees)
updateSetDirty(iCalObjectId)
makeSeriesDirty(uid)
}

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun upsertAttendees(attendees: List<Attendee>)

/*
@Transaction
suspend fun updateDates(iCalObjectId: Long, uid: String, dtstart: Long?, dtstartTimezone: String?, due: Long?, dueTimezone: String?, completed: Long?, completedTimezone: String?) {
setDates(iCalObjectId, dtstart, dtstartTimezone, due, dueTimezone, completed, completedTimezone)
updateSetDirty(iCalObjectId)
makeSeriesDirty(uid)
}

@Query("UPDATE $TABLE_NAME_ICALOBJECT SET $COLUMN_DTSTART = :dtstart, $COLUMN_DTSTART_TIMEZONE = :dtstartTimezone, $COLUMN_DUE = :due, $COLUMN_DUE_TIMEZONE = :dueTimezone, $COLUMN_COMPLETED = :completed, $COLUMN_COMPLETED_TIMEZONE = :completedTimezone WHERE $COLUMN_ID = :iCalObjectId")
suspend fun setDates(iCalObjectId: Long, dtstart: Long?, dtstartTimezone: String?, due: Long?, dueTimezone: String?, completed: Long?, completedTimezone: String?)
*/

@Transaction
suspend fun saveAll(
icalObject: ICalObject,
Expand Down
Loading
Loading