Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.2.1-beta.2 #329

Merged
merged 25 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v3
Expand All @@ -39,7 +39,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v3
Expand All @@ -65,7 +65,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v3
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18

- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v3
Expand Down Expand Up @@ -200,7 +200,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: Cache node_modules
uses: actions/cache@v3
Expand All @@ -218,7 +218,7 @@ jobs:
with:
cache: gradle
distribution: temurin
java-version: 11
java-version: 17

- name: Update App Platform ID
working-directory: source/examples/Basic/config/
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/app_prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v2
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: "Checkout ${{ inputs.ref }}"
uses: actions/checkout@v2
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: "Checkout ${{ inputs.ref }}"
uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/app_stg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v2
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: "Checkout ${{ inputs.ref }}"
uses: actions/checkout@v2
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"

- name: "Checkout ${{ inputs.ref }}"
uses: actions/checkout@v2
Expand Down
87 changes: 21 additions & 66 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import groovy.json.JsonSlurper

// android/build.gradle
// based on:
//
Expand All @@ -10,15 +8,15 @@ import groovy.json.JsonSlurper
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
// original location:
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
def DEFAULT_BUILD_TOOLS_VERSION = '30.0.2'
def DEFAULT_BUILD_TOOLS_VERSION = '34.0.0'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
apply plugin: 'com.android.library'
// apply plugin: 'maven'
apply plugin: "kotlin-android"
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.20'
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
Expand All @@ -29,13 +27,13 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
}
android {
compileSdkVersion 33
compileSdkVersion 34
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
defaultConfig {
minSdkVersion 22
Expand All @@ -44,28 +42,32 @@ android {
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
}
lintOptions {
abortOnError false
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
dexOptions {
javaMaxHeapSize "4g"
}
buildFeatures {
viewBinding true
}

flavorDimensions "store"
productFlavors {
amazon {
dimension "store"
}

play {
dimension "store"
}
}
}
repositories {
mavenCentral()
// ref: https://www.baeldung.com/maven-local-repository
mavenLocal()
maven { url("https://packages.namiml.com/NamiSDK/Amazon/") }
maven { url("https://packages.namiml.com/NamiSDK/Android/") }
maven { url 'https://jitpack.io' }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
Expand All @@ -83,35 +85,12 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'com.github.jeziellago:compose-markdown:0.3.0'
compileOnly "com.namiml:sdk-amazon:3.2.0-beta.01"
playImplementation "com.namiml:sdk-android:3.2.1-beta.02"
amazonImplementation "com.namiml:sdk-amazon:3.2.1-beta.02"

implementation 'com.facebook.react:react-native:+' // From node_modules
implementation "com.facebook.react:react-native:+" // From node_modules
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
}
def configureReactNativePom(def pom) {
def packageJson = new JsonSlurper().parseText(file('../package.json').text)
pom.project {
name packageJson.title
artifactId packageJson.name
version = packageJson.version
group = "com.nami.reactlibrary"
description packageJson.description
url packageJson.repository.baseUrl
licenses {
license {
name packageJson.license
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
distribution 'repo'
}
}
developers {
developer {
id packageJson.author.username
name packageJson.author.name
}
}
}

}

configurations {
Expand All @@ -121,39 +100,15 @@ configurations {
afterEvaluate { project ->
// some Gradle build hooks ref:
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
task androidJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += files(android.bootClasspath)
// classpath += files(project.getConfigurations().getByName('compile').asList())
// classpath += files(project.getConfigurations().getByName('customConfig').asList())
include '**/*.java'
}
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
classifier = 'javadoc'
from androidJavadoc.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
include '**/*.java'
}
android.libraryVariants.all { variant ->
def name = variant.name.capitalize()
def javaCompileTask = variant.javaCompileProvider.get()
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
from javaCompileTask.destinationDir
}
}
artifacts {
archives androidSourcesJar
archives androidJavadocJar
}

task installArchives(type: Upload) {
configuration = configurations.archives
// repositories.mavenDeployer {
// // Deploy to react-native-event-bridge/maven, ready to publish to npm
// repository url: "file://${projectDir}/../android/maven"
// configureReactNativePom pom
// }
}
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed May 26 17:12:26 EDT 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
} else {
Arguments.createArray()
}
val settingsList = mutableListOf("extendedClientInfo:react-native:3.2.0")
val settingsList = mutableListOf("extendedClientInfo:react-native:3.2.1-beta.2")
namiCommandsReact?.toArrayList()?.filterIsInstance<String>()?.let { commandsFromReact ->
settingsList.addAll(commandsFromReact)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
const val CAMPAIGN_TYPE = "campaignType"
const val CAMPAIGN_URL = "campaignUrl"
const val PAYWALL_NAME = "paywallName"
const val COMPONENT_CHANGE_ID = "componentChangeId"
const val COMPONENT_CHANGE_NAME = "componentChangeName"
const val COMPONENT_CHANGE = "componentChange"
const val SEGMENT_ID = "segmentId"
const val EXTERNAL_SEGMENT_ID = "externalSegmentId"
const val DEEP_LINK_URL = "deeplinkUrl"
const val TIME_SPENT_ON_PAYWALL = "timeSpentOnPaywall"
const val VIDEO_METADATA = "videoMetadata"
const val _RESULT_CAMPAIGN = "ResultCampaign"
}

Expand Down Expand Up @@ -60,6 +61,7 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
if (context != null) {
val productGroups: MutableList<String> = mutableListOf()
val customAttributes: MutableMap<String, String> = mutableMapOf()
val customObject: MutableMap<String, String> = mutableMapOf()

if (context.hasKey("productGroups")) {
val groups = context.getArray("productGroups")
Expand All @@ -86,10 +88,22 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
}
}

if (context.hasKey("customObject")) {
val attr = context.getMap("customObject")
if (attr != null) {
val keyIterator = attr.keySetIterator()
while (keyIterator.hasNextKey()) {
val key = keyIterator.nextKey()
customObject[key] = attr.getString(key) ?: ""
}
Log.d(LOG_TAG, "customObject $customObject")
}
}

if (context.hasKey("productGroups")) {
paywallLaunchContext = PaywallLaunchContext(productGroups.toList(), customAttributes)
paywallLaunchContext = PaywallLaunchContext(productGroups.toList(), customAttributes, customObject)
} else {
paywallLaunchContext = PaywallLaunchContext(null, customAttributes)
paywallLaunchContext = PaywallLaunchContext(null, customAttributes, customObject)
}
}

Expand Down Expand Up @@ -150,12 +164,39 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
putString(CAMPAIGN_TYPE, paywallEvent.campaignType ?: "")
putString(CAMPAIGN_URL, paywallEvent.campaignUrl ?: "")
putString(PAYWALL_NAME, paywallEvent.paywallName ?: "")
putString(COMPONENT_CHANGE_ID, paywallEvent?.componentChange?.id ?: "")
putString(COMPONENT_CHANGE_NAME, paywallEvent?.componentChange?.name ?: "")
putString(SEGMENT_ID, paywallEvent.segmentId ?: "")
putString(EXTERNAL_SEGMENT_ID, paywallEvent.externalSegmentId ?: "")
putString(DEEP_LINK_URL, paywallEvent.deeplinkUrl ?: "")

}

if (paywallEvent.componentChange != null) {
val componentChangeMap = Arguments.createMap().apply {
putString("id", paywallEvent.componentChange?.id ?: "")
putString("name", paywallEvent.componentChange?.name ?: "")
}

resultMap.putMap(COMPONENT_CHANGE, componentChangeMap)
}

if (paywallEvent.videoMetadata != null) {
val videoMetadataMap = Arguments.createMap().apply {
putString("id", paywallEvent.videoMetadata?.id ?: "")
putString("name", paywallEvent.videoMetadata?.name ?: "")
putBoolean("autoplayVideo", paywallEvent.videoMetadata?.autoplayVideo ?: false)
putBoolean("muteByDefault", paywallEvent.videoMetadata?.muteByDefault ?: false)
putBoolean("loopVideo", paywallEvent.videoMetadata?.loopVideo ?: false)
putDouble("contentDuration", paywallEvent.videoMetadata?.contentDuration ?: 0.0)
putDouble("contentTimecode", paywallEvent.videoMetadata?.contentTimecode ?: 0.0)
}

resultMap.putMap(VIDEO_METADATA, videoMetadataMap)
}

if (paywallEvent.timeSpentOnPaywall != null) {
resultMap.putDouble(TIME_SPENT_ON_PAYWALL, paywallEvent.timeSpentOnPaywall ?: 0.0)
}

emitEvent(_RESULT_CAMPAIGN, resultMap)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :

@ReactMethod
fun setAppSuppliedVideoDetails(url: String, name: String?) {
// To be implemented
NamiPaywallManager.setAppSuppliedVideoDetails(url = url, name = name)
}

@ReactMethod
Expand Down
Loading
Loading