diff --git a/CHANGELOG.md b/CHANGELOG.md index 195ac45d..7d291de5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ The changelog for `Superwall`. Also see the [releases](https://github.com/superwall-me/Superwall-Android/releases) on GitHub. +## 1.0.0-alpha.43 + +### Enhancements + +- Adds `handleLog` to the `SuperwallDelegate`. + ## 1.0.0-alpha.42 ### Fixes diff --git a/superwall/build.gradle.kts b/superwall/build.gradle.kts index ab01e825..aea793a7 100644 --- a/superwall/build.gradle.kts +++ b/superwall/build.gradle.kts @@ -19,7 +19,7 @@ plugins { id("maven-publish") } -version = "1.0.0-alpha.42" +version = "1.0.0-alpha.43" android { compileSdk = 33 diff --git a/superwall/src/main/java/com/superwall/sdk/delegate/SuperwallDelegateAdapter.kt b/superwall/src/main/java/com/superwall/sdk/delegate/SuperwallDelegateAdapter.kt index 1d3d43ba..915103bb 100644 --- a/superwall/src/main/java/com/superwall/sdk/delegate/SuperwallDelegateAdapter.kt +++ b/superwall/src/main/java/com/superwall/sdk/delegate/SuperwallDelegateAdapter.kt @@ -57,17 +57,23 @@ class SuperwallDelegateAdapter { ?: javaDelegate?.subscriptionStatusDidChange(newValue) } - private fun handleLog( + fun handleLog( level: String, scope: String, message: String?, info: Map?, error: Throwable? ) { - Logger.debug( - logLevel = LogLevel.valueOf(level), - scope = LogScope.valueOf(scope), - message = message ?: "No message", + kotlinDelegate?.handleLog( + level = level, + scope = scope, + message = message, + info = info, + error = error + ) ?: javaDelegate?.handleLog( + level = level, + scope = scope, + message = message, info = info, error = error ) diff --git a/superwall/src/main/java/com/superwall/sdk/logger/Logger.kt b/superwall/src/main/java/com/superwall/sdk/logger/Logger.kt index 124ca703..682072c7 100644 --- a/superwall/src/main/java/com/superwall/sdk/logger/Logger.kt +++ b/superwall/src/main/java/com/superwall/sdk/logger/Logger.kt @@ -41,16 +41,15 @@ interface Loggable { dumping["error"] = it } - // TODO: Add logging to the delegate - // Launch a coroutine to handle the logging - -// Superwall.instance.dependencyContainer.delegateAdapter.handleLog( -// level = logLevel.toString(), -// scope = scope.toString(), -// message = message, -// info = info, -// error = error -// ) + if (Superwall.initialized) { + Superwall.instance.dependencyContainer.delegateAdapter.handleLog( + level = logLevel.toString(), + scope = scope.toString(), + message = message, + info = info, + error = error + ) + } if (!shouldPrint(logLevel, scope)) { return