Skip to content
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

#76 Fix sentry error logging for flaker companion app. Change package of sample app #77

Merged
merged 1 commit into from
Oct 18, 2023
Merged
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 @@ -3,24 +3,24 @@ package io.github.rotbolt.flakerandroidmonitor
import android.content.Context
import io.sentry.Sentry
import io.sentry.SentryEvent
import io.sentry.SentryLevel
import io.sentry.SentryOptions
import io.sentry.android.core.SentryAndroid

class FlakerMonitorImpl : FlakerMonitor {
override fun initialize(appContext: Context) {
SentryAndroid.init(appContext) { options ->
options.dsn = BuildConfig.SENTRY_DSN
// Add a callback that will be used before the event is sent to Sentry.
// With this callback, you can modify the event or, when returning null, also discard the event.
options.beforeSend =
SentryOptions.BeforeSendCallback { event: SentryEvent, _ ->
if (SentryLevel.DEBUG == event.level) {
null
} else {
event
}
}
options.beforeSend = SentryOptions.BeforeSendCallback { event: SentryEvent, _ -> filterEvent(event) }
}
}

private fun filterEvent(event: SentryEvent): SentryEvent? {
return event.throwable?.stackTrace?.let { stackTrace ->
if (stackTrace.any { it.className.startsWith("io.github.rotbolt") }) {
event
} else {
null
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions sampleapp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name="io.github.rotbolt.flakersampleapp.MainApplication"
android:name="io.github.bolt.flakersampleapp.MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Flaker">
<activity
android:name="io.github.rotbolt.flakersampleapp.home.HomeActivity"
android:name="io.github.bolt.flakersampleapp.home.HomeActivity"
android:exported="true"
android:label="@string/app_name"
android:taskAffinity="io.github.rotbolt.flakersampleapp.sampleapp"
android:taskAffinity="io.github.bolt.flakersampleapp.sampleapp"
android:theme="@style/Theme.Flaker">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.rotbolt.flakersampleapp
package io.github.bolt.flakersampleapp

import android.app.Application
import io.github.bolt.flakersampleapp.di.AppContainer
import io.github.rotbolt.flakerandroidokhttp.di.FlakerAndroidOkhttpContainer
import io.github.rotbolt.flakersampleapp.di.AppContainer

class MainApplication : Application() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.rotbolt.flakersampleapp.data.remote
package io.github.bolt.flakersampleapp.data.remote

import retrofit2.HttpException
import retrofit2.Response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.rotbolt.flakersampleapp.di
package io.github.bolt.flakersampleapp.di

import io.github.rotbolt.flakersampleapp.home.di.HomeContainer
import io.github.bolt.flakersampleapp.home.di.HomeContainer

class AppContainer {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.rotbolt.flakersampleapp.di
package io.github.bolt.flakersampleapp.di

import kotlinx.coroutines.Dispatchers

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.rotbolt.flakersampleapp.di
package io.github.bolt.flakersampleapp.di

import io.github.rotbolt.flakerokhttpcore.FlakerInterceptor
import okhttp3.OkHttpClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.rotbolt.flakersampleapp.home
package io.github.bolt.flakersampleapp.home

import android.os.Bundle
import android.widget.Toast
Expand All @@ -25,9 +25,9 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import io.github.rotbolt.flakersampleapp.MainApplication
import io.github.rotbolt.flakersampleapp.home.di.HomeContainer
import io.github.rotbolt.flakersampleapp.theme.FlakerTheme
import io.github.bolt.flakersampleapp.MainApplication
import io.github.bolt.flakersampleapp.home.di.HomeContainer
import io.github.bolt.flakersampleapp.theme.FlakerTheme
import kotlinx.coroutines.flow.collectLatest

class HomeActivity : ComponentActivity() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.github.rotbolt.flakersampleapp.home
package io.github.bolt.flakersampleapp.home

import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import io.github.rotbolt.flakersampleapp.data.remote.RemoteResult
import io.github.rotbolt.flakersampleapp.home.data.remote.UsersApiClient
import io.github.bolt.flakersampleapp.data.remote.RemoteResult
import io.github.bolt.flakersampleapp.home.data.remote.UsersApiClient
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asSharedFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.rotbolt.flakersampleapp.home.data.remote
package io.github.bolt.flakersampleapp.home.data.remote

import io.github.rotbolt.flakersampleapp.data.remote.RemoteResult
import io.github.rotbolt.flakersampleapp.data.remote.handleRemoteResponse
import io.github.rotbolt.flakersampleapp.home.data.remote.dto.UserData
import io.github.bolt.flakersampleapp.data.remote.RemoteResult
import io.github.bolt.flakersampleapp.data.remote.handleRemoteResponse
import io.github.bolt.flakersampleapp.home.data.remote.dto.UserData
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.rotbolt.flakersampleapp.home.data.remote
package io.github.bolt.flakersampleapp.home.data.remote

import io.github.rotbolt.flakersampleapp.home.data.remote.dto.UserData
import io.github.bolt.flakersampleapp.home.data.remote.dto.UserData
import retrofit2.Response
import retrofit2.http.GET

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.rotbolt.flakersampleapp.home.data.remote.dto
package io.github.bolt.flakersampleapp.home.data.remote.dto

@Suppress("ConstructorParameterNaming")
data class UserData(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.github.rotbolt.flakersampleapp.home.di
package io.github.bolt.flakersampleapp.home.di

import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.createSavedStateHandle
import androidx.lifecycle.viewmodel.initializer
import androidx.lifecycle.viewmodel.viewModelFactory
import io.github.rotbolt.flakersampleapp.di.CoroutineDispatcherProvider
import io.github.rotbolt.flakersampleapp.home.HomeViewModel
import io.github.rotbolt.flakersampleapp.home.data.remote.UsersApiClient
import io.github.rotbolt.flakersampleapp.home.data.remote.UsersApiService
import io.github.bolt.flakersampleapp.di.CoroutineDispatcherProvider
import io.github.bolt.flakersampleapp.home.HomeViewModel
import io.github.bolt.flakersampleapp.home.data.remote.UsersApiClient
import io.github.bolt.flakersampleapp.home.data.remote.UsersApiService
import retrofit2.Retrofit

class HomeContainer(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.rotbolt.flakersampleapp.theme
package io.github.bolt.flakersampleapp.theme

import androidx.compose.ui.graphics.Color

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.rotbolt.flakersampleapp.theme
package io.github.bolt.flakersampleapp.theme

import android.app.Activity
import android.os.Build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.rotbolt.flakersampleapp.theme
package io.github.bolt.flakersampleapp.theme

import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
Expand Down