Skip to content

Update the header params for network request #4995

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

Merged
merged 1 commit into from
May 11, 2023
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.firebase.sessions.settings

import android.content.Context
import android.os.Build
import android.util.Log
import androidx.datastore.preferences.preferencesDataStore
import com.google.firebase.installations.FirebaseInstallationsApi
Expand Down Expand Up @@ -102,11 +103,11 @@ internal class RemoteSettings(
// All the required fields are available, start making a network request.
val options =
mapOf(
"X-Crashlytics-Installation-ID" to installationId as String,
"X-Crashlytics-Device-Model" to appInfo.deviceModel,
// TODO(visum) Add OS version parameters
// "X-Crashlytics-OS-Build-Version" to "",
// "X-Crashlytics-OS-Display-Version" to "",
"X-Crashlytics-Installation-ID" to installationId,
"X-Crashlytics-Device-Model" to
removeForwardSlashesIn(String.format("%s/%s", Build.MANUFACTURER, Build.MODEL)),
"X-Crashlytics-OS-Build-Version" to removeForwardSlashesIn(Build.VERSION.INCREMENTAL),
"X-Crashlytics-OS-Display-Version" to removeForwardSlashesIn(Build.VERSION.RELEASE),
"X-Crashlytics-API-Client-Version" to appInfo.sessionSdkVersion
)

Expand Down Expand Up @@ -163,8 +164,13 @@ internal class RemoteSettings(
)
}

private fun removeForwardSlashesIn(s: String): String {
return s.replace(FORWARD_SLASH_STRING.toRegex(), "")
}

companion object {
private const val SESSION_CONFIGS_NAME = "firebase_session_settings"
private const val TAG = "SessionConfigFetcher"
private const val FORWARD_SLASH_STRING: String = "/"
}
}