Skip to content

Commit

Permalink
Merge pull request #103 from SiftScience/API-6752_API_24
Browse files Browse the repository at this point in the history
API-6752: Upgraded to API 19 Java 7
  • Loading branch information
sbogolii-sift authored Sep 12, 2022
2 parents 6d0742e + 4611504 commit 4f1955e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Change Log

## [1.1.3] - 2022-09-09
## [1.2.0] - 2022-09-09

### Changed
- Upgraded gson to version 2.9.1
- Upgraded to API Level 24


## [1.1.2] - 2022-07-15
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=1.1.3
VERSION_NAME=1.2.0
VERSION_CODE=25

GROUP=com.siftscience
Expand Down
6 changes: 3 additions & 3 deletions hello-sift/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
compileSdkVersion 31
buildToolsVersion "30.0.0"

defaultConfig {
applicationId "siftscience.android.hellosift"
minSdkVersion 16
targetSdkVersion 30
minSdkVersion 19
targetSdkVersion 31
versionCode 1
versionName '0.0.1'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down
3 changes: 2 additions & 1 deletion hello-sift/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".HelloSift">
<activity android:name=".HelloSift"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
4 changes: 2 additions & 2 deletions sift/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ android {
buildToolsVersion '30.0.0'

defaultConfig {
minSdkVersion 16 // Jelly Bean 4.1.x (basically Java 6)
minSdkVersion 19 // Java 7
targetSdkVersion 31
versionCode 25
versionName '1.1.3'
versionName '1.2.0'

consumerProguardFiles 'proguard-rules.pro'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void reconnectLocationServices() {
}

private void doCollect() {
String installationId = Settings.Secure.getString(this.context.getContentResolver(),
@SuppressLint("HardwareIds") String installationId = Settings.Secure.getString(this.context.getContentResolver(),
Settings.Secure.ANDROID_ID);
this.sift.appendAppStateEvent(
new MobileEventJson()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package siftscience.android;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
Expand Down Expand Up @@ -92,6 +93,7 @@ public void collect() {
.withTime(Time.now()));
}

@SuppressLint("HardwareIds")
private AndroidDevicePropertiesJson get() {
// Package properties
PackageManager packageManager = this.context.getPackageManager();
Expand Down
11 changes: 6 additions & 5 deletions sift/src/main/java/siftscience/android/Sift.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

package siftscience.android;

import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;

import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -238,10 +241,8 @@ private Config(String accountId,
this.disallowLocationCollection = disallowLocationCollection;
}

@RequiresApi(api = Build.VERSION_CODES.N)
boolean isValid() {

StringJoiner configurationErrors = new StringJoiner(", ");
List<String> configurationErrors = new ArrayList<>();

if (accountId == null || accountId.isEmpty()) {
configurationErrors.add("accountId");
Expand All @@ -255,11 +256,11 @@ boolean isValid() {
configurationErrors.add("server URL format");
}

boolean valid = configurationErrors.length() == 0;
boolean valid = configurationErrors.size() == 0;

if (!valid) {
Log.d(TAG, "The following configuration properties are missing or empty: " +
configurationErrors.toString());
TextUtils.join(",", configurationErrors));
}

return valid;
Expand Down
3 changes: 0 additions & 3 deletions sift/src/main/java/siftscience/android/Uploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
/**
* Stateless utility class for sending MobileEventJson batches to Sift backend
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public class Uploader {
private static final String TAG = Uploader.class.getName();
private static final long BACKOFF_MULTIPLIER = TimeUnit.SECONDS.toSeconds(3);
Expand Down Expand Up @@ -104,7 +103,6 @@ public Request build() {
this.configProvider = configProvider;
}

@RequiresApi(api = Build.VERSION_CODES.N)
public void upload(List<MobileEventJson> batch) {
// Kick-off the first upload
try {
Expand All @@ -131,7 +129,6 @@ private void doUpload(Request request, int retriesRemaining) {
}

/** Builds a Request for the specified event batch */
@RequiresApi(api = Build.VERSION_CODES.N)
@Nullable
private Request makeRequest(List<MobileEventJson> batch) throws IOException {
if (batch == null || batch.isEmpty()) {
Expand Down

0 comments on commit 4f1955e

Please sign in to comment.