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 @@ -14,6 +14,7 @@ val SharedString.value: String
SharedString.BetaSection -> stringResource(R.string.more_section_public_beta)
SharedString.CommuterRailAndFerryTickets ->
stringResource(R.string.resources_link_mticket)
SharedString.Crash -> "Crash"
SharedString.DebugMode -> stringResource(R.string.feature_flag_debug_mode)
SharedString.FareInformation -> stringResource(R.string.resources_link_fare_info)
SharedString.FeatureFlagsSection -> stringResource(R.string.more_section_feature_flags)
Expand Down
9 changes: 8 additions & 1 deletion iosApp/iosApp/Pages/More/MoreAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2026 MBTA. All rights reserved.
//

import Sentry
import Shared
import SwiftUI

struct MoreAction: View {
Expand All @@ -14,7 +16,12 @@ struct MoreAction: View {
var callback: () -> Void

var body: some View {
Button(action: callback) {
Button(action: {
Shared.Sentry.shared.captureMessage(message: "Sentry SDK from Swift via KMP works")
SentrySDK.addBreadcrumb(.init(level: .warning, category: "Huh"))
SentrySDK.capture(message: "Sentry SDK directly from Swift works")
callback()
}) {
HStack(alignment: .center, spacing: 0) {
Text(label)
.foregroundStyle(Color.text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extension SharedString {
"Commuter Rail and Ferry Tickets",
comment: "Label for a More page link to the MBTA mTicket app"
)
case .crash: "Crash"
case .debugMode:
NSLocalizedString(
"Debug Mode",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.mbta.tid.mbta_app

import io.sentry.kotlin.multiplatform.Sentry
import io.sentry.kotlin.multiplatform.SentryLevel
import io.sentry.kotlin.multiplatform.SentryOptions

public fun initializeSentry(dsn: String, environment: String) {
val configuration: (SentryOptions) -> Unit = {
it.dsn = dsn
it.environment = environment
it.beforeBreadcrumb = { breadcrumb -> breadcrumb }
it.debug = true
it.diagnosticLevel = SentryLevel.DEBUG
it.logs.enabled = true
}
Sentry.init(configuration)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public enum class SharedString {
BetaEarlyAccessNote,
BetaSection,
CommuterRailAndFerryTickets,
Crash,
DebugMode,
FareInformation,
FeatureFlagsSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import com.mbta.tid.mbta_app.repositories.IOnboardingRepository
import com.mbta.tid.mbta_app.repositories.ISubscriptionsRepository
import com.mbta.tid.mbta_app.repositories.Settings
import com.mbta.tid.mbta_app.utils.SharedString
import io.sentry.kotlin.multiplatform.Sentry
import io.sentry.kotlin.multiplatform.SentryLevel
import io.sentry.kotlin.multiplatform.protocol.Breadcrumb
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -113,11 +116,21 @@ public class MoreViewModel(
MoreItem.Action(
label = SharedString.ForceNotificationsBeta,
action = {
Sentry.addBreadcrumb(
Breadcrumb(level = SentryLevel.WARNING, type = "Huh")
)
Sentry.captureMessage("Sentry SDK directly from Kotlin works")
CoroutineScope(coroutineDispatcher).launch {
onboardingRepository.notificationsBetaResetAndForce()
}
},
),
MoreItem.Action(
label = SharedString.Crash,
action = {
throw IllegalStateException("crashing from Kotlin to check Sentry")
},
),
),
),
MoreSection(
Expand Down
Loading