Skip to content
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

Analytics: Fix SDK Version Bug #304

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# PayPal Android SDK Release Notes

## unreleased
* CorePayments
* Fix issue that causes analytics version number to always be `null`

## 2.0.0-beta1 (2024-11-20)
* Breaking Changes
* PayPalNativePayments
Expand Down
2 changes: 1 addition & 1 deletion CardPayments/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {

buildTypes {
release {
version = android.defaultConfig.versionName // had to add this to get the version in the build
version = rootProject.version
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand Down
9 changes: 7 additions & 2 deletions CorePayments/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ android {
targetSdkVersion modules.androidTargetVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
buildConfigField "String", "CLIENT_SDK_VERSION", "\"$versionName\""
buildConfigField "String", "CLIENT_SDK_VERSION", "\"${requireExists(rootProject.version)}\""
}

buildTypes {
release {
version = android.defaultConfig.versionName // had to add this to get the version in the build
version = rootProject.version
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand Down Expand Up @@ -82,6 +82,11 @@ dependencies {
androidTestImplementation libs.kotlinx.coroutinesTest
}

static def requireExists(String value) {
if (value) return value
throw new Exception("Error in CorePayments/build.gradle: Variable does not exist.")
}

project.ext.name = "core-payments"
project.ext.version = rootProject.version
project.ext.pom_name = "PayPal SDK - CorePayments"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ internal class TrackingEventsAPI constructor(
private val coreConfig: CoreConfig,
private val restClient: RestClient
) {

// api-m.sandbox.paypal.com does not currently send FPTI events to BigQuery/Looker
constructor(coreConfig: CoreConfig) :
this(coreConfig, RestClient(coreConfig))
this(coreConfig, RestClient(toLiveConfig(coreConfig)))

suspend fun sendEvent(event: AnalyticsEventData, deviceData: DeviceData): HttpResponse {
val apiRequest = createAPIRequestForEvent(event, deviceData)
Expand Down Expand Up @@ -79,5 +81,8 @@ internal class TrackingEventsAPI constructor(

const val KEY_EVENT_PARAMETERS = "event_params"
const val KEY_EVENTS = "events"

fun toLiveConfig(config: CoreConfig): CoreConfig =
CoreConfig(config.clientId, environment = Environment.LIVE)
}
}
2 changes: 1 addition & 1 deletion FraudProtection/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {

buildTypes {
release {
version = android.defaultConfig.versionName // had to add this to get the version in the build
version = rootProject.version
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand Down
2 changes: 1 addition & 1 deletion PayPalWebPayments/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {

buildTypes {
release {
version = android.defaultConfig.versionName // had to add this to get the version in the build
version = rootProject.version
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand Down
2 changes: 1 addition & 1 deletion PaymentButtons/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {

buildTypes {
release {
version = android.defaultConfig.versionName // had to add this to get the version in the build
version = rootProject.version
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand Down
3 changes: 1 addition & 2 deletions Venmo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ android {

buildTypes {
release {
version = android.defaultConfig.versionName
// had to add this to get the version in the build
version = rootProject.version
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand Down
Loading