Skip to content
Open
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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.gradle/
build/
local.properties
*.iml
.idea/
.DS_Store

.claude/
AUDIT_REPORT.md
FIXES_IMPLEMENTED.md
611 changes: 594 additions & 17 deletions README.md

Large diffs are not rendered by default.

27 changes: 19 additions & 8 deletions android-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ ext {

android {
namespace 'com.absmartly.android.sdk'
compileSdk 33
compileSdk 35

defaultConfig {
minSdk 21
targetSdk 33
targetSdk 35
versionCode 1
versionName "1.0"

Expand All @@ -25,11 +25,17 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
consumerProguardFiles 'consumer-proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
publishing {
singleVariant("release") {
Expand All @@ -40,15 +46,20 @@ android {
}

dependencies {
implementation 'androidx.annotation:annotation:1.7.1'

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:4.11.0'
testImplementation 'org.mockito:mockito-inline:4.11.0'
testImplementation 'org.robolectric:robolectric:4.10.3'

androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

implementation 'com.absmartly.sdk:core-api:1.6.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4.2'
compileOnly files('../../java-sdk/core-api/build/libs/core-api.jar')
testImplementation files('../../java-sdk/core-api/build/libs/core-api.jar')
testImplementation 'net.sourceforge.streamsupport:streamsupport-minifuture:1.7.4'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.2'
Comment on lines +49 to +62

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n "compileOnly|testImplementation|api|implementation|core-api|streamsupport|minifuture" \
  android-sdk/build.gradle README.md

rg -n "com\.absmartly\.sdk|java8\.util\.concurrent\.CompletableFuture" \
  android-sdk README.md

Repository: absmartly/android-sdk

Length of output: 4340


Publish the core API and Java 8 backport as public dependencies android-sdk/build.gradle still declares core-api.jar as compileOnly and streamsupport-minifuture as testImplementation, but the Android SDK’s public surface uses com.absmartly.sdk.* types and the README imports java8.util.concurrent.CompletableFuture. Consumers who depend only on com.absmartly.sdk:android-sdk will be missing those classes. Make the dependency graph transitive, or remove those types from the published API/docs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@android-sdk/build.gradle` around lines 49 - 62, The android-sdk dependency
declarations must expose all types used by its public API and README. In the
dependencies block of android-sdk/build.gradle, change core-api.jar from
compileOnly to a published implementation dependency and promote
streamsupport-minifuture from testImplementation to implementation, while
preserving the existing test coverage dependencies.

implementation 'org.conscrypt:conscrypt-android:2.5.2'
}

Expand Down
12 changes: 12 additions & 0 deletions android-sdk/consumer-proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Keep Jackson annotations and model classes for ABSmartly SDK
-keepattributes *Annotation*

# Keep all classes in the json package
-keep class com.absmartly.sdk.json.** { *; }

# Keep Jackson serialization
-keep class com.fasterxml.jackson.** { *; }
-keepclassmembers class * {
@com.fasterxml.jackson.annotation.* <fields>;
@com.fasterxml.jackson.annotation.* <methods>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
package com.absmartly.android.sdk;

import android.content.Context;

import androidx.annotation.NonNull;

import com.absmartly.android.sdk.cache.SqliteAndroidLocalCache;
import com.absmartly.sdk.ABsmartly;
import com.absmartly.sdk.ABsmartlyConfig;
import com.absmartly.sdk.Client;
import com.absmartly.sdk.ClientConfig;
import com.absmartly.sdk.ContextConfig;
import com.absmartly.sdk.json.ContextData;

import java.io.Closeable;
import java.io.IOException;
import java.util.Objects;

public class ABSmartlyAndroid implements Closeable {

public static ABSmartlyAndroid create(
@NonNull String endpoint,
@NonNull String apiKey,
@NonNull String application,
@NonNull String environment,
@NonNull Context androidContext) {
Objects.requireNonNull(endpoint, "endpoint is required");
Objects.requireNonNull(apiKey, "apiKey is required");
Objects.requireNonNull(application, "application is required");
Objects.requireNonNull(environment, "environment is required");
Objects.requireNonNull(androidContext, "Android Context is required");
return new ABSmartlyAndroid(endpoint, apiKey, application, environment, androidContext);
}

public static Builder builder() {
return new Builder();
}

private final ABsmartly sdk;
private final SqliteAndroidLocalCache cache;

private ABSmartlyAndroid(
@NonNull String endpoint,
@NonNull String apiKey,
@NonNull String application,
@NonNull String environment,
@NonNull Context androidContext) {
this.cache = new SqliteAndroidLocalCache(androidContext.getApplicationContext());

final ClientConfig clientConfig = ClientConfig.create()
.setEndpoint(endpoint)
.setAPIKey(apiKey)
.setApplication(application)
.setEnvironment(environment);

final ABsmartlyConfig sdkConfig = ABsmartlyConfig.create()
.setClient(Client.create(clientConfig));

this.sdk = ABsmartly.create(sdkConfig);
}

ABSmartlyAndroid(@NonNull ABsmartly sdk, @NonNull SqliteAndroidLocalCache cache) {
this.sdk = sdk;
this.cache = cache;
}

public com.absmartly.sdk.Context createContext(@NonNull ContextConfig config) {
return sdk.createContext(config);
}

public com.absmartly.sdk.Context createContextWith(@NonNull ContextConfig config, ContextData data) {
return sdk.createContextWith(config, data);
}

public ABsmartly getSdk() {
return sdk;
}

public SqliteAndroidLocalCache getCache() {
return cache;
}

@Override
public void close() throws IOException {
IOException sdkException = null;
try {
sdk.close();
} catch (IOException e) {
sdkException = e;
}
try {
cache.close();
} catch (Exception e) {
if (sdkException != null) {
sdkException.addSuppressed(e);
throw sdkException;
}
if (e instanceof IOException) {
throw (IOException) e;
}
throw new IOException(e);
}
if (sdkException != null) {
throw sdkException;
}
}

public static final class Builder {
private String endpoint;
private String apiKey;
private String application;
private String environment;
private Context androidContext;

private Builder() {}

public Builder endpoint(@NonNull String endpoint) {
this.endpoint = endpoint;
return this;
}

public Builder apiKey(@NonNull String apiKey) {
this.apiKey = apiKey;
return this;
}

public Builder application(@NonNull String application) {
this.application = application;
return this;
}

public Builder environment(@NonNull String environment) {
this.environment = environment;
return this;
}

public Builder context(@NonNull Context androidContext) {
this.androidContext = androidContext;
return this;
}

public ABSmartlyAndroid build() {
if (endpoint == null) throw new IllegalStateException("endpoint is required");
if (apiKey == null) throw new IllegalStateException("apiKey is required");
if (application == null) throw new IllegalStateException("application is required");
if (environment == null) throw new IllegalStateException("environment is required");
if (androidContext == null) throw new IllegalStateException("Android Context is required");
return new ABSmartlyAndroid(endpoint, apiKey, application, environment, androidContext);
}
}
}
Loading