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

Remove bugsnag #30

Merged
merged 3 commits into from
Sep 12, 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
6 changes: 1 addition & 5 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}

- name: Assemble production APK
if: "!contains(steps.tagger.outputs.tag, '-beta')"
Expand All @@ -58,7 +57,6 @@ jobs:
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}

- name: Create pre-release
if: contains(steps.tagger.outputs.tag, '-beta')
Expand Down Expand Up @@ -141,13 +139,11 @@ jobs:
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}

- name: Assemble production and upload to Google Play
if: "!contains(steps.tagger.outputs.tag, '-beta')"
run: bundle exec fastlane production
env:
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
5 changes: 4 additions & 1 deletion PRIVACY_POLICY.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ https://support.google.com/drive/answer/10375054?hl=en

## Automatic error reports

*Removed in 0.8.3*

Anonymous device information may be collected in the event of an app crash or error.

To do this the app uses the service "Bugsnag":
Expand All @@ -66,7 +68,8 @@ https://www.bugsnag.com/
Bugsnag's privacy policy can be found here:
https://docs.bugsnag.com/legal/privacy-policy/

Error reports contain information related to the error that occured, your device and software versions, e.g. what happened when the error occured, your phone model, Android version and app version.
Error reports contain information related to the error that occured, your device and software versions, e.g. what
happened when the error occured, your phone model, Android version and app version.

You can disable automatic reports in the app's settings.

Expand Down
8 changes: 0 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
}
apply(plugin = "dagger.hilt.android.plugin")
apply(plugin = "androidx.navigation.safeargs.kotlin")
apply(plugin = "com.bugsnag.android.gradle")

android {
val packageName = ProjectConfig.packageName
Expand All @@ -31,10 +30,6 @@ android {
buildConfigField("String", "BUILDTIME", "\"${buildTime()}\"")
buildConfigField("String", "VERSION_CODE", "\"${ProjectConfig.Version.code}\"")
buildConfigField("String", "VERSION_NAME", "\"${ProjectConfig.Version.name}\"")

manifestPlaceholders["bugsnagApiKey"] = getBugSnagApiKey(
File(System.getProperty("user.home"), ".appconfig/${packageName}/bugsnag.properties")
) ?: "fake"
}

signingConfigs {
Expand Down Expand Up @@ -144,9 +139,6 @@ dependencies {
addIO()
addRetrofit()

"gplayImplementation"("com.bugsnag:bugsnag-android:5.9.2")
"gplayImplementation"("com.getkeepsafe.relinker:relinker:1.4.3")

addAndroidCore()
addAndroidUI()
addWorkerManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,25 @@ package eu.darken.octi.common.debug.autoreport

import android.app.Application
import android.content.Context
import com.bugsnag.android.Bugsnag
import com.bugsnag.android.Configuration
import com.getkeepsafe.relinker.ReLinker
import dagger.hilt.android.qualifiers.ApplicationContext
import eu.darken.octi.App
import eu.darken.octi.common.BuildConfigWrap
import eu.darken.octi.common.InstallId
import eu.darken.octi.common.datastore.valueBlocking
import eu.darken.octi.common.debug.AutomaticBugReporter
import eu.darken.octi.common.debug.Bugs
import eu.darken.octi.common.debug.autoreport.bugsnag.BugsnagErrorHandler
import eu.darken.octi.common.debug.autoreport.bugsnag.BugsnagLogger
import eu.darken.octi.common.debug.autoreport.bugsnag.NOPBugsnagErrorHandler
import eu.darken.octi.common.debug.logging.Logging
import eu.darken.octi.common.debug.logging.log
import eu.darken.octi.common.debug.logging.logTag
import javax.inject.Inject
import javax.inject.Provider
import javax.inject.Singleton

@Singleton
class GooglePlayReporting @Inject constructor(
@ApplicationContext private val context: Context,
private val debugSettings: DebugSettings,
private val installId: InstallId,
private val bugsnagLogger: Provider<BugsnagLogger>,
private val bugsnagErrorHandler: Provider<BugsnagErrorHandler>,
private val nopBugsnagErrorHandler: Provider<NOPBugsnagErrorHandler>,
) : AutomaticBugReporter {

override fun setup(application: Application) {
val isEnabled = debugSettings.isAutoReportingEnabled.valueBlocking
log(TAG) { "setup(): isEnabled=$isEnabled" }

if (isEnabled) {
ReLinker
.log { message -> log(App.TAG) { "ReLinker: $message" } }
.loadLibrary(application, "bugsnag-plugin-android-anr")
}
try {
val bugsnagConfig = Configuration.load(context).apply {
if (debugSettings.isAutoReportingEnabled.valueBlocking) {
Logging.install(bugsnagLogger.get())
setUser(installId.id, null, null)
autoTrackSessions = true
addOnError(bugsnagErrorHandler.get())
addMetadata("App", "buildFlavor", BuildConfigWrap.FLAVOR)
log(TAG) { "Bugsnag setup done!" }
} else {
autoTrackSessions = false
addOnError(nopBugsnagErrorHandler.get())
log(TAG) { "Installing Bugsnag NOP error handler due to user opt-out!" }
}
}

Bugsnag.start(context, bugsnagConfig)
Bugs.reporter = this
} catch (e: IllegalStateException) {
log(TAG) { "Bugsnag API Key not configured." }
}
}

override fun notify(throwable: Throwable) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />

<meta-data
android:name="com.bugsnag.android.API_KEY"
android:value="${bugsnagApiKey}" />

<activity
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="sensor"
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/res/xml/preferences_acknowledgements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@
<PreferenceCategory
android:title="@string/settings_licenses_label"
app:iconSpaceReserved="false">
<Preference
android:key="license.bugsnag"
android:summary="Client side library for crash monitoring via bugsnag.com. (MIT)"
android:title="Bugsnag"
app:iconSpaceReserved="false">
<intent
android:action="android.intent.action.VIEW"
android:data="https://github.com/bugsnag/bugsnag-android" />
</Preference>
<eu.darken.octi.common.preferences.IntentPreference
android:key="license.materialdesignicons"
android:summary="materialdesignicons.com (SIL Open Font License 1.1 / Attribution 4.0 International)"
Expand Down
10 changes: 7 additions & 3 deletions app/src/main/res/xml/preferences_general.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<PreferenceCategory android:title="@string/settings_category_ui_label">

Expand All @@ -9,13 +10,16 @@
android:title="@string/ui_theme_setting_label" />
</PreferenceCategory>

<PreferenceCategory android:title="@string/settings_category_other_label">
<PreferenceCategory
android:title="@string/settings_category_other_label"
app:isPreferenceVisible="false">

<CheckBoxPreference
android:icon="@drawable/ic_spider_thread_onsurface"
android:key="debug.bugreport.automatic.enabled"
android:summary="Automatically reports issues, e.g. details on the app crashes so I can figure out why and fix it."
android:title="Automatic bug reports" />
android:title="Automatic bug reports"
app:isPreferenceVisible="false" />

</PreferenceCategory>

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/xml/preferences_support.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
android:icon="@drawable/ic_id_onsurface"
android:key="support.installid"
android:summary="@string/support_installid_desc"
android:title="@string/support_installid_label" />
android:title="@string/support_installid_label"
app:isPreferenceVisible="false" />
<Preference
android:icon="@drawable/ic_baseline_bug_report_24"
android:key="support.debuglog"
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ buildscript {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.Kotlin.core}")
classpath("com.google.dagger:hilt-android-gradle-plugin:${Versions.Dagger.core}")
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.AndroidX.Navigation.core}")
classpath("com.bugsnag:bugsnag-android-gradle-plugin:7.2.1")
}
}

Expand Down
10 changes: 0 additions & 10 deletions buildSrc/src/main/java/ProjectConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,4 @@ fun com.android.build.api.dsl.SigningConfig.setupCredentials(
keyPassword = props.getProperty("release.keyPassword")
}
}
}

fun getBugSnagApiKey(
propertiesPath: File?
): String? {
val bugsnagProps = Properties().apply {
propertiesPath?.takeIf { it.canRead() }?.let { load(FileInputStream(it)) }
}

return System.getenv("BUGSNAG_API_KEY") ?: bugsnagProps.getProperty("bugsnag.apikey")
}