mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-12-22 12:47:54 +01:00
Self Hosted Acra Crashlytics, Removed Firebase and Razorpay sdk for F-DROID
This commit is contained in:
parent
8f7bc00801
commit
dad897aa76
@ -14,6 +14,7 @@
|
||||
* * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import Extras.Android.Acra
|
||||
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
|
||||
import org.jetbrains.compose.compose
|
||||
|
||||
@ -22,9 +23,6 @@ plugins {
|
||||
kotlin("android")
|
||||
id("kotlin-parcelize")
|
||||
id("org.jetbrains.compose")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
id("com.google.firebase.firebase-perf")
|
||||
}
|
||||
|
||||
group = "com.shabinder"
|
||||
@ -32,6 +30,10 @@ version = Versions.versionName
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
// Remove jcenter as soon as following issue closes
|
||||
// https://github.com/matomo-org/matomo-sdk-android/issues/301
|
||||
jcenter()
|
||||
}
|
||||
|
||||
android {
|
||||
@ -126,13 +128,15 @@ dependencies {
|
||||
|
||||
// Extras
|
||||
Extras.Android.apply {
|
||||
implementation(Acra.notification)
|
||||
implementation(Acra.http)
|
||||
implementation(appUpdator)
|
||||
implementation(razorpay)
|
||||
implementation(matomo)
|
||||
}
|
||||
|
||||
implementation("dev.icerock.moko:parcelize:0.6.1")
|
||||
implementation("com.github.shabinder:storage-chooser:2.0.4.45")
|
||||
implementation("com.google.accompanist:accompanist-insets:0.9.0")
|
||||
implementation("com.google.accompanist:accompanist-insets:0.9.1")
|
||||
|
||||
// Test
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
|
@ -17,8 +17,14 @@
|
||||
package com.shabinder.spotiflyer
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import com.shabinder.common.di.initKoin
|
||||
import com.shabinder.spotiflyer.di.appModule
|
||||
import org.acra.config.httpSender
|
||||
import org.acra.config.notification
|
||||
import org.acra.data.StringFormat
|
||||
import org.acra.ktx.initAcra
|
||||
import org.acra.sender.HttpSender
|
||||
import org.koin.android.ext.koin.androidContext
|
||||
import org.koin.android.ext.koin.androidLogger
|
||||
import org.koin.core.component.KoinComponent
|
||||
@ -29,11 +35,42 @@ class App: Application(), KoinComponent {
|
||||
super.onCreate()
|
||||
|
||||
val loggingEnabled = true
|
||||
|
||||
// KOIN - DI
|
||||
initKoin(loggingEnabled) {
|
||||
androidLogger(Level.NONE) // No virtual method elapsedNow
|
||||
androidContext(this@App)
|
||||
modules(appModule(loggingEnabled))
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
override fun attachBaseContext(base: Context?) {
|
||||
super.attachBaseContext(base)
|
||||
// Crashlytics
|
||||
initAcra {
|
||||
buildConfigClass = BuildConfig::class.java
|
||||
reportFormat = StringFormat.JSON
|
||||
/*
|
||||
* Prompt User Before Sending Any Crash Report
|
||||
* Obeying `F-Droid Inclusion Privacy Rules`
|
||||
* */
|
||||
notification {
|
||||
title = getString(R.string.acra_notification_title)
|
||||
text = getString(R.string.acra_notification_text)
|
||||
channelName = getString(R.string.acra_notification_channel)
|
||||
channelDescription = getString(R.string.acra_notification_channel_desc)
|
||||
sendOnClick = true
|
||||
}
|
||||
// Send Crash Report to self hosted Acrarium (FOSS)
|
||||
httpSender {
|
||||
uri = "https://kind-grasshopper-73.telebit.io/acrarium/report"
|
||||
basicAuthLogin = "sDj2xCKQIxw0dujf"
|
||||
basicAuthPassword = "O83du0TsgsDJ69zN"
|
||||
httpMethod = HttpSender.Method.POST
|
||||
connectionTimeout = 15000
|
||||
socketTimeout = 20000
|
||||
compress = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@
|
||||
package com.shabinder.spotiflyer
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@ -51,12 +50,9 @@ import com.google.accompanist.insets.ProvideWindowInsets
|
||||
import com.google.accompanist.insets.navigationBarsPadding
|
||||
import com.google.accompanist.insets.statusBarsHeight
|
||||
import com.google.accompanist.insets.statusBarsPadding
|
||||
import com.razorpay.Checkout
|
||||
import com.razorpay.PaymentResultListener
|
||||
import com.shabinder.common.di.*
|
||||
import com.shabinder.common.di.worker.ForegroundService
|
||||
import com.shabinder.common.models.Actions
|
||||
import com.shabinder.common.models.AllPlatforms
|
||||
import com.shabinder.common.models.DownloadStatus
|
||||
import com.shabinder.common.models.PlatformActions
|
||||
import com.shabinder.common.models.PlatformActions.Companion.SharedPreferencesKey
|
||||
@ -71,14 +67,13 @@ import com.shabinder.spotiflyer.ui.NetworkDialog
|
||||
import com.shabinder.spotiflyer.ui.PermissionDialog
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import org.json.JSONObject
|
||||
import org.koin.android.ext.android.inject
|
||||
import java.io.File
|
||||
|
||||
const val disableDozeCode = 1223
|
||||
|
||||
@ExperimentalAnimationApi
|
||||
class MainActivity : ComponentActivity(), PaymentResultListener {
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
private val fetcher: FetchPlatformQueryResult by inject()
|
||||
private val dir: Dir by inject()
|
||||
@ -134,7 +129,6 @@ class MainActivity : ComponentActivity(), PaymentResultListener {
|
||||
|
||||
private fun initialise() {
|
||||
checkIfLatestVersion()
|
||||
Checkout.preload(applicationContext)
|
||||
handleIntentFromExternalActivity()
|
||||
}
|
||||
|
||||
@ -237,11 +231,7 @@ class MainActivity : ComponentActivity(), PaymentResultListener {
|
||||
}
|
||||
|
||||
override fun giveDonation() {
|
||||
try {
|
||||
startPayment(this@MainActivity)
|
||||
}catch (e:Exception) {
|
||||
openPlatform("",platformLink = "https://razorpay.com/payment-button/pl_GnKuuDBdBu0ank/view/?utm_source=payment_button&utm_medium=button&utm_campaign=payment_button")
|
||||
}
|
||||
openPlatform("",platformLink = "https://razorpay.com/payment-button/pl_GnKuuDBdBu0ank/view/?utm_source=payment_button&utm_medium=button&utm_campaign=payment_button")
|
||||
}
|
||||
|
||||
override fun shareApp() {
|
||||
@ -390,50 +380,4 @@ class MainActivity : ComponentActivity(), PaymentResultListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPaymentError(errorCode: Int, response: String?) {
|
||||
try{
|
||||
showPopUpMessage("Payment Failed, Response:$response")
|
||||
}catch (e: Exception){
|
||||
Log.d("Razorpay Payment","Exception in onPaymentSuccess $response")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPaymentSuccess(razorpayPaymentId: String?) {
|
||||
try{
|
||||
showPopUpMessage("Payment Successful, ThankYou!")
|
||||
}catch (e: Exception){
|
||||
showPopUpMessage("Razorpay Payment, Error Occurred.")
|
||||
Log.d("Razorpay Payment","Exception in onPaymentSuccess, ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* RazorPay Payment
|
||||
* */
|
||||
private fun startPayment(mainActivity: Activity) {
|
||||
val co = Checkout().apply {
|
||||
setKeyID("rzp_live_3ZQeoFYOxjmXye")
|
||||
setImage(com.shabinder.common.di.R.drawable.ic_spotiflyer_logo)
|
||||
}
|
||||
|
||||
try {
|
||||
val preFill = JSONObject()
|
||||
|
||||
val options = JSONObject().apply {
|
||||
put("name", "SpotiFlyer")
|
||||
put("description", "Thanks For the Donation!")
|
||||
// You can omit the image option to fetch the image from dashboard
|
||||
// put("image","https://github.com/Shabinder/SpotiFlyer/raw/master/app/SpotifyDownload.png")
|
||||
put("currency", "INR")
|
||||
put("amount", "4900")
|
||||
put("prefill", preFill)
|
||||
}
|
||||
|
||||
co.open(mainActivity, options)
|
||||
} catch (e: Exception) {
|
||||
// showPop("Error in payment: "+ e.message)
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,4 +30,8 @@
|
||||
<string name="share_subtitle">Share this app with your friends and family.</string>
|
||||
<string name="made_with_love">Made with</string>
|
||||
<string name="in_india">in India</string>
|
||||
<string name="acra_notification_title">OOPS, SpotiFlyer Crashed</string>
|
||||
<string name="acra_notification_text">Please Send Crash Report to App Developers, So this unfortunate event may not happen again.</string>
|
||||
<string name="acra_notification_channel">SpotiFlyer_Crashlytics</string>
|
||||
<string name="acra_notification_channel_desc">Notification Channel to send Spotiflyer Crashes.</string>
|
||||
</resources>
|
@ -32,9 +32,6 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation("com.android.tools.build:gradle:4.2.0")
|
||||
implementation("com.google.gms:google-services:4.3.5")
|
||||
implementation("com.google.firebase:perf-plugin:1.3.5")
|
||||
implementation("com.google.firebase:firebase-crashlytics-gradle:2.5.2")
|
||||
implementation("org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktLint}")
|
||||
implementation(JetBrains.Compose.gradlePlugin)
|
||||
implementation(JetBrains.Kotlin.gradlePlugin)
|
||||
|
@ -142,8 +142,14 @@ object Extras {
|
||||
const val jaudioTagger = "com.github.Shabinder:JAudioTagger-Android:1.0"
|
||||
const val kermit = "co.touchlab:kermit:${Versions.kermit}"
|
||||
object Android {
|
||||
val razorpay = "com.razorpay:checkout:1.6.7"
|
||||
val fetch = "androidx.tonyodev.fetch2:xfetch2:3.1.6"
|
||||
object Acra {
|
||||
// Self Hosted Crashlytics (FOSS)
|
||||
private const val VERSION = "5.8.1-beta11"
|
||||
val http = "ch.acra:acra-http:$VERSION"
|
||||
val notification = "ch.acra:acra-notification:$VERSION"
|
||||
}
|
||||
// Self Hosted Analytics (FOSS)
|
||||
val matomo = "org.matomo.sdk:tracker:4.1.2"
|
||||
val appUpdator = "com.github.amitbd1508:AppUpdater:4.1.0"
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ kotlin {
|
||||
androidMain {
|
||||
dependencies {
|
||||
implementation(compose.materialIconsExtended)
|
||||
implementation(Extras.Android.razorpay)
|
||||
implementation(Extras.mp3agic)
|
||||
implementation("com.github.shabinder:storage-chooser:2.0.4.45")
|
||||
// implementation(files("$rootDir/libs/mobile-ffmpeg.aar"))
|
||||
|
@ -31,6 +31,7 @@ kotlin {
|
||||
kotlinOptions.jvmTarget = "14"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
@ -40,6 +41,7 @@ kotlin {
|
||||
implementation(project(":common:compose"))
|
||||
implementation(project(":common:data-models"))
|
||||
implementation(project(":common:root"))
|
||||
|
||||
// Decompose
|
||||
implementation(Decompose.decompose)
|
||||
implementation(Decompose.extensionsCompose)
|
||||
@ -66,8 +68,10 @@ compose.desktop {
|
||||
packageName = "SpotiFlyer"
|
||||
copyright = "© 2021 Shabinder. All rights reserved."
|
||||
vendor = "Shabinder"
|
||||
|
||||
val iconsRoot = project.file("src/jvmMain/resources/drawable")
|
||||
macOS {
|
||||
bundleID = "com.shabinder.spotiflyer"
|
||||
iconFile.set(iconsRoot.resolve("spotiflyer.icns"))
|
||||
}
|
||||
windows {
|
||||
|
Loading…
Reference in New Issue
Block a user