Skip to content

Commit

Permalink
clean up user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
RingerJK committed Jan 26, 2023
1 parent 0d68bfe commit f642c93
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ext {
// version which we should use in this build
def mapboxNavigatorVersion = System.getenv("FORCE_MAPBOX_NAVIGATION_NATIVE_VERSION")
if (mapboxNavigatorVersion == null || mapboxNavigatorVersion == '') {
mapboxNavigatorVersion = '124.0.1'
mapboxNavigatorVersion = 'master-SNAPSHOT'
}
println("Navigation Native version: " + mapboxNavigatorVersion)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ import kotlinx.coroutines.sync.withLock
import java.lang.reflect.Field
import java.util.Locale

private const val MAPBOX_NAVIGATION_USER_AGENT_BASE = "mapbox-navigation-android"
private const val MAPBOX_NAVIGATION_TOKEN_EXCEPTION_ROUTER =
"You need to provide an access token in NavigationOptions in order to use the default " +
"Router."
Expand Down Expand Up @@ -546,7 +545,7 @@ class MapboxNavigation @VisibleForTesting internal constructor(
MapboxMetricsReporter.init(
navigationOptions.applicationContext,
token,
obtainUserAgent()
USER_AGENT,
)
MapboxMetricsReporter.toggleLogging(navigationOptions.isDebugLoggingEnabled)
}
Expand Down Expand Up @@ -1996,10 +1995,6 @@ class MapboxNavigation @VisibleForTesting internal constructor(
rerouteController?.interrupt()
}

private fun obtainUserAgent(): String {
return "$MAPBOX_NAVIGATION_USER_AGENT_BASE/${BuildConfig.MAPBOX_NAVIGATION_VERSION_NAME}"
}

private fun monitorNotificationActionButton(channel: ReceiveChannel<NotificationAction>) {
mainJobController.scope.monitorChannelWithException(
channel,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mapbox.navigation.metrics

import android.content.Context
import android.os.Handler
import com.google.gson.Gson
import com.mapbox.bindgen.Value
import com.mapbox.common.Event
Expand Down Expand Up @@ -66,7 +67,7 @@ object MapboxMetricsReporter : MetricsReporter {
* Events priority. See [EventPriority]
*/
@Volatile
var eventsPriority: EventPriority = EventPriority.QUEUED
var eventsPriority: EventPriority = EventPriority.IMMEDIATE

/**
* Initialize [EventsServiceInterface] and [TelemetryService] that need to send event to
Expand All @@ -80,10 +81,8 @@ object MapboxMetricsReporter : MetricsReporter {
fun init(
context: Context,
accessToken: String,
_userAgent: String
userAgent: String
) {
// todo REMOVE
val userAgent = "com.mapbox.onetap.app/v0.146.0-7-g8fc5f5c/1465 MapboxNavigationNative/123.2.0MapboxNavigationNative MapboxCommon/23.2.1 Android (13; r0s (SM-S901B))"
isTelemetryInitialized = true
val eventsServerOptions = EventsServerOptions(accessToken, userAgent, null)
eventsService = EventsServiceProvider.provideEventsService(eventsServerOptions)
Expand Down

0 comments on commit f642c93

Please sign in to comment.