Skip to content
Draft
Show file tree
Hide file tree
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 @@ -27,9 +27,14 @@ import org.phoenixframework.Socket
// expect val appVariant: AppVariant

class MainApplication : Application() {
private val socket = Socket(appVariant.socketUrl, decode = ::decodeMessage)

override fun onCreate() {
val locale = super.applicationContext.resources.getString(R.string.current_locale)
val socket =
Socket(
appVariant.socketUrl,
params = mapOf("locale" to locale),
decode = ::decodeMessage,
)
super.onCreate()
initKoin(
appVariant,
Expand Down
3 changes: 2 additions & 1 deletion iosApp/iosApp/ProductionAppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ struct ProductionAppView: View {
}

private static func initSocket() -> PhoenixSocket {
let socket = Socket(appVariant.socketUrl)
let locale = NSLocalizedString("key/current_locale", comment: "")
let socket = Socket(appVariant.socketUrl, paramsClosure: { ["locale": locale] })

// decreasing default from 5s
socket.reconnectAfter = { tries in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ internal constructor(
@SerialName("informed_entity") val informedEntity: List<InformedEntity>,
val lifecycle: Lifecycle,
val severity: Int,
val summaries: List<AlertSummaryEntity>? = null,
@SerialName("updated_at") val updatedAt: EasternTimeInstant,
// This field is not parsed from the Alert object from the backend, it is injected from
// global data in the AlertsUsecase if any informed entities apply to a facility.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mbta.tid.mbta_app.model

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
public data class AlertSummaryEntity(
@SerialName("alert_id") val alertId: String,
@SerialName("route_id") val routeId: String?,
@SerialName("stop_id") val stopId: String?,
@SerialName("trip_id") val tripId: String?,
@SerialName("direction_id") val directionId: Int?,
val summary: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ private constructor(
public var header: String? = null
public var lifecycle: Alert.Lifecycle = Alert.Lifecycle.New
public var severity: Int = 0

public var summaries: List<AlertSummaryEntity>? = null
public var updatedAt: EasternTimeInstant =
EasternTimeInstant(Instant.fromEpochMilliseconds(0))
public var facilities: Map<String, Facility>? = null
Expand Down Expand Up @@ -153,6 +155,7 @@ private constructor(
informedEntity,
lifecycle,
severity,
summaries,
updatedAt,
facilities,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.mbta.tid.mbta_app.json
import com.mbta.tid.mbta_app.model.response.AlertsStreamDataResponse

internal object AlertsChannel : ChannelSpec {
override val topic = "alerts:v2"
override val topic = "alerts:v3"

override val updateEvent = "stream_data"

Expand Down
Loading