Skip to content

Commit

Permalink
Merge pull request #18 from bloomreach/dev
Browse files Browse the repository at this point in the history
Dev > main v1.0.13
  • Loading branch information
prashant-br authored Feb 6, 2024
2 parents 60299c2 + 09caf3d commit f161e39
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 5 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ android {
minSdk 24
targetSdk 32
versionCode 1
versionName "1.0.12"
versionName "1.0.13"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
debug {
buildConfigField "String", 'SDK_VERSION', '"1.0.9"'
buildConfigField "String", 'SDK_VERSION', '"1.0.13"'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

release {
buildConfigField "String", 'SDK_VERSION', '"1.0.9"'
buildConfigField "String", 'SDK_VERSION', '"1.0.13"'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/bloomreach/discovery/api/ApiConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ internal object ApiConstants {
const val FACET = "facet"
const val FILTER = "filter"
const val IMAGE_ID = "image_id"
const val FACET_VERSION = "facet.version"

const val DEFAULT_FACET_FLAG = false

const val CATEGORY_TYPE = "category_type"
const val CATEGORY_TYPE_DYNAMIC = "dynamic"

}
10 changes: 10 additions & 0 deletions src/main/java/com/bloomreach/discovery/api/BrApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ object BrApi {
apiProcessor.processCoreApi(categorySearchRequest.getMap(), brApiCompletionListener)
}

/**
* Method for calling Dynamic Category Search API request
* @param categorySearchRequest Request Object required for Category Search API
* @param brApiCompletionListener Callback listener
*/
fun dynamicCategorySearchApi(categorySearchRequest: CategorySearchRequest, brApiCompletionListener: BrApiCompletionListener) {
categorySearchRequest.setDynamicCategory()
categorySearchApi(categorySearchRequest, brApiCompletionListener)
}

/**
* Method for calling Content API request
* @param contentSearchRequest Request Object required for Content Search API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ class CategorySearchRequest() : SearchRequest<CategorySearchRequest>() {
private fun setSearchType(): CategorySearchRequest {
return set(ApiConstants.SEARCH_TYPE, ApiConstants.SEARCH_TYPE_CATEGORY)
}

/**
* Method to set hardcoded default parameters required for Category Search API
* @return A reference request object
*/
internal fun setDynamicCategory(): CategorySearchRequest {
return set(ApiConstants.CATEGORY_TYPE, ApiConstants.CATEGORY_TYPE_DYNAMIC)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,15 @@ sealed class SearchRequest<T>() : RequestMap<T>() {
fun url(value: String): T {
return set(ApiConstants.URL, value)
}

/**
* Method to Facet Version
*
* @param value facet version eg: '3.0'
*
* @return A reference to the current Request object
*/
fun facetVersion(value: String): T {
return set(ApiConstants.FACET_VERSION, value)
}
}
42 changes: 40 additions & 2 deletions src/main/java/com/bloomreach/discovery/pixel/PixelTracker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ object PixelTracker {
}

/**
* Method for sending the Category Search Page View Pixel
* Method for sending the Category Page View Pixel
* @param ref Synthetic URL from referrer screen
* @param title Screen name of the app view.
* @param categoryId Unique category ID as referred to in the database/catalog. Bloomreach requires the cat_id field to be unique across your site.
Expand Down Expand Up @@ -373,7 +373,7 @@ object PixelTracker {
// create pixel object based ob input
val pixelObject = PixelObject(
type = PixelType.EVENT,
pType = PageType.PRODUCT_PAGE,
pType = PageType.SEARCH_PAGE,
group = GroupType.SUGGEST,
eType = "submit",
ref = ref,
Expand Down Expand Up @@ -401,6 +401,7 @@ object PixelTracker {
* @param searchTerm User's typed search query submitted to search box
* @param catalogs List of CatalogItem that are shown in the page.
*/
@Deprecated("This method will be removed in future version. Instead use suggestionEventPixel(ref, title,typedTerm, searchTerm, catalogs)")
fun suggestionEventPixel(
ref: String,
title: String,
Expand Down Expand Up @@ -435,6 +436,43 @@ object PixelTracker {
}
}

/**
* Method for sending the Suggestion Event Pixel
* @param ref Synthetic URL from referrer screen
* @param title Screen name of the app view.
* @param typedTerm The display query (the one or more letters) that the user has actually typed.
This is NOT the suggested word or phrase.
* @param searchTerm User's typed search query submitted to search box
* @param catalogs List of CatalogItem that are shown in the page.
*/
fun suggestionEventPixel(
ref: String,
title: String,
typedTerm: String,
searchTerm: String,
catalogs: List<CatalogItem>? = null
) {
if (this::brPixel.isInitialized) {
// create pixel object based ob input
val pixelObject = PixelObject(
type = PixelType.EVENT,
pType = PageType.PRODUCT_PAGE,
group = GroupType.SUGGEST,
eType = "click",
ref = ref,
title = title,
searchTerm = searchTerm,
typedTerm = typedTerm,
catalogs = catalogs
)

// send pixel for further processing
pixelProcessor.processPixel(pixelObject)
} else {
Log.e(TAG, "Pixel Tracker not initialised")
}
}

/**
* Method for sending the Quick Event Pixel
* @param ref Synthetic URL from referrer screen
Expand Down

0 comments on commit f161e39

Please sign in to comment.