Skip to content

Commit 2cfbfba

Browse files
author
AR Abdul Azeez
committed
hardcoded APP Ids and json serialize values
1 parent 68d572c commit 2cfbfba

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/backend/impl/ParamsBackendService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ internal class ParamsBackendService(
6060

6161
// Process Remote Logging params
6262
var remoteLoggingParams: RemoteLoggingParamsObject? = null
63-
responseJson.expandJSONObject("remote_logging") {
63+
responseJson.expandJSONObject("logging_config") {
6464
val logLevel = parseLogLevel(it)
6565
remoteLoggingParams =
6666
RemoteLoggingParamsObject(

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/debug/internal/logging/otel/android/OtelIdResolver.kt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.onesignal.common.IDManager
55
import com.onesignal.core.internal.config.ConfigModel
66
import com.onesignal.core.internal.preferences.PreferenceOneSignalKeys
77
import com.onesignal.core.internal.preferences.PreferenceStores
8+
import com.onesignal.debug.internal.logging.Logging
89
import com.onesignal.user.internal.backend.IdentityConstants
910
import org.json.JSONArray
1011
import org.json.JSONObject
@@ -23,9 +24,14 @@ internal class OtelIdResolver(
2324
) {
2425
companion object {
2526
/**
26-
* Default error appId prefix when appId cannot be resolved.
27+
* Hardcoded error appId prefix when appId cannot be resolved.
2728
*/
28-
private const val ERROR_APP_ID_PREFIX = "8123-1231-4343-2323-error-"
29+
private const val ERROR_APP_ID_RESOLVE = "00000000-0000-4000-a000-000000000000"
30+
private const val ERROR_APP_ID_PREFIX_UNKNOWN = "e1100000-0000-4000-a000-000000000000"
31+
private const val ERROR_APP_ID_PREFIX_NO_APPID_IN_CONFIG = "e1100000-0000-4000-a000-000000000001"
32+
private const val ERROR_APP_ID_PREFIX_NO_CONFIG_STORE = "e1100000-0000-4000-a000-000000000002"
33+
private const val ERROR_APP_ID_PREFIX_NO_APPID_IN_CONFIG_STORE = "e1100000-0000-4000-a000-000000000003"
34+
private const val ERROR_APP_ID_PREFIX_NO_CONTEXT = "e1100000-0000-4000-a000-000000000004"
2935
}
3036

3137
// Get SharedPreferences instance (fresh each time to avoid caching issues in tests)
@@ -91,7 +97,8 @@ internal class OtelIdResolver(
9197
val appIdFromConfig = extractAppIdFromConfig(configModel)
9298
appIdFromConfig ?: resolveAppIdFromLegacy(configModel)
9399
} catch (e: Exception) {
94-
"$ERROR_APP_ID_PREFIX${e.javaClass.simpleName}"
100+
Logging.error("Trying resolve the app Id${e.message}")
101+
ERROR_APP_ID_RESOLVE
95102
}
96103
}
97104

@@ -118,14 +125,13 @@ internal class OtelIdResolver(
118125

119126
return legacyAppId ?: run {
120127
// Third: return error appId with affix
121-
val errorAffix = when {
122-
context == null -> "no-context"
123-
hasEmptyConfigStore() -> "no-appid-in-config" // Store exists but is empty array
124-
configModel == null -> "config-store-not-found" // Store doesn't exist
125-
!configModel.has("appId") -> "no-appid-in-config" // Store exists but no appId field
126-
else -> "unknown"
128+
return when {
129+
context == null -> ERROR_APP_ID_PREFIX_NO_CONTEXT
130+
hasEmptyConfigStore() -> ERROR_APP_ID_PREFIX_NO_APPID_IN_CONFIG_STORE // Store exists but is empty array
131+
configModel == null -> ERROR_APP_ID_PREFIX_NO_CONFIG_STORE // Store doesn't exist
132+
!configModel.has("appId") -> ERROR_APP_ID_PREFIX_NO_APPID_IN_CONFIG // Store exists but no appId field
133+
else -> ERROR_APP_ID_PREFIX_UNKNOWN
127134
}
128-
"$ERROR_APP_ID_PREFIX$errorAffix"
129135
}
130136
}
131137

0 commit comments

Comments
 (0)