Skip to content

Commit

Permalink
Merge pull request #60 from growthbook/refactoring/follow-documentation
Browse files Browse the repository at this point in the history
Refactoring: Adapting GBSDKBuilder class according to the documentation
  • Loading branch information
vazarkevych authored Jul 5, 2023
2 parents 30b22a1 + ca561d7 commit 853cf38
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
6 changes: 3 additions & 3 deletions GrowthBook/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "io.growthbook.sdk"
version = "1.1.33"
version = "1.1.34"

kotlin {

Expand Down Expand Up @@ -95,14 +95,14 @@ android {
}
buildTypes {
release {
isMinifyEnabled = true
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
debug {
isMinifyEnabled = true
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@ class GBSDKBuilderJAVA(
* Tracking Callback - Track Events for Experiments
* EncryptionKey - Encryption key if you intend to use data encryption.
*/
class GBSDKBuilderApp(
apiKey: String, hostURL: String, attributes: Map<String, Any>,
trackingCallback: GBTrackingCallback, encryptionKey: String?
class GBSDKBuilder(
apiKey: String,
hostURL: String,
attributes: Map<String, Any>,
trackingCallback: GBTrackingCallback,
encryptionKey: String? = null
) : SDKBuilder(
apiKey, hostURL,
attributes, trackingCallback, encryptionKey
Expand All @@ -130,7 +133,7 @@ class GBSDKBuilderApp(
/**
* Set Refresh Handler - Will be called when cache is refreshed
*/
fun setRefreshHandler(refreshHandler: GBCacheRefreshHandler): GBSDKBuilderApp {
fun setRefreshHandler(refreshHandler: GBCacheRefreshHandler): GBSDKBuilder {
this.refreshHandler = refreshHandler
return this
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.sdk.growthbook.integration

import com.sdk.growthbook.GBSDKBuilderApp
import com.sdk.growthbook.GBSDKBuilder
import com.sdk.growthbook.GrowthBookSDK
import com.sdk.growthbook.tests.MockNetworkClient
import org.intellij.lang.annotations.Language
Expand Down Expand Up @@ -83,7 +83,7 @@ internal class VerifySDKReturnFeatureValues {
}

private fun buildSDK(json: String, attributes: Map<String, Any> = mapOf()): GrowthBookSDK {
return GBSDKBuilderApp(
return GBSDKBuilder(
"some_key",
"http://host.com",
attributes = attributes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.sdk.growthbook.tests

import com.sdk.growthbook.GBSDKBuilderApp
import com.sdk.growthbook.GBSDKBuilder
import com.sdk.growthbook.Utils.DefaultCrypto
import com.sdk.growthbook.Utils.encryptToFeaturesDataModel
import com.sdk.growthbook.model.GBExperiment
Expand Down Expand Up @@ -52,7 +52,7 @@ class GBEncryptedFeatures {
@Test
fun testEncrypt() {

val sdkInstance = GBSDKBuilderApp(
val sdkInstance = GBSDKBuilder(
testApiKey,
testHostURL,
attributes = testAttributes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.sdk.growthbook.tests

import com.sdk.growthbook.GBSDKBuilderApp
import com.sdk.growthbook.GBSDKBuilder
import com.sdk.growthbook.GBSDKBuilderJAVA
import com.sdk.growthbook.GrowthBookSDK
import com.sdk.growthbook.Utils.GBCacheRefreshHandler
Expand Down Expand Up @@ -29,7 +29,7 @@ class GrowthBookSDKBuilderTests {
@Test
fun testSDKInitilizationDefault() {

val sdkInstance = GBSDKBuilderApp(
val sdkInstance = GBSDKBuilder(
testApiKey,
testHostURL,
attributes = testAttributes,
Expand All @@ -50,7 +50,7 @@ class GrowthBookSDKBuilderTests {

val variations: HashMap<String, Int> = HashMap()

val sdkInstance = GBSDKBuilderApp(
val sdkInstance = GBSDKBuilder(
testApiKey,
testHostURL,
attributes = testAttributes,
Expand All @@ -73,7 +73,7 @@ class GrowthBookSDKBuilderTests {

val variations: HashMap<String, Int> = HashMap()

val sdkInstance = GBSDKBuilderApp(
val sdkInstance = GBSDKBuilder(
testApiKey,
testHostURL,
attributes = testAttributes,
Expand All @@ -98,7 +98,7 @@ class GrowthBookSDKBuilderTests {

var isRefreshed = false

val sdkInstance = GBSDKBuilderApp(
val sdkInstance = GBSDKBuilder(
testApiKey,
testHostURL,
attributes = testAttributes,
Expand All @@ -125,7 +125,7 @@ class GrowthBookSDKBuilderTests {
val gbError = GBError(error = null)
val gbCacheRefreshHandler: GBCacheRefreshHandler = { isRefreshed, gbError -> }

val sdkInstance = GBSDKBuilderApp(
val sdkInstance = GBSDKBuilder(
testApiKey,
testHostURL,
encryptionKey = null,
Expand All @@ -145,7 +145,7 @@ class GrowthBookSDKBuilderTests {
@Test
fun testSDKRunMethods() {

val sdkInstance = GBSDKBuilderApp(
val sdkInstance = GBSDKBuilder(
testApiKey,
testHostURL,
attributes = testAttributes,
Expand All @@ -167,7 +167,7 @@ class GrowthBookSDKBuilderTests {
attributes: Map<String, Any> = mapOf(),
encryptionKey: String?
): GrowthBookSDK {
return GBSDKBuilderApp(
return GBSDKBuilder(
"some_key",
"http://host.com",
attributes = attributes,
Expand Down

0 comments on commit 853cf38

Please # to comment.