Skip to content

Commit

Permalink
merge(#31): fix: empty url replaced with default url
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubsta authored Jun 12, 2023
2 parents 93182b2 + 5fa4e9a commit a2156d3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions rampsdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ android {
minSdkVersion 21
targetSdkVersion 32
versionCode 17
versionName "3.0.1"
versionName "3.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
buildConfigField 'String', 'VERSION', "\"${defaultConfig.versionName}\""
Expand Down Expand Up @@ -84,7 +84,7 @@ afterEvaluate {
from components.release
groupId = 'com.github.RampNetwork'
artifactId = 'ramp-sdk-android'
version = '3.0.0'
version = '3.0.2'
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions rampsdk/src/main/java/network/ramp/sdk/facade/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ data class Config(

/**
* An optional string parameter that allows you to use a non-production version of our widget.
* Example: "https://ri-widget-staging.firebaseapp.com"
* Example: "https://app.demo.ramp.network"
*/
val url: String = "https://buy.ramp.network",
var url: String = DEFAULT_URL,

/**
* An optional string parameter that sets a list of available crypto assets for user to choose from.
Expand Down Expand Up @@ -111,9 +111,14 @@ data class Config(

var useSendCryptoCallbackVersion: Int? = SEND_CRYPTO_CALLBACK_VERSION

) : Parcelable{
) : Parcelable {

companion object{
init {
url = url.ifBlank { DEFAULT_URL }
}

companion object {
const val SEND_CRYPTO_CALLBACK_VERSION = 1
const val DEFAULT_URL = "https://buy.ramp.network"
}
}
3 changes: 1 addition & 2 deletions rampsdk/src/main/java/network/ramp/sdk/facade/RampSDK.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class RampSDK {
activity: Activity,
config: Config,
callback: RampCallback,
//@DEPRECATED to remove in next major release
url: String? = null
) {
Timber.d("RAMP SDK version - ${BuildConfig.VERSION}")
Expand All @@ -38,7 +39,6 @@ class RampSDK {
intent.putExtra(
CONFIG_EXTRA, config
)
intent.putExtra(URL_EXTRA, url)
activity.startActivity(intent)
}

Expand Down Expand Up @@ -103,6 +103,5 @@ class RampSDK {

companion object {
internal const val CONFIG_EXTRA = "config"
internal const val URL_EXTRA = "url"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package network.ramp.sdk.ui.activity
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.webkit.WebView
import androidx.appcompat.app.AppCompatActivity
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -17,7 +16,6 @@ import network.ramp.sdk.facade.Config
import network.ramp.sdk.facade.RampSDK.Companion.CONFIG_EXTRA
import timber.log.Timber
import network.ramp.sdk.events.model.*
import network.ramp.sdk.facade.RampSDK.Companion.URL_EXTRA
import network.ramp.sdk.ui.webview.RampWidgetWebViewChromeClient.Companion.CAMERA_PERMISSION_REQUEST
import network.ramp.sdk.ui.webview.RampWidgetWebViewClient

Expand All @@ -32,8 +30,6 @@ internal class RampWidgetActivity : AppCompatActivity(), Contract.View {

private lateinit var config: Config

private var url: String? = null

private val jsInterface = RampSdkJsInterface(
onPostMessage = {
rampPresenter.handlePostMessage(it)
Expand All @@ -55,9 +51,6 @@ internal class RampWidgetActivity : AppCompatActivity(), Contract.View {
config = it
} ?: returnOnError("Config object cannot be null")

intent.extras?.getString(URL_EXTRA)?.let {
url = it
}
if (savedInstanceState == null) {
Timber.d(rampPresenter.buildUrl(config))
securityCheck(intent)?.let {
Expand Down

0 comments on commit a2156d3

Please sign in to comment.