Skip to content

Commit

Permalink
Setup sentry new projects
Browse files Browse the repository at this point in the history
  • Loading branch information
sdsantos committed Nov 19, 2024
1 parent 94236d9 commit 833b907
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class AndroidApplication : Application() {
override val model = "${Build.MANUFACTURER} ${Build.MODEL}"
override val needsToRequestNotificationsPermission =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
override val sentryDsn = "https://[email protected]/4508325642764288"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.onEach
import org.ooni.probe.data.models.SettingsKey
import org.ooni.probe.data.repositories.PreferenceRepository
import org.ooni.probe.shared.PlatformInfo

class CrashMonitoring(
private val preferencesRepository: PreferenceRepository,
private val platformInfo: PlatformInfo,
) {
suspend fun setup() {
preferencesRepository.getValueByKey(SettingsKey.SEND_CRASH)
.onEach { sendCrash ->
if (sendCrash == true) {
Sentry.init {
it.dsn = SENTRY_DSN
it.dsn = platformInfo.sentryDsn
}
} else {
Sentry.close()
Expand Down Expand Up @@ -81,9 +83,4 @@ class CrashMonitoring(
)
}
}

companion object {
private const val SENTRY_DSN =
"https://[email protected]/5619989"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ interface OrganizationConfigInterface {
val baseSoftwareName: String

val ooniApiBaseUrl: String
get() = "https://api.dev.ooni.io"
get() = "https://api.ooni.org"

val ooniRunDomain: String
get() = "run.test.ooni.org"
get() = "run.ooni.org"

val ooniRunDashboardUrl: String
get() = "https://run.test.ooni.org"
get() = "https://run.ooni.org"

val explorerUrl: String
get() = "https://explorer.test.ooni.org"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class Dependencies(

// Monitoring

val crashMonitoring by lazy { CrashMonitoring(preferenceRepository) }
val crashMonitoring by lazy { CrashMonitoring(preferenceRepository, platformInfo) }
val appLogger by lazy {
AppLogger(
readFile = readFile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface PlatformInfo {
val osVersion: String
val model: String
val needsToRequestNotificationsPermission: Boolean
val sentryDsn: String
}

enum class Platform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class SetupDependencies(
override val osVersion = with(UIDevice.currentDevice) { "$systemName $systemVersion" }
override val model = UIDevice.currentDevice.model
override val needsToRequestNotificationsPermission = true
override val sentryDsn = "https://[email protected]/4508325650235392"
}

private fun buildDatabaseDriver() = NativeSqliteDriver(schema = Database.Schema, name = "OONIProbe.db")
Expand Down

0 comments on commit 833b907

Please sign in to comment.