-
Notifications
You must be signed in to change notification settings - Fork 180
feat: set firebase events for merchant details #925
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
Merged
HashEngineering
merged 5 commits into
master
from
feature-explore-dash-firebase-merchant-details
Mar 31, 2022
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f44d523
track firebase events on explore dash related to merchant details flow
ClaudeHangui 9fb2d7c
rename merchant details event
ClaudeHangui ce1505f
rename function to track merchant details event
ClaudeHangui 04b6abd
- set function to handle event tracking
ClaudeHangui 6036b85
refactor tracking event of click on merchant/atm
ClaudeHangui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,10 +41,14 @@ import java.util.* | |
| class ItemDetails(context: Context, attrs: AttributeSet): LinearLayout(context, attrs) { | ||
| private val binding = ItemDetailsViewBinding.inflate(LayoutInflater.from(context), this) | ||
|
|
||
| private var onSendDashClicked: (() -> Unit)? = null | ||
| private var onSendDashClicked: ((isPayingWithDash: Boolean) -> Unit)? = null | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are required to track only when the |
||
| private var onReceiveDashClicked: (() -> Unit)? = null | ||
| private var onShowAllLocationsClicked: (() -> Unit)? = null | ||
| private var onBackButtonClicked: (() -> Unit)? = null | ||
| private var onNavigationButtonClicked: (() -> Unit)? = null | ||
| private var onDialPhoneButtonClicked: (() -> Unit)? = null | ||
| private var onOpenWebsiteButtonClicked: (() -> Unit)? = null | ||
| private var onBuyGiftCardButtonClicked: (() -> Unit)? = null | ||
|
|
||
| init { | ||
| orientation = VERTICAL | ||
|
|
@@ -60,7 +64,7 @@ class ItemDetails(context: Context, attrs: AttributeSet): LinearLayout(context, | |
| } | ||
| } | ||
|
|
||
| fun setOnSendDashClicked(listener: () -> Unit) { | ||
| fun setOnSendDashClicked(listener: (Boolean) -> Unit) { | ||
| onSendDashClicked = listener | ||
| } | ||
|
|
||
|
|
@@ -76,6 +80,22 @@ class ItemDetails(context: Context, attrs: AttributeSet): LinearLayout(context, | |
| onBackButtonClicked = listener | ||
| } | ||
|
|
||
| fun setOnNavigationButtonClicked(listener: () -> Unit) { | ||
| onNavigationButtonClicked = listener | ||
| } | ||
|
|
||
| fun setOnDialPhoneButtonClicked(listener: () -> Unit) { | ||
| onDialPhoneButtonClicked = listener | ||
| } | ||
|
|
||
| fun setOnOpenWebsiteButtonClicked(listener: () -> Unit) { | ||
| onOpenWebsiteButtonClicked = listener | ||
| } | ||
|
|
||
| fun setOnBuyGiftCardButtonClicked(listener: () -> Unit) { | ||
| onBuyGiftCardButtonClicked = listener | ||
| } | ||
|
|
||
| fun getMerchantType(type: String?): String { | ||
| return when (cleanMerchantTypeValue(type)) { | ||
| MerchantType.ONLINE -> resources.getString(R.string.explore_online_merchant) | ||
|
|
@@ -102,18 +122,21 @@ class ItemDetails(context: Context, attrs: AttributeSet): LinearLayout(context, | |
| linkBtn.isVisible = !item.website.isNullOrEmpty() | ||
| linkBtn.setOnClickListener { | ||
| openWebsite(item.website!!) | ||
| onOpenWebsiteButtonClicked?.invoke() | ||
| } | ||
|
|
||
| directionBtn.isVisible = !isOnline && | ||
| ((item.latitude != null && item.longitude != null) || | ||
| !item.googleMaps.isNullOrBlank()) | ||
| directionBtn.setOnClickListener { | ||
| openMaps(item) | ||
| onNavigationButtonClicked?.invoke() | ||
| } | ||
|
|
||
| callBtn.isVisible = !isOnline && !item.phone.isNullOrEmpty() | ||
| callBtn.setOnClickListener { | ||
| dialPhone(item.phone!!) | ||
| onDialPhoneButtonClicked?.invoke() | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -142,11 +165,14 @@ class ItemDetails(context: Context, attrs: AttributeSet): LinearLayout(context, | |
| if (isDash) { | ||
| payBtn.isVisible = true | ||
| payBtn.text = context.getText(R.string.explore_pay_with_dash) | ||
| payBtn.setOnClickListener { onSendDashClicked?.invoke() } | ||
| payBtn.setOnClickListener { onSendDashClicked?.invoke(true) } | ||
| } else { | ||
| payBtn.isVisible = !merchant.deeplink.isNullOrBlank() | ||
| payBtn.text = context.getText(R.string.explore_buy_gift_card) | ||
| payBtn.setOnClickListener { openDeeplink(merchant.deeplink!!) } | ||
| payBtn.setOnClickListener { | ||
| openDeeplink(merchant.deeplink!!) | ||
| onBuyGiftCardButtonClicked?.invoke() | ||
| } | ||
| } | ||
|
|
||
| showAllBtn.setOnClickListener { onShowAllLocationsClicked?.invoke() } | ||
|
|
@@ -177,7 +203,7 @@ class ItemDetails(context: Context, attrs: AttributeSet): LinearLayout(context, | |
| showAllBtn.isVisible = false | ||
| backButton.isVisible = false | ||
|
|
||
| sellBtn.setOnClickListener { onSendDashClicked?.invoke() } | ||
| sellBtn.setOnClickListener { onSendDashClicked?.invoke(false) } | ||
| buyBtn.setOnClickListener { onReceiveDashClicked?.invoke() } | ||
|
|
||
| buyBtn.isVisible = atm.type != AtmType.SELL | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does it need to be a separate method for each event? Perhaps a
trackEvent(name: String)method is sufficient, with the caller deciding which event name constant to provide.Otherwise, half of the viewModel will consist of these methods.
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.
@Syn-McJ I set up a function to handle tracking in vm
please check it out !
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.
@ClaudeHangui looks great!