Skip to content

Commit ae88548

Browse files
author
Yevhen Podkovyrin
committed
Release 1.0.10
1 parent a01dcfe commit ae88548

16 files changed

Lines changed: 204 additions & 123 deletions

File tree

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ buildscript {
22
ext {
33
kotlinVersion = '1.9.21'
44

5-
sdk_version = '1.0.9'
5+
sdk_version = '1.0.10'
66
groupId = 'com.flexa'
77
core_version = sdk_version
88
scan_version = sdk_version
@@ -32,17 +32,17 @@ buildscript {
3232
navigation = '2.5.2'
3333
}
3434
dependencies {
35-
classpath 'com.android.tools.build:gradle:8.2.2'
35+
classpath 'com.android.tools.build:gradle:8.7.3'
3636
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
3737
}
3838
}
3939
plugins {
40-
id 'com.android.application' version '8.2.2' apply false
41-
id 'com.android.library' version '8.2.2' apply false
40+
id 'com.android.application' version '8.7.3' apply false
41+
id 'com.android.library' version '8.7.3' apply false
4242
id 'org.jetbrains.kotlin.android' version "$kotlinVersion" apply false
4343
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlinVersion" apply false
4444
}
4545

4646
task clean(type: Delete) {
47-
delete rootProject.buildDir
47+
delete layout.buildDirectory.asFile.get()
4848
}

core/build.gradle

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ plugins {
44
id 'com.android.library'
55
id 'org.jetbrains.kotlin.android'
66
id 'kotlin-parcelize'
7-
id 'maven-publish'
87
id 'org.jetbrains.kotlin.plugin.serialization'
98
id 'kotlin-kapt'
9+
id 'maven-publish'
1010
}
1111

1212
android {
@@ -30,7 +30,7 @@ android {
3030
it.buildConfigField 'String', 'DEBUG_API_HOST', 'null'
3131
}
3232
debug {
33-
it.buildConfigField 'String', 'DEBUG_API_HOST', "\"${localProperties['debug.api.host']?:""}\""
33+
it.buildConfigField 'String', 'DEBUG_API_HOST', "\"${localProperties['debug.api.host'] ?: ""}\""
3434
}
3535
}
3636
def date = new SimpleDateFormat("yyyy-MM-dd").format(new Date())
@@ -47,17 +47,11 @@ android {
4747
}
4848
buildFeatures {
4949
compose true
50+
buildConfig true
5051
}
5152
composeOptions {
5253
kotlinCompilerExtensionVersion kotlin_compiler_version
5354
}
54-
sourceSets {
55-
main {
56-
kotlin {
57-
srcDir("$buildDir/generated/api")
58-
}
59-
}
60-
}
6155
gradle.taskGraph.whenReady {
6256
def task = it.getAllTasks().find { t -> t.name.contains('bundle') }
6357
if (task && task.name && (
@@ -105,7 +99,6 @@ dependencies {
10599
implementation "androidx.lifecycle:lifecycle-runtime-compose:$lifecycle_version"
106100
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
107101

108-
109102
/*AppCompat*/
110103
implementation 'androidx.appcompat:appcompat:1.7.0'
111104

@@ -138,6 +131,8 @@ dependencies {
138131
testImplementation 'org.robolectric:robolectric:4.13'
139132
}
140133

134+
def module_description = 'The core module is required by all other modules in the Flexa SDK. The Flexa SDK is a suite of prebuilt functionality that enables your wallet app to interface directly with Flexa-powered payment systems in-person and online'
135+
141136
project.afterEvaluate {
142137
publishing {
143138
publications {
@@ -174,18 +169,5 @@ project.afterEvaluate {
174169
}
175170
}
176171
}
177-
repositories {
178-
maven {
179-
name = "GitHubPackages"
180-
url = uri("https://maven.pkg.github.com/flexa/flexa-android")
181-
credentials {
182-
def propertiesFile = rootProject.file("local.properties")
183-
def localProperties = new Properties()
184-
localProperties.load(new FileInputStream(propertiesFile))
185-
username = localProperties['gpr.user'] ?: ""
186-
password = localProperties['gpr.key'] ?: ""
187-
}
188-
}
189-
}
190172
}
191173
}

core/build_type.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Tue Dec 03 19:05:36 EET 2024
1+
#Mon Jan 27 16:12:24 EET 2025
22
BUILD_TYPE=debug

core/src/main/java/com/flexa/core/data/data/AppInfoProvider.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,28 @@ internal class AppInfoProvider {
4343
"Inaccessible"
4444
}
4545

46+
fun getAppBuildNumber(application: Context): String =
47+
try {
48+
val packageInfo = when {
49+
Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU ->
50+
application.packageManager
51+
.getPackageInfo(application.packageName, 0)
52+
53+
else -> application.packageManager
54+
.getPackageInfo(
55+
application.packageName,
56+
PackageManager.PackageInfoFlags.of(0)
57+
)
58+
}
59+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
60+
packageInfo.longVersionCode.toString()
61+
} else {
62+
packageInfo.versionCode.toString()
63+
}
64+
} catch (e: Exception) {
65+
"Inaccessible"
66+
}
67+
4668
fun getAppPackageName(context: Context): String =
4769
try {
4870
val packageInfo = when {

core/src/main/java/com/flexa/core/data/rest/FlexaInterceptor.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ internal abstract class FlexaInterceptor: Interceptor {
2020
Flexa.context?.run { AppInfoProvider.getAppName(this) } ?: "Inaccessible"
2121
val appVersion =
2222
Flexa.context?.run { AppInfoProvider.getAppVersion(this) } ?: "Inaccessible"
23+
val appBuildNumber =
24+
Flexa.context?.run { AppInfoProvider.getAppBuildNumber(this) } ?: "Inaccessible"
2325
val appPackageName =
2426
Flexa.context?.run { AppInfoProvider.getAppPackageName(this) } ?: "Inaccessible"
25-
val deviceModel = Build.MODEL
26-
val deviceManufacturer = Build.MANUFACTURER
27-
val userAgent =
28-
"$deviceManufacturer $deviceModel/${Build.VERSION.SDK_INT}(${Build.VERSION.RELEASE}) " +
27+
val sdkVersion = "${Build.VERSION.RELEASE} (${Build.VERSION.SDK_INT})"
28+
val userAgent = "Android/$sdkVersion " +
2929
"Spend/${BuildConfig.SPEND_SDK_VERSION} " +
30-
"$appPackageName/$appVersion"
30+
"$appPackageName/$appVersion ($appBuildNumber)"
3131
HeadersBundle(
3232
appName = appName,
3333
version = releaseDate,

core/src/main/java/com/flexa/core/data/rest/RestRepository.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.flexa.core.data.rest
22

3+
import android.os.Build
34
import android.util.Log
45
import com.flexa.BuildConfig
56
import com.flexa.core.data.storage.SecuredPreferences
@@ -81,7 +82,7 @@ internal class RestRepository(
8182
preferences.getStringSynchronously(FlexaConstants.UNIQUE_IDENTIFIER) ?: ""
8283
put("challenge", challenge)
8384
put("device_id", deviceId)
84-
put("device_model", "Android")
85+
put("device_model", "${Build.MANUFACTURER} ${Build.MODEL}")
8586
put("email", email)
8687
}.run { toString().toRequestBody(mediaType) }
8788

example/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ android {
5353
}
5454
buildFeatures {
5555
compose true
56+
buildConfig true
5657
}
5758
composeOptions {
5859
kotlinCompilerExtensionVersion kotlin_compiler_version

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ kotlin.code.style=official
2222
# thereby reducing the size of the R class for that library
2323
android.nonTransitiveRClass=true
2424
org.gradle.unsafe.configuration-cache=false
25-
android.defaults.buildfeatures.buildconfig=true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Sep 24 10:55:24 EEST 2024
1+
#Fri Jan 24 22:52:02 EET 2025
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

scan/build.gradle

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -126,37 +126,6 @@ project.afterEvaluate {
126126
}
127127
}
128128
}
129-
bar(MavenPublication) {
130-
groupId rootProject.groupId
131-
artifactId artifactName
132-
version rootProject.core_version
133-
def propertiesFile = file('build_type.properties')
134-
if (!propertiesFile.canRead()) {
135-
throw new FileNotFoundException("Could not read " + propertiesFile.name)
136-
}
137-
Properties properties = new Properties()
138-
properties.load(new FileInputStream(propertiesFile))
139-
def type = properties['BUILD_TYPE']
140-
println '<<<--- Building library --->>> ' + type
141-
artifact "$buildDir/outputs/aar/${artifactName}-${type}.aar"
142-
pom.withXml {
143-
def dependenciesNode = asNode().appendNode("dependencies")
144-
configurations.each {
145-
if (it.name == 'api' || it.name == 'implementation') {
146-
configurations[it.name].allDependencies.forEach {
147-
if (it.group != null && (it.name != null || "unspecified" == it.name)
148-
&& it.version != null && "unspecified" != it.version) {
149-
println 'dep -->>> ' + it.group + ':' + it.name + ':' + it.version
150-
def dependencyNode = dependenciesNode.appendNode("dependency")
151-
dependencyNode.appendNode("groupId", it.group)
152-
dependencyNode.appendNode("artifactId", it.name)
153-
dependencyNode.appendNode("version", it.version)
154-
}
155-
}
156-
}
157-
}
158-
}
159-
}
160129
}
161130
repositories {
162131
maven {

0 commit comments

Comments
 (0)