Bimba.git

ref: fce99bb7fe691fea197b4cac75ee9cbc1eb836a4

app/src/main/java/xyz/apiote/bimba/czwek/Bimba.kt


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// SPDX-FileCopyrightText: Adam Evyčędo
//
// SPDX-License-Identifier: GPL-3.0-or-later

package xyz.apiote.bimba.czwek

import android.content.Context
import androidx.core.app.NotificationManagerCompat
import org.acra.BuildConfig
import org.acra.config.httpSender
import org.acra.config.notification
import org.acra.data.StringFormat
import org.acra.ktx.initAcra
import org.acra.security.TLS
import org.acra.sender.HttpSender
import org.osmdroid.config.Configuration
import java.io.File

class Bimba : android.app.Application() {
	override fun onCreate() {
		super.onCreate()
		Configuration.getInstance()
			.let { config ->
				config.load(
					applicationContext,
					applicationContext.getSharedPreferences("shp", MODE_PRIVATE)
				)
				config.osmdroidBasePath = File(applicationContext.cacheDir.absolutePath, "osmdroid")

				config.osmdroidTileCache = File(config.osmdroidBasePath.absolutePath, "tile")
			}
	}

	override fun attachBaseContext(base: Context) {
		super.attachBaseContext(base)

		initAcra {
			buildConfigClass = BuildConfig::class.java
			reportFormat = StringFormat.JSON

			httpSender {
				uri = "https://bimba.apiote.xyz/acra/send"
				httpMethod = HttpSender.Method.POST
				tlsProtocols = listOf(TLS.V1_3, TLS.V1_2)
			}

			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_description)
				channelImportance = NotificationManagerCompat.IMPORTANCE_DEFAULT
				sendButtonText = getString(R.string.send)
				resSendButtonIcon = R.drawable.send
				discardButtonText = getString(R.string.discard)
				resDiscardButtonIcon = R.drawable.discard
				sendWithCommentButtonText = getString(R.string.send_with_comment)
				resSendWithCommentButtonIcon = R.drawable.comment
				commentPrompt = getString(R.string.acra_notification_comment)
			}
		}
	}
}