-
Notifications
You must be signed in to change notification settings - Fork 1
Android SDK: All tests passing (9/9 unit) #2
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
Open
joalves
wants to merge
1
commit into
absmartly:main
Choose a base branch
from
joalves:fix/android-sdk-tests-passing-rebased
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>; | ||
| } |
151 changes: 151 additions & 0 deletions
151
android-sdk/src/main/java/com/absmartly/android/sdk/ABSmartlyAndroid.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
Repository: absmartly/android-sdk
Length of output: 4340
Publish the core API and Java 8 backport as public dependencies
android-sdk/build.gradlestill declarescore-api.jarascompileOnlyandstreamsupport-minifutureastestImplementation, but the Android SDK’s public surface usescom.absmartly.sdk.*types and the README importsjava8.util.concurrent.CompletableFuture. Consumers who depend only oncom.absmartly.sdk:android-sdkwill be missing those classes. Make the dependency graph transitive, or remove those types from the published API/docs.🤖 Prompt for AI Agents