diff --git a/app/build.gradle b/app/build.gradle
index 70dcd464..9c7bb531 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -47,8 +47,9 @@ android {
}
}
packagingOptions {
- exclude 'META-INF/AL2.0'
- exclude 'META-INF/LGPL2.1'
+ resources {
+ excludes += ['META-INF/AL2.0', 'META-INF/LGPL2.1']
+ }
}
}
@@ -68,7 +69,7 @@ dependencies {
*/
testImplementation 'org.json:json:20200518'
- testImplementation "com.fasterxml.jackson.core:jackson-databind:$jackson"
+ testImplementation "com.google.code.gson:gson:$gson"
//testImplementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8"
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp3"
@@ -77,7 +78,7 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
androidTestImplementation "androidx.test.ext:junit-ktx:" + rootProject.extJUnitVersion
- androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jackson"
+ androidTestImplementation "com.google.code.gson:gson:$gson"
androidTestImplementation 'androidx.test.espresso:espresso-contrib:' + rootProject.espressoVersion
androidTestImplementation "com.jakewharton.espresso:okhttp3-idling-resource:$jakeWhartonOkhttpOdlingResource"
diff --git a/app/src/androidTest/java/com/pixlee/pixleeandroidsdk/HMACTest.kt b/app/src/androidTest/java/com/pixlee/pixleeandroidsdk/HMACTest.kt
index 5382a850..8d76b38e 100644
--- a/app/src/androidTest/java/com/pixlee/pixleeandroidsdk/HMACTest.kt
+++ b/app/src/androidTest/java/com/pixlee/pixleeandroidsdk/HMACTest.kt
@@ -1,6 +1,7 @@
package com.pixlee.pixleeandroidsdk
-import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.Gson
+import com.google.gson.JsonObject
import com.pixlee.pixleesdk.network.HMAC
import org.json.JSONException
import org.junit.Assert
@@ -15,14 +16,15 @@ class HMACTest {
@Test
@Throws(JSONException::class, InvalidKeyException::class, NoSuchAlgorithmException::class)
fun `test-HMAC-SHA1`() {
- val text: String = ObjectMapper().createObjectNode().apply{
- this.put("album_id", 12345)
- this.put("title", "Testing Photo Upload")
- this.put("approved", true)
- this.put("email", "test@example.com")
- this.put("username", "Submitter Person")
- this.put("photo_uri", "https://example.com/test.jpg")
- }.toString().replace("\\/", "/")
+ val text: String = Gson().toJson(JsonObject().apply {
+ addProperty("album_id", 12345)
+ addProperty("title", "Testing Photo Upload")
+ addProperty("approved", true)
+ addProperty("email", "test@example.com")
+ addProperty("username", "Submitter Person")
+ addProperty("photo_uri", "https://example.com/test.jpg")
+ }).replace("\\/", "/")
+
val test = HMAC.computeHmac(text, "ABCDEFG")
val targetResult = "epBvDlHbQho/rNDdQVJowWMtGsg="
Assert.assertEquals(targetResult, test)
diff --git a/app/src/test/java/com/pixlee/pixleesdk/HMACTest.kt b/app/src/test/java/com/pixlee/pixleesdk/HMACTest.kt
index ddfa44fe..c18342f8 100644
--- a/app/src/test/java/com/pixlee/pixleesdk/HMACTest.kt
+++ b/app/src/test/java/com/pixlee/pixleesdk/HMACTest.kt
@@ -1,6 +1,7 @@
package com.pixlee.pixleesdk
-import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.Gson
+import com.google.gson.JsonObject
import com.pixlee.pixleesdk.network.HMAC
import org.json.JSONException
import org.junit.Assert
@@ -15,16 +16,17 @@ class HMACTest {
@Test
@Throws(JSONException::class, InvalidKeyException::class, NoSuchAlgorithmException::class)
fun testHMAC() {
- val text: String = ObjectMapper().createObjectNode().apply{
- this.put("album_id", 12345)
- this.put("title", "Testing Photo Upload")
- this.put("approved", true)
- this.put("email", "test@example.com")
- this.put("username", "Submitter Person")
- this.put("photo_uri", "https://example.com/test.jpg")
- }.toString().replace("\\/", "/")
- val test = HMAC.computeHmac(text, "ABCDEFG")
- val targetResult = "epBvDlHbQho/rNDdQVJowWMtGsg="
+ val text: String = Gson().toJson(JsonObject().apply {
+ addProperty("album_id", 12345)
+ addProperty("title", "Testing Photo Upload")
+ addProperty("approved", true)
+ addProperty("email", "test@example.com")
+ addProperty("username", "Submitter Person")
+ addProperty("photo_uri", "https://example.com/test.jpg")
+ }).replace("\\/", "/")
+
+ val test = HMAC.computeHmac(text, "ABCDEFG")
+ val targetResult = "epBvDlHbQho/rNDdQVJowWMtGsg="
Assert.assertEquals(targetResult, test)
}
}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index c60081f0..c728296d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,12 +1,12 @@
buildscript {
- ext.kotlin_version = '1.5.20'
- ext.coroutines = "1.5.0"
+ ext.kotlin_version = '1.6.10'
+ ext.coroutines = "1.5.2"
repositories {
google()
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.0.4'
+ classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -44,8 +44,8 @@ ext {
jakeWhartonOkhttpOdlingResource = "1.0.0"
- androidxAppcompat = "1.4.1"
- androidxConstraint = "2.1.3"
+ androidxAppcompat = "1.4.2"
+ androidxConstraint = "2.1.4"
material = "1.5.0"
lifecycle = "2.4.0"
@@ -63,7 +63,7 @@ ext {
checkerframeworkVersion = '3.13.0'
exoPlayer="2.16.1"
supportLibraryVersion = '27.0.0'
- jackson = '2.10.3'
+ gson = '2.9.1'
junit = '4.13.2'
androidxRunner = '1.4.0'
androidXrules = '1.4.0'
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 9f8bc61d..abda7fe0 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
diff --git a/pixleesdk/build.gradle b/pixleesdk/build.gradle
index b3177de5..41d5003e 100644
--- a/pixleesdk/build.gradle
+++ b/pixleesdk/build.gradle
@@ -44,35 +44,34 @@ android {
}
}
}
-
packagingOptions {
- exclude 'META-INF/AL2.0'
- exclude 'META-INF/LGPL2.1'
+ resources {
+ excludes += ['META-INF/AL2.0', 'META-INF/LGPL2.1']
+ }
}
+
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines"
- implementation 'androidx.core:core-ktx:1.7.0'
+ testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines"
/**
* testing
*/
testImplementation "junit:junit:$junit"
testImplementation 'org.json:json:20200518'
- androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jackson"
+ androidTestImplementation "com.google.code.gson:gson:$gson"
androidTestImplementation 'androidx.test.ext:junit-ktx:' + rootProject.extJUnitVersion
androidTestImplementation 'androidx.test.espresso:espresso-contrib:' + rootProject.espressoVersion
androidTestImplementation "com.jakewharton.espresso:okhttp3-idling-resource:$jakeWhartonOkhttpOdlingResource"
- implementation "com.fasterxml.jackson.core:jackson-databind:$jackson"
+ implementation "com.google.code.gson:gson:$gson"
+
+// implementation "androidx.appcompat:appcompat:$androidxAppcompat"
- implementation "androidx.appcompat:appcompat:$androidxAppcompat"
- implementation "com.google.android.material:material:$material"
/**
* Network
*/
@@ -93,9 +92,6 @@ dependencies {
* Glide(Image library)
*/
implementation "com.github.bumptech.glide:glide:$glide"
- implementation "com.github.bumptech.glide:annotations:$glide"
- implementation "com.github.bumptech.glide:okhttp3-integration:$glide"
- kapt "com.github.bumptech.glide:compiler:$glide"
/**
* Glide Transformation
@@ -111,13 +107,9 @@ dependencies {
compileOnly "org.checkerframework:checker-qual:$checkerframeworkVersion"
implementation "com.google.android.exoplayer:exoplayer-core:$exoPlayer"
- implementation "com.google.android.exoplayer:exoplayer-dash:$exoPlayer"
implementation "com.google.android.exoplayer:exoplayer-ui:$exoPlayer"
- implementation "com.google.android.exoplayer:extension-ima:$exoPlayer"
implementation "com.google.android.exoplayer:extension-cronet:$exoPlayer"
- implementation 'androidx.annotation:annotation:1.3.0'
-
implementation "androidx.recyclerview:recyclerview:1.2.1"
}
diff --git a/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/NetworkModule.java b/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/NetworkModule.java
index 1f58d1db..c24f7eae 100644
--- a/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/NetworkModule.java
+++ b/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/NetworkModule.java
@@ -1,6 +1,5 @@
package com.pixlee.pixleesdk.network;
-import android.os.Build;
import android.util.Log;
import com.orhanobut.logger.Logger;
@@ -116,18 +115,6 @@ public static synchronized OkHttpClient provideOkHttpClient() {
.readTimeout(timeout_read, TimeUnit.SECONDS)
.writeTimeout(timeout_write, TimeUnit.SECONDS);
- // enable Tls12 on Pre Lollipop
- try {
- if (Build.VERSION.SDK_INT < 21) {
- TLSSocketFactory tlsSocketFactory = new TLSSocketFactory();
- if (tlsSocketFactory.getTrustManager() != null) {
- ok.sslSocketFactory(tlsSocketFactory, tlsSocketFactory.getTrustManager());
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
diff --git a/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/TLSSocketFactory.java b/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/TLSSocketFactory.java
deleted file mode 100644
index 094250eb..00000000
--- a/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/TLSSocketFactory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.pixlee.pixleesdk.network;
-
-import androidx.annotation.Nullable;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.security.KeyManagementException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.util.Arrays;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-
-/**
- * Created by sungjun on 3/26/20.
- */
-public class TLSSocketFactory extends SSLSocketFactory {
-
- private SSLSocketFactory delegate;
- private TrustManager[] trustManagers;
-
- public TLSSocketFactory() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
- generateTrustManagers();
- SSLContext context = SSLContext.getInstance("TLS");
- context.init(null, trustManagers, null);
- delegate = context.getSocketFactory();
- }
-
- private void generateTrustManagers() throws KeyStoreException, NoSuchAlgorithmException {
- TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- trustManagerFactory.init((KeyStore) null);
- TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
-
- if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
- throw new IllegalStateException("Unexpected default trust managers:"
- + Arrays.toString(trustManagers));
- }
-
- this.trustManagers = trustManagers;
- }
-
-
- @Override
- public String[] getDefaultCipherSuites() {
- return delegate.getDefaultCipherSuites();
- }
-
- @Override
- public String[] getSupportedCipherSuites() {
- return delegate.getSupportedCipherSuites();
- }
-
- @Override
- public Socket createSocket() throws IOException {
- return enableTLSOnSocket(delegate.createSocket());
- }
-
- @Override
- public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException {
- return enableTLSOnSocket(delegate.createSocket(s, host, port, autoClose));
- }
-
- @Override
- public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
- return enableTLSOnSocket(delegate.createSocket(host, port));
- }
-
- @Override
- public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException {
- return enableTLSOnSocket(delegate.createSocket(host, port, localHost, localPort));
- }
-
- @Override
- public Socket createSocket(InetAddress host, int port) throws IOException {
- return enableTLSOnSocket(delegate.createSocket(host, port));
- }
-
- @Override
- public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException {
- return enableTLSOnSocket(delegate.createSocket(address, port, localAddress, localPort));
- }
-
- private Socket enableTLSOnSocket(Socket socket) {
- if(socket != null && (socket instanceof SSLSocket)) {
- ((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});
- }
- return socket;
- }
-
- @Nullable
- public X509TrustManager getTrustManager() {
- return (X509TrustManager) trustManagers[0];
- }
-}
diff --git a/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/adaptor/UploadedJsonAdapter.java b/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/adaptor/UploadedJsonAdapter.java
index d8dd5f9a..d298a0f0 100644
--- a/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/adaptor/UploadedJsonAdapter.java
+++ b/pixleesdk/src/main/java/com/pixlee/pixleesdk/network/adaptor/UploadedJsonAdapter.java
@@ -1,18 +1,13 @@
package com.pixlee.pixleesdk.network.adaptor;
-import android.util.Log;
-
import androidx.annotation.NonNull;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.gson.Gson;
import com.pixlee.pixleesdk.network.annotation.FieldUploadedJson;
import com.squareup.moshi.FromJson;
import com.squareup.moshi.JsonReader;
import com.squareup.moshi.ToJson;
-import org.json.JSONException;
import org.json.JSONObject;
public class UploadedJsonAdapter {
@@ -31,9 +26,7 @@ public JSONObject fromJson(@NonNull final JsonReader reader) throws Exception {
return reader.nextNull();
} else {
try {
- ObjectMapper mapper = new ObjectMapper();
- String data = mapper.writeValueAsString(reader.readJsonValue());
- return new JSONObject(data);
+ return new JSONObject(new Gson().toJson(reader.readJsonValue()));
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/pixleesdk/src/main/java/com/pixlee/pixleesdk/ui/widgets/PXLPhotoProductView.kt b/pixleesdk/src/main/java/com/pixlee/pixleesdk/ui/widgets/PXLPhotoProductView.kt
index d6f3e408..de0cb4b3 100644
--- a/pixleesdk/src/main/java/com/pixlee/pixleesdk/ui/widgets/PXLPhotoProductView.kt
+++ b/pixleesdk/src/main/java/com/pixlee/pixleesdk/ui/widgets/PXLPhotoProductView.kt
@@ -9,14 +9,12 @@ import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
-import android.view.animation.*
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.RelativeLayout
import androidx.annotation.ColorInt
import androidx.annotation.DrawableRes
import androidx.core.view.ViewCompat
-import androidx.core.view.doOnPreDraw
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
@@ -42,7 +40,6 @@ import com.pixlee.pixleesdk.util.HotspotsReader
import com.pixlee.pixleesdk.util.px
import com.pixlee.pixleesdk.util.setCompatIconWithColor
import kotlinx.coroutines.*
-import java.util.*
/**
@@ -153,7 +150,7 @@ class PXLPhotoProductView : FrameLayout, LifecycleObserver {
headerConfiguration.backButton?.apply {
binding.vBack.setOnClickListener { onClickListener?.let { it() } }
binding.vBack.background = GradientDrawable().apply {
- shape = android.graphics.drawable.GradientDrawable.OVAL
+ shape = GradientDrawable.OVAL
setColor(backgroundColor)
}
binding.vBack.setPadding(padding, padding, padding, padding)
@@ -171,7 +168,7 @@ class PXLPhotoProductView : FrameLayout, LifecycleObserver {
onCheckedListener?.let { it1 -> it1(isMutted) }
}
binding.vMute.background = GradientDrawable().apply {
- shape = android.graphics.drawable.GradientDrawable.OVAL
+ shape = GradientDrawable.OVAL
setColor(backgroundColor)
}
binding.vMute.setPadding(padding, padding, padding, padding)
@@ -276,7 +273,7 @@ class PXLPhotoProductView : FrameLayout, LifecycleObserver {
layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT)
setImageResource(R.drawable.outline_local_offer_black_24)
background = GradientDrawable().apply {
- shape = android.graphics.drawable.GradientDrawable.OVAL
+ shape = GradientDrawable.OVAL
setColor(Color.WHITE)
}
val padding = 10.px.toInt()
@@ -284,7 +281,7 @@ class PXLPhotoProductView : FrameLayout, LifecycleObserver {
ViewCompat.setElevation(this, 20f)
val position = reader.getHotspotsPosition(boundingBoxProduct)
apply {
- doOnPreDraw {
+ post {
x = position.x - (width.toFloat() / 2f)
y = position.y - (height.toFloat() / 2f)
}
diff --git a/pixleesdk/src/main/java/com/pixlee/pixleesdk/ui/widgets/PXLPhotoView.kt b/pixleesdk/src/main/java/com/pixlee/pixleesdk/ui/widgets/PXLPhotoView.kt
index 7c8aaf88..0ae0e46e 100644
--- a/pixleesdk/src/main/java/com/pixlee/pixleesdk/ui/widgets/PXLPhotoView.kt
+++ b/pixleesdk/src/main/java/com/pixlee/pixleesdk/ui/widgets/PXLPhotoView.kt
@@ -29,7 +29,6 @@ import com.google.android.exoplayer2.source.ProgressiveMediaSource
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector.ParametersBuilder
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
-import com.google.android.exoplayer2.ui.StyledPlayerView
import com.google.android.exoplayer2.upstream.DataSource
import com.google.android.exoplayer2.util.ErrorMessageProvider
import com.google.android.exoplayer2.util.EventLogger
diff --git a/pixleesdk/src/main/res/drawable/white_rounded.xml b/pixleesdk/src/main/res/drawable/white_rounded.xml
new file mode 100644
index 00000000..fe1b6aec
--- /dev/null
+++ b/pixleesdk/src/main/res/drawable/white_rounded.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
diff --git a/pixleesdk/src/main/res/layout/activity_video_viewer.xml b/pixleesdk/src/main/res/layout/activity_video_viewer.xml
deleted file mode 100644
index 12ae4645..00000000
--- a/pixleesdk/src/main/res/layout/activity_video_viewer.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pixleesdk/src/main/res/layout/item_product.xml b/pixleesdk/src/main/res/layout/item_product.xml
index 0c4618fb..a7c9199a 100644
--- a/pixleesdk/src/main/res/layout/item_product.xml
+++ b/pixleesdk/src/main/res/layout/item_product.xml
@@ -1,11 +1,10 @@
-
-
+
diff --git a/pixleesdk/src/main/res/values-night/themes.xml b/pixleesdk/src/main/res/values-night/themes.xml
index 4b97013d..9224640d 100644
--- a/pixleesdk/src/main/res/values-night/themes.xml
+++ b/pixleesdk/src/main/res/values-night/themes.xml
@@ -19,17 +19,8 @@
diff --git a/pixleesdk/src/main/res/values/styles.xml b/pixleesdk/src/main/res/values/styles.xml
deleted file mode 100644
index 2eae5433..00000000
--- a/pixleesdk/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
diff --git a/pixleesdk/src/main/res/values/themes.xml b/pixleesdk/src/main/res/values/themes.xml
index 5a3079b8..a51e0431 100644
--- a/pixleesdk/src/main/res/values/themes.xml
+++ b/pixleesdk/src/main/res/values/themes.xml
@@ -15,38 +15,13 @@
~ limitations under the License.
-->
-
-
-
\ No newline at end of file
diff --git a/simpleapp/src/main/res/values/styles.xml b/simpleapp/src/main/res/values/styles.xml
index 1ec9f547..a461db8a 100644
--- a/simpleapp/src/main/res/values/styles.xml
+++ b/simpleapp/src/main/res/values/styles.xml
@@ -1,6 +1,6 @@
-
-
-
-
@@ -23,6 +16,6 @@
-
-
+
+
\ No newline at end of file