From 29b29eda6aa6fa5dbace49bf36f2927e2ffd7152 Mon Sep 17 00:00:00 2001 From: praveek Date: Wed, 31 Jan 2024 18:35:25 -0800 Subject: [PATCH 1/5] Clean up gradle scripts and use AEP Gradle plugin --- code/build.gradle | 50 ---- code/build.gradle.kts | 18 ++ code/checkstyle.gradle | 28 --- code/checkstyle.xml | 23 -- code/codeformat.gradle | 20 -- code/core/build.gradle | 152 ------------ code/core/build.gradle.kts | 45 ++++ ...-proguard-rules.pro => consumer-rules.pro} | 0 code/core/gradle.properties | 1 - code/core/release.gradle | 116 --------- code/core/src/main/AndroidManifest.xml | 3 +- code/gradle.properties | 9 - code/gradle/wrapper/gradle-wrapper.properties | 2 +- code/identity/build.gradle | 186 --------------- code/identity/build.gradle.kts | 27 +++ code/identity/src/main/AndroidManifest.xml | 3 +- .../identity/IdentityFunctionalTests.kt | 2 +- code/integration-tests/build.gradle | 63 ----- code/integration-tests/build.gradle.kts | 63 +++++ code/integration-tests/consumer-rules.pro | 0 code/integration-tests/proguard-rules.pro | 21 -- .../identity/IdentityIntegrationTests.kt | 39 ++-- code/jacoco.gradle | 43 ---- code/lifecycle/build.gradle | 179 -------------- code/lifecycle/build.gradle.kts | 27 +++ code/lifecycle/src/main/AndroidManifest.xml | 3 +- code/macrobenchmark/build.gradle | 53 ----- code/macrobenchmark/build.gradle.kts | 55 +++++ .../src/main/AndroidManifest.xml | 3 +- code/microbenchmark/build.gradle | 57 ----- code/microbenchmark/build.gradle.kts | 53 +++++ code/proguard-rules.pro | 21 -- code/settings.gradle | 20 -- code/settings.gradle.kts | 32 +++ code/signal/build.gradle | 178 -------------- code/signal/build.gradle.kts | 28 +++ code/signal/src/main/AndroidManifest.xml | 3 +- code/test-third-party-extension/build.gradle | 22 -- .../build.gradle.kts | 26 +++ .../proguard-rules.pro | 21 -- .../src/main/AndroidManifest.xml | 3 +- code/testapp-kotlin/build.gradle | 84 ------- code/testapp-kotlin/proguard-rules.pro | 21 -- .../app/kotlin/ExampleInstrumentedTest.kt | 34 --- .../src/main/AndroidManifest.xml | 31 --- .../src/main/assets/ADBMobileConfig.json | 8 - .../drawable-v24/ic_launcher_foreground.xml | 30 --- .../res/drawable/ic_launcher_background.xml | 170 -------------- .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 - .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 - .../src/main/res/values/colors.xml | 10 - .../src/main/res/values/strings.xml | 3 - code/{testapp-kotlin => testapp}/.gitignore | 0 code/testapp/build.gradle | 71 ------ code/testapp/build.gradle.kts | 81 +++++++ code/testapp/proguard-rules.pro | 2 +- .../src/androidTest/AndroidManifest.xml | 11 - .../marketing/mobile/PerformanceTest.java | 87 ------- .../testapp/UIServicesInstrumentedTest.java | 196 ---------------- code/testapp/src/main/AndroidManifest.xml | 19 +- .../src/main/assets/ADBMobileConfig-rules.zip | Bin .../src/main/assets/ADBMobileConfig.json | 20 +- .../mobile/core/testapp}/CoreView.kt | 88 ++++--- .../mobile/core/testapp}/HomeView.kt | 8 +- .../mobile/core/testapp}/IdentityView.kt | 2 +- .../mobile/core/testapp}/LifecycleView.kt | 14 +- .../mobile/core/testapp}/MainActivity.kt | 21 +- .../marketing/mobile/core/testapp}/MyApp.kt | 10 +- .../mobile/core/testapp}/NavRoutes.kt | 4 +- .../mobile/core/testapp}/PerformanceView.kt | 7 +- .../mobile/core/testapp}/ServicesView.kt | 18 +- .../mobile/core/testapp}/SignalView.kt | 15 +- .../mobile/core/testapp}/Utilities.kt | 32 +-- .../core/testapp}/extension/PerfExtension.kt | 2 +- .../core/testapp/ui}/alert/AlertCard.kt | 2 +- .../core/testapp/ui}/alert/AlertCreator.kt | 2 +- .../ui}/floatingbutton/FloatingButtonCard.kt | 2 +- .../floatingbutton/FloatingButtonCreator.kt | 4 +- .../ui}/inappmessage/InAppMessageCard.kt | 2 +- .../ui}/inappmessage/InAppMessageCreator.kt | 2 +- .../mobile/core/testapp}/ui/theme/Color.kt | 2 +- .../mobile/core/testapp}/ui/theme/Shape.kt | 2 +- .../mobile/core/testapp}/ui/theme/Theme.kt | 4 +- .../mobile/core/testapp}/ui/theme/Type.kt | 2 +- .../mobile/services/ui/TestAppUIServices.java | 66 ------ .../com/adobe/testapp/ExtensionFragment.java | 123 ---------- .../java/com/adobe/testapp/MainActivity.java | 56 ----- .../com/adobe/testapp/MobileCoreFragment.java | 220 ------------------ .../java/com/adobe/testapp/PagerAdapter.java | 48 ---- .../testapp/PlatformServicesFragment.java | 88 ------- .../java/com/adobe/testapp/RootFragment.java | 36 --- .../main/java/com/adobe/testapp/TestApp.java | 54 ----- .../com/adobe/testapp/UIServicesFragment.java | 74 ------ .../res/drawable-v24/ic_floating_button.xml | 0 .../drawable-v24/ic_launcher_foreground.xml | 26 +-- .../res/drawable/ic_launcher_background.xml | 134 +++++------ .../src/main/res/layout/activity_main.xml | 52 ----- .../main/res/layout/fragment_extension.xml | 119 ---------- .../main/res/layout/fragment_mobile_core.xml | 196 ---------------- .../res/layout/fragment_platform_services.xml | 29 --- .../src/main/res/layout/fragment_root.xml | 7 - .../main/res/layout/fragment_ui_services.xml | 135 ----------- .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3056 -> 0 bytes .../src/main/res/mipmap-hdpi/ic_launcher.webp | Bin .../res/mipmap-hdpi/ic_launcher_round.png | Bin 5024 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2096 -> 0 bytes .../src/main/res/mipmap-mdpi/ic_launcher.webp | Bin .../res/mipmap-mdpi/ic_launcher_round.png | Bin 2858 -> 0 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4569 -> 0 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 7098 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 6464 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 10676 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 9250 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 15523 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin code/testapp/src/main/res/values/colors.xml | 12 +- code/testapp/src/main/res/values/strings.xml | 16 +- code/testapp/src/main/res/values/styles.xml | 11 - .../src/main/res/values/themes.xml | 2 +- .../com/adobe/testapp/ExampleUnitTest.java | 27 --- 127 files changed, 715 insertions(+), 3647 deletions(-) delete mode 100644 code/build.gradle create mode 100644 code/build.gradle.kts delete mode 100644 code/checkstyle.gradle delete mode 100644 code/checkstyle.xml delete mode 100644 code/codeformat.gradle delete mode 100644 code/core/build.gradle create mode 100644 code/core/build.gradle.kts rename code/core/{lib-proguard-rules.pro => consumer-rules.pro} (100%) delete mode 100644 code/core/gradle.properties delete mode 100644 code/core/release.gradle delete mode 100644 code/identity/build.gradle create mode 100644 code/identity/build.gradle.kts delete mode 100644 code/integration-tests/build.gradle create mode 100644 code/integration-tests/build.gradle.kts delete mode 100644 code/integration-tests/consumer-rules.pro delete mode 100644 code/integration-tests/proguard-rules.pro delete mode 100644 code/jacoco.gradle delete mode 100644 code/lifecycle/build.gradle create mode 100644 code/lifecycle/build.gradle.kts delete mode 100644 code/macrobenchmark/build.gradle create mode 100644 code/macrobenchmark/build.gradle.kts delete mode 100644 code/microbenchmark/build.gradle create mode 100644 code/microbenchmark/build.gradle.kts delete mode 100644 code/proguard-rules.pro delete mode 100644 code/settings.gradle create mode 100644 code/settings.gradle.kts delete mode 100644 code/signal/build.gradle create mode 100644 code/signal/build.gradle.kts delete mode 100644 code/test-third-party-extension/build.gradle create mode 100644 code/test-third-party-extension/build.gradle.kts delete mode 100644 code/test-third-party-extension/proguard-rules.pro delete mode 100644 code/testapp-kotlin/build.gradle delete mode 100644 code/testapp-kotlin/proguard-rules.pro delete mode 100644 code/testapp-kotlin/src/androidTest/java/com/adobe/marketing/mobile/app/kotlin/ExampleInstrumentedTest.kt delete mode 100644 code/testapp-kotlin/src/main/AndroidManifest.xml delete mode 100644 code/testapp-kotlin/src/main/assets/ADBMobileConfig.json delete mode 100644 code/testapp-kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml delete mode 100644 code/testapp-kotlin/src/main/res/drawable/ic_launcher_background.xml delete mode 100644 code/testapp-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml delete mode 100644 code/testapp-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml delete mode 100644 code/testapp-kotlin/src/main/res/values/colors.xml delete mode 100644 code/testapp-kotlin/src/main/res/values/strings.xml rename code/{testapp-kotlin => testapp}/.gitignore (100%) delete mode 100644 code/testapp/build.gradle create mode 100644 code/testapp/build.gradle.kts delete mode 100644 code/testapp/src/androidTest/AndroidManifest.xml delete mode 100644 code/testapp/src/androidTest/java/com/adobe/marketing/mobile/PerformanceTest.java delete mode 100644 code/testapp/src/androidTest/java/com/adobe/testapp/UIServicesInstrumentedTest.java rename code/{testapp-kotlin => testapp}/src/main/assets/ADBMobileConfig-rules.zip (100%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/CoreView.kt (73%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/HomeView.kt (91%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/IdentityView.kt (98%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/LifecycleView.kt (69%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/MainActivity.kt (85%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/MyApp.kt (80%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/NavRoutes.kt (90%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/PerformanceView.kt (91%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/ServicesView.kt (75%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/SignalView.kt (69%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/Utilities.kt (69%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/extension/PerfExtension.kt (97%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui}/alert/AlertCard.kt (96%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui}/alert/AlertCreator.kt (95%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui}/floatingbutton/FloatingButtonCard.kt (96%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui}/floatingbutton/FloatingButtonCreator.kt (93%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui}/inappmessage/InAppMessageCard.kt (96%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui}/inappmessage/InAppMessageCreator.kt (98%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/ui/theme/Color.kt (93%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/ui/theme/Shape.kt (93%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/ui/theme/Theme.kt (95%) rename code/{testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin => testapp/src/main/java/com/adobe/marketing/mobile/core/testapp}/ui/theme/Type.kt (96%) delete mode 100644 code/testapp/src/main/java/com/adobe/marketing/mobile/services/ui/TestAppUIServices.java delete mode 100644 code/testapp/src/main/java/com/adobe/testapp/ExtensionFragment.java delete mode 100644 code/testapp/src/main/java/com/adobe/testapp/MainActivity.java delete mode 100644 code/testapp/src/main/java/com/adobe/testapp/MobileCoreFragment.java delete mode 100644 code/testapp/src/main/java/com/adobe/testapp/PagerAdapter.java delete mode 100644 code/testapp/src/main/java/com/adobe/testapp/PlatformServicesFragment.java delete mode 100644 code/testapp/src/main/java/com/adobe/testapp/RootFragment.java delete mode 100644 code/testapp/src/main/java/com/adobe/testapp/TestApp.java delete mode 100644 code/testapp/src/main/java/com/adobe/testapp/UIServicesFragment.java rename code/{testapp-kotlin => testapp}/src/main/res/drawable-v24/ic_floating_button.xml (100%) delete mode 100644 code/testapp/src/main/res/layout/activity_main.xml delete mode 100644 code/testapp/src/main/res/layout/fragment_extension.xml delete mode 100644 code/testapp/src/main/res/layout/fragment_mobile_core.xml delete mode 100644 code/testapp/src/main/res/layout/fragment_platform_services.xml delete mode 100644 code/testapp/src/main/res/layout/fragment_root.xml delete mode 100644 code/testapp/src/main/res/layout/fragment_ui_services.xml delete mode 100644 code/testapp/src/main/res/mipmap-hdpi/ic_launcher.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-hdpi/ic_launcher.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-hdpi/ic_launcher_round.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-hdpi/ic_launcher_round.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-mdpi/ic_launcher.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-mdpi/ic_launcher.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-mdpi/ic_launcher_round.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-mdpi/ic_launcher_round.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-xhdpi/ic_launcher.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-xhdpi/ic_launcher.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-xhdpi/ic_launcher_round.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-xhdpi/ic_launcher_round.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-xxhdpi/ic_launcher.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-xxhdpi/ic_launcher.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-xxxhdpi/ic_launcher.webp (100%) delete mode 100644 code/testapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename code/{testapp-kotlin => testapp}/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp (100%) delete mode 100644 code/testapp/src/main/res/values/styles.xml rename code/{testapp-kotlin => testapp}/src/main/res/values/themes.xml (73%) delete mode 100644 code/testapp/src/test/java/com/adobe/testapp/ExampleUnitTest.java diff --git a/code/build.gradle b/code/build.gradle deleted file mode 100644 index cdce08f99..000000000 --- a/code/build.gradle +++ /dev/null @@ -1,50 +0,0 @@ -buildscript { - ext { - kotlin_version = '1.5.31' - compose_version = '1.0.5' - dokka_version = '1.7.10' - } - repositories { - google() - maven { - url "https://plugins.gradle.org/m2/" - } - mavenCentral() - - } - dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath "org.jacoco:org.jacoco.core:0.8.7" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" - classpath 'org.jetbrains.kotlinx:binary-compatibility-validator:0.11.1' - classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}" - classpath 'androidx.benchmark:benchmark-gradle-plugin:1.2.0-alpha06' - classpath "com.diffplug.spotless:spotless-plugin-gradle:6.12.0" - } -} - -allprojects { - repositories { - mavenCentral() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - google() - } - apply plugin: 'maven-publish' - if (project.hasProperty("sonatypeUser") && project.hasProperty("sonatypePass")) { - ext["ossrhUsername"] = "$sonatypeUser" - ext["ossrhPassword"] = "$sonatypePass" - } else { - ext["ossrhUsername"] = "" - ext["ossrhPassword"] = "" - } -} - -ext { - minSdkVersion = 21 - targetSdkVersion = 33 - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - kotlinJvmTarget = JavaVersion.VERSION_1_8 - kotlinLanguageVersion = "1.5" - kotlinApiVersion = "1.5" -} \ No newline at end of file diff --git a/code/build.gradle.kts b/code/build.gradle.kts new file mode 100644 index 000000000..aa3aa6db5 --- /dev/null +++ b/code/build.gradle.kts @@ -0,0 +1,18 @@ +buildscript { + repositories { + gradlePluginPortal() + google() + mavenCentral() + maven { url = uri("https://jitpack.io") } + mavenLocal() + } + + + dependencies { + classpath("com.github.adobe:aepsdk-commons:ce2a07254d") + classpath("org.jetbrains.kotlinx:binary-compatibility-validator:0.13.2") + classpath("androidx.benchmark:benchmark-gradle-plugin:1.2.3") + } +} + + diff --git a/code/checkstyle.gradle b/code/checkstyle.gradle deleted file mode 100644 index b6e176f15..000000000 --- a/code/checkstyle.gradle +++ /dev/null @@ -1,28 +0,0 @@ -apply plugin: "checkstyle" - -checkstyle { - configFile rootProject.file('checkstyle.xml') - ignoreFailures false - showViolations true - toolVersion = "8.15" -} - -/** Checkstyle task for new files (not in exclude list). Fail build if a check fails **/ -task checkstyle(type: Checkstyle) { - configFile rootProject.file('checkstyle.xml') - - //fail early - ignoreFailures false - showViolations true - - source 'src' - include '**/*.java' - exclude '**/gen/**' - exclude '**/test/**' - exclude '**/legacy/**' - exclude '**/androidTest/**' - exclude '**/R.java' - exclude '**/BuildConfig.java' -// exclude rootProject.file('checkstyle/checkstyle-exclude-list.txt') as String[] - classpath = files() -} \ No newline at end of file diff --git a/code/checkstyle.xml b/code/checkstyle.xml deleted file mode 100644 index 803e983a9..000000000 --- a/code/checkstyle.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/code/codeformat.gradle b/code/codeformat.gradle deleted file mode 100644 index db2abc8c1..000000000 --- a/code/codeformat.gradle +++ /dev/null @@ -1,20 +0,0 @@ -apply plugin: 'com.diffplug.spotless' - -spotless { - java { - toggleOffOn("format:off", "format:on") - target "src/*/java/**/*.java" - googleJavaFormat('1.15.0').aosp().reflowLongStrings() - importOrder() - removeUnusedImports() - endWithNewline() - formatAnnotations() - licenseHeaderFile "../../config/formatter/adobe.header.txt" - } - kotlin { - target "src/*/java/**/*.kt" - ktlint('0.47.0') - endWithNewline() - licenseHeaderFile "../../config/formatter/adobe.header.txt" - } -} diff --git a/code/core/build.gradle b/code/core/build.gradle deleted file mode 100644 index 9874242e6..000000000 --- a/code/core/build.gradle +++ /dev/null @@ -1,152 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'org.jetbrains.dokka' - -// Disable variants for binary compatibility validation tasks. -apply plugin: 'binary-compatibility-validator' -ext.disableVariants = project.gradle.startParameter.taskNames.any { taskName -> - project.logger.debug(taskName) - taskName.contains("apiDump") || taskName.contains("apiCheck") -} -apiValidation { - ignoredPackages += [ - "com.adobe.marketing.mobile.internal", - "com.adobe.marketing.mobile.services.internal", - "com.adobe.marketing.mobile.services.ui.internal" - ] - - ignoredClasses += [ - "com.adobe.marketing.mobile.core.BuildConfig" - ] -} - -android { - namespace 'com.adobe.marketing.mobile.core' - compileSdkVersion rootProject.ext.targetSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - //Include the Proguard rules for Core Extension in the aar - consumerProguardFiles 'lib-proguard-rules.pro' - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - testOptions { - unitTests.returnDefaultValues = true - unitTests.includeAndroidResources = true - } - - flavorDimensions "target" - - if (disableVariants) { - sourceSets { - main { - java { - srcDirs 'src/phone/java' - } - } - } - } else { - productFlavors { - phone { - dimension "target" - } - } - } - - buildTypes { - debug { - testCoverageEnabled true - } - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility rootProject.ext.sourceCompatibility - targetCompatibility rootProject.ext.targetCompatibility - } - - kotlinOptions { - jvmTarget = rootProject.ext.kotlinJvmTarget - languageVersion = rootProject.ext.kotlinLanguageVersion - apiVersion = rootProject.ext.kotlinApiVersion - } - buildFeatures { - compose true - } - composeOptions { - kotlinCompilerExtensionVersion '1.0.5' - } -} - -apply from: '../checkstyle.gradle' -apply from: '../codeformat.gradle' -apply from: '../jacoco.gradle' -apply from: 'release.gradle' - -dokkaJavadoc.configure { - dokkaSourceSets { - named("main") { - noAndroidSdkLink.set(false) - perPackageOption { - matchingRegex.set(".*\\.internal.*") // proper setting - suppress.set(true) - } - } - - if (!disableVariants) { - named("phone") { - noAndroidSdkLink.set(false) - perPackageOption { - matchingRegex.set(".*\\.internal.*") // proper setting - suppress.set(true) - } - } - } - } -} - -dependencies { - //noinspection GradleDependency,GradleCompatible - implementation 'androidx.appcompat:appcompat:1.0.0' - //noinspection GradleDependency - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - - // Jetpack Compose runtime - implementation "androidx.compose.runtime:runtime:${compose_version}" - // Jetpack compose animation (for animated visibility) - implementation("androidx.compose.animation:animation:1.1.0") - // Material UI 1.x - implementation "androidx.compose.material:material:${compose_version}" - // Jetpack + Activity integration - implementation 'androidx.activity:activity-compose:1.5.0' - // Jetpack Compose tooling - debugImplementation "androidx.compose.ui:ui-tooling:${compose_version}" - - // unit tests - testImplementation "junit:junit:4.13.2" - testImplementation "org.mockito:mockito-core:4.5.1" - testImplementation 'org.mockito:mockito-inline:4.5.1' - //noinspection GradleDependency - testImplementation 'commons-codec:commons-codec:1.15' - testImplementation 'org.robolectric:robolectric:3.6.2' - testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0" - //noinspection GradleDependency - testImplementation 'org.json:json:20160810' - //noinspection GradleDependency - testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version" - testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0" - - // instrumentation tests - androidTestImplementation 'androidx.test:rules:1.4.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation "androidx.compose.ui:ui-test-junit4:${compose_version}" - androidTestImplementation "androidx.compose.ui:ui-test-manifest:$compose_version" - androidTestImplementation 'androidx.test.espresso:espresso-core:2.0.0' - - dokkaGfmPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:${dokka_version}") -} diff --git a/code/core/build.gradle.kts b/code/core/build.gradle.kts new file mode 100644 index 000000000..e4c35f7a2 --- /dev/null +++ b/code/core/build.gradle.kts @@ -0,0 +1,45 @@ +import com.adobe.marketing.mobile.gradle.BuildConstants + +plugins { + id("aep-library") + id("binary-compatibility-validator") +} + +val coreExtensionName: String by project +val coreExtensionVersion: String by project +val coreMavenRepoName: String by project +val coreMavenRepoDescription: String by project + +aepLibrary { + namespace = "com.adobe.marketing.mobile.core" + moduleName = coreExtensionName + moduleVersion = coreExtensionVersion + compose = true + enableDokkaDoc = true + enableSpotless = true + enableCheckStyle = true + publishing { + mavenRepoName = coreMavenRepoName + mavenRepoDescription = coreMavenRepoDescription + gitRepoName = "aepsdk-core-android" + + addMavenDependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8", BuildConstants.Versions.KOTLIN) + addMavenDependency("androidx.appcompat", "appcompat", BuildConstants.Versions.ANDROIDX_APPCOMPAT) + addMavenDependency("androidx.compose.runtime", "runtime", BuildConstants.Versions.COMPOSE) + addMavenDependency("androidx.compose.material", "material", BuildConstants.Versions.COMPOSE_MATERIAL) + addMavenDependency("androidx.compose.animation", "animation", BuildConstants.Versions.COMPOSE) + addMavenDependency("androidx.activity", "activity-compose", BuildConstants.Versions.ANDROIDX_ACTIVITY_COMPOSE) + } +} + +apiValidation { + ignoredPackages.addAll(setOf( + "com.adobe.marketing.mobile.internal", + "com.adobe.marketing.mobile.services.internal", + "com.adobe.marketing.mobile.services.ui.internal" + )) + + ignoredClasses.addAll(setOf( + "com.adobe.marketing.mobile.core.BuildConfig" + )) +} diff --git a/code/core/lib-proguard-rules.pro b/code/core/consumer-rules.pro similarity index 100% rename from code/core/lib-proguard-rules.pro rename to code/core/consumer-rules.pro diff --git a/code/core/gradle.properties b/code/core/gradle.properties deleted file mode 100644 index dc3f46be0..000000000 --- a/code/core/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -android.enableUnitTestBinaryResources=false \ No newline at end of file diff --git a/code/core/release.gradle b/code/core/release.gradle deleted file mode 100644 index 8407088f8..000000000 --- a/code/core/release.gradle +++ /dev/null @@ -1,116 +0,0 @@ -apply plugin: 'signing' -apply plugin: 'maven-publish' - -task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { - archiveClassifier.set('javadoc') - from dokkaJavadoc.outputDirectory -} - -def isJitPackBuild() { - return hasProperty('jitpack') -} -def isReleaseBuild() { - return hasProperty('release') -} - -def groupIdForPublish = isJitPackBuild()? 'com.github.adobe.aepsdk-core-android': 'com.adobe.marketing.mobile' - -// A class to represent a dependency node to be attached to POM -class DependencyNode { - final String groupId - final String artifactId - final String version - - DependencyNode(final String groupId, final String artifactId, final String version) { - this.groupId = groupId - this.artifactId = artifactId - this.version = version - } -} - -// A list of Dependency objects representing dependencies to be attached to POM -def dependencyList = [ - new DependencyNode("org.jetbrains.kotlin", "kotlin-stdlib-jdk8", "${rootProject.kotlin_version}"), - new DependencyNode("androidx.appcompat", "appcompat", "1.0.0"), - new DependencyNode("androidx.compose.runtime", "runtime", "${rootProject.compose_version}"), - new DependencyNode("androidx.compose.material", "material", "${rootProject.compose_version}"), - new DependencyNode("androidx.compose.animation", "animation", "1.1.0"), - new DependencyNode("androidx.activity", "activity-compose", "1.5.0") -] - -version = isReleaseBuild() ? rootProject.coreExtensionVersion : rootProject.coreExtensionVersion+"-SNAPSHOT" - -publishing { - publications { - release(MavenPublication) { - groupId = groupIdForPublish - artifactId = rootProject.coreExtensionName - version = version - artifact("$buildDir/outputs/aar/${rootProject.coreExtensionAARName}") - artifact javadocJar - pom { - name = rootProject.coreMavenRepoName - description = rootProject.coreMavenRepoDescription - url = 'https://developer.adobe.com/client-sdks' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - developers { - developer { - id = 'adobe' - name = 'adobe' - email = 'adobe-mobile-testing@adobe.com' - } - } - scm { - connection = 'scm:git:github.com//adobe/aepsdk-core-android.git' - developerConnection = 'scm:git:ssh://github.com//adobe/aepsdk-core-android.git' - url = 'https://github.com/adobe/aepsdk-core-android' - } - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - - // loop dependencyList and add each dependency to POM as a node - dependencyList.each { dependency -> - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', dependency.groupId) - dependencyNode.appendNode('artifactId', dependency.artifactId) - dependencyNode.appendNode('version', dependency.version) - } - } - } - } - } - repositories { - maven { - name = "sonatype" - url = version.endsWith('SNAPSHOT') ? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_PASSWORD") - } - } - } -} -//tasks.withType(Javadoc).all { enabled = false } -publishToMavenLocal.dependsOn('assemblePhone') -publishReleasePublicationToMavenLocal.dependsOn('assemblePhone') -publish.dependsOn('assemblePhone') - -ext."signing.gnupg.executable"="gpg" -ext."signing.gnupg.keyName"=System.getenv("GPG_KEY_ID") -ext."signing.gnupg.passphrase"=System.getenv("GPG_PASSPHRASE") - -signing { - useGpgCmd() - required { - tasks.withType(PublishToMavenRepository).find { - gradle.taskGraph.hasTask it - } - } - sign publishing.publications -} \ No newline at end of file diff --git a/code/core/src/main/AndroidManifest.xml b/code/core/src/main/AndroidManifest.xml index 319fbf12d..e8a97286a 100644 --- a/code/core/src/main/AndroidManifest.xml +++ b/code/core/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/code/gradle.properties b/code/gradle.properties index cad212bce..9355bfd23 100644 --- a/code/gradle.properties +++ b/code/gradle.properties @@ -1,35 +1,26 @@ -#Thu, 29 Jun 2023 22:36:11 +0000 org.gradle.jvmargs=-Xmx2048m android.injected.testOnly=false org.gradle.configureondemand=false android.useAndroidX=true -## Remove the line below in favor of android publishing DSL when it becomes available in AGP 8.x -android.disableAutomaticComponentCreation=true - -# #Maven artifacts #Core extension coreExtensionVersion=2.5.0 coreExtensionName=core -coreExtensionAARName=core-phone-release.aar coreMavenRepoName=AdobeMobileCoreSdk coreMavenRepoDescription=Android Core Extension for Adobe Mobile Marketing #Signal extension signalExtensionVersion=2.0.1 signalExtensionName=signal -signalExtensionAARName=signal-phone-release.aar signalMavenRepoName=AdobeMobileSignalSdk signalMavenRepoDescription=Android Signal Extension for Adobe Mobile Marketing #Lifecycle extension lifecycleExtensionVersion=2.0.4 lifecycleExtensionName=lifecycle -lifecycleExtensionAARName=lifecycle-phone-release.aar lifecycleMavenRepoName=AdobeMobileLifecycleSdk lifecycleMavenRepoDescription=Android Lifecycle Extension for Adobe Mobile Marketing #Identity extension identityExtensionVersion=2.0.3 identityExtensionName=identity -identityExtensionAARName=identity-phone-release.aar identityMavenRepoName=AdobeMobileIdentitySdk identityMavenRepoDescription=Android Identity Extension for Adobe Mobile Marketing diff --git a/code/gradle/wrapper/gradle-wrapper.properties b/code/gradle/wrapper/gradle-wrapper.properties index b1159fc54..b93c46a5f 100644 --- a/code/gradle/wrapper/gradle-wrapper.properties +++ b/code/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/code/identity/build.gradle b/code/identity/build.gradle deleted file mode 100644 index e7c427f84..000000000 --- a/code/identity/build.gradle +++ /dev/null @@ -1,186 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'maven-publish' -apply plugin: 'signing' - - -android { - namespace 'com.adobe.marketing.mobile.identity' - compileSdkVersion rootProject.ext.targetSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - //Include the Proguard rules for Core Extension in the aar - consumerProguardFiles 'lib-proguard-rules.pro' - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - sourceSets { - } - - testOptions { - unitTests.returnDefaultValues = true - unitTests.includeAndroidResources = true - } - - flavorDimensions "target" - - productFlavors { - phone { - dimension "target" - } - } - - buildTypes { - debug { - testCoverageEnabled true - } - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility rootProject.ext.sourceCompatibility - targetCompatibility rootProject.ext.targetCompatibility - } - - kotlinOptions { - jvmTarget = rootProject.ext.kotlinJvmTarget - languageVersion = rootProject.ext.kotlinLanguageVersion - apiVersion = rootProject.ext.kotlinApiVersion - } -} - -apply from: '../checkstyle.gradle' -apply from: '../codeformat.gradle' -apply from: '../jacoco.gradle' - - -def isJitPackBuild() { - return hasProperty('jitpack') -} - -def isReleaseBuild() { - return hasProperty('release') -} - -def groupIdForPublish = isJitPackBuild()? 'com.github.adobe.aepsdk-core-android': 'com.adobe.marketing.mobile' - -version = isReleaseBuild() ? rootProject.identityExtensionVersion : rootProject.identityExtensionVersion+"-SNAPSHOT" - -android.libraryVariants.all { variant -> - tasks.withType(Javadoc) { - source = [android.sourceSets.main.java.sourceFiles, android.sourceSets.phone.java.sourceFiles] - ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" - - doFirst{classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)} - - exclude "**/BuildConfig.java" - exclude "**/R.java" - options { - links "https://developer.android.com/reference" - } - } -} - -task javadocPublic(type: Javadoc) { - destinationDir = reporting.file("javadocPublic") - options.memberLevel = JavadocMemberLevel.PUBLIC -} - -task javadocPublish(type: Jar) { - from javadocPublic - archiveClassifier.set('javadoc') -} -publishing { - publications { - release(MavenPublication) { - groupId = groupIdForPublish - artifactId = rootProject.identityExtensionName - version = version - artifact("$buildDir/outputs/aar/${rootProject.identityExtensionAARName}") - artifact javadocPublish - - pom { - name = rootProject.identityMavenRepoName - description = rootProject.identityMavenRepoDescription - url = 'https://developer.adobe.com/client-sdks' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - developers { - developer { - id = 'adobe' - name = 'adobe' - email = 'adobe-mobile-testing@adobe.com' - } - } - scm { - connection = 'scm:git:github.com//adobe/aepsdk-core-android.git' - developerConnection = 'scm:git:ssh://github.com//adobe/aepsdk-core-android.git' - url = 'https://github.com/adobe/aepsdk-core-android' - } - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - - def coreDependencyNode = dependenciesNode.appendNode('dependency') - coreDependencyNode.appendNode('groupId', 'com.adobe.marketing.mobile') - coreDependencyNode.appendNode('artifactId', 'core') - coreDependencyNode.appendNode('version', rootProject.coreExtensionVersion) - } - } - } - } - - repositories { - maven { - name = "sonatype" - url = version.endsWith('SNAPSHOT') ? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_PASSWORD") - } - } - } -} - -ext."signing.gnupg.executable"="gpg" -ext."signing.gnupg.keyName"=System.getenv("GPG_KEY_ID") -ext."signing.gnupg.passphrase"=System.getenv("GPG_PASSPHRASE") - -signing { - useGpgCmd() - required { - tasks.withType(PublishToMavenRepository).find { - gradle.taskGraph.hasTask it - } - } - sign publishing.publications -} - -publishToMavenLocal.dependsOn('assemblePhone') - -dependencies { - //noinspection GradleDependency,GradleCompatible - implementation 'androidx.appcompat:appcompat:1.0.0' - implementation project(path: ':core') - - // unit tests - testImplementation "junit:junit:4.13.2" - testImplementation "org.mockito:mockito-core:4.5.1" - testImplementation 'org.mockito:mockito-inline:4.5.1' - testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0" - //noinspection GradleDependency - testImplementation 'org.json:json:20160810' - - // instrumentation tests - androidTestImplementation 'androidx.test:rules:1.4.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' -} \ No newline at end of file diff --git a/code/identity/build.gradle.kts b/code/identity/build.gradle.kts new file mode 100644 index 000000000..2829eb8a2 --- /dev/null +++ b/code/identity/build.gradle.kts @@ -0,0 +1,27 @@ +plugins { + id("aep-library") +} + +val identityExtensionName: String by project +val identityExtensionVersion: String by project +val identityMavenRepoName: String by project +val identityMavenRepoDescription: String by project +val coreExtensionVersion: String by project + +aepLibrary { + namespace = "com.adobe.marketing.mobile.identity" + moduleName = identityExtensionName + moduleVersion = identityExtensionVersion + enableSpotless = true + enableCheckStyle = true + publishing { + mavenRepoName = identityMavenRepoName + mavenRepoDescription = identityMavenRepoDescription + gitRepoName = "aepsdk-core-android" + addCoreDependency(coreExtensionVersion) + } +} + +dependencies { + implementation(project(":core")) +} \ No newline at end of file diff --git a/code/identity/src/main/AndroidManifest.xml b/code/identity/src/main/AndroidManifest.xml index 45a9a7fff..94cbbcfc3 100644 --- a/code/identity/src/main/AndroidManifest.xml +++ b/code/identity/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/code/identity/src/test/java/com/adobe/marketing/mobile/identity/IdentityFunctionalTests.kt b/code/identity/src/test/java/com/adobe/marketing/mobile/identity/IdentityFunctionalTests.kt index 7bdc81895..c007c88ee 100644 --- a/code/identity/src/test/java/com/adobe/marketing/mobile/identity/IdentityFunctionalTests.kt +++ b/code/identity/src/test/java/com/adobe/marketing/mobile/identity/IdentityFunctionalTests.kt @@ -49,7 +49,7 @@ import org.mockito.kotlin.reset import org.mockito.kotlin.verify import java.io.InputStream import java.net.HttpURLConnection -import java.util.* +import java.util.Random import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit diff --git a/code/integration-tests/build.gradle b/code/integration-tests/build.gradle deleted file mode 100644 index fa8ac8712..000000000 --- a/code/integration-tests/build.gradle +++ /dev/null @@ -1,63 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -android { - namespace 'com.adobe.marketing.mobile.integration' - compileSdkVersion rootProject.ext.targetSdkVersion - - defaultConfig { - minSdk rootProject.ext.minSdkVersion - targetSdk rootProject.ext.targetSdkVersion - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - - // The following argument makes the Android Test Orchestrator run its - // "pm clear" command after each test invocation. This command ensures - // that the app's state is completely cleared between tests. - testInstrumentationRunnerArguments clearPackageData: 'true' - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } - testOptions { - execution 'ANDROIDX_TEST_ORCHESTRATOR' - } - -} -dependencies { - -// implementation fileTree(include: ['*.aar'], dir: 'libs') - - implementation 'androidx.core:core-ktx:1.3.2' - implementation 'androidx.appcompat:appcompat:1.0.0' - implementation project(path: ':core') - implementation project(path: ':signal') - implementation project(path: ':identity') - implementation project(path: ':lifecycle') - - androidTestImplementation('com.adobe.marketing.mobile:analytics:2.0.3') { - transitive = false - } - - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - - androidTestImplementation 'androidx.test:runner:1.4.0' - - androidTestUtil 'androidx.test:orchestrator:1.4.1' -} \ No newline at end of file diff --git a/code/integration-tests/build.gradle.kts b/code/integration-tests/build.gradle.kts new file mode 100644 index 000000000..52e6b4296 --- /dev/null +++ b/code/integration-tests/build.gradle.kts @@ -0,0 +1,63 @@ +import com.adobe.marketing.mobile.gradle.BuildConstants + +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.adobe.marketing.mobile.integration" + compileSdk = BuildConstants.Versions.COMPILE_SDK_VERSION + + defaultConfig { + minSdk = BuildConstants.Versions.MIN_SDK_VERSION + consumerProguardFiles("consumer-rules.pro") + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + // The following argument makes the Android Test Orchestrator run its + // "pm clear" command after each test invocation. This command ensures + // that the app's state is completely cleared between tests. + testInstrumentationRunnerArguments["clearPackageData"] = "true" + } + + buildTypes { + getByName(BuildConstants.BuildTypes.RELEASE) { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + + compileOptions { + sourceCompatibility = BuildConstants.Versions.JAVA_SOURCE_COMPATIBILITY + targetCompatibility = BuildConstants.Versions.JAVA_TARGET_COMPATIBILITY + } + + kotlinOptions { + jvmTarget = BuildConstants.Versions.KOTLIN_JVM_TARGET + languageVersion = BuildConstants.Versions.KOTLIN_LANGUAGE_VERSION + apiVersion = BuildConstants.Versions.KOTLIN_API_VERSION + } + + testOptions { + execution = "ANDROIDX_TEST_ORCHESTRATOR" + } +} + +dependencies { + implementation(project(":core")) + implementation(project(":signal")) + implementation(project(":identity")) + implementation(project(":lifecycle")) + + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar")))) + implementation(BuildConstants.Dependencies.ANDROIDX_CORE_KTX) + implementation(BuildConstants.Dependencies.ANDROIDX_APPCOMPAT) + + testImplementation(BuildConstants.Dependencies.JUNIT) + androidTestImplementation(BuildConstants.Dependencies.ANDROIDX_TEST_EXT_JUNIT) + androidTestImplementation(BuildConstants.Dependencies.ESPRESSO_CORE) + androidTestImplementation(BuildConstants.Dependencies.ANDROIDX_TEST_RUNNER) + + androidTestUtil(BuildConstants.Dependencies.ANDROIDX_TEST_ORCHESTRATOR) + +} \ No newline at end of file diff --git a/code/integration-tests/consumer-rules.pro b/code/integration-tests/consumer-rules.pro deleted file mode 100644 index e69de29bb..000000000 diff --git a/code/integration-tests/proguard-rules.pro b/code/integration-tests/proguard-rules.pro deleted file mode 100644 index 481bb4348..000000000 --- a/code/integration-tests/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/code/integration-tests/src/androidTest/java/com/adobe/marketing/mobile/integration/identity/IdentityIntegrationTests.kt b/code/integration-tests/src/androidTest/java/com/adobe/marketing/mobile/integration/identity/IdentityIntegrationTests.kt index ae5660d1c..6d6abde24 100644 --- a/code/integration-tests/src/androidTest/java/com/adobe/marketing/mobile/integration/identity/IdentityIntegrationTests.kt +++ b/code/integration-tests/src/androidTest/java/com/adobe/marketing/mobile/integration/identity/IdentityIntegrationTests.kt @@ -11,7 +11,9 @@ package com.adobe.marketing.mobile.integration.identity import android.content.Context +import android.content.SharedPreferences import android.util.Log +import androidx.core.content.edit import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.adobe.marketing.mobile.* @@ -102,7 +104,6 @@ class IdentityIntegrationTests { listOf( Identity.EXTENSION, MonitorExtension::class.java, - Analytics.EXTENSION ) ) { countDownLatch.countDown() @@ -302,12 +303,7 @@ class IdentityIntegrationTests { configurationAwareness { configurationLatch.countDown() } configurationLatch.await() - Analytics.setVisitorIdentifier("testVid") - val analyticsLatch = CountDownLatch(1) - Analytics.getVisitorIdentifier{ id -> - analyticsLatch.countDown() - } - analyticsLatch.await() + setAnalyticsVisitorIdentifier("testVid") val countDownLatch = CountDownLatch(1) Identity.getUrlVariables { variables -> @@ -364,12 +360,7 @@ class IdentityIntegrationTests { val configurationLatch = CountDownLatch(1) configurationAwareness { configurationLatch.countDown() } configurationLatch.await() - Analytics.setVisitorIdentifier("testVid") - val analyticsLatch = CountDownLatch(1) - Analytics.getVisitorIdentifier{ id -> - analyticsLatch.countDown() - } - analyticsLatch.await() + setAnalyticsVisitorIdentifier("testVid") Identity.appendVisitorInfoForURL("https://adobe.com") { url -> assertNotNull(url) @@ -438,11 +429,7 @@ class IdentityIntegrationTests { ) ) - Analytics.setVisitorIdentifier("testVid") - val analyticsLatch = CountDownLatch(1) - Analytics.getVisitorIdentifier { - analyticsLatch.countDown() - } + setAnalyticsVisitorIdentifier("testVid") MobileCore.setAdvertisingIdentifier("adid") Identity.syncIdentifiers(mapOf("id1" to "value1")) val identityLatch = CountDownLatch(1) @@ -452,7 +439,6 @@ class IdentityIntegrationTests { identityLatch.countDown() } identityLatch.await() - analyticsLatch.await() val countDownLatch = CountDownLatch(1) var receivedSDKIdentities : String? = null @@ -619,4 +605,19 @@ class IdentityIntegrationTests { MonitorExtension.configurationAwareness(callback) } + val ANALYTICS_DATASTORE_NAME = "AnalyticsDataStorage" + val ANALYTICS_REQUEST_VISITOR_ID_KEY = "vid" + + private fun setAnalyticsVisitorIdentifier(vid: String?) { + val context = ApplicationProvider.getApplicationContext() + val sharedPreference = context.getSharedPreferences(ANALYTICS_DATASTORE_NAME, 0) + sharedPreference.edit { + if (vid.isNullOrEmpty()) { + remove(ANALYTICS_REQUEST_VISITOR_ID_KEY) + } else { + putString(ANALYTICS_REQUEST_VISITOR_ID_KEY, vid) + } + commit() + } + } } diff --git a/code/jacoco.gradle b/code/jacoco.gradle deleted file mode 100644 index 03f44b8db..000000000 --- a/code/jacoco.gradle +++ /dev/null @@ -1,43 +0,0 @@ - apply plugin: 'jacoco' - -task unitTestsCoverageReport(type: JacocoReport, dependsOn: "testPhoneDebugUnitTest") { - def excludeRegex = ['**/ADB*.class', '**/BuildConfig.class'] - def javaClasses = fileTree(dir: "${project.buildDir}/intermediates/javac/phoneDebug/classes", excludes: excludeRegex) - def kotlinClasses = fileTree(dir: "${project.buildDir}/tmp/kotlin-classes/phoneDebug", excludes: excludeRegex) - classDirectories.setFrom(files([javaClasses, kotlinClasses])) - - def mainSrc = "${project.projectDir}/src/main/java" - def phoneSrc = "${project.projectDir}/src/phone/java" - sourceDirectories.setFrom files([mainSrc, phoneSrc]) - - executionData.setFrom fileTree(dir: "$buildDir", includes: [ - "outputs/unit_test_code_coverage/phoneDebugUnitTest/testPhoneDebugUnitTest.exec", - ]) - - reports { - xml.enabled true - csv.enabled false - html.enabled true - } -} - -task functionalTestsCoverageReport(type: JacocoReport, dependsOn: "createPhoneDebugCoverageReport") { - def excludeRegex = ['**/ADB*.class', '**/BuildConfig.class'] - def javaClasses = fileTree(dir: "${project.buildDir}/intermediates/javac/phoneDebug/classes", excludes: excludeRegex) - def kotlinClasses = fileTree(dir: "${project.buildDir}/tmp/kotlin-classes/phoneDebug", excludes: excludeRegex) - classDirectories.setFrom(files([javaClasses, kotlinClasses])) - - def mainSrc = "${project.projectDir}/src/main/java" - def phoneSrc = "${project.projectDir}/src/phone/java" - sourceDirectories.setFrom files([mainSrc, phoneSrc]) - - executionData.setFrom fileTree(dir: "$buildDir", includes: [ - "outputs/code_coverage/phoneDebugAndroidTest/connected/*coverage.ec" - ]) - reports { - xml.enabled true - csv.enabled false - html.enabled false - } -} - diff --git a/code/lifecycle/build.gradle b/code/lifecycle/build.gradle deleted file mode 100644 index 6f081e777..000000000 --- a/code/lifecycle/build.gradle +++ /dev/null @@ -1,179 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: "jacoco" -apply plugin: 'maven-publish' -apply plugin: 'signing' - -android { - namespace 'com.adobe.marketing.mobile.lifecycle' - compileSdkVersion rootProject.ext.targetSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - //Include the Proguard rules for Core Extension in the aar - consumerProguardFiles 'lib-proguard-rules.pro' - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - sourceSets { - } - - testOptions { - unitTests.returnDefaultValues = true - unitTests.includeAndroidResources = true - } - - flavorDimensions "target" - - productFlavors { - phone { - dimension "target" - } - } - - buildTypes { - debug { - testCoverageEnabled true - debuggable true - } - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility rootProject.ext.sourceCompatibility - targetCompatibility rootProject.ext.targetCompatibility - } -} - -apply from: '../checkstyle.gradle' -apply from: '../codeformat.gradle' -apply from: '../jacoco.gradle' - -def isJitPackBuild() { - return hasProperty('jitpack') -} - -def isReleaseBuild() { - return hasProperty('release') -} - -version = isReleaseBuild() ? rootProject.lifecycleExtensionVersion : rootProject.lifecycleExtensionVersion + "-SNAPSHOT" - -def groupIdForPublish = isJitPackBuild() ? 'com.github.adobe.aepsdk-core-android' : 'com.adobe.marketing.mobile' - -android.libraryVariants.all { variant -> - tasks.withType(Javadoc) { - source = [android.sourceSets.main.java.sourceFiles, android.sourceSets.phone.java.sourceFiles] - ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" - - doFirst{classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)} - - exclude "**/BuildConfig.java" - exclude "**/R.java" - options { - links "https://developer.android.com/reference" - } - } -} - -task javadocPublic(type: Javadoc) { - destinationDir = reporting.file("javadocPublic") - options.memberLevel = JavadocMemberLevel.PUBLIC -} - -task javadocPublish(type: Jar) { - from javadocPublic - archiveClassifier.set('javadoc') -} - -publishing { - publications { - release(MavenPublication) { - groupId = groupIdForPublish - artifactId = rootProject.lifecycleExtensionName - version = version - artifact("$buildDir/outputs/aar/${rootProject.lifecycleExtensionAARName}") - artifact javadocPublish - pom { - name = rootProject.lifecycleMavenRepoName - description = rootProject.lifecycleMavenRepoDescription - url = 'https://developer.adobe.com/client-sdks' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - developers { - developer { - id = 'adobe' - name = 'adobe' - email = 'adobe-mobile-testing@adobe.com' - } - } - scm { - connection = 'scm:git:github.com//adobe/aepsdk-core-android.git' - developerConnection = 'scm:git:ssh://github.com//adobe/aepsdk-core-android.git' - url = 'https://github.com/adobe/aepsdk-core-android' - } - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - - def coreDependencyNode = dependenciesNode.appendNode('dependency') - coreDependencyNode.appendNode('groupId', 'com.adobe.marketing.mobile') - coreDependencyNode.appendNode('artifactId', 'core') - coreDependencyNode.appendNode('version', rootProject.coreExtensionVersion) - } - } - } - } - - repositories { - maven { - name = "sonatype" - url = version.endsWith('SNAPSHOT') ? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_PASSWORD") - } - } - } - -} - -ext."signing.gnupg.executable" = "gpg" -ext."signing.gnupg.keyName" = System.getenv("GPG_KEY_ID") -ext."signing.gnupg.passphrase" = System.getenv("GPG_PASSPHRASE") - -signing { - useGpgCmd() - required { - tasks.withType(PublishToMavenRepository).find { - gradle.taskGraph.hasTask it - } - } - sign publishing.publications -} - -publishToMavenLocal.dependsOn('assemblePhone') - -dependencies { - implementation 'androidx.appcompat:appcompat:1.0.0' - implementation project(path: ':core') - // Unit tests - testImplementation "junit:junit:4.13.2" - //noinspection GradleDependency - testImplementation "org.mockito:mockito-core:4.5.1" - testImplementation 'org.mockito:mockito-inline:4.5.1' - testImplementation 'commons-codec:commons-codec:1.15' - testImplementation 'org.robolectric:robolectric:3.6.2' - //noinspection GradleDependency - testImplementation 'org.json:json:20160810' - // Instrumentation tests - androidTestImplementation 'androidx.test:rules:1.4.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' -} diff --git a/code/lifecycle/build.gradle.kts b/code/lifecycle/build.gradle.kts new file mode 100644 index 000000000..86103500b --- /dev/null +++ b/code/lifecycle/build.gradle.kts @@ -0,0 +1,27 @@ +plugins { + id("aep-library") +} + +val lifecycleExtensionName: String by project +val lifecycleExtensionVersion: String by project +val lifecycleMavenRepoName: String by project +val lifecycleMavenRepoDescription: String by project +val coreExtensionVersion: String by project + +aepLibrary { + namespace = "com.adobe.marketing.mobile.lifecycle" + moduleName = lifecycleExtensionName + moduleVersion = lifecycleExtensionVersion + enableSpotless = true + enableCheckStyle = true + publishing { + mavenRepoName = lifecycleMavenRepoName + mavenRepoDescription = lifecycleMavenRepoDescription + gitRepoName = "aepsdk-core-android" + addCoreDependency(coreExtensionVersion) + } +} + +dependencies { + implementation(project(":core")) +} \ No newline at end of file diff --git a/code/lifecycle/src/main/AndroidManifest.xml b/code/lifecycle/src/main/AndroidManifest.xml index 898d76563..94cbbcfc3 100644 --- a/code/lifecycle/src/main/AndroidManifest.xml +++ b/code/lifecycle/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/code/macrobenchmark/build.gradle b/code/macrobenchmark/build.gradle deleted file mode 100644 index 9c405767c..000000000 --- a/code/macrobenchmark/build.gradle +++ /dev/null @@ -1,53 +0,0 @@ -plugins { - id 'com.android.test' - id 'org.jetbrains.kotlin.android' -} - -android { - namespace 'com.adobe.marketing.mobile.macrobenchmark' - compileSdkVersion rootProject.ext.targetSdkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } - - defaultConfig { - minSdk 26 - targetSdk rootProject.ext.targetSdkVersion - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - // This benchmark buildType is used for benchmarking, and should function like your - // release build (for example, with minification on). It's signed with a debug key - // for easy local/CI testing. - benchmark { - debuggable = true - signingConfig = debug.signingConfig - matchingFallbacks = ["release"] - } - } - - targetProjectPath = ":testapp-kotlin" - experimentalProperties["android.experimental.self-instrumenting"] = true -} - -dependencies { - implementation 'androidx.test.ext:junit:1.1.3' - implementation 'androidx.test.espresso:espresso-core:3.4.0' - implementation 'androidx.test.uiautomator:uiautomator:2.2.0' - implementation 'androidx.benchmark:benchmark-macro-junit4:1.1.0' - implementation "androidx.profileinstaller:profileinstaller:1.2.0" -} - -androidComponents { - beforeVariants(selector().all()) { - enabled = buildType == "benchmark" - } -} \ No newline at end of file diff --git a/code/macrobenchmark/build.gradle.kts b/code/macrobenchmark/build.gradle.kts new file mode 100644 index 000000000..2a56e5ea3 --- /dev/null +++ b/code/macrobenchmark/build.gradle.kts @@ -0,0 +1,55 @@ +import com.adobe.marketing.mobile.gradle.BuildConstants + +plugins { + id("com.android.test") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.adobe.marketing.mobile.macrobenchmark" + compileSdk = BuildConstants.Versions.COMPILE_SDK_VERSION + + defaultConfig { + minSdk = 26 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + compileOptions { + sourceCompatibility = BuildConstants.Versions.JAVA_SOURCE_COMPATIBILITY + targetCompatibility = BuildConstants.Versions.JAVA_TARGET_COMPATIBILITY + } + + kotlinOptions { + jvmTarget = BuildConstants.Versions.KOTLIN_JVM_TARGET + languageVersion = BuildConstants.Versions.KOTLIN_LANGUAGE_VERSION + apiVersion = BuildConstants.Versions.KOTLIN_API_VERSION + } + + buildTypes { + // This benchmark buildType is used for benchmarking, and should function like your + // release build (for example, with minification on). It's signed with a debug key + // for easy local/CI testing. + create("benchmark") { + isDebuggable = true + signingConfig = get("debug").signingConfig + matchingFallbacks.add("release") + } + } + + targetProjectPath = ":testapp" + experimentalProperties["android.experimental.self-instrumenting"] = true +} + +dependencies { + implementation("androidx.test.ext:junit:1.1.5") + implementation("androidx.test.espresso:espresso-core:3.5.1") + implementation("androidx.test.uiautomator:uiautomator:2.2.0") + implementation("androidx.benchmark:benchmark-macro-junit4:1.2.3") + implementation("androidx.profileinstaller:profileinstaller:1.3.1") +} + +androidComponents { + beforeVariants(selector().all()) { + it.enable = (it.buildType == "benchmark") + } +} \ No newline at end of file diff --git a/code/macrobenchmark/src/main/AndroidManifest.xml b/code/macrobenchmark/src/main/AndroidManifest.xml index 7fd69d2df..7709ad7d1 100644 --- a/code/macrobenchmark/src/main/AndroidManifest.xml +++ b/code/macrobenchmark/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/code/microbenchmark/build.gradle b/code/microbenchmark/build.gradle deleted file mode 100644 index a23b847b9..000000000 --- a/code/microbenchmark/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -plugins { - id 'com.android.library' - id 'androidx.benchmark' - id 'org.jetbrains.kotlin.android' -} - -android { - namespace 'com.adobe.marketing.mobile.microbenchmark' - compileSdkVersion rootProject.ext.targetSdkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } - - defaultConfig { - minSdk 26 - targetSdk rootProject.ext.targetSdkVersion - - testInstrumentationRunner 'androidx.benchmark.junit4.AndroidBenchmarkRunner' - } - - testBuildType = "release" - buildTypes { - debug { - // Since debuggable can"t be modified by gradle for library modules, - // it must be done in a manifest - see src/androidTest/AndroidManifest.xml - minifyEnabled true - proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "benchmark-proguard-rules.pro" - } - release { - isDefault = true - } - } -} - -dependencies { - androidTestImplementation 'androidx.test:runner:1.4.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.benchmark:benchmark-junit4:1.2.0-alpha04' - - implementation project(path: ':core') - implementation project(path: ':identity') - implementation project(path: ':signal') - implementation project(path: ':lifecycle') - - // Add your dependencies here. Note that you cannot benchmark code - // in an app module this way - you will need to move any code you - // want to benchmark to a library module: - // https://developer.android.com/studio/projects/android-library#Convert - -} \ No newline at end of file diff --git a/code/microbenchmark/build.gradle.kts b/code/microbenchmark/build.gradle.kts new file mode 100644 index 000000000..4e588bac3 --- /dev/null +++ b/code/microbenchmark/build.gradle.kts @@ -0,0 +1,53 @@ +import com.adobe.marketing.mobile.gradle.BuildConstants + +plugins { + id("com.android.library") + id("androidx.benchmark") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.adobe.marketing.mobile.microbenchmark" + compileSdk = BuildConstants.Versions.COMPILE_SDK_VERSION + + defaultConfig { + minSdk = 26 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + compileOptions { + sourceCompatibility = BuildConstants.Versions.JAVA_SOURCE_COMPATIBILITY + targetCompatibility = BuildConstants.Versions.JAVA_TARGET_COMPATIBILITY + } + + kotlinOptions { + jvmTarget = BuildConstants.Versions.KOTLIN_JVM_TARGET + languageVersion = BuildConstants.Versions.KOTLIN_LANGUAGE_VERSION + apiVersion = BuildConstants.Versions.KOTLIN_API_VERSION + } + + testBuildType = "release" + buildTypes { + debug { + // Since debuggable can"t be modified by gradle for library modules, + // it must be done in a manifest - see src/androidTest/AndroidManifest.xml + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "benchmark-proguard-rules.pro") + } + release { + isDefault = true + } + } +} + +dependencies { + implementation(project(":core")) + implementation(project(":identity")) + implementation(project(":signal")) + implementation(project(":lifecycle")) + + androidTestImplementation("androidx.test:runner:1.5.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.benchmark:benchmark-junit4:1.2.3") +} \ No newline at end of file diff --git a/code/proguard-rules.pro b/code/proguard-rules.pro deleted file mode 100644 index f1b424510..000000000 --- a/code/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/code/settings.gradle b/code/settings.gradle deleted file mode 100644 index 8fb426f53..000000000 --- a/code/settings.gradle +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/7.3/userguide/multi_project_builds.html - */ - -rootProject.name = 'aepsdk-core-android' -include ':core', - ':lifecycle', - ':identity', - ':signal', - ':testapp', - ':testapp-kotlin', - ':integration-tests', - ':test-third-party-extension', - ':macrobenchmark', - ':microbenchmark' diff --git a/code/settings.gradle.kts b/code/settings.gradle.kts new file mode 100644 index 000000000..309b06bb3 --- /dev/null +++ b/code/settings.gradle.kts @@ -0,0 +1,32 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + mavenLocal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + mavenLocal() + maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } + maven { url = uri("https://jitpack.io") } + } +} + +rootProject.name = "aepsdk-core-android" +include ( + ":core", + ":lifecycle", + ":identity", + ":signal", + ":test-third-party-extension", + ":integration-tests", + ":macrobenchmark", + ":microbenchmark", + ":testapp", + ) \ No newline at end of file diff --git a/code/signal/build.gradle b/code/signal/build.gradle deleted file mode 100644 index 1eea51765..000000000 --- a/code/signal/build.gradle +++ /dev/null @@ -1,178 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'org.jetbrains.dokka' -apply plugin: 'maven-publish' -apply plugin: 'signing' - -android { - namespace 'com.adobe.marketing.mobile.signal' - compileSdkVersion rootProject.ext.targetSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - //Include the Proguard rules for Core Extension in the aar - consumerProguardFiles 'lib-proguard-rules.pro' - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - sourceSets { - } - - testOptions { - unitTests.returnDefaultValues = true - unitTests.includeAndroidResources = true - } - - flavorDimensions "target" - - productFlavors { - phone { - dimension "target" - } - } - - buildTypes { - debug { - testCoverageEnabled true - } - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility rootProject.ext.sourceCompatibility - targetCompatibility rootProject.ext.targetCompatibility - } - - kotlinOptions { - jvmTarget = rootProject.ext.kotlinJvmTarget - languageVersion = rootProject.ext.kotlinLanguageVersion - apiVersion = rootProject.ext.kotlinApiVersion - } -} - -dokkaJavadoc.configure { - dokkaSourceSets { - named("main") { - noAndroidSdkLink.set(false) - perPackageOption { - matchingRegex.set(".*\\.internal.*") // proper setting - suppress.set(true) - } - } - } -} - -apply from: '../checkstyle.gradle' -apply from: '../codeformat.gradle' -apply from: '../jacoco.gradle' - -def isJitPackBuild() { - return hasProperty('jitpack') -} - -def isReleaseBuild() { - return hasProperty('release') -} - -version = isReleaseBuild() ? rootProject.signalExtensionVersion : rootProject.signalExtensionVersion+"-SNAPSHOT" - -def groupIdForPublish = isJitPackBuild()? 'com.github.adobe.aepsdk-core-android': 'com.adobe.marketing.mobile' - -task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { - archiveClassifier.set('javadoc') - from dokkaJavadoc.outputDirectory -} - -publishing { - publications { - release(MavenPublication) { - groupId = groupIdForPublish - artifactId = rootProject.signalExtensionName - version = version - artifact("$buildDir/outputs/aar/${rootProject.signalExtensionAARName}") - artifact javadocJar - - pom { - name = rootProject.signalMavenRepoName - description = rootProject.signalMavenRepoDescription - url = 'https://developer.adobe.com/client-sdks' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - developers { - developer { - id = 'adobe' - name = 'adobe' - email = 'adobe-mobile-testing@adobe.com' - } - } - scm { - connection = 'scm:git:github.com//adobe/aepsdk-core-android.git' - developerConnection = 'scm:git:ssh://github.com//adobe/aepsdk-core-android.git' - url = 'https://github.com/adobe/aepsdk-core-android' - } - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - - def coreDependencyNode = dependenciesNode.appendNode('dependency') - coreDependencyNode.appendNode('groupId', 'com.adobe.marketing.mobile') - coreDependencyNode.appendNode('artifactId', 'core') - coreDependencyNode.appendNode('version', rootProject.coreExtensionVersion) - } - } - } - } - - repositories { - maven { - name = "sonatype" - url = version.endsWith('SNAPSHOT') ? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_PASSWORD") - } - } - } -} - -ext."signing.gnupg.executable"="gpg" -ext."signing.gnupg.keyName"=System.getenv("GPG_KEY_ID") -ext."signing.gnupg.passphrase"=System.getenv("GPG_PASSPHRASE") - -signing { - useGpgCmd() - required { - tasks.withType(PublishToMavenRepository).find { - gradle.taskGraph.hasTask it - } - } - sign publishing.publications -} - -tasks.withType(Javadoc).all { enabled = false } -publishToMavenLocal.dependsOn('assemblePhone') - -dependencies { - //noinspection GradleDependency,GradleCompatible - implementation 'androidx.appcompat:appcompat:1.0.0' - //noinspection GradleDependency,GradleCompatible - implementation project(path: ':core') - // Unit tests - testImplementation "junit:junit:4.13.2" - testImplementation "org.mockito:mockito-core:4.5.1" - testImplementation 'org.mockito:mockito-inline:4.5.1' - testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0" - //noinspection GradleDependency - testImplementation 'org.json:json:20160810' - // Instrumentation tests - androidTestImplementation 'androidx.test:rules:1.4.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' -} \ No newline at end of file diff --git a/code/signal/build.gradle.kts b/code/signal/build.gradle.kts new file mode 100644 index 000000000..5666da594 --- /dev/null +++ b/code/signal/build.gradle.kts @@ -0,0 +1,28 @@ +plugins { + id("aep-library") +} + +val signalExtensionName: String by project +val signalExtensionVersion: String by project +val signalMavenRepoName: String by project +val signalMavenRepoDescription: String by project +val coreExtensionVersion: String by project + +aepLibrary { + namespace = "com.adobe.marketing.mobile.signal" + moduleName = signalExtensionName + moduleVersion = signalExtensionVersion + enableDokkaDoc = false + enableSpotless = true + enableCheckStyle = true + publishing { + mavenRepoName = signalMavenRepoName + mavenRepoDescription = signalMavenRepoDescription + gitRepoName = "aepsdk-core-android" + addCoreDependency(coreExtensionVersion) + } +} + +dependencies { + implementation(project(":core")) +} \ No newline at end of file diff --git a/code/signal/src/main/AndroidManifest.xml b/code/signal/src/main/AndroidManifest.xml index ea07a6460..94cbbcfc3 100644 --- a/code/signal/src/main/AndroidManifest.xml +++ b/code/signal/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/code/test-third-party-extension/build.gradle b/code/test-third-party-extension/build.gradle deleted file mode 100644 index 2c55164b8..000000000 --- a/code/test-third-party-extension/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -apply plugin: 'com.android.library' - -android { - namespace 'com.adobe.marketing.mobile.sample.thirdparyextension' - compileSdkVersion rootProject.ext.targetSdkVersion - - defaultConfig { - minSdk rootProject.ext.minSdkVersion - targetSdk rootProject.ext.targetSdkVersion - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation project(':core') -} diff --git a/code/test-third-party-extension/build.gradle.kts b/code/test-third-party-extension/build.gradle.kts new file mode 100644 index 000000000..1ecd3ac9c --- /dev/null +++ b/code/test-third-party-extension/build.gradle.kts @@ -0,0 +1,26 @@ +import com.adobe.marketing.mobile.gradle.BuildConstants + +plugins { + id("com.android.library") +} + +android { + namespace = "com.adobe.marketing.mobile.sample.thirdpartyextension" + compileSdk = BuildConstants.Versions.COMPILE_SDK_VERSION + + defaultConfig { + minSdk = BuildConstants.Versions.MIN_SDK_VERSION + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar")))) + implementation(project(":core")) +} diff --git a/code/test-third-party-extension/proguard-rules.pro b/code/test-third-party-extension/proguard-rules.pro deleted file mode 100644 index f1b424510..000000000 --- a/code/test-third-party-extension/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/code/test-third-party-extension/src/main/AndroidManifest.xml b/code/test-third-party-extension/src/main/AndroidManifest.xml index 374e6ac12..74b7379f7 100644 --- a/code/test-third-party-extension/src/main/AndroidManifest.xml +++ b/code/test-third-party-extension/src/main/AndroidManifest.xml @@ -1,4 +1,3 @@ - + \ No newline at end of file diff --git a/code/testapp-kotlin/build.gradle b/code/testapp-kotlin/build.gradle deleted file mode 100644 index 1b5596960..000000000 --- a/code/testapp-kotlin/build.gradle +++ /dev/null @@ -1,84 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' -} - -android { - namespace 'com.adobe.marketing.mobile.app.kotlin' - compileSdk rootProject.ext.targetSdkVersion - - defaultConfig { - applicationId "com.adobe.marketing.mobile.app.kotlin" - minSdk rootProject.ext.minSdkVersion - targetSdk rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary true - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - benchmark { - signingConfig signingConfigs.debug - matchingFallbacks = ['release'] - debuggable false - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } - buildFeatures { - compose true - } - composeOptions { - kotlinCompilerExtensionVersion '1.0.5' - } - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } -} - -dependencies { - implementation 'androidx.core:core-ktx:1.3.2' - implementation "androidx.compose.ui:ui:${compose_version}" - implementation "androidx.compose.material:material:${compose_version}" - implementation "androidx.compose.ui:ui-tooling-preview:${compose_version}" - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.0.0' - implementation "androidx.activity:activity-compose:1.5.0" - implementation 'androidx.navigation:navigation-compose:2.4.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' - - implementation project(path: ':core') - implementation project(path: ':identity') - implementation project(path: ':lifecycle') - implementation project(path: ':signal') - - /* Uncomment the following line when testing with analytics extension */ - //implementation 'com.adobe.marketing.mobile:analytics:2.0.0', withoutCore - - /* Uncomment the following line when testing with assurance extension */ - //implementation 'com.adobe.marketing.mobile:assurance:2.0.0', withoutCore - - /* Uncomment the following line when testing with local test-third-party-extension changes */ - //implementation project(':test-third-party-extension') - - /* Uncomment the following line when testing with test-third-party-extension from artifactory */ - //implementation 'com.example.victory:test-third-party-extension:2.0.0-SNAPSHOT' - - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} \ No newline at end of file diff --git a/code/testapp-kotlin/proguard-rules.pro b/code/testapp-kotlin/proguard-rules.pro deleted file mode 100644 index 481bb4348..000000000 --- a/code/testapp-kotlin/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/code/testapp-kotlin/src/androidTest/java/com/adobe/marketing/mobile/app/kotlin/ExampleInstrumentedTest.kt b/code/testapp-kotlin/src/androidTest/java/com/adobe/marketing/mobile/app/kotlin/ExampleInstrumentedTest.kt deleted file mode 100644 index e9ca58438..000000000 --- a/code/testapp-kotlin/src/androidTest/java/com/adobe/marketing/mobile/app/kotlin/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ -package com.adobe.marketing.mobile.app.kotlin - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("com.adobe.marketing.mobile.app.kotlin", appContext.packageName) - } -} \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/AndroidManifest.xml b/code/testapp-kotlin/src/main/AndroidManifest.xml deleted file mode 100644 index 97f437990..000000000 --- a/code/testapp-kotlin/src/main/AndroidManifest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/assets/ADBMobileConfig.json b/code/testapp-kotlin/src/main/assets/ADBMobileConfig.json deleted file mode 100644 index b3679315f..000000000 --- a/code/testapp-kotlin/src/main/assets/ADBMobileConfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "rules.url": "https://assets.adobedtm.com/94f571f308d5/fec7505defe0/launch-eaa54c95a6b5-development-rules.zip", - "experienceCloud.org": "972C898555E9F7BC7F000101@AdobeOrg", - "lifecycle.sessionTimeout": 300, - "global.privacy": "optedin", - "property.id": "PR16596147e65c4d37980310bae3097e6b", - "build.environment": "dev" -} \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml b/code/testapp-kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d114..000000000 --- a/code/testapp-kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/res/drawable/ic_launcher_background.xml b/code/testapp-kotlin/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9cb..000000000 --- a/code/testapp-kotlin/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/code/testapp-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/code/testapp-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cfe5..000000000 --- a/code/testapp-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/code/testapp-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cfe5..000000000 --- a/code/testapp-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/res/values/colors.xml b/code/testapp-kotlin/src/main/res/values/colors.xml deleted file mode 100644 index f8c6127d3..000000000 --- a/code/testapp-kotlin/src/main/res/values/colors.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF - \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/res/values/strings.xml b/code/testapp-kotlin/src/main/res/values/strings.xml deleted file mode 100644 index 3cfaa6594..000000000 --- a/code/testapp-kotlin/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - testapp-kotlin - \ No newline at end of file diff --git a/code/testapp-kotlin/.gitignore b/code/testapp/.gitignore similarity index 100% rename from code/testapp-kotlin/.gitignore rename to code/testapp/.gitignore diff --git a/code/testapp/build.gradle b/code/testapp/build.gradle deleted file mode 100644 index f6b043aae..000000000 --- a/code/testapp/build.gradle +++ /dev/null @@ -1,71 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion rootProject.ext.targetSdkVersion - - defaultConfig { - applicationId "com.adobe.marketing.mobile.app" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "2.0.0" - - //This says that my test app only wants to use the Phone variant - missingDimensionStrategy 'target', 'phone' - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - buildTypes { - debug { - testCoverageEnabled true - } - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - - testOptions { - animationsDisabled true - } -} - -dependencies { - def withoutCore = { exclude group: 'com.adobe.marketing.mobile', module: 'core' } - implementation 'androidx.appcompat:appcompat:1.0.0' - implementation 'com.google.android.material:material:1.0.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation project(':core') - implementation project(':identity') - implementation project(':signal') - implementation project(':lifecycle') - - /* Uncomment the following line when testing with analytics extension */ - //implementation 'com.adobe.marketing.mobile:analytics:2.0.0', withoutCore - - /* Uncomment the following line when testing with assurance extension */ - //implementation 'com.adobe.marketing.mobile:assurance:2.0.0', withoutCore - - /* Uncomment the following line when testing with local test-third-party-extension changes */ - //implementation project(':test-third-party-extension') - - /* Uncomment the following line when testing with test-third-party-extension from artifactory */ - //implementation 'com.example.victory:test-third-party-extension:1.0.0-SNAPSHOT', withoutCore - - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test:rules:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0', { - exclude group: 'com.android.support', module: 'support-annotations' - } - androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.0' - androidTestImplementation 'androidx.test.espresso:espresso-web:3.1.0' - - androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' -} \ No newline at end of file diff --git a/code/testapp/build.gradle.kts b/code/testapp/build.gradle.kts new file mode 100644 index 000000000..c183b4660 --- /dev/null +++ b/code/testapp/build.gradle.kts @@ -0,0 +1,81 @@ +import com.adobe.marketing.mobile.gradle.BuildConstants +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.adobe.marketing.mobile.core.testapp" + compileSdk = BuildConstants.Versions.COMPILE_SDK_VERSION + + defaultConfig { + applicationId = "com.adobe.marketing.mobile.core.testapp" + minSdk = BuildConstants.Versions.MIN_SDK_VERSION + targetSdk = BuildConstants.Versions.TARGET_SDK_VERSION + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + } + compileOptions { + sourceCompatibility = BuildConstants.Versions.JAVA_SOURCE_COMPATIBILITY + targetCompatibility = BuildConstants.Versions.JAVA_TARGET_COMPATIBILITY + } + + kotlinOptions { + jvmTarget = BuildConstants.Versions.KOTLIN_JVM_TARGET + languageVersion = BuildConstants.Versions.KOTLIN_LANGUAGE_VERSION + apiVersion = BuildConstants.Versions.KOTLIN_API_VERSION + } + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + create("benchmark") { + matchingFallbacks.add("release") + isDebuggable = false + } + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = BuildConstants.Versions.COMPOSE_COMPILER + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + val composeVersion = "1.6.0" + + implementation("androidx.core:core-ktx:1.12.0") + implementation("androidx.compose.ui:ui:${composeVersion}") + implementation("androidx.compose.material:material:${composeVersion}") + implementation("androidx.compose.ui:ui-tooling-preview:${composeVersion}") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0") + implementation("androidx.activity:activity-compose:1.8.2") + implementation("androidx.navigation:navigation-compose:2.7.6") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1") + + implementation(project(":core")) + implementation(project(":identity")) + implementation(project(":lifecycle")) + implementation(project(":signal")) + + /* Uncomment the following line when testing with assurance extension */ + // implementation("com.adobe.marketing.mobile:assurance:3.0.0") { + // isTransitive = false + // } + + /* Uncomment the following line when testing with local test-third-party-extension changes */ + // implementation(project(":test-third-party-extension") + + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") +} \ No newline at end of file diff --git a/code/testapp/proguard-rules.pro b/code/testapp/proguard-rules.pro index f1b424510..481bb4348 100644 --- a/code/testapp/proguard-rules.pro +++ b/code/testapp/proguard-rules.pro @@ -18,4 +18,4 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/code/testapp/src/androidTest/AndroidManifest.xml b/code/testapp/src/androidTest/AndroidManifest.xml deleted file mode 100644 index c51d5de21..000000000 --- a/code/testapp/src/androidTest/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/code/testapp/src/androidTest/java/com/adobe/marketing/mobile/PerformanceTest.java b/code/testapp/src/androidTest/java/com/adobe/marketing/mobile/PerformanceTest.java deleted file mode 100644 index 35e8ddeec..000000000 --- a/code/testapp/src/androidTest/java/com/adobe/marketing/mobile/PerformanceTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ -package com.adobe.marketing.mobile; - - -import android.content.Context; -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.core.widget.TextViewCompat; -import android.util.Log; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class PerformanceTest { - - class TestModule extends Module { - - TestModule(final EventHub hub) { - super("TestModule", hub); - - } - - @Override - protected void onUnregistered() { - - } - } - - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("com.adobe.testapp", appContext.getPackageName()); - } - - @Test - public void rulesEnginePerformanceTest() throws UnsupportedConditionException, JsonException, InvalidModuleException, - InterruptedException { - PlatformServices platformServices = new AndroidPlatformServices(); - EventHub eventHub = new EventHub("RulesEeningTest", platformServices); - RulesEngine rulesEngine = new RulesEngine(eventHub); - JsonUtilityService.JSONObject testRuleConditionJson = - platformServices.getJsonUtilityService().createJSONObject("{\"type\":\"matcher\",\"definition\":{\"key\":\"key\",\"matcher\":\"eq\",\"values\":[\"value\"]}}"); - RuleCondition ruleCondition = RuleCondition.ruleConditionFromJson(testRuleConditionJson); - Event event = new Event.Builder("", EventType.CONFIGURATION, - EventSource.RESPONSE_CONTENT).build(); - List events = new ArrayList<>(); - events.add(event); - List rules = new ArrayList<>(); - - for (int i = 0; i < 1000; i++) { - rules.add(new Rule(ruleCondition, events)); - } - - long start = System.currentTimeMillis(); - rulesEngine.replaceRules(new TestModule(eventHub), rules); - - for (int i = 0; i < 100; i++) { - rulesEngine.evaluateRules(new Event.Builder("", EventType.CONFIGURATION, - EventSource.RESPONSE_CONTENT).build()); - } - - Log.d("+++++", " time =>>>>>>>>>> " + (System.currentTimeMillis() - start)); - - } -} \ No newline at end of file diff --git a/code/testapp/src/androidTest/java/com/adobe/testapp/UIServicesInstrumentedTest.java b/code/testapp/src/androidTest/java/com/adobe/testapp/UIServicesInstrumentedTest.java deleted file mode 100644 index 8e1995f12..000000000 --- a/code/testapp/src/androidTest/java/com/adobe/testapp/UIServicesInstrumentedTest.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import static androidx.test.espresso.Espresso.onView; -import static androidx.test.espresso.action.ViewActions.click; -import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; -import static androidx.test.espresso.assertion.ViewAssertions.matches; -import static androidx.test.espresso.intent.Intents.intended; -import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction; -import static androidx.test.espresso.intent.matcher.IntentMatchers.hasData; -import static androidx.test.espresso.matcher.RootMatchers.isDialog; -import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; -import static androidx.test.espresso.matcher.ViewMatchers.withId; -import static androidx.test.espresso.matcher.ViewMatchers.withTagKey; -import static androidx.test.espresso.matcher.ViewMatchers.withTagValue; -import static androidx.test.espresso.matcher.ViewMatchers.withText; -import static androidx.test.espresso.web.assertion.WebViewAssertions.webMatches; -import static androidx.test.espresso.web.sugar.Web.onWebView; -import static androidx.test.espresso.web.webdriver.DriverAtoms.findElement; -import static androidx.test.espresso.web.webdriver.DriverAtoms.getText; - -import android.content.Context; -import android.content.Intent; -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.espresso.intent.rule.IntentsTestRule; -import androidx.test.espresso.web.webdriver.Locator; -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.uiautomator.By; -import androidx.test.uiautomator.UiDevice; -import androidx.test.uiautomator.UiObject2; -import androidx.test.uiautomator.Until; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.*; - -import com.adobe.marketing.mobile.TestAppUIServices; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class UIServicesInstrumentedTest { - - @Rule - public final IntentsTestRule mActivityRule = new IntentsTestRule<>(MainActivity.class); - private final UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); - private static final int TIMEOUT = 5000; - - @Before - public void setup() { - onView(withText(R.string.tab_ui_services)) - .perform(click()); - } - - @Test - public void testShowAlert() { - onView(withId(R.id.btnShowAlert)) - .perform(click()); - - int titleId = mActivityRule.getActivity().getResources() - .getIdentifier("alertTitle", "id", "android"); - - onView(withId(titleId)) - .inRoot(isDialog()) - .check(matches(withText(R.string.test_alert_title))) - .check(matches(isDisplayed())); - - onView(withId(android.R.id.message)) - .inRoot(isDialog()) - .check(matches(withText(R.string.test_alert_message))) - .check(matches(isDisplayed())); - - onView(withId(android.R.id.button2)) - .inRoot(isDialog()) - .check(matches(withText(R.string.test_alert_negative_text))) - .check(matches(isDisplayed())); - - onView(withId(android.R.id.button1)) - .inRoot(isDialog()) - .check(matches(withText(R.string.test_alert_positive_text))) - .check(matches(isDisplayed())); - - onView(withId(android.R.id.button1)) - .perform(click()); - - onView(withText(titleId)) - .check(doesNotExist()); - } - - @Test - public void testShowLocalNotification() { - String expectedAppName = mActivityRule.getActivity().getString(R.string.app_name); - - onView(withId(R.id.btnShowLocalNotification)) - .perform(click()); - - uiDevice.openNotification(); - uiDevice.wait(Until.hasObject(By.text(expectedAppName)), TIMEOUT); - UiObject2 notificationTitle = uiDevice.findObject(By.text(expectedAppName)); - assertEquals(notificationTitle.getText(), expectedAppName); - - UiObject2 notificationContent = uiDevice.findObject(By.text(getResourceString(R.string.test_notification_content))); - assertEquals(notificationContent.getText(), getResourceString(R.string.test_notification_content)); - - tearDown(); - } - - @Test - public void testShowLocalNotificationWithTitle() { - String expectedAppName = mActivityRule.getActivity().getString(R.string.app_name); - - onView(withId(R.id.btnShowLocalNotificationWithTitle)) - .perform(click()); - - uiDevice.openNotification(); - uiDevice.wait(Until.hasObject(By.text(expectedAppName)), TIMEOUT); - UiObject2 notificationTitle = uiDevice.findObject(By.text(getResourceString(R.string.test_notification_title))); - assertEquals(notificationTitle.getText(), getResourceString(R.string.test_notification_title)); - - UiObject2 notificationContent = uiDevice.findObject(By.text(getResourceString(R.string.test_notification_content))); - assertEquals(notificationContent.getText(), getResourceString(R.string.test_notification_content)); - - tearDown(); - } - - @Test - public void testShowWebView() { - onView(withId(R.id.btnShowFullScreenMsg)) - .perform(click()); - - onWebView().forceJavascriptEnabled(); - - onWebView().withElement(findElement(Locator.TAG_NAME, "body")) - .check(webMatches(getText(), containsString(getResourceString(R.string.test_fullscreen_html)))); - } - - @Test - public void testShowUrl() { - onView(withId(R.id.btnShowUrl)) - .perform(click()); - intended(allOf(hasAction(Intent.ACTION_VIEW), hasData(getResourceString(R.string.test_url)))); - tearDown(); - } - - @Test - public void testShowHideFloatingButton() { - onView(withId(R.id.btnShowFloatingButton)) - .perform(click()); - - onView(allOf(withTagValue(is((Object) TestAppUIServices.getFloatingButtonTag())), isDisplayed())) - .check(matches(isDisplayed())); - - onView(withId(R.id.btnHideFloatingButton)) - .perform(click()); - - onView(allOf(withTagValue(is((Object) TestAppUIServices.getFloatingButtonTag())), isDisplayed())) - .check(doesNotExist()); - } - - public void tearDown() { - uiDevice.pressBack(); - } - - private String getResourceString(int id) { - Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - return targetContext.getString(id); - } - - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - - assertEquals("com.adobe.testapp", appContext.getPackageName()); - } -} diff --git a/code/testapp/src/main/AndroidManifest.xml b/code/testapp/src/main/AndroidManifest.xml index 3704f41b9..fecce1c22 100644 --- a/code/testapp/src/main/AndroidManifest.xml +++ b/code/testapp/src/main/AndroidManifest.xml @@ -1,36 +1,29 @@ - - - + xmlns:tools="http://schemas.android.com/tools"> + android:theme="@style/Theme.AEPSDKCoreAndroid"> + android:name="com.adobe.marketing.mobile.core.testapp.MainActivity" + android:exported="true" + android:theme="@style/Theme.AEPSDKCoreAndroid"> - - - \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/assets/ADBMobileConfig-rules.zip b/code/testapp/src/main/assets/ADBMobileConfig-rules.zip similarity index 100% rename from code/testapp-kotlin/src/main/assets/ADBMobileConfig-rules.zip rename to code/testapp/src/main/assets/ADBMobileConfig-rules.zip diff --git a/code/testapp/src/main/assets/ADBMobileConfig.json b/code/testapp/src/main/assets/ADBMobileConfig.json index fdef48357..b3679315f 100644 --- a/code/testapp/src/main/assets/ADBMobileConfig.json +++ b/code/testapp/src/main/assets/ADBMobileConfig.json @@ -1,16 +1,8 @@ { - "global.privacy" : "optedin", - "analytics.launchHitDelay" : 0, - "analytics.backdatePreviousSessionInfo" : false, - "analytics.offlineEnabled" : false, - "build.environment" : "dev", - "rules.url" : "https://assets.adobedtm.com/launch-EN8fc4e9cda45e4514b075f0cf5e249742-development-rules.zip", - "experienceCloud.org" : "11111111111@AdobeOrg", - "lifecycle.sessionTimeout" : 5, - "analytics.server" : "obumobile5.sc.omtrdc.net", - "analytics.rsids" : "mobile5mob41911499889258395", - "analytics.batchLimit" : 1, - "property.id" : "PR075b22fc3221479d8a5817c2b8e50890", - "analytics.aamForwardingEnabled" : false, - "experienceCloud.server" : "dpm.demdex.net" + "rules.url": "https://assets.adobedtm.com/94f571f308d5/fec7505defe0/launch-eaa54c95a6b5-development-rules.zip", + "experienceCloud.org": "972C898555E9F7BC7F000101@AdobeOrg", + "lifecycle.sessionTimeout": 300, + "global.privacy": "optedin", + "property.id": "PR16596147e65c4d37980310bae3097e6b", + "build.environment": "dev" } \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/CoreView.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/CoreView.kt similarity index 73% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/CoreView.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/CoreView.kt index 70b853969..920379c1a 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/CoreView.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/CoreView.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp import android.widget.Toast import androidx.compose.foundation.layout.Arrangement @@ -25,7 +25,6 @@ import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController @@ -33,7 +32,8 @@ import androidx.navigation.compose.rememberNavController import com.adobe.marketing.mobile.LoggingMode import com.adobe.marketing.mobile.MobileCore import com.adobe.marketing.mobile.MobilePrivacyStatus -import com.adobe.marketing.mobile.app.kotlin.ui.theme.AepsdkcoreandroidTheme +import com.adobe.marketing.mobile.core.testapp.ui.theme.AEPSDKCoreAndroidTheme +import com.adobe.marketing.mobile.services.Log import com.adobe.marketing.mobile.services.ServiceProvider @Composable @@ -98,26 +98,60 @@ fun CoreView(navController: NavHostController) { Text(text = "setLogLevel(LogLevel.DEBUG)") } Button(onClick = { - MobileCore.log(LoggingMode.VERBOSE, "VERBOSE_TAG", "This is a VERBOSE message.") + MobileCore.setLogLevel(LoggingMode.WARNING) }) { - Text(text = "log (VERBOSE)") + Text(text = "setLogLevel(LogLevel.WARNING)") + } + Button(onClick = { + MobileCore.setLogLevel(LoggingMode.ERROR) + }) { + Text(text = "setLogLevel(LogLevel.ERROR)") } - Button(onClick = { showAlert("Log Level: ${MobileCore.getLogLevel()}") }) { Text(text = "getLogLevel") } Button(onClick = { - com.adobe.marketing.mobile.services.Log.debug( - "extension-name", - "kotlin-app", - "This is a %s log", - "debug" + Log.trace( + "CoreView", + "testapp", + "This is a %s log", + "verbose" + ) + }) { + Text(text = "Log.verbose") + } + Button(onClick = { + Log.debug( + "CoreView", + "testapp", + "This is a %s log", + "debug" ) }) { Text(text = "Log.debug") } + Button(onClick = { + Log.warning( + "CoreView", + "testapp", + "This is a %s log", + "warning" + ) + }) { + Text(text = "Log.warning") + } + Button(onClick = { + Log.error( + "CoreView", + "testapp", + "This is a %s log", + "error" + ) + }) { + Text(text = "Log.error") + } Button(onClick = { MobileCore.setPushIdentifier("ABC") }) { @@ -150,6 +184,21 @@ fun CoreView(navController: NavHostController) { }) { Text(text = "trackState") } + Button(onClick = { + MobileCore.lifecycleStart(null) + }) { + Text(text = "lifecycleStart") + } + Button(onClick = { + MobileCore.lifecycleStart(mapOf("key" to "value")) + }) { + Text(text = "lifecycleStart(contextData)") + } + Button(onClick = { + MobileCore.lifecyclePause() + }) { + Text(text = "lifecyclePause") + } Button(onClick = { MobileCore.resetIdentities() }) { @@ -171,23 +220,10 @@ private fun showCoreVersion() { } private fun updateConfiguration() { - registerEventListener( - "com.adobe.eventType.configuration", - "com.adobe.eventSource.requestContent" - ) { event -> - showAlert(event) - } - - MobileCore.updateConfiguration(mapOf("'global.privacy" to "optedout")) + MobileCore.updateConfiguration(mapOf("global.privacy" to "optedout")) } private fun clearUpdatedConfiguration() { - registerEventListener( - "com.adobe.eventType.configuration", - "com.adobe.eventSource.requestContent" - ) { event -> - showAlert(event) - } MobileCore.clearUpdatedConfiguration() } @@ -195,7 +231,7 @@ private fun clearUpdatedConfiguration() { @Preview(showBackground = true) @Composable fun DefaultPreviewForCoreView() { - AepsdkcoreandroidTheme { + AEPSDKCoreAndroidTheme { CoreView(rememberNavController()) } } \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/HomeView.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/HomeView.kt similarity index 91% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/HomeView.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/HomeView.kt index 412ddd37e..bf2086676 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/HomeView.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/HomeView.kt @@ -8,25 +8,23 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.material.Button import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.testTag import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import androidx.navigation.compose.rememberNavController -import com.adobe.marketing.mobile.app.kotlin.ui.theme.AepsdkcoreandroidTheme +import com.adobe.marketing.mobile.core.testapp.ui.theme.AEPSDKCoreAndroidTheme @Composable fun HomeView(navController: NavHostController) { @@ -75,7 +73,7 @@ fun HomeView(navController: NavHostController) { @Preview(showBackground = true) @Composable fun DefaultPreviewForHomeView() { - AepsdkcoreandroidTheme { + AEPSDKCoreAndroidTheme { HomeView(rememberNavController()) } } \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/IdentityView.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/IdentityView.kt similarity index 98% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/IdentityView.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/IdentityView.kt index 5afd162db..886c784f6 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/IdentityView.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/IdentityView.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp import android.widget.Toast import androidx.compose.foundation.layout.* diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/LifecycleView.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/LifecycleView.kt similarity index 69% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/LifecycleView.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/LifecycleView.kt index 874eb2670..91f1896aa 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/LifecycleView.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/LifecycleView.kt @@ -8,16 +8,20 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.Button import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController +import com.adobe.marketing.mobile.Signal @Composable fun LifecycleView(navController: NavHostController) { @@ -27,6 +31,12 @@ fun LifecycleView(navController: NavHostController) { }) { Text(text = "Home") } - Text(text = "Lifecycle!") + Column( + modifier = Modifier.fillMaxSize(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text(text = "Signal extension version - ${Signal.extensionVersion()}") + } } } \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/MainActivity.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/MainActivity.kt similarity index 85% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/MainActivity.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/MainActivity.kt index 1e5f83ce4..9aa3578f1 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/MainActivity.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/MainActivity.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp import android.os.Bundle import androidx.activity.ComponentActivity @@ -16,20 +16,18 @@ import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface -import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController -import com.adobe.marketing.mobile.app.kotlin.ui.theme.AepsdkcoreandroidTheme +import com.adobe.marketing.mobile.core.testapp.ui.theme.AEPSDKCoreAndroidTheme class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { - AepsdkcoreandroidTheme { + AEPSDKCoreAndroidTheme { // A surface container using the 'background' color from the theme Surface( modifier = Modifier.fillMaxSize(), @@ -79,16 +77,3 @@ fun NavigationInit() { } } } - -@Composable -fun Greeting(name: String) { - Text(text = "Hello $name!") -} - -@Preview(showBackground = true) -@Composable -fun DefaultPreview() { - AepsdkcoreandroidTheme { - Greeting("Android") - } -} \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/MyApp.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/MyApp.kt similarity index 80% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/MyApp.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/MyApp.kt index 5fb969de0..e4cc185bc 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/MyApp.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/MyApp.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp import android.app.Application import com.adobe.marketing.mobile.MobileCore @@ -16,7 +16,7 @@ import com.adobe.marketing.mobile.Identity import com.adobe.marketing.mobile.Lifecycle import com.adobe.marketing.mobile.LoggingMode import com.adobe.marketing.mobile.Signal -import com.adobe.marketing.mobile.app.kotlin.extension.PerfExtension +import com.adobe.marketing.mobile.core.testapp.extension.PerfExtension class MyApp : Application() { @@ -24,11 +24,11 @@ class MyApp : Application() { super.onCreate() MobileCore.setApplication(this) MobileCore.setLogLevel(LoggingMode.VERBOSE) + + // The test app uses bundled config. Uncomment this and change the app ID for testing the mobile tags property. // MobileCore.configureWithAppID("YOUR_APP_ID") val extensions = listOf(Identity.EXTENSION, Signal.EXTENSION, Lifecycle.EXTENSION, PerfExtension::class.java) - MobileCore.registerExtensions(extensions) { - - } + MobileCore.registerExtensions(extensions) {} } } diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/NavRoutes.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/NavRoutes.kt similarity index 90% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/NavRoutes.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/NavRoutes.kt index 44e3f1b9b..f59d85e34 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/NavRoutes.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/NavRoutes.kt @@ -8,14 +8,14 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp sealed class NavRoutes(val route: String) { object HomeView : NavRoutes("home") object CoreView : NavRoutes("core") object SignalView : NavRoutes("signal") object LifecycleView : NavRoutes("lifecycle") - object IdentityView : NavRoutes("Identity") + object IdentityView : NavRoutes("identity") object ServicesView : NavRoutes("services") object PerformanceView : NavRoutes("performance") } \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/PerformanceView.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/PerformanceView.kt similarity index 91% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/PerformanceView.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/PerformanceView.kt index 2ecefcd59..1aa05e712 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/PerformanceView.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/PerformanceView.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState @@ -23,11 +23,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import com.adobe.marketing.mobile.Event -import com.adobe.marketing.mobile.LoggingMode import com.adobe.marketing.mobile.MobileCore -import com.adobe.marketing.mobile.MobilePrivacyStatus -import com.adobe.marketing.mobile.app.kotlin.extension.PerfExtension -import java.util.concurrent.atomic.AtomicInteger +import com.adobe.marketing.mobile.core.testapp.extension.PerfExtension @Composable fun PerformanceView(navController: NavHostController) { diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ServicesView.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ServicesView.kt similarity index 75% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ServicesView.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ServicesView.kt index 6cd3a2464..3cad42f0b 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ServicesView.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ServicesView.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -22,13 +22,13 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import androidx.navigation.compose.rememberNavController -import com.adobe.marketing.mobile.app.kotlin.ui.theme.AepsdkcoreandroidTheme -import com.adobe.marketing.mobile.app.kotlin.uiservices.alert.AlertCard -import com.adobe.marketing.mobile.app.kotlin.uiservices.alert.AlertCreator -import com.adobe.marketing.mobile.app.kotlin.uiservices.floatingbutton.FloatingButtonCard -import com.adobe.marketing.mobile.app.kotlin.uiservices.floatingbutton.FloatingButtonCreator -import com.adobe.marketing.mobile.app.kotlin.uiservices.inappmessage.InAppMessageCard -import com.adobe.marketing.mobile.app.kotlin.uiservices.inappmessage.InAppMessageCreator +import com.adobe.marketing.mobile.core.testapp.ui.theme.AEPSDKCoreAndroidTheme +import com.adobe.marketing.mobile.core.testapp.ui.alert.AlertCard +import com.adobe.marketing.mobile.core.testapp.ui.alert.AlertCreator +import com.adobe.marketing.mobile.core.testapp.ui.floatingbutton.FloatingButtonCard +import com.adobe.marketing.mobile.core.testapp.ui.floatingbutton.FloatingButtonCreator +import com.adobe.marketing.mobile.core.testapp.ui.inappmessage.InAppMessageCard +import com.adobe.marketing.mobile.core.testapp.ui.inappmessage.InAppMessageCreator import com.adobe.marketing.mobile.services.ServiceProvider val inAppMessage = InAppMessageCreator.create() @@ -55,7 +55,7 @@ fun ServicesView(navController: NavHostController) { @Preview(showBackground = true) @Composable fun DefaultPreviewForServicesView() { - AepsdkcoreandroidTheme { + AEPSDKCoreAndroidTheme { ServicesView(rememberNavController()) } } \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/SignalView.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/SignalView.kt similarity index 69% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/SignalView.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/SignalView.kt index e19fa2147..a39b57a88 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/SignalView.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/SignalView.kt @@ -8,16 +8,20 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.Button import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController +import com.adobe.marketing.mobile.Signal @Composable fun SignalView(navController: NavHostController) { @@ -27,6 +31,13 @@ fun SignalView(navController: NavHostController) { }) { Text(text = "Home") } - Text(text = "Signal!") + Column( + modifier = Modifier.fillMaxSize(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text(text = "Signal extension version - ${Signal.extensionVersion()}") + } + } } \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/Utilities.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/Utilities.kt similarity index 69% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/Utilities.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/Utilities.kt index e25d02eea..98393c54c 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/Utilities.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/Utilities.kt @@ -8,12 +8,9 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin +package com.adobe.marketing.mobile.core.testapp -import com.adobe.marketing.mobile.AdobeCallbackWithError -import com.adobe.marketing.mobile.AdobeError import com.adobe.marketing.mobile.Event -import com.adobe.marketing.mobile.MobileCore import com.adobe.marketing.mobile.services.ServiceProvider import com.adobe.marketing.mobile.services.ui.Alert import com.adobe.marketing.mobile.services.ui.Presentable @@ -31,27 +28,6 @@ internal val alertEventListener = object : AlertEventListener { override fun onError(presentable: Presentable, error: PresentationError) {} } -internal fun registerEventListener( - eventType: String, - eventSource: String, - hear: (event: Event) -> Unit -) { - MobileCore.registerEventListener( - eventType, - eventSource, - object : - AdobeCallbackWithError { - override fun call(event: Event?) { - event?.run(hear) - } - - override fun fail(error: AdobeError?) { - throw RuntimeException("Failed to register EventListener!!!") - } - - }) -} - internal fun showAlert(event: Event) { val alert = Alert(AlertSettings.Builder() .title("Event") @@ -60,7 +36,8 @@ internal fun showAlert(event: Event) { .build() , alertEventListener) - ServiceProvider.getInstance().uiService.create(alert, DefaultPresentationUtilityProvider()) + val alertPresentable = ServiceProvider.getInstance().uiService.create(alert, DefaultPresentationUtilityProvider()) + alertPresentable.show() } internal fun showAlert(message: String) { @@ -71,5 +48,6 @@ internal fun showAlert(message: String) { .build() , alertEventListener) - ServiceProvider.getInstance().uiService.create(alert, DefaultPresentationUtilityProvider()) + val alertPresentable = ServiceProvider.getInstance().uiService.create(alert, DefaultPresentationUtilityProvider()) + alertPresentable.show() } diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/extension/PerfExtension.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/extension/PerfExtension.kt similarity index 97% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/extension/PerfExtension.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/extension/PerfExtension.kt index 3d73683e7..238ce20c8 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/extension/PerfExtension.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/extension/PerfExtension.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin.extension +package com.adobe.marketing.mobile.core.testapp.extension import com.adobe.marketing.mobile.EventSource import com.adobe.marketing.mobile.EventType diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/alert/AlertCard.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/alert/AlertCard.kt similarity index 96% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/alert/AlertCard.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/alert/AlertCard.kt index 97c441653..363869274 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/alert/AlertCard.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/alert/AlertCard.kt @@ -1,4 +1,4 @@ -package com.adobe.marketing.mobile.app.kotlin.uiservices.alert +package com.adobe.marketing.mobile.core.testapp.ui.alert import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/alert/AlertCreator.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/alert/AlertCreator.kt similarity index 95% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/alert/AlertCreator.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/alert/AlertCreator.kt index 3a7237c8d..398948aa2 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/alert/AlertCreator.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/alert/AlertCreator.kt @@ -1,4 +1,4 @@ -package com.adobe.marketing.mobile.app.kotlin.uiservices.alert +package com.adobe.marketing.mobile.core.testapp.ui.alert import com.adobe.marketing.mobile.services.ServiceProvider import com.adobe.marketing.mobile.services.ui.Alert diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/floatingbutton/FloatingButtonCard.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/floatingbutton/FloatingButtonCard.kt similarity index 96% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/floatingbutton/FloatingButtonCard.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/floatingbutton/FloatingButtonCard.kt index 3affb1153..8ffa347f7 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/floatingbutton/FloatingButtonCard.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/floatingbutton/FloatingButtonCard.kt @@ -1,4 +1,4 @@ -package com.adobe.marketing.mobile.app.kotlin.uiservices.floatingbutton +package com.adobe.marketing.mobile.core.testapp.ui.floatingbutton import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/floatingbutton/FloatingButtonCreator.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/floatingbutton/FloatingButtonCreator.kt similarity index 93% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/floatingbutton/FloatingButtonCreator.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/floatingbutton/FloatingButtonCreator.kt index 5948e5c1e..5c9d241b9 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/floatingbutton/FloatingButtonCreator.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/floatingbutton/FloatingButtonCreator.kt @@ -1,10 +1,10 @@ -package com.adobe.marketing.mobile.app.kotlin.uiservices.floatingbutton +package com.adobe.marketing.mobile.core.testapp.ui.floatingbutton import android.content.Context import android.graphics.drawable.Drawable import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.toBitmap -import com.adobe.marketing.mobile.app.kotlin.R +import com.adobe.marketing.mobile.core.testapp.R import com.adobe.marketing.mobile.services.ServiceProvider import com.adobe.marketing.mobile.services.ui.FloatingButton import com.adobe.marketing.mobile.services.ui.Presentable diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/inappmessage/InAppMessageCard.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/inappmessage/InAppMessageCard.kt similarity index 96% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/inappmessage/InAppMessageCard.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/inappmessage/InAppMessageCard.kt index 196731842..c24b02f1a 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/inappmessage/InAppMessageCard.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/inappmessage/InAppMessageCard.kt @@ -1,4 +1,4 @@ -package com.adobe.marketing.mobile.app.kotlin.uiservices.inappmessage +package com.adobe.marketing.mobile.core.testapp.ui.inappmessage import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/inappmessage/InAppMessageCreator.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/inappmessage/InAppMessageCreator.kt similarity index 98% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/inappmessage/InAppMessageCreator.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/inappmessage/InAppMessageCreator.kt index fa7c2b701..8f13b4502 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/uiservices/inappmessage/InAppMessageCreator.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/inappmessage/InAppMessageCreator.kt @@ -1,4 +1,4 @@ -package com.adobe.marketing.mobile.app.kotlin.uiservices.inappmessage +package com.adobe.marketing.mobile.core.testapp.ui.inappmessage import com.adobe.marketing.mobile.services.Log import com.adobe.marketing.mobile.services.ServiceProvider diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Color.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Color.kt similarity index 93% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Color.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Color.kt index d885255e5..4b4fa3195 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Color.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Color.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin.ui.theme +package com.adobe.marketing.mobile.core.testapp.ui.theme import androidx.compose.ui.graphics.Color diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Shape.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Shape.kt similarity index 93% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Shape.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Shape.kt index 33aea5907..ea348a622 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Shape.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Shape.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin.ui.theme +package com.adobe.marketing.mobile.core.testapp.ui.theme import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Shapes diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Theme.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Theme.kt similarity index 95% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Theme.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Theme.kt index 8337a73c3..0c45692cb 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Theme.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Theme.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin.ui.theme +package com.adobe.marketing.mobile.core.testapp.ui.theme import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material.MaterialTheme @@ -38,7 +38,7 @@ private val LightColorPalette = lightColors( ) @Composable -fun AepsdkcoreandroidTheme( +fun AEPSDKCoreAndroidTheme( darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit ) { diff --git a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Type.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Type.kt similarity index 96% rename from code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Type.kt rename to code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Type.kt index 02d247d7f..280d00d26 100644 --- a/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/app/kotlin/ui/theme/Type.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/core/testapp/ui/theme/Type.kt @@ -8,7 +8,7 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package com.adobe.marketing.mobile.app.kotlin.ui.theme +package com.adobe.marketing.mobile.core.testapp.ui.theme import androidx.compose.material.Typography import androidx.compose.ui.text.TextStyle diff --git a/code/testapp/src/main/java/com/adobe/marketing/mobile/services/ui/TestAppUIServices.java b/code/testapp/src/main/java/com/adobe/marketing/mobile/services/ui/TestAppUIServices.java deleted file mode 100644 index a24d70a91..000000000 --- a/code/testapp/src/main/java/com/adobe/marketing/mobile/services/ui/TestAppUIServices.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.marketing.mobile.services.ui; - -import java.util.Map; - -public class TestAppUIServices { - - private AndroidUIService uiService; - - public TestAppUIServices() { - uiService = new AndroidUIService(); - } - - public void showAlert(final String title, final String message, final String positiveButtonText, - final String negativeButtonText) { - AlertSetting settings = AlertSetting.build(title, message, positiveButtonText, negativeButtonText); - uiService.showAlert(settings, null); - } - - public void showLocalNotification(final String identifier, final String content, final long fireDate, - final int delaySeconds, final String deeplink, final Map userInfo, - final String sound) { - NotificationSetting notificationSetting = NotificationSetting.build(identifier, content, fireDate, delaySeconds, deeplink, userInfo, sound, null); - uiService.showLocalNotification(notificationSetting); - } - - public void showLocalNotification(final String identifier, final String content, final long fireDate, - final int delaySeconds, final String deeplink, final Map userInfo, - final String sound, final String title) { - NotificationSetting notificationSetting = NotificationSetting.build(identifier, content, fireDate, delaySeconds, deeplink, userInfo, sound, title); - uiService.showLocalNotification(notificationSetting); - } - - public void showFullscreenMessage(final String html) { - FullscreenMessage fullScreenMessage = uiService.createFullscreenMessage(html, null, false, null); - fullScreenMessage.show(); - } - - public void showUrl(final String url) { - uiService.showUrl(url); - } - - public void showFloatingButton() { - FloatingButton floatingButtonManager = uiService.createFloatingButton(null); - floatingButtonManager.display(); - } - - public void hideFloatingButton() { - FloatingButton floatingButtonManager = uiService.createFloatingButton(null); - floatingButtonManager.remove(); - } - - public static String getFloatingButtonTag() { - return FloatingButtonView.VIEW_TAG; - } -} diff --git a/code/testapp/src/main/java/com/adobe/testapp/ExtensionFragment.java b/code/testapp/src/main/java/com/adobe/testapp/ExtensionFragment.java deleted file mode 100644 index 9732eda1a..000000000 --- a/code/testapp/src/main/java/com/adobe/testapp/ExtensionFragment.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import android.os.Bundle; -import androidx.fragment.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; - -import java.util.HashMap; -import java.util.Map; - -/** - * A simple {@link Fragment} subclass. - */ -public class ExtensionFragment extends Fragment implements View.OnClickListener { - - private TextView tvEventsProcessed; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.fragment_extension, container, false); - tvEventsProcessed = view.findViewById(R.id.tvEventsProcessed); - Button btnDispatchEvent = view.findViewById(R.id.btnDispatchEvent); - Button btnDispatchPaired = view.findViewById(R.id.btnDispatchPaired); - Button btnPrintLatestConfig = view.findViewById(R.id.btnPrintLatestConfig); - Button btnUnregisterExtension = view.findViewById(R.id.btnUnregisterExtension); - Button btnRegisterExtension = view.findViewById(R.id.btnRegisterExtension); - Button gotoMain = view.findViewById(R.id.gotoMain); - - btnDispatchEvent.setOnClickListener(this); - btnDispatchPaired.setOnClickListener(this); - btnPrintLatestConfig.setOnClickListener(this); - btnUnregisterExtension.setOnClickListener(this); - btnRegisterExtension.setOnClickListener(this); - gotoMain.setOnClickListener(this); - - return view; - } - - - public void onDispatchEvent(View view) { - Map profile = new HashMap(); - profile.put("username", "Alex"); - profile.put("userage", "25"); - profile.put("city", "Bucharest"); - // Victory.setProfile(profile); - } - - public void onDispatchEventWithResponseCallback(View view) { - // Victory.getNoEventsProcessed(new AdobeCallback() { - // @Override - // public void call(final Long value) { - // runOnUiThread(new Runnable() { - // @Override - // public void run() { - // TextView t = (TextView) findViewById(R.id.tvEventsProcessed); - // String newText = "Events processed # " + String.valueOf(value); - // t.setText(newText); - // } - // }); - // } - // }); - } - - public void onRegisterExtension(View view) { - // Victory.registerExtension(); - } - - public void onUnregisterExtension(View view) { - // Victory.unregisterExtension(); - if (getActivity() != null) { - getActivity().runOnUiThread(new Runnable() { - @Override - public void run() { - tvEventsProcessed.setText(R.string.events_processed_0); - } - }); - } - } - - public void onGotoMainActivity(final View view) { - // Victory.gotoActivity(MainActivity.class.getName()); - } - - public void onPrintLatestConfig(final View view) { - // Victory.printLatestConfig(); - } - - @Override - public void onClick(View view) { - int viewId = view.getId(); - - if (viewId == R.id.btnDispatchEvent) { - onDispatchEvent(view); - } else if (viewId == R.id.btnDispatchPaired) { - onDispatchEventWithResponseCallback(view); - } else if (viewId == R.id.btnPrintLatestConfig) { - onPrintLatestConfig(view); - } else if (viewId == R.id.btnUnregisterExtension) { - onUnregisterExtension(view); - } else if (viewId == R.id.btnRegisterExtension) { - onRegisterExtension(view); - } else if (viewId == R.id.gotoMain) { - onGotoMainActivity(view); - } - - } -} \ No newline at end of file diff --git a/code/testapp/src/main/java/com/adobe/testapp/MainActivity.java b/code/testapp/src/main/java/com/adobe/testapp/MainActivity.java deleted file mode 100644 index 7268dac3b..000000000 --- a/code/testapp/src/main/java/com/adobe/testapp/MainActivity.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import com.google.android.material.tabs.TabLayout; -import androidx.viewpager.widget.ViewPager; -import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; -import androidx.appcompat.widget.Toolbar; - -public class MainActivity extends AppCompatActivity { - private ViewPager viewPager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - Toolbar toolbar = findViewById(R.id.toolbar); - toolbar.setTitle(getResources().getString(R.string.app_name)); - setSupportActionBar(toolbar); - - TabLayout tabLayout = findViewById(R.id.tabLayout); - - viewPager = findViewById(R.id.viewPager); - PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); - viewPager.setAdapter(adapter); - - tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { - @Override - public void onTabSelected(TabLayout.Tab tab) { - viewPager.setCurrentItem(tab.getPosition()); - } - - @Override - public void onTabUnselected(TabLayout.Tab tab) { - - } - - @Override - public void onTabReselected(TabLayout.Tab tab) { - - } - }); - viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); - } -} diff --git a/code/testapp/src/main/java/com/adobe/testapp/MobileCoreFragment.java b/code/testapp/src/main/java/com/adobe/testapp/MobileCoreFragment.java deleted file mode 100644 index 75536afc3..000000000 --- a/code/testapp/src/main/java/com/adobe/testapp/MobileCoreFragment.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import android.content.Context; -import android.graphics.Color; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentTransaction; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.Spinner; -import android.widget.TextView; - -import com.adobe.marketing.mobile.LoggingMode; -import com.adobe.marketing.mobile.MobileCore; - -import java.util.HashMap; -import java.util.Map; - -public class MobileCoreFragment extends Fragment implements View.OnClickListener { - - private static final String TAG = "MobileCoreFragment"; - private LogModeSpinAdapter spinAdapter; - - public MobileCoreFragment() { - // Required empty public constructor - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_mobile_core, container, false); - - view.findViewById(R.id.btnSetConfig).setOnClickListener(this); - view.findViewById(R.id.btnLifecyclePause).setOnClickListener(this); - view.findViewById(R.id.btnSetAdvId).setOnClickListener(this); - view.findViewById(R.id.btnSetPushId).setOnClickListener(this); - view.findViewById(R.id.btnCollectPii).setOnClickListener(this); - view.findViewById(R.id.btnTrackState).setOnClickListener(this); - view.findViewById(R.id.btnTrackAction).setOnClickListener(this); - view.findViewById(R.id.btnRegisterExtension).setOnClickListener(this); - view.findViewById(R.id.btnLog).setOnClickListener(this); - - spinAdapter = new LogModeSpinAdapter(getActivity(), android.R.layout.simple_spinner_item, LoggingMode.values()); - Spinner logModeSpinner = view.findViewById(R.id.logMoreSpinner); - logModeSpinner.setAdapter(spinAdapter); - logModeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView parent, View view, int position, long id) { - LoggingMode mode = spinAdapter.getItem(position); - MobileCore.setLogLevel(mode); - } - - @Override - public void onNothingSelected(AdapterView parent) { - // nothing at all - } - }); - - LoggingMode selectedMode = MobileCore.getLogLevel(); - logModeSpinner.setSelection(selectedMode.id); - return view; - } - - @Override - public void onClick(View view) { - int viewId = view.getId(); - - if (viewId == R.id.btnSetConfig) { - onSetConfigClicked(view); - } else if (viewId == R.id.btnLifecyclePause) { - onLifecyclePause(view); - } else if (viewId == R.id.btnSetAdvId) { - onSetAdvId(view); - } else if (viewId == R.id.btnSetPushId) { - onSetPushId(view); - } else if (viewId == R.id.btnLifecycleStart) { - onLifecycleStart(view); - } else if (viewId == R.id.btnCollectPii) { - onCollectPii(view); - } else if (viewId == R.id.btnTrackState) { - onTrackState(view); - } else if (viewId == R.id.btnTrackAction) { - onTrackAction(view); - } else if (viewId == R.id.btnRegisterExtension) { - onRegisterExtension(view); - } else if (viewId == R.id.btnLog) { - onLog(view); - } - } - - - public void onSetConfigClicked(View view) { - Map config = new HashMap<>(); - config.put("lifecycle.timeout", 5); - MobileCore.updateConfiguration(config); - } - - public void onLifecyclePause(View view) { - MobileCore.lifecyclePause(); - } - - public void onSetAdvId(View view) { - MobileCore.setAdvertisingIdentifier("advid"); - } - - public void onSetPushId(View view) { - MobileCore.setPushIdentifier("pushid"); - } - - public void onLifecycleStart(View view) { - Map c = new HashMap<>(); - c.put("key", "value"); - MobileCore.lifecycleStart(c); - } - - public void onCollectPii(View view) { - Map c = new HashMap<>(); - c.put("key", "value"); - MobileCore.collectPii(c); - } - - public void onTrackState(View view) { - Map c = new HashMap<>(); - c.put("key", "value"); - MobileCore.trackState("state", c); - } - - public void onTrackAction(View view) { - Map c = new HashMap<>(); - c.put("key", "value"); - MobileCore.trackAction("action", c); - } - - public void onRegisterExtension(View view) { - FragmentTransaction transaction = getFragmentManager().beginTransaction(); - transaction.replace(R.id.root_frame, new ExtensionFragment()); - transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); - transaction.addToBackStack(null); - transaction.commit(); - } - - /** - * Produce sample log entries. - */ - public void onLog(View view) { - Log.v(TAG, "Logging VERBOSE from android.util.Log"); - MobileCore.log(LoggingMode.VERBOSE, TAG, "Logging TRACE from MobileCore"); - - Log.d(TAG, "Logging DEBUG from android.util.Log"); - MobileCore.log(LoggingMode.DEBUG, TAG, "Logging DEBUG from MobileCore"); - - Log.w(TAG, "Logging WARNING from android.util.Log"); - MobileCore.log(LoggingMode.WARNING, TAG, "Logging WARNING from MobileCore"); - - Log.e(TAG, "Logging ERROR from android.util.Log"); - MobileCore.log(LoggingMode.ERROR, TAG, "Logging ERROR from MobileCore"); - - Log.i(TAG, "Logging INFO from android.util.Log"); - } - - static class LogModeSpinAdapter extends ArrayAdapter { - - private final LoggingMode[] values; - - public LogModeSpinAdapter(Context context, int textViewResourceId, LoggingMode[] values) { - super(context, textViewResourceId, values); - this.values = values; - } - - @Override - public int getCount() { - return values.length; - } - - @Override - public LoggingMode getItem(int position) { - return values[position]; - } - - @Override - public long getItemId(int position) { - return position; - } - - @Override - @NonNull - public View getView(int position, View convertView, @NonNull ViewGroup parent) { - TextView label = (TextView) super.getView(position, convertView, parent); - label.setTextColor(Color.BLACK); - label.setText(values[position].name()); - - return label; - } - - @Override - public View getDropDownView(int position, View convertView, @NonNull ViewGroup parent) { - TextView label = (TextView) super.getDropDownView(position, convertView, parent); - label.setTextColor(Color.BLACK); - label.setText(values[position].name()); - - return label; - } - } -} \ No newline at end of file diff --git a/code/testapp/src/main/java/com/adobe/testapp/PagerAdapter.java b/code/testapp/src/main/java/com/adobe/testapp/PagerAdapter.java deleted file mode 100644 index 10eeda7db..000000000 --- a/code/testapp/src/main/java/com/adobe/testapp/PagerAdapter.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentPagerAdapter; - -public class PagerAdapter extends FragmentPagerAdapter { - - private final int totalTabsCount; - - PagerAdapter(FragmentManager fm, int totalTabsCount) { - super(fm); - this.totalTabsCount = totalTabsCount; - } - - @Override - public Fragment getItem(int position) { - switch (position) { - case 0: - return new RootFragment(); - - case 1: - return new UIServicesFragment(); - - case 2: - return new PlatformServicesFragment(); - - default: - return null; - } - } - - @Override - public int getCount() { - return totalTabsCount; - } -} diff --git a/code/testapp/src/main/java/com/adobe/testapp/PlatformServicesFragment.java b/code/testapp/src/main/java/com/adobe/testapp/PlatformServicesFragment.java deleted file mode 100644 index 5a011b76b..000000000 --- a/code/testapp/src/main/java/com/adobe/testapp/PlatformServicesFragment.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import android.os.Bundle; -import androidx.fragment.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.adobe.marketing.mobile.services.ui.TestAppUIServices; -import com.adobe.marketing.mobile.services.DeviceInforming; -import com.adobe.marketing.mobile.services.ServiceProvider; - -/** - * A simple {@link Fragment} subclass. - */ -public class PlatformServicesFragment extends Fragment implements View.OnClickListener { - - private TestAppUIServices testAppUIServices; - - - public PlatformServicesFragment() { - testAppUIServices = new TestAppUIServices(); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_platform_services, container, false); - - view.findViewById(R.id.btnShowDeviceInfo).setOnClickListener(this); - - return view; - } - - @Override - public void onClick(View view) { - - switch (view.getId()) { - case R.id.btnShowDeviceInfo: - DeviceInforming deviceInforming = ServiceProvider.getInstance().getDeviceInfoService(); - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("\ngetApplicationName() - " + deviceInforming.getApplicationName()); - stringBuffer.append("\ngetApplicationPackageName() - " + deviceInforming.getApplicationPackageName()); - stringBuffer.append("\ngetApplicationVersion() - " + deviceInforming.getApplicationVersion()); - stringBuffer.append("\ngetApplicationVersionCode() - " + deviceInforming.getApplicationVersionCode()); - stringBuffer.append("\ngetApplicationBaseDir() - " + deviceInforming.getApplicationBaseDir()); - stringBuffer.append("\ngetApplicationCacheDir() - " + deviceInforming.getApplicationCacheDir()); - stringBuffer.append("\ngetActiveLocale() - " + deviceInforming.getActiveLocale()); - stringBuffer.append("\ngetSystemLocale() - " + deviceInforming.getSystemLocale()); - stringBuffer.append("\ngetCanonicalPlatformName() - " + deviceInforming.getCanonicalPlatformName()); - stringBuffer.append("\ngetDefaultUserAgent() - " + deviceInforming.getDefaultUserAgent()); - stringBuffer.append("\ngetDeviceBuildId() - " + deviceInforming.getDeviceBuildId()); - stringBuffer.append("\ngetDeviceType() - " + deviceInforming.getDeviceType()); - stringBuffer.append("\ngetDeviceManufacturer() - " + deviceInforming.getDeviceManufacturer()); - stringBuffer.append("\ngetDeviceName() - " + deviceInforming.getDeviceName()); - stringBuffer.append("\ngetLocaleString() - " + deviceInforming.getLocaleString()); - stringBuffer.append("\ngetMobileCarrierName() - " + deviceInforming.getMobileCarrierName()); - stringBuffer.append("\ngetNetworkConnectionStatus() - " + deviceInforming.getNetworkConnectionStatus()); - stringBuffer.append("\ngetOperatingSystemVersion() - " + deviceInforming.getOperatingSystemVersion()); - stringBuffer.append("\ngetRunMode() - " + deviceInforming.getRunMode()); - stringBuffer.append("\ngetWidthPixels - " + deviceInforming.getDisplayInformation().getWidthPixels()); - stringBuffer.append("\ngetHeightPixels - " + deviceInforming.getDisplayInformation().getHeightPixels()); - stringBuffer.append("\ngetDensityDpi - " + deviceInforming.getDisplayInformation().getDensityDpi()); - - - - testAppUIServices.showAlert(getString(R.string.test_alert_title), stringBuffer.toString(), - getString(R.string.test_alert_positive_text), getString(R.string.test_alert_negative_text)); - break; - - default: - break; - } - - - } -} \ No newline at end of file diff --git a/code/testapp/src/main/java/com/adobe/testapp/RootFragment.java b/code/testapp/src/main/java/com/adobe/testapp/RootFragment.java deleted file mode 100644 index 9490300ba..000000000 --- a/code/testapp/src/main/java/com/adobe/testapp/RootFragment.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import android.os.Bundle; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentTransaction; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -public class RootFragment extends Fragment { - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_root, container, false); - - if (getFragmentManager() != null) { - FragmentTransaction transaction = getFragmentManager().beginTransaction(); - transaction.replace(R.id.root_frame, new MobileCoreFragment()); - transaction.commit(); - } - - return view; - } -} \ No newline at end of file diff --git a/code/testapp/src/main/java/com/adobe/testapp/TestApp.java b/code/testapp/src/main/java/com/adobe/testapp/TestApp.java deleted file mode 100644 index 13ac34eeb..000000000 --- a/code/testapp/src/main/java/com/adobe/testapp/TestApp.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import com.adobe.marketing.mobile.Extension; -import com.adobe.marketing.mobile.Identity; -import com.adobe.marketing.mobile.Lifecycle; -import com.adobe.marketing.mobile.MobileCore; -import com.adobe.marketing.mobile.Signal; - -import android.app.Application; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -public class TestApp extends Application { - - @Override - public void onCreate() { - super.onCreate(); - MobileCore.setApplication(this); - MobileCore.setLogLevel(com.adobe.marketing.mobile.LoggingMode.VERBOSE); - // MobileCore.configureWithAppID("YOUR_APP_ID") - - List> extensions = Arrays.asList( - Identity.EXTENSION, - Signal.EXTENSION, - Lifecycle.EXTENSION - ); - - MobileCore.registerExtensions(extensions, value -> { - MobileCore.collectPii(new HashMap() { - { - put("triggerKey", "collectPIIIOS"); - put("cusFirstName", "aa"); - put("cusLastName", "bb"); - put("cusEmail", "aa.bb@gmail.com"); - } - }); - }); - - } -} - diff --git a/code/testapp/src/main/java/com/adobe/testapp/UIServicesFragment.java b/code/testapp/src/main/java/com/adobe/testapp/UIServicesFragment.java deleted file mode 100644 index 078bf1c48..000000000 --- a/code/testapp/src/main/java/com/adobe/testapp/UIServicesFragment.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright 2022 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - OF ANY KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. - */ - -package com.adobe.testapp; - -import android.os.Bundle; -import androidx.fragment.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.adobe.marketing.mobile.services.ui.TestAppUIServices; - -/** - * A simple {@link Fragment} subclass. - */ -public class UIServicesFragment extends Fragment implements View.OnClickListener { - - private TestAppUIServices testAppUIServices; - - public UIServicesFragment() { - testAppUIServices = new TestAppUIServices(); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_ui_services, container, false); - - view.findViewById(R.id.btnShowAlert).setOnClickListener(this); - view.findViewById(R.id.btnShowLocalNotification).setOnClickListener(this); - view.findViewById(R.id.btnShowLocalNotificationWithTitle).setOnClickListener(this); - view.findViewById(R.id.btnShowFullScreenMsg).setOnClickListener(this); - view.findViewById(R.id.btnShowUrl).setOnClickListener(this); - view.findViewById(R.id.btnShowFloatingButton).setOnClickListener(this); - view.findViewById(R.id.btnHideFloatingButton).setOnClickListener(this); - - return view; - } - - @Override - public void onClick(View view) { - int viewId = view.getId(); - - if (viewId == R.id.btnShowAlert) { - testAppUIServices.showAlert(getString(R.string.test_alert_title), getString(R.string.test_alert_message), - getString(R.string.test_alert_positive_text), getString(R.string.test_alert_negative_text)); - } else if (viewId == R.id.btnShowLocalNotification) { - testAppUIServices.showLocalNotification("id", getString(R.string.test_notification_content), - System.currentTimeMillis() / 1000, 0, "myscheme://link", null, - "sound.wav"); - } else if (viewId == R.id.btnShowLocalNotificationWithTitle) { - testAppUIServices.showLocalNotification("id", getString(R.string.test_notification_content), - System.currentTimeMillis() / 1000, 0, "myscheme://link", null, - "sound.wav", getString(R.string.test_notification_title)); - } else if (viewId == R.id.btnShowFullScreenMsg) { - testAppUIServices.showFullscreenMessage("" + getString(R.string.test_fullscreen_html) + ""); - } else if (viewId == R.id.btnShowUrl) { - testAppUIServices.showUrl(getString(R.string.test_url)); - } else if (viewId == R.id.btnShowFloatingButton) { - testAppUIServices.showFloatingButton(); - } else if (viewId == R.id.btnHideFloatingButton) { - testAppUIServices.hideFloatingButton(); - } - } -} \ No newline at end of file diff --git a/code/testapp-kotlin/src/main/res/drawable-v24/ic_floating_button.xml b/code/testapp/src/main/res/drawable-v24/ic_floating_button.xml similarity index 100% rename from code/testapp-kotlin/src/main/res/drawable-v24/ic_floating_button.xml rename to code/testapp/src/main/res/drawable-v24/ic_floating_button.xml diff --git a/code/testapp/src/main/res/drawable-v24/ic_launcher_foreground.xml b/code/testapp/src/main/res/drawable-v24/ic_launcher_foreground.xml index c7bd21dbd..2b068d114 100644 --- a/code/testapp/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/code/testapp/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -2,19 +2,15 @@ xmlns:aapt="http://schemas.android.com/aapt" android:width="108dp" android:height="108dp" - android:viewportHeight="108" - android:viewportWidth="108"> - + android:viewportWidth="108" + android:viewportHeight="108"> + - + android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" + android:strokeWidth="1" + android:strokeColor="#00000000" /> + \ No newline at end of file diff --git a/code/testapp/src/main/res/drawable/ic_launcher_background.xml b/code/testapp/src/main/res/drawable/ic_launcher_background.xml index d5fccc538..07d5da9cb 100644 --- a/code/testapp/src/main/res/drawable/ic_launcher_background.xml +++ b/code/testapp/src/main/res/drawable/ic_launcher_background.xml @@ -2,169 +2,169 @@ + android:viewportWidth="108" + android:viewportHeight="108"> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> diff --git a/code/testapp/src/main/res/layout/activity_main.xml b/code/testapp/src/main/res/layout/activity_main.xml deleted file mode 100644 index 654be6b43..000000000 --- a/code/testapp/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/code/testapp/src/main/res/layout/fragment_extension.xml b/code/testapp/src/main/res/layout/fragment_extension.xml deleted file mode 100644 index 0c57cdadb..000000000 --- a/code/testapp/src/main/res/layout/fragment_extension.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - -