fossasia / susi_iOS

SUSI AI iOS app http://susi.ai
Apache License 2.0
1.87k stars 139 forks source link

Feat: Feedback by latest timestamp #522

Closed baquer closed 5 years ago

baquer commented 5 years ago

Fixes #520

Changes: show feedback by latest timestamp

Screenshots for the change:

screenshot 2019-02-21 at 3 04 02 am

baquer commented 5 years ago

@chashmeetsingh , @jogendra , please review the PR.

chashmeetsingh commented 5 years ago

Why not do something like this:

var feedbacks: [Feedback]? {
        get {
            return feedbacks?.sorted(by: {$0.timeStamp > $1.timeStamp})
        }
        didSet {
            feedbackDisplayTableView.reloadData()
        }
    }
baquer commented 5 years ago

@jogendra , here is the SS.

screenshot 2019-02-21 at 7 53 51 pm

jogendra commented 5 years ago

@baquer I would suggest you to use method suggested by @chashmeetsingh

baquer commented 5 years ago

@baquer I would suggest you to use method suggested by @chashmeetsingh

@jogendra , i tried with the getter, setter method , which @chashmeetsingh suggested , but , when i put the code in getter , its make a recursive call with this warning "All paths through this function will call itself" and the app is getting terminated by giving this error "EXC_BAD_ACCESS (code=2, address=0x7ffedfda1fb8)"

jogendra commented 5 years ago

@baquer okay! Approving your PR.

chashmeetsingh commented 5 years ago

Oh, ok. But why is reloadData() called before the elements are sorted.

baquer commented 5 years ago

Oh, ok. But why is reloadData() called before the elements are sorted.

@chashmeetsingh , thanks for pointing this , it's my mistake 😁 , will fix this .

chashmeetsingh commented 5 years ago

Please squash your commits.

jogendra commented 5 years ago

I am squashing and merging!