Skip to content

Commit

Permalink
Release 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cristidregan committed Feb 3, 2023
1 parent 1d5b507 commit a0fd758
Show file tree
Hide file tree
Showing 53 changed files with 302 additions and 461 deletions.
53 changes: 0 additions & 53 deletions OmetriaSDK/build.gradle

This file was deleted.

55 changes: 55 additions & 0 deletions OmetriaSDK/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
val versionName = "1.4.1"

plugins {
id("com.android.library")
id("kotlin-android")
}

android {
compileSdk = 31

defaultConfig {
minSdk = 21
targetSdk = 29
}

buildTypes {
debug {
buildConfigField("String", "SDK_VERSION_NAME", "\"$versionName\"")
}
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
buildConfigField("String", "SDK_VERSION_NAME", "\"$versionName\"")
}
}
}

val kotlinVersion = rootProject.extra.get("kotlin_version") as String

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

// Android Core
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
implementation("androidx.core:core-ktx:1.8.0")
implementation("androidx.appcompat:appcompat:1.4.2")

// Lifecycle
implementation("androidx.lifecycle:lifecycle-process:2.5.1")
implementation("androidx.lifecycle:lifecycle-common-java8:2.5.1")

// Add the SDK for Firebase Cloud Messaging
implementation("com.google.firebase:firebase-messaging:23.0.8")
}

// Publishing
extra.apply {
set("PUBLISH_GROUP_ID", "com.ometria")
set("PUBLISH_ARTIFACT_ID", "android-sdk")
set("PUBLISH_VERSION", versionName)
}

apply("${rootProject.projectDir}/scripts/publish-mavencentral.gradle")
2 changes: 1 addition & 1 deletion OmetriaSDK/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion OmetriaSDK/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<uses-permission android:name="android.permission.INTERNET" />

<application>
<receiver android:name=".notification.PushClickBroadcastReceiver" />
<activity android:name=".notification.NotificationInteractionActivity"/>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package com.android.ometriasdk.core

/**
* Created by cristiandregan
* on 14/08/2020.
*/

internal object Constants {
object Date {
const val API_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
Expand Down
15 changes: 10 additions & 5 deletions OmetriaSDK/src/main/java/com/android/ometriasdk/core/LocalCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import com.android.ometriasdk.core.event.OmetriaEvent
import com.android.ometriasdk.core.network.toJson
import com.android.ometriasdk.core.network.toOmetriaEventList

/**
* Created by cristiandregan
* on 24/07/2020.
*/

private const val LOCAL_CACHE_PREFERENCES = "LOCAL_CACHE_PREFERENCES"
private const val IS_FIRST_APP_RUN_KEY = "IS_FIRST_APP_RUN_KEY"
private const val INSTALLATION_ID_KEY = "INSTALLATION_ID_KEY"
Expand All @@ -19,6 +14,7 @@ private const val PUSH_TOKEN_KEY = "PUSH_TOKEN_KEY"
private const val CUSTOMER_ID_KEY = "CUSTOMER_ID_KEY"
private const val EMAIL_KEY = "EMAIL_KEY"
private const val ARE_NOTIFICATIONS_ENABLED_KEY = "ARE_NOTIFICATIONS_ENABLED_KEY"
private const val IS_FIRST_PERMISSION_UPDATE_EVENT_KEY = "IS_FIRST_PERMISSION_UPDATE_EVENT_KEY"
private const val JSON_ARRAY = "[]"
private const val SDK_VERSION_RN_KEY = "SDK_VERSION_RN_KEY"

Expand Down Expand Up @@ -130,6 +126,15 @@ internal class LocalCache(private val context: Context) {
return getLocalCachePreferences().getBoolean(ARE_NOTIFICATIONS_ENABLED_KEY, true)
}

fun saveIsFirstPermissionsUpdateEvent(isFirstPermissionsUpdateEvent: Boolean) {
getLocalCachePreferences().edit()
.putBoolean(IS_FIRST_PERMISSION_UPDATE_EVENT_KEY, isFirstPermissionsUpdateEvent).apply()
}

fun isFirstPermissionsUpdateEvent(): Boolean {
return getLocalCachePreferences().getBoolean(IS_FIRST_PERMISSION_UPDATE_EVENT_KEY, true)
}

fun getSdkVersionRN(): String? {
return getLocalCachePreferences().getString(SDK_VERSION_RN_KEY, null)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ package com.android.ometriasdk.core

import android.util.Log

/**
* Created by cristiandregan
* on 20/07/2020.
*/

const val VERBOSE = 2
const val DEBUG = 3
const val INFO = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ import com.android.ometriasdk.notification.OmetriaNotificationInteractionHandler
import com.google.firebase.messaging.RemoteMessage
import java.util.*

/**
* Created by cristiandregan
* on 08/07/2020.
*/

/**
* The primary class that allows instantiating and integrating Ometria in your application
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ package com.android.ometriasdk.core

import android.app.Application

/**
* Created by cristiandregan
* on 16/07/2020.
*/

internal class OmetriaConfig(
var apiToken: String,
var application: Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ import java.net.HttpURLConnection
import java.net.MalformedURLException
import java.net.URL

/**
* Created by cristiandregan
* on 06/08/2020.
*/

private const val TOO_MANY_REQUESTS_STATUS_CODE = 429

internal class Repository(
Expand Down Expand Up @@ -116,10 +111,13 @@ internal class Repository(

fun saveAreNotificationsEnabled(areNotificationsEnabled: Boolean) {
localCache.saveAreNotificationsEnabled(areNotificationsEnabled)
localCache.saveIsFirstPermissionsUpdateEvent(false)
}

fun areNotificationsEnabled(): Boolean = localCache.areNotificationsEnabled()

fun isFirstPermissionsUpdateEvent(): Boolean = localCache.isFirstPermissionsUpdateEvent()

fun getRedirectForUrl(url: String, listener: ProcessAppLinkListener) {
executor.execute {
var urlTemp: URL? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.*

/**
* Created by cristiandregan
* on 28/07/2020.
*/

/**
* @return A hashcode used to compare and group cached events in batches when performing flush.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ import java.text.SimpleDateFormat
import java.util.*
import java.util.concurrent.TimeUnit

/**
* Created by cristiandregan
* on 27/07/2020.
*/

private const val FLUSH_LIMIT = 10
private const val BATCH_LIMIT = 100
private const val THROTTLE_LIMIT = 10L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package com.android.ometriasdk.core.event

/**
* Created by cristiandregan
* on 12/08/2020.
*/

/**
* An object that describes the contents of a shopping basket.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package com.android.ometriasdk.core.event

/**
* Created by cristiandregan
* on 12/08/2020.
*/

/**
* An object representing one entry of a particular item in a basket. It can have its own price and
* quantity based on different rules and promotions that are being applied.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ import com.android.ometriasdk.BuildConfig
import com.android.ometriasdk.core.Constants.Common.PLATFORM
import java.util.*

/**
* Created by cristiandregan
* on 17/07/2020.
*/

internal data class OmetriaEvent(
val eventId: String,
var isBeingFlushed: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package com.android.ometriasdk.core.event

/**
* Created by cristiandregan
* on 24/07/2020.
*/

internal enum class OmetriaEventType(var id: String) {
// Application related events
APP_INSTALLED("appInstalled"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import java.io.*
import java.net.HttpURLConnection
import java.nio.charset.Charset

/**
* Created by cristiandregan
* on 20/08/2020.
*/

private const val ERROR_RESPONSE_CODE_START_RANGE = 300
private const val SUCCESS_RESPONSE_CODE_START_RANGE = 200
private const val SUCCESS_RESPONSE_CODE_END_RANGE = 299
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import java.net.MalformedURLException
import java.net.URL
import java.util.concurrent.TimeUnit

/**
* Created by cristiandregan
* on 20/08/2020.
*/

private const val POST = "POST"
private const val TIMEOUT_IN_SECONDS = 30L

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject

/**
* Created by cristiandregan
* on 21/08/2020.
*/

internal fun String.toOmetriaEventList(): MutableList<OmetriaEvent> {
val jsonArray = JSONArray(this)
val ometriaEventArray = mutableListOf<OmetriaEvent>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ import com.android.ometriasdk.notification.OmetriaNotificationBody
import org.json.JSONArray
import org.json.JSONObject

/**
* Created by cristiandregan
* on 21/08/2020.
*/

internal fun Collection<OmetriaEvent>.toJson(): JSONArray {
val jsonArray = JSONArray()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package com.android.ometriasdk.core.network.model


/**
* Created by cristiandregan
* on 07/08/2020.
*/

internal data class OmetriaApiError(
val detail: String? = null,
val status: Int? = null,
Expand Down
Loading

0 comments on commit a0fd758

Please sign in to comment.