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

Cs 43851/sequential sync : sequential sync support added #47

Merged
merged 4 commits into from
Feb 8, 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
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# CHANGELOG

## Version 3.14.0

### Date: 10-Feb-2024

- support of new sync api
- initSeqSync in stack class
- seqSync in stack class

---

## Version 3.13.0

### Date: 02-Feb-2024

- Fixed dependency installing issue
- Fixed Download Issue
- Error Status Code added
- Support of early access headers

---

## Version 3.12.4

Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ buildscript {
}

dependencies {
//classpath "com.android.tools.build:gradle:8.2.1" //8.2.1
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'io.github.gradle-nexus:publish-plugin:2.0.0-rc-1'
classpath "org.jacoco:org.jacoco.core:$jacoco_version"
Expand Down
5 changes: 1 addition & 4 deletions contentstack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android.buildFeatures.buildConfig true
mavenPublishing {
publishToMavenCentral(SonatypeHost.DEFAULT)
signAllPublications()
coordinates("com.contentstack.sdk", "android", "3.13.0")
coordinates("com.contentstack.sdk", "android", "3.14.0")

pom {
name = "contentstack-android"
Expand Down Expand Up @@ -132,14 +132,12 @@ android {
}
configurations { archives }
dependencies {
def multidex = "2.0.1"
def volley = "1.2.1"
def junit = "4.13.2"
configurations.configureEach { resolutionStrategy.force 'com.android.support:support-annotations:23.1.0' }
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.volley:volley:$volley"
implementation "junit:junit:$junit"
// For AGP 7.4+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:core:1.5.0'
Expand All @@ -158,6 +156,5 @@ tasks.register('createJar', Jar) {
archivesBaseName = "contentstack.jar"
from('build/contentstack-jar/')
include 'com/contentstack/'
//include 'META-INF/'
}
createJar.dependsOn(clearJar, unzip, build)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class SDKConstant {
public static final boolean debug = false;
public static boolean IS_NETWORK_AVAILABLE = true;
public static String PROTOCOL = "https://";
public static String SDK_VERSION = "3.13.0";
public static String SDK_VERSION = "3.14.0";
public final static int NO_NETWORK_CONNECTION = 408;
public final static int TimeOutDuration = 30000; // timeout in millisecond
public final static int NumRetry = 0;
Expand Down
89 changes: 65 additions & 24 deletions contentstack/src/main/java/com/contentstack/sdk/Stack.java

Large diffs are not rendered by default.

29 changes: 24 additions & 5 deletions contentstack/src/main/java/com/contentstack/sdk/SyncStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,24 @@ public class SyncStack {
private int count;
private String URL;
private String pagination_token;
private String sync_token;
private String syncToken;
private ArrayList<JSONObject> syncItems;
private String sequentialToken;


/**
* Gets sequential token based on sync response
*
* @return sequentialToken
*/
public String getSequentialToken() {
return sequentialToken;
}

public void setSequentialToken(String sequentialToken) {
this.sequentialToken = sequentialToken;
}

/**
* Gets url.
*
Expand Down Expand Up @@ -82,7 +96,7 @@ public String getPaginationToken() {
* @return the sync token
*/
public String getSyncToken() {
return this.sync_token;
return this.syncToken;
}

/**
Expand Down Expand Up @@ -130,12 +144,17 @@ protected void setJSON(JSONObject jsonobject) {
if (receiveJson.has("pagination_token")) {
this.pagination_token = receiveJson.optString("pagination_token");
} else {
this.sync_token = null;
this.syncToken = null;
}
if (receiveJson.has("sync_token")) {
this.sync_token = receiveJson.optString("sync_token");
this.syncToken = receiveJson.optString("sync_token");
} else {
this.syncToken = null;
}
if (receiveJson.has("last_seq_id")) {
this.sequentialToken = receiveJson.optString("last_seq_id");
} else {
this.sync_token = null;
this.sequentialToken = null;
}
}
} catch (Exception e) {
Expand Down
2 changes: 0 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
Expand Down
Loading