Skip to content

[NMA-806] Merchants search results - #775

Merged
HashEngineering merged 24 commits into
explore-dashfrom
merchants-search-results
Oct 6, 2021
Merged

HashEngineering merged 24 commits into
explore-dashfrom
merchants-search-results

Conversation

@Syn-McJ

@Syn-McJ Syn-McJ commented Oct 5, 2021

Copy link
Copy Markdown
Member

Search results and filters for merchants in the Explore Dash feature.

Issue being fixed or feature implemented

  • Added tables to the local SQLite database for Merchants and for Full-Text Search over merchants
  • Added migration to the new DB schema and an integration test for it
  • Implemented simple sync of Firebase database with local SQLite
  • Implemented UI and functionality for search and filtering by territory and type of merchant
  • Updated Kotlin version to remove some issues with Flows
  • Added some unit tests for the ExploreViewModel
  • Fixed unit testing in github workflows (running unit tests with flavor doesn't seem to work)

Related PR's and Dependencies

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

@Syn-McJ Syn-McJ self-assigned this Oct 5, 2021
Comment on lines -19 to -20
<!-- <item name="elevation">0dp</item>-->
<!-- <item name="android:windowTranslucentStatus">true</item>-->

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this be used later?

@Syn-McJ Syn-McJ Oct 6, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not, so I removed it. According to the design we have a shadow under appbar but not when the results panel is fully expanded. I'm not sure this will be easy to do, probably better to just leave the shadow always on, we'll see.

import org.mockito.Mockito.mock


class ExploreViewModelTest {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of adding tests.

@HashEngineering HashEngineering left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source files are missing a license/copyright header at the top of the files. This can be added later.

import org.dash.wallet.features.exploredash.data.model.MerchantFTS

@Dao
interface MerchantDao {

@ClaudeHangui ClaudeHangui Oct 6, 2021 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to have the suspend modifier here in your Dao. From the MerchantRepository it appears the calls to these functions are also done in suspending functions; I believe it's a little bit redundant. I think it would have made sense to have this modifier here in the Dao if the functions in the repository were not suspending. In this case, we would have made the calls to these DAO functions in a dispatcher (an IO to be precise); as it is the case in our viewmodels.
Removing the suspending modifier here and leaving the repository as it is should just work fine

@Syn-McJ Syn-McJ Oct 6, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't quite get it, MerchantRepository is for interacting with Firebase database, what does dao has to do with it?
Suspend functions in Dao exist so that you can call them from any context (including Main) and they don't block, because Room runs them in IO internally.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I get what's the reason for this confusion. Let's discuss this in slack.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry got confused: I saw a repository implementation (FirebaseMerchantTable) and I now understand it's for firebase and not for local DB

}

@Entity(tableName = "merchant")
data class Merchant(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the variable name is the same as the property name, there's no need to specify it again

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not, it's lowercase.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad didn't notice it


package org.dash.wallet.features.exploredash.di

import dagger.Binds

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps in the future, for consistency, we could agree on naming the implementation of our interfaces directly from the name of the implemented interface. i.e something like this: MerchantRepositoryInt -> MerchantRepositoryImpl

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of InterfaceImpl convention as it's not informative. MerchantRepository interface describes methods for retrieving merchants, but the specific implementations can use Firebase, can do REST requests, or use local SQLite db, therefore implementing class has to describe this in its name and not just repeat interface name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot that there are 3 data sources here

@ClaudeHangui

Copy link
Copy Markdown
Contributor

@HashEngineering I'm good with the review as well

@HashEngineering
HashEngineering merged commit d029df4 into explore-dash Oct 6, 2021
@Syn-McJ
Syn-McJ deleted the merchants-search-results branch October 14, 2021 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants