Compare commits
No commits in common. "386fb20bff1e793e0291341fb15046fdc5be5420" and "515f950bdeb31e468f33b14d7d6df9ff8260d515" have entirely different histories.
386fb20bff
...
515f950bde
@ -3,8 +3,6 @@
|
|||||||
* Copyright (c) 2025. All rights reserved.
|
* Copyright (c) 2025. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Properties
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
@ -17,22 +15,12 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "ru.risdeveau.geotracker"
|
applicationId = "ru.risdeveau.geotracker"
|
||||||
minSdk = 26
|
minSdk = 24
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 3
|
versionCode = 2
|
||||||
versionName = "1.2"
|
versionName = "1.1"
|
||||||
setProperty("archivesBaseName", "$applicationId-v$versionCode($versionName)")
|
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
val secretProperties = Properties().apply {
|
|
||||||
val secretFile = rootProject.file("secrets.properties")
|
|
||||||
if (secretFile.exists())
|
|
||||||
secretFile.inputStream().use { load(it) }
|
|
||||||
else
|
|
||||||
println("Warning: secrets.properties not found!")
|
|
||||||
}
|
|
||||||
manifestPlaceholders["sentry_url"] = secretProperties.getProperty("SENTRY_URL")!!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -42,10 +30,6 @@ android {
|
|||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
"proguard-rules.pro"
|
"proguard-rules.pro"
|
||||||
)
|
)
|
||||||
manifestPlaceholders["sentry_env"] = "production"
|
|
||||||
}
|
|
||||||
debug {
|
|
||||||
manifestPlaceholders["sentry_env"] = "develop"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@ -87,5 +71,4 @@ dependencies {
|
|||||||
implementation(libs.logback.classic)
|
implementation(libs.logback.classic)
|
||||||
|
|
||||||
implementation(libs.splitties.base)
|
implementation(libs.splitties.base)
|
||||||
implementation(libs.sentry)
|
|
||||||
}
|
}
|
@ -26,35 +26,6 @@
|
|||||||
android:theme="@style/Theme.GeoTracker"
|
android:theme="@style/Theme.GeoTracker"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.dsn"
|
|
||||||
android:value="${sentry_url}" />
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.environment"
|
|
||||||
android:value="${sentry_env}" />
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.send-default-pii"
|
|
||||||
android:value="true" />
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.traces.sample-rate"
|
|
||||||
android:value="1.0" />
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.traces.user-interaction.enable"
|
|
||||||
android:value="true" />
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.attach-screenshot"
|
|
||||||
android:value="true" />
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.attach-view-hierarchy"
|
|
||||||
android:value="true" />
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.session-replay.on-error-sample-rate"
|
|
||||||
android:value="1.0" />
|
|
||||||
<meta-data
|
|
||||||
android:name="io.sentry.session-replay.session-sample-rate"
|
|
||||||
android:value="0.1" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
@ -12,9 +12,3 @@ object SettingsPreferences : Preferences("settings") {
|
|||||||
var url by stringPref("url", "https://geo.tmp.codrs.ru")
|
var url by stringPref("url", "https://geo.tmp.codrs.ru")
|
||||||
val interval by IntPref("interval", 15)
|
val interval by IntPref("interval", 15)
|
||||||
}
|
}
|
||||||
|
|
||||||
object StatisticsPreferences : Preferences("statistics") {
|
|
||||||
var totalSent by IntPref("total_sent", 0)
|
|
||||||
var sessionSent by IntPref("session_sent", 0)
|
|
||||||
var lastSent by LongPref("last_sent", 0)
|
|
||||||
}
|
|
@ -16,7 +16,6 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.time.Instant
|
|
||||||
|
|
||||||
|
|
||||||
class LocationForegroundService : Service() {
|
class LocationForegroundService : Service() {
|
||||||
@ -37,12 +36,6 @@ class LocationForegroundService : Service() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
StatisticsPreferences.apply {
|
|
||||||
totalSent++
|
|
||||||
sessionSent++
|
|
||||||
lastSent = Instant.now().epochSecond
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +70,7 @@ class LocationForegroundService : Service() {
|
|||||||
|
|
||||||
private fun createNotificationChannel() {
|
private fun createNotificationChannel() {
|
||||||
Log.d("Service", "createNotificationChannel")
|
Log.d("Service", "createNotificationChannel")
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val channel = NotificationChannel(
|
val channel = NotificationChannel(
|
||||||
"location_channel",
|
"location_channel",
|
||||||
"Отправка Местоположения",
|
"Отправка Местоположения",
|
||||||
@ -85,6 +79,7 @@ class LocationForegroundService : Service() {
|
|||||||
val manager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
val manager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||||
manager.createNotificationChannel(channel)
|
manager.createNotificationChannel(channel)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun createNotification(): Notification {
|
private fun createNotification(): Notification {
|
||||||
val stopIntent = Intent(this, LocationForegroundService::class.java).apply {
|
val stopIntent = Intent(this, LocationForegroundService::class.java).apply {
|
||||||
|
@ -50,7 +50,6 @@ import ru.risdeveau.geotracker.ui.theme.GeoTrackerTheme
|
|||||||
import splitties.experimental.ExperimentalSplittiesApi
|
import splitties.experimental.ExperimentalSplittiesApi
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import splitties.resources.appStr
|
import splitties.resources.appStr
|
||||||
import java.time.Instant
|
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
@ -69,29 +68,13 @@ class MainActivity : ComponentActivity() {
|
|||||||
|
|
||||||
when (screen) {
|
when (screen) {
|
||||||
Screen.Main -> {
|
Screen.Main -> {
|
||||||
var totalSent by remember { mutableIntStateOf(0) }
|
|
||||||
var sessionSent by remember { mutableIntStateOf(0) }
|
|
||||||
var lastSent by remember { mutableIntStateOf(0) }
|
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
Log.d("Thread", "Starting...")
|
Log.d("Thread", "Starting...")
|
||||||
startLocationService()
|
startLocationService()
|
||||||
StatisticsPreferences.sessionSent = 0
|
|
||||||
Log.d("Thread", "Started")
|
Log.d("Thread", "Started")
|
||||||
|
|
||||||
while (true) {
|
|
||||||
totalSent = StatisticsPreferences.totalSent
|
|
||||||
sessionSent = StatisticsPreferences.sessionSent
|
|
||||||
lastSent = (Instant.now().epochSecond - StatisticsPreferences.lastSent).toInt()
|
|
||||||
delay(1000)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(Modifier.align(Alignment.Center)) {
|
Text("Hello world")
|
||||||
Text("Всего отправлено: $totalSent")
|
|
||||||
Text("Отправлено за эту сессию: $sessionSent")
|
|
||||||
Text("В последний раз было отпавлено $lastSent секунд назад")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Screen.Settings -> {
|
Screen.Settings -> {
|
||||||
|
@ -11,7 +11,6 @@ lifecycleRuntimeKtx = "2.8.7"
|
|||||||
activityCompose = "1.10.1"
|
activityCompose = "1.10.1"
|
||||||
composeBom = "2024.04.01"
|
composeBom = "2024.04.01"
|
||||||
logbackClassic = "1.2.11"
|
logbackClassic = "1.2.11"
|
||||||
sentry = "8.12.0"
|
|
||||||
splittiesFunPackAndroidBase = "3.0.0"
|
splittiesFunPackAndroidBase = "3.0.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
@ -36,7 +35,6 @@ ktor-client-json = { module = "io.ktor:ktor-client-json", version.ref = "ktor" }
|
|||||||
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
|
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
|
||||||
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
|
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
|
||||||
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logbackClassic" }
|
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logbackClassic" }
|
||||||
sentry = { module = "io.sentry:sentry-android", version.ref = "sentry" }
|
|
||||||
splitties-base = { module = "com.louiscad.splitties:splitties-fun-pack-android-base", version.ref = "splittiesFunPackAndroidBase" }
|
splitties-base = { module = "com.louiscad.splitties:splitties-fun-pack-android-base", version.ref = "splittiesFunPackAndroidBase" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user