Skip to content

Commit

Permalink
Update native SDKs and build settings (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
igstewart3 authored Sep 19, 2024
1 parent bf128c9 commit 6e58d66
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 35 deletions.
4 changes: 2 additions & 2 deletions AndroidUnityWrapper~/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
val kotlinVersion by extra("1.8.22")
val kotlinVersion by extra("1.9.24")
repositories {
mavenCentral()
google()
}
dependencies {
classpath("com.android.tools.build:gradle:8.1.4")
classpath("com.android.tools.build:gradle:8.6.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")

// NOTE: Do not place your application dependencies here; they belong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
18 changes: 9 additions & 9 deletions AndroidUnityWrapper~/unity/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
}

android {
compileSdk = 34
buildToolsVersion = "34.0.0"
compileSdk = 35
buildToolsVersion = "35.0.0"
namespace = "com.marigold.sdk.unity"

defaultConfig {
Expand Down Expand Up @@ -35,7 +35,7 @@ tasks.register<Delete>("clearJar") {
tasks.register<Copy>("makeJar") {
dependsOn("clearJar", "build")

from("build/intermediates/aar_main_jar/release/")
from("build/intermediates/aar_main_jar/release/syncReleaseLibJars")
into("../../Plugins/Android/libs/")
include("classes.jar")
rename ("classes.jar", "MarigoldWrapper.jar")
Expand All @@ -49,12 +49,12 @@ repositories {

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation("com.marigold.sdk:marigold:20.2.0")
implementation("androidx.core:core-ktx:1.12.0")
implementation("com.marigold.sdk:marigold:23.0.0")
implementation("androidx.core:core-ktx:1.13.1")

testImplementation("junit:junit:4.13.2")
testImplementation("org.mockito:mockito-inline:4.1.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:4.0.0")
testImplementation("org.robolectric:robolectric:4.10.3")
testImplementation("androidx.test:core:1.5.0")
testImplementation("org.mockito:mockito-inline:5.2.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.3.1")
testImplementation("org.robolectric:robolectric:4.12.1")
testImplementation("androidx.test:core:1.6.1")
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package com.marigold.sdk.unity

import android.app.Activity
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.location.Location
import android.os.Handler
import android.os.Looper
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.marigold.sdk.Marigold
import com.marigold.sdk.MessageStream
import com.marigold.sdk.unity.UnitySender.Companion.MARIGOLD_RECEIVE_DEVICE_ID
Expand Down Expand Up @@ -36,13 +31,9 @@ object MarigoldWrapper {
val activity = UnityPlayer.currentActivity
setupMessageHandling(activity)

val broadcastManager = LocalBroadcastManager.getInstance(activity)
broadcastManager.registerReceiver(object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val count = intent.getIntExtra(MessageStream.EXTRA_UNREAD_MESSAGE_COUNT, 0)
unitySender.sendUnityMessage(MESSAGE_STREAM_UNITY, MESSAGE_STREAM_RECEIVE_UNREAD_COUNT, count.toString())
}
}, IntentFilter(Marigold.ACTION_MESSAGE_COUNT_UPDATE))
messageStream.addUnreadMessageCountListener { _, unreadCount ->
unitySender.sendUnityMessage(MESSAGE_STREAM_UNITY, MESSAGE_STREAM_RECEIVE_UNREAD_COUNT, unreadCount.toString())
}

setWrapperInfo()
}
Expand Down Expand Up @@ -99,7 +90,7 @@ object MarigoldWrapper {
cArg[1] = String::class.java
val setWrapperMethod = Marigold.Companion::class.java.getDeclaredMethod("setWrapper", *cArg)
setWrapperMethod.isAccessible = true
setWrapperMethod.invoke(Marigold.Companion, "Unity", "2.1.1")
setWrapperMethod.invoke(Marigold.Companion, "Unity", "3.0.0")
} catch (e: NoSuchMethodException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import android.location.Location
import androidx.test.core.app.ApplicationProvider
import com.marigold.sdk.Marigold
import com.marigold.sdk.MessageStream
import com.marigold.sdk.interfaces.UnreadMessageCountListener
import com.marigold.sdk.unity.UnitySender.Companion.MARIGOLD_RECEIVE_DEVICE_ID
import com.marigold.sdk.unity.UnitySender.Companion.MARIGOLD_UNITY
import com.marigold.sdk.unity.UnitySender.Companion.MESSAGE_STREAM_RECEIVE_UNREAD_COUNT
import com.marigold.sdk.unity.UnitySender.Companion.MESSAGE_STREAM_UNITY
import com.unity3d.player.UnityPlayer
import org.junit.After
import org.junit.Assert.assertEquals
Expand Down Expand Up @@ -47,6 +50,8 @@ class MarigoldWrapperTest {
private lateinit var marigoldStringHandlerCaptor: ArgumentCaptor<Marigold.MarigoldHandler<String?>>
@Captor
private lateinit var marigoldVoidHandlerCaptor: ArgumentCaptor<Marigold.MarigoldHandler<Void?>>
@Captor
private lateinit var unreadCountListenerCaptor: ArgumentCaptor<UnreadMessageCountListener>

private val emptyIntent = Intent()
private val error = Error("Test Error")
Expand Down Expand Up @@ -76,6 +81,11 @@ class MarigoldWrapperTest {
verify(activity).intent
verify(marigold).addNotificationTappedListener(any())
verify(messageStream).setInAppOnClickListener(any())
verify(messageStream).addUnreadMessageCountListener(capture(unreadCountListenerCaptor))

val unreadMessageCountListener = unreadCountListenerCaptor.value
unreadMessageCountListener.onUnreadMessageCountUpdated(activity, 21)
verify(unitySender).sendUnityMessage(MESSAGE_STREAM_UNITY, MESSAGE_STREAM_RECEIVE_UNREAD_COUNT, "21")
}

@Test
Expand All @@ -86,6 +96,7 @@ class MarigoldWrapperTest {
verify(activity, times(1)).intent
verify(marigold, times(1)).addNotificationTappedListener(any())
verify(messageStream, times(1)).setInAppOnClickListener(any())
verify(messageStream, times(1)).addUnreadMessageCountListener(any())
}

@Test
Expand Down
Binary file modified Plugins/Android/libs/MarigoldWrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion Plugins/iOS/MarigoldWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ - (void)setupCallbacks {
#pragma mark Wrapper

- (void)setWrapperDetails {
[self.marigold setWrapperName:@"Unity" andVersion:@"2.1.1"];
[self.marigold setWrapperName:@"Unity" andVersion:@"3.0.0"];
}

# pragma mark Location
Expand Down
8 changes: 3 additions & 5 deletions iOSUnityWrapper~/iOSUnityWrapper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -318,7 +318,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand All @@ -337,7 +337,6 @@
CURRENT_PROJECT_VERSION = 1;
GCC_PREFIX_HEADER = iOSUnityWrapperTests/GlobalHeader.pch;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.marigold.sdk.iOSUnityWrapperTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -358,7 +357,6 @@
CURRENT_PROJECT_VERSION = 1;
GCC_PREFIX_HEADER = iOSUnityWrapperTests/GlobalHeader.pch;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.marigold.sdk.iOSUnityWrapperTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -401,7 +399,7 @@
repositoryURL = "https://github.com/sailthru/sailthru-mobile-ios-sdk";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 15.0.0;
minimumVersion = 18.0.0;
};
};
FA2A0F322B85AA1F0013F6CC /* XCRemoteSwiftPackageReference "ocmock" */ = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"originHash" : "fb75b2c0acc5c11282cd4b22739373accef73b42ce456ae696836c5219dbfb56",
"pins" : [
{
"identity" : "ocmock",
Expand All @@ -13,10 +14,10 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/sailthru/sailthru-mobile-ios-sdk",
"state" : {
"revision" : "2e71269a5ce5c75009f2002873af5fa31bd10ce4",
"version" : "15.1.0"
"revision" : "9103cb2098b51f88ff4050958954c9e1f7328cd7",
"version" : "18.0.0"
}
}
],
"version" : 2
"version" : 3
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.marigold.sdk.unity",
"version": "2.1.1",
"version": "3.0.0",
"displayName": "Marigold Unity SDK",
"description": "This package contains the Marigold Unity SDK, a wrapper SDK around our native iOS and Android SDKs that allows them to be used for Unity development.",
"unity": "2020.2",
Expand Down

0 comments on commit 6e58d66

Please sign in to comment.