Skip to content

Commit

Permalink
chore: add pinpoint-core package (#165)
Browse files Browse the repository at this point in the history
* fix service class notification handling

* add pinpoint core package
  • Loading branch information
div5yesh authored Mar 14, 2023
1 parent 398b148 commit 58ca09d
Show file tree
Hide file tree
Showing 51 changed files with 154 additions and 159 deletions.
4 changes: 0 additions & 4 deletions aws-analytics-pinpoint-targeting/gradle.properties

This file was deleted.

2 changes: 1 addition & 1 deletion aws-analytics-pinpoint/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ group = properties["POM_GROUP"].toString()

dependencies {
implementation(project(":core"))
implementation(project(":aws-analytics-pinpoint-targeting"))
implementation(project(":aws-pinpoint-core"))

implementation(dependency.androidx.appcompat)
implementation(dependency.aws.pinpoint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ import com.amplifyframework.analytics.AnalyticsEvent
import com.amplifyframework.analytics.AnalyticsProperties
import com.amplifyframework.analytics.UserProfile
import com.amplifyframework.analytics.pinpoint.models.AWSPinpointUserProfile
import com.amplifyframework.analytics.pinpoint.targeting.endpointProfile.EndpointProfile
import com.amplifyframework.auth.AuthPlugin
import com.amplifyframework.auth.cognito.AWSCognitoAuthPlugin
import com.amplifyframework.core.Amplify
import com.amplifyframework.hub.HubChannel
import com.amplifyframework.hub.HubEvent
import com.amplifyframework.logging.AndroidLoggingPlugin
import com.amplifyframework.logging.LogLevel
import com.amplifyframework.pinpoint.core.endpointProfile.EndpointProfile
import com.amplifyframework.testutils.HubAccumulator
import com.amplifyframework.testutils.Resources
import com.amplifyframework.testutils.Sleep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint

import com.amplifyframework.analytics.AnalyticsBooleanProperty
Expand All @@ -22,8 +23,8 @@ import com.amplifyframework.analytics.AnalyticsIntegerProperty
import com.amplifyframework.analytics.AnalyticsProperties
import com.amplifyframework.analytics.AnalyticsStringProperty
import com.amplifyframework.analytics.UserProfile
import com.amplifyframework.analytics.pinpoint.targeting.AnalyticsClient
import com.amplifyframework.analytics.pinpoint.targeting.TargetingClient
import com.amplifyframework.pinpoint.core.AnalyticsClient
import com.amplifyframework.pinpoint.core.TargetingClient

internal class AWSPinpointAnalyticsPluginBehavior(
private val analyticsClient: AnalyticsClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ package com.amplifyframework.analytics.pinpoint
import android.content.Context
import aws.sdk.kotlin.services.pinpoint.PinpointClient
import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider
import com.amplifyframework.analytics.pinpoint.targeting.AnalyticsClient
import com.amplifyframework.analytics.pinpoint.targeting.TargetingClient
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidAppDetails
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidDeviceDetails
import com.amplifyframework.analytics.pinpoint.targeting.database.PinpointDatabase
import com.amplifyframework.analytics.pinpoint.targeting.util.getUniqueId
import com.amplifyframework.pinpoint.core.AnalyticsClient
import com.amplifyframework.pinpoint.core.TargetingClient
import com.amplifyframework.pinpoint.core.data.AndroidAppDetails
import com.amplifyframework.pinpoint.core.data.AndroidDeviceDetails
import com.amplifyframework.pinpoint.core.database.PinpointDatabase
import com.amplifyframework.pinpoint.core.util.getUniqueId

/**
* PinpointManager is the entry point to Pinpoint Analytics and Targeting.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import com.amplifyframework.analytics.AnalyticsProperties;
import com.amplifyframework.analytics.UserProfile;
import com.amplifyframework.analytics.pinpoint.targeting.models.AWSPinpointUserProfileBehavior;
import com.amplifyframework.pinpoint.core.models.AWSPinpointUserProfileBehavior;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import androidx.test.core.app.ApplicationProvider
import com.amplifyframework.analytics.AnalyticsEvent
import com.amplifyframework.analytics.AnalyticsProperties
import com.amplifyframework.analytics.pinpoint.models.AWSPinpointUserProfile
import com.amplifyframework.analytics.pinpoint.targeting.AnalyticsClient
import com.amplifyframework.analytics.pinpoint.targeting.TargetingClient
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidAppDetails
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidDeviceDetails
import com.amplifyframework.analytics.pinpoint.targeting.endpointProfile.EndpointProfile
import com.amplifyframework.analytics.pinpoint.targeting.models.PinpointEvent
import com.amplifyframework.analytics.pinpoint.targeting.models.PinpointSession
import com.amplifyframework.analytics.pinpoint.targeting.models.SDKInfo
import com.amplifyframework.analytics.pinpoint.targeting.util.getUniqueId
import com.amplifyframework.pinpoint.core.AnalyticsClient
import com.amplifyframework.pinpoint.core.TargetingClient
import com.amplifyframework.pinpoint.core.data.AndroidAppDetails
import com.amplifyframework.pinpoint.core.data.AndroidDeviceDetails
import com.amplifyframework.pinpoint.core.endpointProfile.EndpointProfile
import com.amplifyframework.pinpoint.core.models.PinpointEvent
import com.amplifyframework.pinpoint.core.models.PinpointSession
import com.amplifyframework.pinpoint.core.models.SDKInfo
import com.amplifyframework.pinpoint.core.util.getUniqueId
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkStatic
Expand All @@ -52,7 +52,7 @@ class AWSPinpointAnalyticsPluginBehaviorTest {

@Before
fun setup() {
mockkStatic("com.amplifyframework.analytics.pinpoint.targeting.util.SharedPreferencesUtilKt")
mockkStatic("com.amplifyframework.pinpoint.core.util.SharedPreferencesUtilKt")
every { sharedPrefs.getUniqueId() }.answers { "UNIQUE_ID" }

awsPinpointAnalyticsPluginBehavior = AWSPinpointAnalyticsPluginBehavior(
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions aws-pinpoint-core/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=aws-pinpoint-core
POM_NAME=Amplify Framework for Android - Pinpoint Core
POM_DESCRIPTION=Amplify Framework for Android - Shared Core Implementation for Amazon Pinpoint
POM_PACKAGING=aar
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
permissions and limitations under the License.
-->

<manifest package="com.amplifyframework.analytics.pinpoint.targeting" />
<manifest package="com.amplifyframework.pinpoint.core" />
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting
package com.amplifyframework.pinpoint.core

import android.app.Application
import android.content.Context
import androidx.annotation.RestrictTo
import aws.sdk.kotlin.services.pinpoint.PinpointClient
import com.amplifyframework.analytics.AnalyticsChannelEventName
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidAppDetails
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidDeviceDetails
import com.amplifyframework.analytics.pinpoint.targeting.database.PinpointDatabase
import com.amplifyframework.analytics.pinpoint.targeting.models.PinpointEvent
import com.amplifyframework.analytics.pinpoint.targeting.models.PinpointSession
import com.amplifyframework.analytics.pinpoint.targeting.models.SDKInfo
import com.amplifyframework.core.Amplify
import com.amplifyframework.core.BuildConfig
import com.amplifyframework.hub.HubChannel
import com.amplifyframework.hub.HubEvent
import com.amplifyframework.pinpoint.core.data.AndroidAppDetails
import com.amplifyframework.pinpoint.core.data.AndroidDeviceDetails
import com.amplifyframework.pinpoint.core.database.PinpointDatabase
import com.amplifyframework.pinpoint.core.models.PinpointEvent
import com.amplifyframework.pinpoint.core.models.PinpointSession
import com.amplifyframework.pinpoint.core.models.SDKInfo
import com.amplifyframework.util.UserAgent
import java.util.UUID
import java.util.concurrent.ConcurrentHashMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting;
package com.amplifyframework.pinpoint.core;

import android.os.Handler;
import android.os.HandlerThread;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting;
package com.amplifyframework.pinpoint.core;

import android.app.Activity;
import android.app.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amplifyframework.analytics.pinpoint.targeting
package com.amplifyframework.pinpoint.core

import android.content.Context
import android.database.Cursor
Expand All @@ -31,13 +31,13 @@ import aws.sdk.kotlin.services.pinpoint.model.PublicEndpoint
import aws.sdk.kotlin.services.pinpoint.model.PutEventsRequest
import aws.sdk.kotlin.services.pinpoint.model.Session
import com.amplifyframework.analytics.AnalyticsEvent
import com.amplifyframework.analytics.pinpoint.targeting.database.EventTable
import com.amplifyframework.analytics.pinpoint.targeting.database.PinpointDatabase
import com.amplifyframework.analytics.pinpoint.targeting.endpointProfile.EndpointProfile
import com.amplifyframework.analytics.pinpoint.targeting.models.PinpointEvent
import com.amplifyframework.analytics.pinpoint.targeting.util.millisToIsoDate
import com.amplifyframework.core.Amplify
import com.amplifyframework.logging.Logger
import com.amplifyframework.pinpoint.core.database.EventTable
import com.amplifyframework.pinpoint.core.database.PinpointDatabase
import com.amplifyframework.pinpoint.core.endpointProfile.EndpointProfile
import com.amplifyframework.pinpoint.core.models.PinpointEvent
import com.amplifyframework.pinpoint.core.util.millisToIsoDate
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amplifyframework.analytics.pinpoint.targeting
package com.amplifyframework.pinpoint.core

import android.content.Context
import androidx.annotation.RestrictTo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting
package com.amplifyframework.pinpoint.core

import android.content.Context
import androidx.annotation.RestrictTo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amplifyframework.analytics.pinpoint.targeting
package com.amplifyframework.pinpoint.core

import android.content.Context
import android.content.SharedPreferences
Expand All @@ -29,16 +29,16 @@ import com.amplifyframework.analytics.AnalyticsIntegerProperty
import com.amplifyframework.analytics.AnalyticsPropertyBehavior
import com.amplifyframework.analytics.AnalyticsStringProperty
import com.amplifyframework.analytics.UserProfile
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidAppDetails
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidDeviceDetails
import com.amplifyframework.analytics.pinpoint.targeting.endpointProfile.EndpointProfile
import com.amplifyframework.analytics.pinpoint.targeting.endpointProfile.EndpointProfileLocation
import com.amplifyframework.analytics.pinpoint.targeting.endpointProfile.EndpointProfileUser
import com.amplifyframework.analytics.pinpoint.targeting.models.AWSPinpointUserProfileBehavior
import com.amplifyframework.analytics.pinpoint.targeting.util.getUniqueId
import com.amplifyframework.analytics.pinpoint.targeting.util.millisToIsoDate
import com.amplifyframework.analytics.pinpoint.targeting.util.putString
import com.amplifyframework.core.Amplify
import com.amplifyframework.pinpoint.core.data.AndroidAppDetails
import com.amplifyframework.pinpoint.core.data.AndroidDeviceDetails
import com.amplifyframework.pinpoint.core.endpointProfile.EndpointProfile
import com.amplifyframework.pinpoint.core.endpointProfile.EndpointProfileLocation
import com.amplifyframework.pinpoint.core.endpointProfile.EndpointProfileUser
import com.amplifyframework.pinpoint.core.models.AWSPinpointUserProfileBehavior
import com.amplifyframework.pinpoint.core.util.getUniqueId
import com.amplifyframework.pinpoint.core.util.millisToIsoDate
import com.amplifyframework.pinpoint.core.util.putString
import java.util.concurrent.ConcurrentHashMap
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting.data
package com.amplifyframework.pinpoint.core.data

import android.content.Context
import androidx.annotation.RestrictTo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting.data
package com.amplifyframework.pinpoint.core.data

import android.content.Context
import android.os.Build
import android.telephony.TelephonyManager
import androidx.annotation.RestrictTo
import com.amplifyframework.analytics.pinpoint.targeting.util.LocaleSerializer
import com.amplifyframework.pinpoint.core.util.LocaleSerializer
import java.util.Locale
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting.database
package com.amplifyframework.pinpoint.core.database

import android.database.sqlite.SQLiteDatabase
import androidx.annotation.RestrictTo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting.database
package com.amplifyframework.pinpoint.core.database

import android.content.ContentValues
import android.content.Context
Expand All @@ -23,7 +23,7 @@ import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteQueryBuilder
import android.net.Uri
import androidx.annotation.RestrictTo
import com.amplifyframework.analytics.pinpoint.targeting.models.PinpointEvent
import com.amplifyframework.pinpoint.core.models.PinpointEvent
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting.database
package com.amplifyframework.pinpoint.core.database

import android.content.Context
import android.database.sqlite.SQLiteDatabase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* permissions and limitations under the License.
*
*/
package com.amplifyframework.analytics.pinpoint.targeting.endpointProfile
package com.amplifyframework.pinpoint.core.endpointProfile

import android.content.Context
import androidx.annotation.RestrictTo
import aws.sdk.kotlin.services.pinpoint.model.ChannelType
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidAppDetails
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidDeviceDetails
import com.amplifyframework.analytics.pinpoint.targeting.util.millisToIsoDate
import com.amplifyframework.core.Amplify
import com.amplifyframework.pinpoint.core.data.AndroidAppDetails
import com.amplifyframework.pinpoint.core.data.AndroidDeviceDetails
import com.amplifyframework.pinpoint.core.util.millisToIsoDate
import java.util.Collections
import java.util.MissingResourceException
import java.util.concurrent.ConcurrentHashMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* permissions and limitations under the License.
*
*/
package com.amplifyframework.analytics.pinpoint.targeting.endpointProfile
package com.amplifyframework.pinpoint.core.endpointProfile

import android.os.Build
import androidx.annotation.RestrictTo
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidAppDetails
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidDeviceDetails
import com.amplifyframework.pinpoint.core.data.AndroidAppDetails
import com.amplifyframework.pinpoint.core.data.AndroidDeviceDetails
import java.util.TimeZone
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*
*/
package com.amplifyframework.analytics.pinpoint.targeting.endpointProfile
package com.amplifyframework.pinpoint.core.endpointProfile

import androidx.annotation.RestrictTo
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*
*/
package com.amplifyframework.analytics.pinpoint.targeting.endpointProfile
package com.amplifyframework.pinpoint.core.endpointProfile

import androidx.annotation.RestrictTo
import java.util.concurrent.ConcurrentHashMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package com.amplifyframework.analytics.pinpoint.targeting.models
package com.amplifyframework.pinpoint.core.models

import androidx.annotation.RestrictTo
import com.amplifyframework.analytics.AnalyticsProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amplifyframework.analytics.pinpoint.targeting.models
package com.amplifyframework.pinpoint.core.models

import androidx.annotation.RestrictTo
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidAppDetails
import com.amplifyframework.analytics.pinpoint.targeting.data.AndroidDeviceDetails
import com.amplifyframework.pinpoint.core.data.AndroidAppDetails
import com.amplifyframework.pinpoint.core.data.AndroidDeviceDetails
import java.util.UUID
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
Expand Down
Loading

0 comments on commit 58ca09d

Please sign in to comment.