-
Notifications
You must be signed in to change notification settings - Fork 28
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
Support for collections in trash #1013
base: master
Are you sure you want to change the base?
Conversation
8651af8
to
3d969f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When tapping an item w/ an attachment in trash it doesn't open it.
There some other minor omissions and comments for discussion.
3d969f2
to
561a6b3
Compare
Co-authored-by: Miltiadis Vasilakis <mvasilak@gmail.com>
Co-authored-by: Miltiadis Vasilakis <mvasilak@gmail.com>
3f44a87
to
a32a8ce
Compare
@@ -61,6 +61,7 @@ struct StoreCollectionsDbRequest: DbRequest { | |||
collection.trash = response.data.isTrash | |||
collection.trashDate = collection.trash ? Date.now : nil | |||
} | |||
collection.updateSortName() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to check for collection.name != response.data.name
and only then update sort name, similar to EditCollectionDbRequest
? May need to do so only for existing collections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems not used anymore, it can be removed.
} | ||
} | ||
|
||
func compare<Val>(lValue: Val?, rValue: Val?, nonNilCompare: (Val, Val) -> ComparisonResult) -> ComparisonResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be more clear to use the already available constants for nil
alternatives. E.g. for Int
, since we want to put nil
values in the end of an ascending order, we may use instead:
func compare(lValue: Int?, rValue: Int?) -> ComparisonResult {
let safeLValue = lValue ?? .max
let safeRValue = rValue ?? .max
if safeLValue == safeRValue {
return .orderedSame
}
return safeLValue < safeRValue ? .orderedAscending : .orderedDescending
}
Similarly for Date
we can use .distantFuture
.
If these comparisons are to be reused throughout the app, we may even consider extending their types accodingly.
} | ||
} | ||
} | ||
if let collections, collectionsIdx < collections.count { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified to:
if let collections, collectionsIdx < collections.count { | |
if let collections { |
collectionsIdx += 1 | ||
} | ||
} | ||
if let items, itemsIdx < items.count { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here:
if let items, itemsIdx < items.count { | |
if let items { |
No description provided.