mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
Compare commits
24
Commits
v2.7.0-rc0
...
v2.8.1-rc0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
870e518ff6 | ||
|
|
6d89169bae | ||
|
|
ac77ee2703 | ||
|
|
18dcf603e9 | ||
|
|
71aaba1b86 | ||
|
|
64b9d5f17a | ||
|
|
a9f23c4bfe | ||
|
|
f454f46778 | ||
|
|
432936ea2c | ||
|
|
8211b0ac88 | ||
|
|
c314987e13 | ||
|
|
fc6cd74752 | ||
|
|
a47011e579 | ||
|
|
fbeeec6539 | ||
|
|
e1cd79cd9d | ||
|
|
692ced1ee7 | ||
|
|
c5cc127df4 | ||
|
|
5f00f10ae8 | ||
|
|
0fc9716f06 | ||
|
|
48fd3543e3 | ||
|
|
41985794c2 | ||
|
|
87a92fd001 | ||
|
|
f6f53f2a15 | ||
|
|
2531769b79 |
@@ -21,6 +21,10 @@ android {
|
||||
buildConfigField("String", "APPLICATION_ID", "\"${ProjectConfig.packageName}\"")
|
||||
buildConfigField("String", "GITSHA", "\"${lastCommitHash()}\"")
|
||||
buildConfigField("String", "BUILDTIME", "\"${buildTime()}\"")
|
||||
|
||||
manifestPlaceholders["bugsnagApiKey"] = getBugSnagApiKey(
|
||||
File(System.getProperty("user.home"), ".appconfig/${ProjectConfig.packageName}/bugsnag.properties")
|
||||
) ?: "bugsnag_apikey_placeholder"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
@@ -95,6 +99,7 @@ dependencies {
|
||||
|
||||
addTesting()
|
||||
|
||||
implementation("com.bugsnag:bugsnag-android:5.9.2")
|
||||
"gplayImplementation"("com.bugsnag:bugsnag-android:5.9.2")
|
||||
"gplayImplementation"("com.getkeepsafe.relinker:relinker:1.4.3")
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,17 @@
|
||||
package eu.darken.capod.debug.autoreport
|
||||
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import eu.darken.capod.common.debug.autoreport.AutomaticBugReporter
|
||||
import eu.darken.capod.debug.autoreport.FossAutoReporting
|
||||
import javax.inject.Singleton
|
||||
|
||||
@InstallIn(SingletonComponent::class)
|
||||
@Module
|
||||
abstract class AutoReportingModule {
|
||||
@Binds
|
||||
@Singleton
|
||||
abstract fun autoreporting(foss: FossAutoReporting): AutomaticBugReporter
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package eu.darken.capod.debug.autoreport
|
||||
|
||||
import android.app.Application
|
||||
import eu.darken.capod.common.debug.autoreport.AutomaticBugReporter
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class FossAutoReporting @Inject constructor() : AutomaticBugReporter {
|
||||
override fun setup(application: Application) {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
override fun notify(throwable: Throwable) {
|
||||
throw IllegalStateException("Who initliazed this? Without setup no calls to here!")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application>
|
||||
<meta-data
|
||||
android:name="com.bugsnag.android.API_KEY"
|
||||
android:value="${bugsnagApiKey}" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,16 @@
|
||||
package eu.darken.capod.debug.autoreport
|
||||
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import eu.darken.capod.common.debug.autoreport.AutomaticBugReporter
|
||||
import javax.inject.Singleton
|
||||
|
||||
@InstallIn(SingletonComponent::class)
|
||||
@Module
|
||||
abstract class AutoReportingModule {
|
||||
@Binds
|
||||
@Singleton
|
||||
abstract fun autoreporting(foss: GplayAutoReporting): AutomaticBugReporter
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package eu.darken.capod.common.debug.autoreport.bugsnag
|
||||
package eu.darken.capod.debug.autoreport
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
@@ -7,7 +7,7 @@ import com.bugsnag.android.Event
|
||||
import com.bugsnag.android.OnErrorCallback
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import eu.darken.capod.common.BuildConfigWrap
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.WARN
|
||||
import eu.darken.capod.common.debug.logging.asLog
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package eu.darken.capod.common.debug.autoreport.bugsnag
|
||||
package eu.darken.capod.debug.autoreport
|
||||
|
||||
import com.bugsnag.android.Event
|
||||
import eu.darken.capod.common.debug.logging.Logging
|
||||
+20
-8
@@ -1,15 +1,16 @@
|
||||
package eu.darken.capod.common.debug.autoreport
|
||||
package eu.darken.capod.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.capod.common.BuildConfigWrap
|
||||
import eu.darken.capod.common.InstallId
|
||||
import eu.darken.capod.common.debug.Bugs
|
||||
import eu.darken.capod.common.debug.autoreport.bugsnag.BugsnagErrorHandler
|
||||
import eu.darken.capod.common.debug.autoreport.bugsnag.BugsnagLogger
|
||||
import eu.darken.capod.common.debug.autoreport.bugsnag.NOPBugsnagErrorHandler
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.common.debug.autoreport.AutomaticBugReporter
|
||||
import eu.darken.capod.common.debug.logging.Logging
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
import eu.darken.capod.common.debug.logging.logTag
|
||||
@@ -18,19 +19,25 @@ import javax.inject.Provider
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class AutoReporting @Inject constructor(
|
||||
class GplayAutoReporting @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 {
|
||||
|
||||
fun setup() {
|
||||
override fun setup(application: Application) {
|
||||
val isEnabled = debugSettings.isAutoReportingEnabled.value
|
||||
log(TAG) { "setup(): isEnabled=$isEnabled" }
|
||||
|
||||
if (!isEnabled) return
|
||||
|
||||
ReLinker
|
||||
.log { message -> log(TAG) { "ReLinker: $message" } }
|
||||
.loadLibrary(application, "bugsnag-plugin-android-anr")
|
||||
|
||||
try {
|
||||
val bugsnagConfig = Configuration.load(context).apply {
|
||||
if (debugSettings.isAutoReportingEnabled.value) {
|
||||
@@ -48,13 +55,18 @@ class AutoReporting @Inject constructor(
|
||||
}
|
||||
|
||||
Bugsnag.start(context, bugsnagConfig)
|
||||
Bugs.ready = true
|
||||
Bugs.reporter = this
|
||||
} catch (e: IllegalStateException) {
|
||||
log(TAG) { "Bugsnag API Key not configured." }
|
||||
}
|
||||
}
|
||||
|
||||
override fun notify(throwable: Throwable) {
|
||||
Bugsnag.notify(throwable)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = logTag("Debug", "AutoReport")
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package eu.darken.capod.common.debug.autoreport.bugsnag
|
||||
package eu.darken.capod.debug.autoreport
|
||||
|
||||
import com.bugsnag.android.Event
|
||||
import com.bugsnag.android.OnErrorCallback
|
||||
@@ -2,7 +2,7 @@ package eu.darken.capod.common.bluetooth
|
||||
|
||||
import dagger.Reusable
|
||||
import eu.darken.capod.common.SystemClockWrap
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import java.time.Instant
|
||||
import javax.inject.Inject
|
||||
import kotlin.random.Random
|
||||
@@ -27,9 +27,7 @@ class FakeBleData @Inject constructor(
|
||||
generatedAtNanos = SystemClockWrap.elapsedRealtimeNanos + 100,
|
||||
manufacturerSpecificData = mapOf(76 to "07 19 01 02 20 75 AA B6 31 00 05 9C 5A A4 5D C0 2C A0 B4 6F B9 ED 8E CE 03 97 CA".hexToByteArray())
|
||||
).run {
|
||||
if (Random.nextBoolean()) {
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
|
||||
// AirPods Gen2
|
||||
@@ -40,9 +38,7 @@ class FakeBleData @Inject constructor(
|
||||
generatedAtNanos = SystemClockWrap.elapsedRealtimeNanos + 100,
|
||||
manufacturerSpecificData = mapOf(76 to "07 19 01 0F 20 75 AA B6 31 00 05 9C 5A A4 5D C0 2C A0 B4 6F B9 ED 8E CE 03 97 CA".hexToByteArray())
|
||||
).run {
|
||||
if (Random.nextBoolean()) {
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
|
||||
// AirPods Gen3
|
||||
@@ -53,9 +49,7 @@ class FakeBleData @Inject constructor(
|
||||
generatedAtNanos = SystemClockWrap.elapsedRealtimeNanos + 200,
|
||||
manufacturerSpecificData = mapOf(76 to "07 19 01 13 20 55 AF 56 31 00 06 6F E4 DF 10 AF 10 60 81 03 3B 76 D9 C7 11 22 88".hexToByteArray())
|
||||
).run {
|
||||
if (Random.nextBoolean()) {
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
// AirPods Max
|
||||
BleScanResult(
|
||||
@@ -65,9 +59,7 @@ class FakeBleData @Inject constructor(
|
||||
generatedAtNanos = SystemClockWrap.elapsedRealtimeNanos + 300,
|
||||
manufacturerSpecificData = mapOf(76 to "07 19 01 0A 20 02 05 80 04 0F 44 A7 60 9B F8 3C FD B1 D8 1C 61 EA 82 60 A3 2C 4E".hexToByteArray())
|
||||
).run {
|
||||
if (Random.nextBoolean()) {
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
// BeatsFlex
|
||||
BleScanResult(
|
||||
@@ -77,9 +69,7 @@ class FakeBleData @Inject constructor(
|
||||
generatedAtNanos = SystemClockWrap.elapsedRealtimeNanos + 400,
|
||||
manufacturerSpecificData = mapOf(76 to "07 19 01 10 20 0A F4 8F 00 01 00 C4 71 9F 9C EF A2 E3 BA 66 FE 1D 45 9F C9 2F A0".hexToByteArray())
|
||||
).run {
|
||||
if (Random.nextBoolean()) {
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
|
||||
// Tws i99999
|
||||
@@ -90,9 +80,7 @@ class FakeBleData @Inject constructor(
|
||||
generatedAtNanos = SystemClockWrap.elapsedRealtimeNanos + 400,
|
||||
manufacturerSpecificData = mapOf(76 to "07 13 01 02 20 71 AA 37 32 00 10 00 64 64 FF 00 00 00 00 00 00".hexToByteArray())
|
||||
).run {
|
||||
if (Random.nextBoolean()) {
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
|
||||
// Unknown Device
|
||||
@@ -103,9 +91,7 @@ class FakeBleData @Inject constructor(
|
||||
generatedAtNanos = SystemClockWrap.elapsedRealtimeNanos + 500,
|
||||
manufacturerSpecificData = mapOf(76 to "07 19 01 FF 20 0A F4 8F 00 01 00 C4 71 9F 9C EF A2 E3 BA 66 FE 1D 45 9F C9 2F A0".hexToByteArray())
|
||||
).run {
|
||||
if (Random.nextBoolean()) {
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
fakeDevices.add(this)
|
||||
}
|
||||
|
||||
return fakeDevices
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package eu.darken.capod.common.collections
|
||||
|
||||
|
||||
fun Collection<Int>.median(): Int = this.sorted().let {
|
||||
if (it.size % 2 == 0) {
|
||||
(it[it.size / 2] + it[(it.size - 1) / 2]) / 2
|
||||
} else {
|
||||
it[it.size / 2]
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package eu.darken.capod.common.debug
|
||||
|
||||
import com.bugsnag.android.Bugsnag
|
||||
import eu.darken.capod.common.debug.autoreport.AutomaticBugReporter
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.*
|
||||
import eu.darken.capod.common.debug.logging.asLog
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
import eu.darken.capod.common.debug.logging.logTag
|
||||
|
||||
object Bugs {
|
||||
var ready = false
|
||||
var reporter: AutomaticBugReporter? = null
|
||||
fun report(
|
||||
tag: String,
|
||||
message: String,
|
||||
@@ -16,11 +16,9 @@ object Bugs {
|
||||
log(TAG, VERBOSE) { "Reporting $exception" }
|
||||
log(tag, ERROR) { "$message\n${exception.asLog()}" }
|
||||
|
||||
if (!ready) {
|
||||
reporter?.notify(exception) ?: run {
|
||||
log(TAG, WARN) { "Bug tracking not initialized yet." }
|
||||
return
|
||||
}
|
||||
Bugsnag.notify(exception)
|
||||
}
|
||||
|
||||
private val TAG = logTag("Bugs")
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package eu.darken.capod.common.debug.autoreport
|
||||
package eu.darken.capod.common.debug
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package eu.darken.capod.common.debug.autoreport
|
||||
|
||||
import android.app.Application
|
||||
|
||||
interface AutomaticBugReporter {
|
||||
|
||||
fun setup(application: Application)
|
||||
|
||||
fun notify(throwable: Throwable)
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import androidx.preference.PreferenceDataStore
|
||||
import com.squareup.moshi.Moshi
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import eu.darken.capod.common.bluetooth.ScannerMode
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.common.preferences.PreferenceStoreMapper
|
||||
import eu.darken.capod.common.preferences.Settings
|
||||
import eu.darken.capod.common.preferences.createFlowPreference
|
||||
@@ -26,7 +26,7 @@ class GeneralSettings @Inject constructor(
|
||||
val monitorMode = preferences.createFlowPreference("core.monitor.mode", MonitorMode.AUTOMATIC, moshi)
|
||||
val scannerMode = preferences.createFlowPreference("core.scanner.mode", ScannerMode.BALANCED, moshi)
|
||||
|
||||
val showAll = preferences.createFlowPreference("core.showall.enabled", false)
|
||||
val showAll = preferences.createFlowPreference("core.showall.enabled", true)
|
||||
|
||||
val minimumSignalQuality = preferences.createFlowPreference("core.signal.minimum", 0.25f)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import eu.darken.capod.common.bluetooth.BleScanner
|
||||
import eu.darken.capod.common.bluetooth.BluetoothManager2
|
||||
import eu.darken.capod.common.bluetooth.ScannerMode
|
||||
import eu.darken.capod.common.coroutine.AppScope
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.VERBOSE
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.WARN
|
||||
import eu.darken.capod.common.debug.logging.asLog
|
||||
|
||||
@@ -6,6 +6,9 @@ import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import eu.darken.capod.common.R
|
||||
import eu.darken.capod.common.bluetooth.BleScanResult
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.VERBOSE
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
import java.time.Duration
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
import kotlin.math.abs
|
||||
@@ -31,14 +34,20 @@ interface PodDevice {
|
||||
val rssi: Int
|
||||
get() = scanResult.rssi
|
||||
|
||||
val confidence: Float
|
||||
val reliability: Float
|
||||
|
||||
/**
|
||||
* This is not correct but it works ¯\_(ツ)_/¯
|
||||
* The range of the RSSI is device specific (ROMs).
|
||||
*/
|
||||
val signalQuality: Float
|
||||
get() = ((100 - abs(rssi)) / 100f) * (max(BASE_CONFIDENCE, confidence))
|
||||
get() {
|
||||
/**
|
||||
* This is not correct but it works ¯\_(ツ)_/¯
|
||||
* The range of the RSSI is device specific (ROMs).
|
||||
*/
|
||||
val sqRssi = ((100 - abs(rssi)) / 100f)
|
||||
val sqReliability = max(BASE_CONFIDENCE, reliability)
|
||||
val sqAge = (Duration.between(seenFirstAt, Instant.now()).toMinutes().coerceAtMost(60) / 60f) * 0.25f
|
||||
log(VERBOSE) { "Signal Quality ($address): rssi=$sqRssi, reliability=$reliability, age=$sqAge" }
|
||||
return (sqRssi + sqReliability + sqAge) / 2f
|
||||
}
|
||||
|
||||
val rawData: Map<Int, ByteArray>
|
||||
get() = scanResult.manufacturerSpecificData
|
||||
@@ -133,6 +142,6 @@ interface PodDevice {
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val BASE_CONFIDENCE = 0.5f
|
||||
const val BASE_CONFIDENCE = 0.0f
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,8 @@ fun SinglePodDevice.getBatteryLevelHeadset(context: Context): String =
|
||||
?: context.getString(R.string.general_value_not_available_label)
|
||||
|
||||
fun PodDevice.getSignalQuality(context: Context): String {
|
||||
val percentage = 100 * signalQuality
|
||||
return "~${percentage.roundToInt()}%"
|
||||
val multiplier = 100 * signalQuality
|
||||
return "${multiplier.roundToInt()}"
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package eu.darken.capod.pods.core.apple
|
||||
|
||||
import eu.darken.capod.common.bluetooth.BleScanResult
|
||||
import eu.darken.capod.common.collections.median
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.VERBOSE
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.WARN
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
@@ -8,10 +9,10 @@ import eu.darken.capod.common.lowerNibble
|
||||
import eu.darken.capod.common.upperNibble
|
||||
import eu.darken.capod.pods.core.HasCase
|
||||
import eu.darken.capod.pods.core.PodDevice
|
||||
import eu.darken.capod.pods.core.apple.airpods.AirPodsPro
|
||||
import eu.darken.capod.pods.core.apple.protocol.ProximityPairing
|
||||
import java.time.Duration
|
||||
import java.time.Instant
|
||||
import kotlin.math.max
|
||||
|
||||
abstract class ApplePodsFactory<PodType : ApplePods>(private val tag: String) {
|
||||
|
||||
@@ -38,7 +39,8 @@ abstract class ApplePodsFactory<PodType : ApplePods>(private val tag: String) {
|
||||
val id: PodDevice.Id,
|
||||
val seenFirstAt: Instant,
|
||||
val seenCounter: Int,
|
||||
val history: List<ApplePods>
|
||||
val history: List<ApplePods>,
|
||||
val lastCaseBattery: Float?,
|
||||
) {
|
||||
val lastMessage: ProximityPairing.Message
|
||||
get() = history.last().proximityMessage
|
||||
@@ -46,63 +48,81 @@ abstract class ApplePodsFactory<PodType : ApplePods>(private val tag: String) {
|
||||
val lastAddress: String
|
||||
get() = history.last().address
|
||||
|
||||
val confidence: Float
|
||||
get() = 0.75f + (history.size / (MAX_HISTORY * 4f))
|
||||
val reliability: Float
|
||||
get() {
|
||||
if (history.size < 2) return 0f
|
||||
|
||||
fun averageRssi(latest: Int): Int =
|
||||
history.map { it.rssi }.plus(latest).takeLast(10).median()
|
||||
val now = Instant.now()
|
||||
|
||||
val pingInterval = List(history.dropLast(1).size) { index ->
|
||||
Duration.between(history[index].seenLastAt, history[index + 1].seenLastAt).toMillis()
|
||||
}.map { it.toInt() }.median()
|
||||
|
||||
val expectedPings: Float = LOOKBACK.toMillis() / pingInterval.toFloat()
|
||||
|
||||
val recentPings = history.filter {
|
||||
Duration.between(it.seenLastAt, now).toMillis() < LOOKBACK.toMillis() + pingInterval
|
||||
}.size
|
||||
|
||||
val reliability: Float = (recentPings / expectedPings)
|
||||
// log("#####") { "interval=$pingInterval, expectedPerMinute=$expectedPings, count=$recentPings" }
|
||||
|
||||
return max(0.0f, reliability).coerceAtMost(1f)
|
||||
}
|
||||
|
||||
fun rssiSmoothed(latest: Int): Int {
|
||||
val now = Instant.now()
|
||||
return history
|
||||
.filter { Duration.between(it.seenLastAt, now) < LOOKBACK }
|
||||
.map { it.rssi }
|
||||
.plus(latest)
|
||||
.median()
|
||||
}
|
||||
|
||||
fun isOlderThan(age: Duration): Boolean {
|
||||
val now = Instant.now()
|
||||
return Duration.between(history.last().seenLastAt, now) > age
|
||||
}
|
||||
|
||||
private fun List<Int>.median(): Int = this.sorted().let {
|
||||
if (it.size % 2 == 0)
|
||||
(it[it.size / 2] + it[(it.size - 1) / 2]) / 2
|
||||
else
|
||||
it[it.size / 2]
|
||||
}
|
||||
|
||||
override fun toString(): String = "KnownDevice(history=${history.size}, last=${history.last()})"
|
||||
|
||||
companion object {
|
||||
const val MAX_HISTORY = 20
|
||||
// 30 seconds at fastest interval
|
||||
const val MAX_HISTORY = 60
|
||||
val LOOKBACK = Duration.ofSeconds(30)
|
||||
}
|
||||
}
|
||||
|
||||
internal val knownDevices = mutableMapOf<PodDevice.Id, KnownDevice>()
|
||||
|
||||
|
||||
fun KnownDevice.getLatestCaseBattery(): Float? = history
|
||||
fun KnownDevice.getLatestCaseBattery(): Float? = this.lastCaseBattery
|
||||
|
||||
private fun Collection<ApplePods>.determineLatestCaseBattery(): Float? = this
|
||||
.filterIsInstance<HasCase>()
|
||||
.mapNotNull { it.batteryCasePercent }
|
||||
.lastOrNull()
|
||||
|
||||
fun KnownDevice.getLatestCaseLidState(basic: DualApplePods): DualApplePods.LidState? {
|
||||
val definitive = setOf(DualApplePods.LidState.OPEN, DualApplePods.LidState.CLOSED)
|
||||
if (definitive.contains(basic.caseLidState)) return null
|
||||
val definitive = setOf(
|
||||
DualApplePods.LidState.OPEN,
|
||||
DualApplePods.LidState.CLOSED,
|
||||
DualApplePods.LidState.NOT_IN_CASE,
|
||||
)
|
||||
if (definitive.contains(basic.caseLidState)) return basic.caseLidState
|
||||
|
||||
return history
|
||||
.filterIsInstance<AirPodsPro>() // TODO why is this AirPodsPro specific here?
|
||||
.lastOrNull { it.caseLidState != DualApplePods.LidState.NOT_IN_CASE }
|
||||
.takeLast(2)
|
||||
.filterIsInstance<DualApplePods>()
|
||||
.lastOrNull { it.caseLidState != DualApplePods.LidState.UNKNOWN }
|
||||
?.caseLidState
|
||||
?: DualApplePods.LidState.NOT_IN_CASE
|
||||
}
|
||||
|
||||
open fun historyTrimmer(
|
||||
pods: List<ApplePods>
|
||||
): List<ApplePods> {
|
||||
var trimmed = pods.takeLast(KnownDevice.MAX_HISTORY)
|
||||
|
||||
// We want to keep the case information
|
||||
// If both pods are removed, and produce more history, we otherwise lose the case battery info.
|
||||
val caseInfoFat = pods.lastOrNull { it is HasCase && it.batteryCasePercent != null }
|
||||
val caseInfoTrimmed = trimmed.lastOrNull { it is HasCase && it.batteryCasePercent != null }
|
||||
if (caseInfoFat != null && caseInfoTrimmed == null) {
|
||||
trimmed = listOf(caseInfoFat) + trimmed.takeLast(KnownDevice.MAX_HISTORY - 1)
|
||||
}
|
||||
|
||||
return trimmed
|
||||
return pods.takeLast(KnownDevice.MAX_HISTORY)
|
||||
}
|
||||
|
||||
internal open fun searchHistory(current: PodType): KnownDevice? {
|
||||
@@ -110,7 +130,7 @@ abstract class ApplePodsFactory<PodType : ApplePods>(private val tag: String) {
|
||||
val message = current.proximityMessage
|
||||
|
||||
knownDevices.values.toList().forEach { knownDevice ->
|
||||
if (knownDevice.isOlderThan(Duration.ofSeconds(20))) {
|
||||
if (knownDevice.isOlderThan(Duration.ofSeconds(30))) {
|
||||
log(tag, VERBOSE) { "searchHistory1: Removing stale known device: $knownDevice" }
|
||||
knownDevices.remove(knownDevice.id)
|
||||
}
|
||||
@@ -146,18 +166,22 @@ abstract class ApplePodsFactory<PodType : ApplePods>(private val tag: String) {
|
||||
|
||||
knownDevices[device.identifier] = when {
|
||||
existing != null -> {
|
||||
val history = existing.history.plus(device)
|
||||
existing.copy(
|
||||
seenCounter = existing.seenCounter + 1,
|
||||
history = existing.history.plus(device)
|
||||
history = history,
|
||||
lastCaseBattery = history.determineLatestCaseBattery() ?: existing.lastCaseBattery
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
log(tag) { "searchHistory1: Creating new history for $device" }
|
||||
val history = listOf(device)
|
||||
KnownDevice(
|
||||
id = device.identifier,
|
||||
seenFirstAt = device.seenFirstAt,
|
||||
seenCounter = 1,
|
||||
history = listOf(device)
|
||||
history = history,
|
||||
lastCaseBattery = history.determineLatestCaseBattery()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ data class AirPodsGen1 constructor(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
private val cachedCaseState: DualApplePods.LidState? = null
|
||||
@@ -55,9 +55,9 @@ data class AirPodsGen1 constructor(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
cachedCaseState = result.getLatestCaseLidState(basic)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ data class AirPodsGen2 constructor(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
private val cachedCaseState: DualApplePods.LidState? = null
|
||||
@@ -54,9 +54,9 @@ data class AirPodsGen2 constructor(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
cachedCaseState = result.getLatestCaseLidState(basic)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ data class AirPodsGen3 constructor(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
private val cachedCaseState: DualApplePods.LidState? = null
|
||||
@@ -54,9 +54,9 @@ data class AirPodsGen3 constructor(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
cachedCaseState = result.getLatestCaseLidState(basic)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import eu.darken.capod.common.isBitSet
|
||||
import eu.darken.capod.pods.core.HasEarDetection
|
||||
import eu.darken.capod.pods.core.PodDevice
|
||||
import eu.darken.capod.pods.core.apple.ApplePods
|
||||
import eu.darken.capod.pods.core.apple.HasAppleColor
|
||||
import eu.darken.capod.pods.core.apple.SingleApplePods
|
||||
import eu.darken.capod.pods.core.apple.SingleApplePodsFactory
|
||||
import eu.darken.capod.pods.core.apple.protocol.ProximityPairing
|
||||
@@ -19,9 +20,9 @@ data class AirPodsMax(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
) : SingleApplePods, HasEarDetection, HasStateDetectionAirPods {
|
||||
) : SingleApplePods, HasEarDetection, HasAppleColor {
|
||||
|
||||
override val model: PodDevice.Model = PodDevice.Model.AIRPODS_MAX
|
||||
|
||||
@@ -57,8 +58,8 @@ data class AirPodsMax(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
reliability = result.reliability,
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ data class AirPodsPro(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
private val cachedCaseState: LidState? = null
|
||||
@@ -73,9 +73,9 @@ data class AirPodsPro(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
cachedCaseState = result.getLatestCaseLidState(basic)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ data class AirPodsPro2(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
private val cachedCaseState: LidState? = null
|
||||
@@ -73,9 +73,9 @@ data class AirPodsPro2(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
cachedCaseState = result.getLatestCaseLidState(basic)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ data class BeatsFitPro(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
private val cachedCaseState: DualApplePods.LidState? = null
|
||||
@@ -54,9 +54,9 @@ data class BeatsFitPro(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
cachedCaseState = result.getLatestCaseLidState(basic)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ data class BeatsFlex(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
) : SingleApplePods {
|
||||
|
||||
@@ -46,8 +46,8 @@ data class BeatsFlex(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
reliability = result.reliability,
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ data class BeatsSolo3(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
) : SingleApplePods {
|
||||
|
||||
@@ -45,8 +45,8 @@ data class BeatsSolo3(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
reliability = result.reliability,
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ data class BeatsStudio3(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
) : SingleApplePods {
|
||||
|
||||
@@ -43,8 +43,8 @@ data class BeatsStudio3(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
reliability = result.reliability,
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ data class BeatsX(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
) : SingleApplePods {
|
||||
|
||||
@@ -46,8 +46,8 @@ data class BeatsX(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
reliability = result.reliability,
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ data class PowerBeats3(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
) : SingleApplePods {
|
||||
|
||||
@@ -46,8 +46,8 @@ data class PowerBeats3(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
reliability = result.reliability,
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ data class PowerBeatsPro(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
private val cachedCaseState: DualApplePods.LidState? = null
|
||||
@@ -54,9 +54,9 @@ data class PowerBeatsPro(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
cachedCaseState = result.getLatestCaseLidState(basic)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ data class FakeAirPodsGen1 constructor(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
) : ApplePods, DualPodDevice, HasEarDetectionDual, HasChargeDetectionDual, HasCase {
|
||||
@@ -138,9 +138,9 @@ data class FakeAirPodsGen1 constructor(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ data class FakeAirPodsGen2 constructor(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
) : ApplePods, DualPodDevice, HasEarDetectionDual, HasChargeDetectionDual, HasCase {
|
||||
@@ -136,9 +136,9 @@ data class FakeAirPodsGen2 constructor(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ data class FakeAirPodsGen3 constructor(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
) : ApplePods, DualPodDevice, HasEarDetectionDual, HasChargeDetectionDual, HasCase {
|
||||
@@ -138,9 +138,9 @@ data class FakeAirPodsGen3 constructor(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ data class FakeAirPodsPro constructor(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
) : ApplePods, DualPodDevice, HasChargeDetectionDual, HasEarDetectionDual, HasCase {
|
||||
@@ -156,9 +156,9 @@ data class FakeAirPodsPro constructor(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ data class FakeAirPodsPro2 constructor(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||
override val reliability: Float = PodDevice.BASE_CONFIDENCE,
|
||||
private val rssiAverage: Int? = null,
|
||||
private val cachedBatteryPercentage: Float? = null,
|
||||
private val cachedCaseState: DualApplePods.LidState? = null,
|
||||
@@ -153,9 +153,9 @@ data class FakeAirPodsPro2 constructor(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
reliability = result.reliability,
|
||||
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ data class UnknownAppleDevice(
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val proximityMessage: ProximityPairing.Message,
|
||||
override val confidence: Float = 0f,
|
||||
override val reliability: Float = 0f,
|
||||
private val rssiAverage: Int? = null,
|
||||
) : ApplePods {
|
||||
|
||||
@@ -49,8 +49,8 @@ data class UnknownAppleDevice(
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
reliability = result.reliability,
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ data class UnknownDevice(
|
||||
override val seenFirstAt: Instant = Instant.now(),
|
||||
override val seenCounter: Int = 1,
|
||||
override val scanResult: BleScanResult,
|
||||
override val confidence: Float = 0f,
|
||||
override val reliability: Float = 0f,
|
||||
private val rssiAverage: Int? = null,
|
||||
) : PodDevice {
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ class UnknownDeviceFactory @Inject constructor() {
|
||||
seenFirstAt = result.seenFirstAt,
|
||||
seenLastAt = scanResult.receivedAt,
|
||||
seenCounter = result.seenCounter,
|
||||
confidence = result.confidence,
|
||||
rssiAverage = result.averageRssi(basic.rssi),
|
||||
reliability = result.confidence,
|
||||
rssiAverage = result.rssiSmoothed(basic.rssi),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class UnknownDeviceFactory @Inject constructor() {
|
||||
val confidence: Float
|
||||
get() = 0.75f + (history.size / (MAX_HISTORY * 4f))
|
||||
|
||||
fun averageRssi(latest: Int): Int =
|
||||
fun rssiSmoothed(latest: Int): Int =
|
||||
history.map { it.rssi }.plus(latest).takeLast(10).median()
|
||||
|
||||
fun isOlderThan(age: Duration): Boolean {
|
||||
@@ -70,7 +70,7 @@ class UnknownDeviceFactory @Inject constructor() {
|
||||
override fun toString(): String = "KnownDevice(history=${history.size}, last=${history.last()})"
|
||||
|
||||
companion object {
|
||||
const val MAX_HISTORY = 10
|
||||
const val MAX_HISTORY = 20
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
<string name="app_name">CAPod</string>
|
||||
<string name="app_name_pro">CAPod Pro</string>
|
||||
<string name="app_name_foss">CAPod FOSS</string>
|
||||
<string name="general_value_not_available_label">غير متوفر</string>
|
||||
<string name="general_error_label">خطأ</string>
|
||||
<string name="general_grant_permission_action">منح الإذن</string>
|
||||
<string name="overview_nomaindevice_label">لا يوجد جهاز أساسي</string>
|
||||
<string name="overview_nomaindevice_description">ِمن غير المحتمل أن تكون جميع الأجهزة المكشوفة مِلكك، شغل جهازك وقم بتوصيله أو اضبط الإعدادات.</string>
|
||||
<string name="overview_bluetooth_disabled_label">تم تعطيل البلوتوت</string>
|
||||
<string name="overview_bluetooth_disabled_description">تم تعطيل البلوتوت، قم بتفعيله ;)</string>
|
||||
<string name="permission_bluetooth_connect_label">اتصال بلوتوث</string>
|
||||
<string name="permission_bluetooth_connect_description">يتطلب هذا التطبيق إذن \"إتصال بلوتوث\" للتفاعل مع الأجهزة المقترنة وبدء الاتصالات.</string>
|
||||
<string name="permission_bluetooth_scan_label">البحث عن بلوتوث</string>
|
||||
<string name="permission_bluetooth_scan_description">يسمح إذن \"فحص البلوتوث\" لهذا التطبيق باكتشاف بيانات البلوتوث واستلامها من الأجهزة القريبة مثل AirPods.</string>
|
||||
<string name="permission_bluetooth_label">بلوتوث</string>
|
||||
<string name="permission_bluetooth_description">يتطلب هذا التطبيق إذن \"البلوتوت\" للاتصال بأجهزة البلوتوت المقترنة.</string>
|
||||
<string name="permission_access_fine_location_label">الوصول إلى موقع جيد</string>
|
||||
<string name="permission_access_fine_location_description">يستخدم CAPod إذن \"الموقع الدقيق\" لتلقي بيانات البلوتوث منخفضة الطاقة. تستخدم سماعات الرأس بلوتوث منخفض الطاقة لبث حالتها. لن يستخدم هذا التطبيق بيانات البلوتوث لتحديد موقعك.</string>
|
||||
<string name="permission_background_location_label">الوصول إلى الموقع في الخلفية</string>
|
||||
<string name="permission_background_location_description">يستخدم تطبيق CAPod \"الوصول إلى موقع الخلفية\" و\"الاتصال التلقائي\" أثناء إغلاق التطبيق. يتيح الوصول إلى الموقع في الخلفية التطبيق في تلقي بيانات البلوتوت منخفضة الطاقة أثناء وجودها في الخلفية. هذا التطبيق لن يستخدم بيانات البلوتوت لتحديد موقعك.</string>
|
||||
<string name="permission_ignore_battery_optimizations_label">تعطيل خاصية تحسينات البطارية</string>
|
||||
<string name="permission_ignore_battery_optimizations_description">تحسينات البطارية تمنع هذا التطبيق من تلقي بيانات البلوتوت بشكل موثوق أثناء وجود التطبيق في الخلفية.</string>
|
||||
<string name="permission_required_title">الإذن التالي مطلوب:</string>
|
||||
<string name="permission_system_alert_window_label">نافذة تنبيه النظام</string>
|
||||
<string name="permission_system_alert_window_description">اسم لتطبيق CAPod بالظهور فوق التطبيقات الأخرى لتفعيل مِيزة \"الإشعارات المنبثقة\".</string>
|
||||
<string name="settings_scanner_mode_lowpower_label">طاقة مُنخفضة</string>
|
||||
<string name="settings_scanner_mode_balanced_label">متوازن</string>
|
||||
<string name="settings_scanner_mode_lowlatency_label">وقت استجابة مُنخفض</string>
|
||||
<string name="settings_monitor_mode_manual_label">عندما يُفتح التطبيق</string>
|
||||
<string name="settings_monitor_mode_automatic_label">عندما يتم توصيل الجهاز</string>
|
||||
<string name="settings_monitor_mode_always_label">دائمًا</string>
|
||||
<string name="settings_reaction_autoconnect_whenseen_label">عندما يُنظر إليه</string>
|
||||
<string name="settings_reaction_autoconnect_caseopen_label">العُلبة مفتوحة</string>
|
||||
<string name="settings_reaction_autoconnect_inear_label">في الأذن</string>
|
||||
<string name="pods_dual_left_label">السماعة اليسرى</string>
|
||||
<string name="pods_dual_right_label">السماعة اليمنى</string>
|
||||
<string name="pods_case_label">العلبة</string>
|
||||
<string name="pods_case_status_open_label">فتح</string>
|
||||
<string name="pods_case_status_closed_label">مُغلق</string>
|
||||
<string name="pods_connection_state_disconnected_label">غير مُتصل بجهاز</string>
|
||||
<string name="pods_connection_state_idle_label">مُتصل بجهاز، لكنه فارغ</string>
|
||||
<string name="pods_connection_state_music_label">في وضع الموسيقى</string>
|
||||
<string name="pods_connection_state_call_label">في وضع الاتصال</string>
|
||||
<string name="pods_connection_state_ringing_label">الرنين</string>
|
||||
<string name="pods_connection_state_hanging_up_label">إنهاء المكالمة</string>
|
||||
<string name="pods_connection_state_unknown_label">حالة اتصال غير معروفة</string>
|
||||
<string name="pods_unknown_raw_data_label">مُسودة بيانات</string>
|
||||
<string name="pods_unknown_label">جهاز غير معروف</string>
|
||||
<string name="pods_unknown_contact_dev">هذا جهاز غير معروف لكنه يستخدم صيغة رسالة مشابهة. دعنا نضيف دعما لها. اتصل بي :)</string>
|
||||
<string name="pods_none_label_short">لا يوجد جهاز</string>
|
||||
<string name="pods_charging_label">في حالة الشحن</string>
|
||||
<string name="pods_inear_label">في الأذن</string>
|
||||
<string name="pods_microphone_label">ميكروفون</string>
|
||||
<string name="pods_yours">الخاصة بك</string>
|
||||
<string name="headset_being_worn_label">يتم ارتداؤها</string>
|
||||
<string name="pods_case_unknown_state">حالة غير معروفة</string>
|
||||
<string name="last_seen_x">آخر ظهور: %s</string>
|
||||
<string name="first_seen_x">أول ظهور:%s</string>
|
||||
</resources>
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
<string name="general_error_label">錯誤</string>
|
||||
<string name="general_grant_permission_action">授予權限</string>
|
||||
<string name="overview_nomaindevice_label">無主要裝置</string>
|
||||
<string name="overview_nomaindevice_description">所有偵測到的裝置似乎並不是你的。開啟並連線你的裝置,也可以調整設定。</string>
|
||||
<string name="overview_nomaindevice_description">所有偵測到的裝置似乎並不是您的。開啟並連線您的裝置,也可以調整設定。</string>
|
||||
<string name="overview_bluetooth_disabled_label">藍牙已停用</string>
|
||||
<string name="overview_bluetooth_disabled_description">藍牙已停用,啟用它 ;)</string>
|
||||
<string name="permission_bluetooth_connect_label">藍牙連線</string>
|
||||
<string name="permission_bluetooth_connect_description">這個應用程式需要「藍牙連線」權限以與已配對的裝置交互或配對新裝置。</string>
|
||||
<string name="permission_bluetooth_scan_label">藍牙掃描</string>
|
||||
<string name="permission_bluetooth_scan_description">「藍牙掃描」權限允許這個應用程式發現附近的裝置並接收藍牙資料,你的 AirPods 需要如此。</string>
|
||||
<string name="permission_bluetooth_scan_description">「藍牙掃描」權限允許這個應用程式發現附近的裝置並接收藍牙資料,您的 AirPods 需要如此。</string>
|
||||
<string name="permission_bluetooth_label">藍牙</string>
|
||||
<string name="permission_bluetooth_description">這個應用程式需要「藍牙」權限與已配對裝置連線。</string>
|
||||
<string name="permission_access_fine_location_label">存取精確位置</string>
|
||||
<string name="permission_access_fine_location_description">CAPod 使用「精確位置」權限以接收低功耗藍牙資料。你的耳機使用低功耗藍牙技術以廣播其狀態。這個應用程式不會使用藍牙資料來確定你的位置。</string>
|
||||
<string name="permission_access_fine_location_description">CAPod 使用「精確位置」權限以接收低功耗藍牙資料。您的耳機使用低功耗藍牙技術以廣播其狀態。這個應用程式不會使用藍牙資料來確定您的位置。</string>
|
||||
<string name="permission_background_location_label">背景位置存取</string>
|
||||
<string name="permission_background_location_description">CAPods 在應用程式關閉時使用「背景位置存取」來啟用諸如「顯示彈出式視窗」和「自動連線」等功能。背景位置存取允許這個應用程式在背景接收低功耗藍牙資料。這個應用程式不會使用藍牙資料來確定你的位置。</string>
|
||||
<string name="permission_background_location_description">CAPods 在應用程式關閉時使用「背景位置存取」來啟用諸如「顯示彈出式視窗」和「自動連線」等功能。背景位置存取允許這個應用程式在背景接收低功耗藍牙資料。這個應用程式不會使用藍牙資料來確定您的位置。</string>
|
||||
<string name="permission_ignore_battery_optimizations_label">停用電池效能最佳化</string>
|
||||
<string name="permission_ignore_battery_optimizations_description">電池效能最佳化使這個應用程式在背景時無法可靠地接收藍牙資料。</string>
|
||||
<string name="permission_required_title">可能要求下列權限:</string>
|
||||
@@ -53,7 +53,7 @@
|
||||
<string name="pods_charging_label">充電中</string>
|
||||
<string name="pods_inear_label">在耳中</string>
|
||||
<string name="pods_microphone_label">麥克風</string>
|
||||
<string name="pods_yours">你的</string>
|
||||
<string name="pods_yours">您的</string>
|
||||
<string name="headset_being_worn_label">正被佩戴</string>
|
||||
<string name="pods_case_unknown_state">未知狀態</string>
|
||||
<string name="last_seen_x">最後連線:%s</string>
|
||||
|
||||
@@ -2,6 +2,7 @@ package eu.darken.capod.pods.core.apple.airpods
|
||||
|
||||
import eu.darken.capod.pods.core.PodDevice
|
||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||
import eu.darken.capod.pods.core.apple.HasAppleColor
|
||||
import io.kotest.matchers.shouldBe
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -53,4 +54,27 @@ class AirPodsMaxTest : BaseAirPodsTest() {
|
||||
isHeadphonesBeingWorn shouldBe true
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `some dude at the gym`() = runTest {
|
||||
create<AirPodsMax>("07 19 01 0A 20 23 07 80 03 03 65 1F 28 32 D0 D9 71 43 00 9A 40 E7 6B EA 6C 2C FB") {
|
||||
rawPrefix shouldBe 0x01.toUByte()
|
||||
rawDeviceModel shouldBe 0x0A20.toUShort()
|
||||
rawStatus shouldBe 0x23.toUByte()
|
||||
rawPodsBattery shouldBe 0x07.toUByte()
|
||||
rawFlags shouldBe 0x8.toUShort()
|
||||
rawCaseBattery shouldBe 0x0.toUShort()
|
||||
rawCaseLidState shouldBe 0x03.toUByte()
|
||||
rawDeviceColor shouldBe 0x03.toUByte()
|
||||
rawSuffix shouldBe 0x65.toUByte()
|
||||
|
||||
batteryHeadsetPercent shouldBe 0.7f
|
||||
|
||||
isHeadsetBeingCharged shouldBe false
|
||||
|
||||
isHeadphonesBeingWorn shouldBe true
|
||||
|
||||
podStyle shouldBe HasAppleColor.DeviceColor.BLUE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ plugins {
|
||||
}
|
||||
apply(plugin = "dagger.hilt.android.plugin")
|
||||
apply(plugin = "androidx.navigation.safeargs.kotlin")
|
||||
apply(plugin = "com.bugsnag.android.gradle")
|
||||
|
||||
android {
|
||||
compileSdk = ProjectConfig.compileSdk
|
||||
@@ -24,10 +23,6 @@ android {
|
||||
|
||||
buildConfigField("String", "GITSHA", "\"${lastCommitHash()}\"")
|
||||
buildConfigField("String", "BUILDTIME", "\"${buildTime()}\"")
|
||||
|
||||
manifestPlaceholders["bugsnagApiKey"] = getBugSnagApiKey(
|
||||
File(System.getProperty("user.home"), ".appconfig/${ProjectConfig.packageName}/bugsnag.properties")
|
||||
) ?: "fake"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
@@ -49,9 +44,12 @@ android {
|
||||
create("gplay") {
|
||||
dimension = "version"
|
||||
signingConfig = signingConfigs["releaseGplay"]
|
||||
extra["useBugsnag"] = true
|
||||
}
|
||||
}
|
||||
|
||||
setupBugsnagPlugin()
|
||||
|
||||
buildTypes {
|
||||
val customProguardRules = fileTree(File("../proguard")) {
|
||||
include("*.pro")
|
||||
@@ -92,7 +90,7 @@ android {
|
||||
if (listOf("release", "beta").any { variantName.toLowerCase().contains(it) }) {
|
||||
val outputFileName = ProjectConfig.packageName + "-WEAROS" +
|
||||
"-v${defaultConfig.versionName}-${defaultConfig.versionCode}" +
|
||||
"-${variantName.toUpperCase()}-${lastCommitHash()}.apk"
|
||||
"-${variantName.toUpperCase()}.apk"
|
||||
|
||||
variantOutputImpl.outputFileName = outputFileName
|
||||
}
|
||||
@@ -138,9 +136,9 @@ dependencies {
|
||||
|
||||
addTesting()
|
||||
|
||||
implementation("com.bugsnag:bugsnag-android:5.9.2")
|
||||
implementation("com.getkeepsafe.relinker:relinker:1.4.3")
|
||||
|
||||
implementation("androidx.wear:wear:1.2.0")
|
||||
implementation("androidx.wear.tiles:tiles-material:1.1.0")
|
||||
|
||||
"gplayImplementation"("com.bugsnag:bugsnag-android:5.9.2")
|
||||
"gplayImplementation"("com.getkeepsafe.relinker:relinker:1.4.3")
|
||||
}
|
||||
@@ -39,10 +39,6 @@
|
||||
android:name="androidx.startup.InitializationProvider"
|
||||
android:authorities="${applicationId}.androidx-startup"
|
||||
tools:node="remove" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.bugsnag.android.API_KEY"
|
||||
android:value="${bugsnagApiKey}" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -3,11 +3,10 @@ package eu.darken.capod
|
||||
import android.app.Application
|
||||
import androidx.hilt.work.HiltWorkerFactory
|
||||
import androidx.work.*
|
||||
import com.getkeepsafe.relinker.ReLinker
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import eu.darken.capod.common.BuildConfigWrap
|
||||
import eu.darken.capod.common.coroutine.AppScope
|
||||
import eu.darken.capod.common.debug.autoreport.AutoReporting
|
||||
import eu.darken.capod.common.debug.autoreport.AutomaticBugReporter
|
||||
import eu.darken.capod.common.debug.logging.*
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.VERBOSE
|
||||
import eu.darken.capod.main.core.GeneralSettings
|
||||
@@ -20,7 +19,7 @@ import javax.inject.Inject
|
||||
open class App : Application(), Configuration.Provider {
|
||||
|
||||
@Inject lateinit var workerFactory: HiltWorkerFactory
|
||||
@Inject lateinit var autoReporting: AutoReporting
|
||||
@Inject lateinit var autoReporting: AutomaticBugReporter
|
||||
@Inject lateinit var generalSettings: GeneralSettings
|
||||
@Inject lateinit var workManager: WorkManager
|
||||
@Inject @AppScope lateinit var appScope: CoroutineScope
|
||||
@@ -29,11 +28,7 @@ open class App : Application(), Configuration.Provider {
|
||||
super.onCreate()
|
||||
if (BuildConfig.DEBUG) Logging.install(LogCatLogger())
|
||||
|
||||
ReLinker
|
||||
.log { message -> log(TAG) { "ReLinker: $message" } }
|
||||
.loadLibrary(this, "bugsnag-plugin-android-anr")
|
||||
|
||||
autoReporting.setup()
|
||||
autoReporting.setup(this)
|
||||
|
||||
setupWorker()
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import androidx.lifecycle.SavedStateHandle
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import eu.darken.capod.common.bluetooth.BluetoothManager2
|
||||
import eu.darken.capod.common.coroutine.DispatcherProvider
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.common.debug.logging.Logging.Priority.VERBOSE
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
import eu.darken.capod.common.flow.combine
|
||||
|
||||
@@ -6,7 +6,6 @@ plugins {
|
||||
}
|
||||
apply(plugin = "dagger.hilt.android.plugin")
|
||||
apply(plugin = "androidx.navigation.safeargs.kotlin")
|
||||
apply(plugin = "com.bugsnag.android.gradle")
|
||||
|
||||
android {
|
||||
|
||||
@@ -22,10 +21,6 @@ android {
|
||||
versionName = ProjectConfig.Version.name
|
||||
|
||||
testInstrumentationRunner = "eu.darken.capod.HiltTestRunner"
|
||||
|
||||
manifestPlaceholders["bugsnagApiKey"] = getBugSnagApiKey(
|
||||
File(System.getProperty("user.home"), ".appconfig/${ProjectConfig.packageName}/bugsnag.properties")
|
||||
) ?: "fake"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
@@ -47,9 +42,12 @@ android {
|
||||
create("gplay") {
|
||||
dimension = "version"
|
||||
signingConfig = signingConfigs["releaseGplay"]
|
||||
extra["useBugsnag"] = true
|
||||
}
|
||||
}
|
||||
|
||||
setupBugsnagPlugin()
|
||||
|
||||
buildTypes {
|
||||
val customProguardRules = fileTree(File(projectDir, "proguard")) {
|
||||
include("*.pro")
|
||||
@@ -90,7 +88,7 @@ android {
|
||||
if (listOf("release", "beta").any { variantName.toLowerCase().contains(it) }) {
|
||||
val outputFileName = ProjectConfig.packageName +
|
||||
"-v${defaultConfig.versionName}-${defaultConfig.versionCode}" +
|
||||
"-${variantName.toUpperCase()}-${lastCommitHash()}.apk"
|
||||
"-${variantName.toUpperCase()}.apk"
|
||||
|
||||
variantOutputImpl.outputFileName = outputFileName
|
||||
}
|
||||
@@ -148,8 +146,8 @@ dependencies {
|
||||
|
||||
addTesting()
|
||||
|
||||
implementation("com.bugsnag:bugsnag-android:5.9.2")
|
||||
implementation("com.getkeepsafe.relinker:relinker:1.4.3")
|
||||
|
||||
"gplayImplementation"("com.android.billingclient:billing:4.0.0")
|
||||
|
||||
"gplayImplementation"("com.bugsnag:bugsnag-android:5.9.2")
|
||||
"gplayImplementation"("com.getkeepsafe.relinker:relinker:1.4.3")
|
||||
}
|
||||
@@ -1,2 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
<string name="foss_upgrade_donate_label">تبرُّع</string>
|
||||
<string name="foss_upgrade_alreadydonated_label">أنا متبرع بالفعل</string>
|
||||
<string name="foss_upgrade_no_money_label">أُنفق كل أموالي على AirPods</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
<string name="upgrades_gplay_unavailable_error">خدمات Google Play غير متاحة.</string>
|
||||
<string name="upgrades_no_purchases_found_check_account">لم يتم العثور على أي مشتريات. هل تستخدم الحساب الصحيح؟</string>
|
||||
</resources>
|
||||
|
||||
@@ -86,10 +86,6 @@
|
||||
android:name="androidx.startup.InitializationProvider"
|
||||
android:authorities="${applicationId}.androidx-startup"
|
||||
tools:node="remove" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.bugsnag.android.API_KEY"
|
||||
android:value="${bugsnagApiKey}" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -3,10 +3,9 @@ package eu.darken.capod
|
||||
import android.app.Application
|
||||
import androidx.hilt.work.HiltWorkerFactory
|
||||
import androidx.work.Configuration
|
||||
import com.getkeepsafe.relinker.ReLinker
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import eu.darken.capod.common.coroutine.AppScope
|
||||
import eu.darken.capod.common.debug.autoreport.AutoReporting
|
||||
import eu.darken.capod.common.debug.autoreport.AutomaticBugReporter
|
||||
import eu.darken.capod.common.debug.logging.*
|
||||
import eu.darken.capod.common.flow.throttleLatest
|
||||
import eu.darken.capod.common.upgrade.UpgradeRepo
|
||||
@@ -25,7 +24,7 @@ import javax.inject.Inject
|
||||
open class App : Application(), Configuration.Provider {
|
||||
|
||||
@Inject lateinit var workerFactory: HiltWorkerFactory
|
||||
@Inject lateinit var autoReporting: AutoReporting
|
||||
@Inject lateinit var autoReporting: AutomaticBugReporter
|
||||
@Inject lateinit var monitorControl: MonitorControl
|
||||
@Inject lateinit var podMonitor: PodMonitor
|
||||
@Inject lateinit var widgetManager: WidgetManager
|
||||
@@ -36,11 +35,7 @@ open class App : Application(), Configuration.Provider {
|
||||
super.onCreate()
|
||||
if (BuildConfig.DEBUG) Logging.install(LogCatLogger())
|
||||
|
||||
ReLinker
|
||||
.log { message -> log(TAG) { "ReLinker: $message" } }
|
||||
.loadLibrary(this, "bugsnag-plugin-android-anr")
|
||||
|
||||
autoReporting.setup()
|
||||
autoReporting.setup(this)
|
||||
|
||||
log(TAG) { "onCreate() done! ${Exception().asLog()}" }
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import androidx.lifecycle.SavedStateHandle
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import eu.darken.capod.common.bluetooth.BluetoothManager2
|
||||
import eu.darken.capod.common.coroutine.DispatcherProvider
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
import eu.darken.capod.common.flow.combine
|
||||
import eu.darken.capod.common.flow.throttleLatest
|
||||
|
||||
@@ -42,8 +42,8 @@ class SinglePodsCardVH(parent: ViewGroup) :
|
||||
// Charge state
|
||||
device.apply {
|
||||
if (this is HasChargeDetection) {
|
||||
chargingIcon.isInvisible = isHeadsetBeingCharged
|
||||
chargingLabel.isInvisible = isHeadsetBeingCharged
|
||||
chargingIcon.isInvisible = !isHeadsetBeingCharged
|
||||
chargingLabel.isInvisible = !isHeadsetBeingCharged
|
||||
} else {
|
||||
chargingIcon.isGone = true
|
||||
chargingLabel.isGone = true
|
||||
@@ -53,8 +53,8 @@ class SinglePodsCardVH(parent: ViewGroup) :
|
||||
// Has ear detection
|
||||
device.apply {
|
||||
if (this is HasEarDetection) {
|
||||
wearIcon.isInvisible = isBeingWorn
|
||||
wearLabel.isInvisible = isBeingWorn
|
||||
wearIcon.isInvisible = !isBeingWorn
|
||||
wearLabel.isInvisible = !isBeingWorn
|
||||
} else {
|
||||
wearIcon.isGone = true
|
||||
wearLabel.isGone = true
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import androidx.fragment.app.viewModels
|
||||
import androidx.preference.Preference
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import eu.darken.capod.R
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.common.observe2
|
||||
import eu.darken.capod.common.uix.PreferenceFragment3
|
||||
import javax.inject.Inject
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package eu.darken.capod.main.ui.settings.general.debug
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import eu.darken.capod.common.coroutine.DispatcherProvider
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
import eu.darken.capod.common.debug.logging.logTag
|
||||
import eu.darken.capod.common.debug.recording.core.RecorderModule
|
||||
|
||||
@@ -37,15 +37,13 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
@Inject lateinit var upgradeRepo: UpgradeRepo
|
||||
@AppScope @Inject lateinit var appScope: CoroutineScope
|
||||
|
||||
private var asyncBarrier: PendingResult? = null
|
||||
|
||||
private fun executeAsync(
|
||||
tag: String,
|
||||
timeout: Duration = Duration.ofSeconds(10),
|
||||
timeout: Duration = Duration.ofSeconds(8),
|
||||
block: suspend () -> Unit
|
||||
) {
|
||||
val start = System.currentTimeMillis()
|
||||
asyncBarrier = goAsync()
|
||||
val asyncBarrier = goAsync()
|
||||
log(TAG, VERBOSE) { "executeAsync($tag) starting asyncBarrier=$asyncBarrier " }
|
||||
|
||||
appScope.launch {
|
||||
@@ -54,7 +52,7 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
} catch (e: Exception) {
|
||||
log(TAG, ERROR) { "executeAsync($tag) failed: ${e.asLog()}" }
|
||||
} finally {
|
||||
asyncBarrier?.finish()
|
||||
asyncBarrier.finish()
|
||||
val stop = System.currentTimeMillis()
|
||||
log(TAG, VERBOSE) { "executeAsync($tag) DONE (${stop - start}ms) " }
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import android.widget.RemoteViews
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import eu.darken.capod.R
|
||||
import eu.darken.capod.pods.core.*
|
||||
import eu.darken.capod.pods.core.apple.DualApplePods
|
||||
import eu.darken.capod.pods.core.apple.SingleApplePods
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@@ -16,12 +14,12 @@ class MonitorNotificationViewFactory @Inject constructor(
|
||||
) {
|
||||
|
||||
fun createContentView(device: PodDevice): RemoteViews = when (device) {
|
||||
is DualApplePods -> createDualApplePods(device)
|
||||
is SingleApplePods -> createSingleApplePods(device)
|
||||
is DualPodDevice -> createDualPods(device)
|
||||
is SinglePodDevice -> createSinglePod(device)
|
||||
else -> createUnknownDevice(device)
|
||||
}
|
||||
|
||||
private fun createDualApplePods(device: DualApplePods): RemoteViews = RemoteViews(
|
||||
private fun createDualPods(device: DualPodDevice): RemoteViews = RemoteViews(
|
||||
context.packageName,
|
||||
R.layout.monitor_notification_dual_pods_small
|
||||
).apply {
|
||||
@@ -29,23 +27,30 @@ class MonitorNotificationViewFactory @Inject constructor(
|
||||
// Left
|
||||
setImageViewResource(R.id.pod_left_icon, device.leftPodIcon)
|
||||
setTextViewText(R.id.pod_left_label, getBatteryLevelLeftPod(context))
|
||||
val isLeftPodCharging = (device as? HasChargeDetectionDual)?.isLeftPodCharging ?: false
|
||||
setViewVisibility(R.id.pod_left_charging, if (isLeftPodCharging) View.VISIBLE else View.GONE)
|
||||
val isLeftPodInEar = (device as? HasEarDetectionDual)?.isLeftPodInEar ?: false
|
||||
setViewVisibility(R.id.pod_left_ear, if (isLeftPodInEar) View.VISIBLE else View.GONE)
|
||||
|
||||
// Case
|
||||
setImageViewResource(R.id.pod_case_icon, device.caseIcon)
|
||||
setTextViewText(R.id.pod_case_label, getBatteryLevelCase(context))
|
||||
setViewVisibility(R.id.pod_case_charging, if (isCaseCharging) View.VISIBLE else View.GONE)
|
||||
setViewVisibility(R.id.pod_case_charging, if (device is HasCase) View.VISIBLE else View.GONE)
|
||||
(device as? HasCase)?.let { case ->
|
||||
setImageViewResource(R.id.pod_case_icon, device.caseIcon)
|
||||
setTextViewText(R.id.pod_case_label, case.getBatteryLevelCase(context))
|
||||
setViewVisibility(R.id.pod_case_charging, if (case.isCaseCharging) View.VISIBLE else View.GONE)
|
||||
}
|
||||
|
||||
// Right
|
||||
setImageViewResource(R.id.pod_right_icon, device.rightPodIcon)
|
||||
setTextViewText(R.id.pod_right_label, getBatteryLevelRightPod(context))
|
||||
val isRightPodCharging = (device as? HasChargeDetectionDual)?.isRightPodCharging ?: false
|
||||
setViewVisibility(R.id.pod_right_charging, if (isRightPodCharging) View.VISIBLE else View.GONE)
|
||||
val isRightPodInEar = (device as? HasEarDetectionDual)?.isRightPodInEar ?: false
|
||||
setViewVisibility(R.id.pod_right_ear, if (isRightPodInEar) View.VISIBLE else View.GONE)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSingleApplePods(device: SingleApplePods): RemoteViews = RemoteViews(
|
||||
private fun createSinglePod(device: SinglePodDevice): RemoteViews = RemoteViews(
|
||||
context.packageName,
|
||||
R.layout.monitor_notification_single_pods_small
|
||||
).apply {
|
||||
|
||||
@@ -6,14 +6,13 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import eu.darken.capod.R
|
||||
import eu.darken.capod.common.debug.autoreport.DebugSettings
|
||||
import eu.darken.capod.common.debug.DebugSettings
|
||||
import eu.darken.capod.databinding.PopupNotificationDualPodsBinding
|
||||
import eu.darken.capod.databinding.PopupNotificationSinglePodsBinding
|
||||
import eu.darken.capod.pods.core.*
|
||||
import eu.darken.capod.pods.core.apple.DualApplePods
|
||||
import eu.darken.capod.pods.core.apple.SingleApplePods
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@@ -26,13 +25,13 @@ class PopUpPodViewFactory @Inject constructor(
|
||||
private val layoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
|
||||
fun createContentView(parent: ViewGroup, device: PodDevice): View = when (device) {
|
||||
is DualApplePods -> createDualApplePods(parent, device)
|
||||
is DualPodDevice -> createDualPods(parent, device)
|
||||
// Unused, has no case to trigger reaction?
|
||||
is SingleApplePods -> createSingleApplePods(parent, device)
|
||||
is SinglePodDevice -> createSinglePod(parent, device)
|
||||
else -> throw IllegalArgumentException("Unexpected device: $device")
|
||||
}
|
||||
|
||||
private fun createDualApplePods(parent: ViewGroup, device: DualApplePods): View =
|
||||
private fun createDualPods(parent: ViewGroup, device: DualPodDevice): View =
|
||||
PopupNotificationDualPodsBinding.inflate(layoutInflater, parent, false).apply {
|
||||
device.apply {
|
||||
podIcon.setImageResource(iconRes)
|
||||
@@ -46,9 +45,12 @@ class PopUpPodViewFactory @Inject constructor(
|
||||
podLeftBatteryLabel.text = getBatteryLevelLeftPod(context)
|
||||
|
||||
// Case
|
||||
podCaseIcon.setImageResource(device.caseIcon)
|
||||
podCaseBatteryIcon.setImageResource(getBatteryDrawable(batteryCasePercent))
|
||||
podCaseBatteryLabel.text = getBatteryLevelCase(context)
|
||||
podCaseContainer.isVisible = device is HasCase
|
||||
(device as? HasCase)?.let { case ->
|
||||
podCaseIcon.setImageResource(case.caseIcon)
|
||||
podCaseBatteryIcon.setImageResource(getBatteryDrawable(case.batteryCasePercent))
|
||||
podCaseBatteryLabel.text = case.getBatteryLevelCase(context)
|
||||
}
|
||||
|
||||
// Right
|
||||
podRightIcon.setImageResource(device.rightPodIcon)
|
||||
@@ -57,7 +59,7 @@ class PopUpPodViewFactory @Inject constructor(
|
||||
}
|
||||
}.root
|
||||
|
||||
private fun createSingleApplePods(parent: ViewGroup, device: SingleApplePods): View =
|
||||
private fun createSinglePod(parent: ViewGroup, device: SinglePodDevice): View =
|
||||
PopupNotificationSinglePodsBinding.inflate(layoutInflater, parent, false).apply {
|
||||
device.apply {
|
||||
headphonesIcon.setImageResource(iconRes)
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/pod_case_container"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pod_icon"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:src="@drawable/devic_earbuds_generic_both"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pod_label"
|
||||
app:layout_constraintEnd_toStartOf="@id/pod_label"
|
||||
@@ -55,9 +53,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pod_left_icon"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/devic_airpods_gen1_left"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pod_left_battery_label"
|
||||
@@ -67,9 +63,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@id/pod_left_battery_icon"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:src="@drawable/ic_baseline_battery_unknown_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pod_left_battery_label"
|
||||
app:layout_constraintEnd_toStartOf="@id/pod_left_battery_label"
|
||||
@@ -103,9 +97,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pod_case_icon"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/devic_airpods_gen1_case"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pod_case_battery_label"
|
||||
@@ -115,9 +107,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@id/pod_case_battery_icon"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:src="@drawable/ic_baseline_battery_unknown_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pod_case_battery_label"
|
||||
app:layout_constraintEnd_toStartOf="@id/pod_case_battery_label"
|
||||
@@ -150,9 +140,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pod_right_icon"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/devic_airpods_gen1_right"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pod_right_battery_label"
|
||||
@@ -162,9 +150,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@id/pod_right_battery_icon"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:src="@drawable/ic_baseline_battery_unknown_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pod_right_battery_label"
|
||||
app:layout_constraintEnd_toStartOf="@id/pod_right_battery_label"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/headphones_icon"
|
||||
android:layout_width="wrap_content"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:src="@drawable/devic_earbuds_generic_both"
|
||||
app:layout_constraintBottom_toBottomOf="@id/headphones_label"
|
||||
app:layout_constraintEnd_toStartOf="@id/headphones_label"
|
||||
@@ -56,9 +54,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@id/headphones_battery_icon"
|
||||
android:layout_width="wrap_content"
|
||||
style="@style/PodInfoItemIcon"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PodInfoItemIcon.Popup"
|
||||
android:src="@drawable/ic_baseline_battery_unknown_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/headphones_battery_label"
|
||||
app:layout_constraintEnd_toStartOf="@id/headphones_battery_label"
|
||||
|
||||
@@ -7,10 +7,73 @@
|
||||
<string name="general_upgrade_action">ترقية</string>
|
||||
<string name="general_check_action">فحص</string>
|
||||
<string name="general_close_action">إغلاق</string>
|
||||
<string name="upgrade_capod_label">ترقية CAPod</string>
|
||||
<string name="upgrade_capod_description">أُحصل على مِيزات إضافية وادعم المُطور.</string>
|
||||
<string name="settings_monitor_mode_label">وضع المراقب</string>
|
||||
<string name="settings_monitor_mode_description">في أي ظرف تريد أن يراقب فيه هذا التطبيق ببانات البلوتوت.</string>
|
||||
<string name="settings_scanner_mode_label">وضع الماسح</string>
|
||||
<string name="settings_scanner_mode_description">هل يجب على ماسح البيانات منخفض الطاقة التي تعمل بتقنية البلوتوت إعطاء الأولوية للأداء أم الحفاظ على الطاقة؟</string>
|
||||
<string name="settings_autopause_label">الإيقاف التلقائي</string>
|
||||
<string name="settings_autopause_description">إيقاف الصوت مؤقتًا عند إزالة الجهاز من أذنك.</string>
|
||||
<string name="settings_showall_label">عرض كل الأجهزة</string>
|
||||
<string name="settings_showall_description">عرض أجهزة الآخرين القريبة منك.</string>
|
||||
<string name="settings_autopplay_label">التشغيل التلقائي</string>
|
||||
<string name="settings_autoplay_description">بدأ تشغيل الصوت عند ارتداء الجهاز.</string>
|
||||
<string name="settings_fake_data_label">بيانات مزيفة</string>
|
||||
<string name="settings_fake_data_description">عرض بيانات مزيفة، مما يعني محاكاة أجهزة غير موجودة.</string>
|
||||
<string name="settings_debug_label">إعدادات التصحيح</string>
|
||||
<string name="settings_debug_description">إعدادات إضافية للمساعدة في استكشاف مشكلات التطبيق وإصلاحها.</string>
|
||||
<string name="settings_signal_minimum_label">الحد الأدنى من جودة الإشارة</string>
|
||||
<string name="settings_signal_minimum_description">الحد الأدنى من جودة الإشارة التي يجب أن يَعتبرها الجهاز لك.</string>
|
||||
<string name="settings_autoconnect_label">الاتصال التلقائي</string>
|
||||
<string name="settings_autoconnect_description">إذا لم يتصل الأندرويد تلقائيًا. فيمكننا أنة نطلبه أيضًا. سيؤدي هذا إلى ضبط إعداد وضع المراقب إلى \"دائما\".</string>
|
||||
<string name="settings_autoconnect_condition_label">حالة الاتصال التلقائي</string>
|
||||
<string name="settings_autoconnect_condition_description">متى يجب أن نحاول الاتصال بجهازك؟</string>
|
||||
<string name="settings_reaction_label">التفاعل</string>
|
||||
<string name="settings_reaction_description">التفاعل مع الأحداث والسلوكيات.</string>
|
||||
<string name="settings_category_yourdevice_label">جهازك</string>
|
||||
<string name="settings_maindevice_address_label">عنوان جهازك</string>
|
||||
<string name="settings_maindevice_address_description">عنوان جهازك المقترن. يستخدم التطبيق هذا لتحديد متى يكون متصلا بهاتفك.</string>
|
||||
<string name="settings_maindevice_address_none">غير موجود</string>
|
||||
<string name="settings_maindevice_model_label">طِراز جهازك</string>
|
||||
<string name="settings_maindevice_model_description">طِراز جهازك الرئيسي. يساعد هذا التطبيق في التعرف على جهازك عندما لا يكون متصلاً بهاتفك.</string>
|
||||
<string name="settings_popup_caseopen_label">عرض إشعار منبثق</string>
|
||||
<string name="settings_popup_caseopen_description">عرض إشعار منبثق عند فتح علبة الجهاز (تجريبي).</string>
|
||||
<string name="settings_onepod_mode_label">وضعية السماعة الواحدة</string>
|
||||
<string name="settings_onepod_mode_description">ليس بالضرورة ارتداء كِلتا السمَّاعتين، ارتداء سمَّاعة واحدة يكفي لتحريك ردود الفعل.</string>
|
||||
<string name="notification_channel_device_status_label">حالة الجهاز</string>
|
||||
<string name="debug_debuglog_size_label">الحجم</string>
|
||||
<string name="debug_debuglog_size_compressed_label">الحجم المضغوط</string>
|
||||
<string name="debug_notification_channel_label">اشعارات التصحيح</string>
|
||||
<string name="debug_debuglog_file_label">ملف مسجل</string>
|
||||
<string name="debug_debuglog_record_action">ملف التصحيح مسجل</string>
|
||||
<string name="settings_support_installid_label">مُعرف التثبيت</string>
|
||||
<string name="settings_support_installid_desc">تقارير الأخطاء والمشاكل التلقائية تكون مجهول المصدر. شارك مُعرف التثبيت الخاص بك إذا احتاج المطور إلى العثور على الأخطاء والمشاكل الخاصة بك.</string>
|
||||
<string name="settings_support_label">الدعم</string>
|
||||
<string name="settings_support_description">إن كنت بحاجة لبعض المساعدة.</string>
|
||||
<string name="issue_tracker_label">تَعقب المشكلة أو الخطأ</string>
|
||||
<string name="issue_tracker_description">أداة تعقب المشكلات العامة لتقارير الأخطاء وطلبات إضافة الميزات للتطبيق (باللغة الإنجليزية فقط).</string>
|
||||
<string name="discord_label">ديسكورد</string>
|
||||
<string name="discord_description">مكان لطرح الأسئلة.</string>
|
||||
<string name="changelog_label">سِجل التغيير</string>
|
||||
<string name="settings_label">الإعدادات</string>
|
||||
<string name="settings_privacy_policy_label">سياسة الخصوصية</string>
|
||||
<string name="settings_privacy_policy_desc">التعامل مع البيانات بمسؤولية.</string>
|
||||
<string name="settings_licenses_label">التراخيص</string>
|
||||
<string name="settings_category_other_label">أخرى</string>
|
||||
<string name="settings_general_label">الإعدادات</string>
|
||||
<string name="settings_general_description">التعديلات العامة التي تؤثر على التطبيق بِرُمَّته.</string>
|
||||
<string name="settings_acknowledgements_label">شكر وتقدير</string>
|
||||
<string name="settings_debug_autoreports_label">إرسال تقارير الأخطاء تلقائيًا</string>
|
||||
<string name="settings_debug_autoreports_description">الإبلاغ عن المشكلات تلقائيًا. كمثال: تفاصيل حول تعطُّل التطبيق حتى أتمكن من معرفة كيفية إصلاحه.</string>
|
||||
<string name="settings_debug_mode_label">وضع التصحيح</string>
|
||||
<string name="settings_debug_mode_description">عرض معلومات إضافية لاستكشاف المشكلات وإصلاحها.</string>
|
||||
<string name="settings_blescanner_unfiltered_label">بيانات BLE الغير المفلترة</string>
|
||||
<string name="settings_blescanner_unfiltered_description">احذف أي عوامل فَلترة من الماسح BLE لإظهار جميع بيانات BLE التي يتم بثُّها. هذا مفيد في إضافة دعم لأنواع سماعات رأس جديدة.</string>
|
||||
<string name="settings_compatibility_mode_label">وضع التوافق</string>
|
||||
<string name="settings_compatibility_mode_description">تعطيل التحسينات لتحسين التوافق. جرب هذه الخاصية إذا كنت لا ترى أي بيانات.</string>
|
||||
<string name="help_translate_label">التَّرْجَمَةً</string>
|
||||
<string name="help_translate_description">ساعد في تَرْجَمَة هذا التطبيق إلى لغتك المفضلة.</string>
|
||||
<string name="translators_thanks_title">المُترجمون</string>
|
||||
<string name="translators_thanks_description">darken</string>
|
||||
</resources>
|
||||
|
||||
@@ -24,19 +24,19 @@
|
||||
<string name="settings_debug_label">偵錯設定</string>
|
||||
<string name="settings_debug_description">一個能協助這個應用程式故障檢修的附加設定。</string>
|
||||
<string name="settings_signal_minimum_label">最低訊號品質</string>
|
||||
<string name="settings_signal_minimum_description">可以被認為是你的裝置的最低訊號品質。</string>
|
||||
<string name="settings_signal_minimum_description">可以被認為是您的裝置的最低訊號品質。</string>
|
||||
<string name="settings_autoconnect_label">自動連線</string>
|
||||
<string name="settings_autoconnect_description">如果 Android 不會自動連線,我們也可以要求它。這將把監視模式設定為「一律」。</string>
|
||||
<string name="settings_autoconnect_condition_label">自動連線條件</string>
|
||||
<string name="settings_autoconnect_condition_description">何時連線到你的裝置?</string>
|
||||
<string name="settings_autoconnect_condition_description">何時連線到您的裝置?</string>
|
||||
<string name="settings_reaction_label">反應</string>
|
||||
<string name="settings_reaction_description">對事件和行為作出反應。</string>
|
||||
<string name="settings_category_yourdevice_label">你的裝置</string>
|
||||
<string name="settings_maindevice_address_label">你的裝置位址</string>
|
||||
<string name="settings_maindevice_address_description">你的已配對裝置的位址,這個應用程式用這個位址來確定何時連線到你的手機。</string>
|
||||
<string name="settings_category_yourdevice_label">您的裝置</string>
|
||||
<string name="settings_maindevice_address_label">您的裝置位址</string>
|
||||
<string name="settings_maindevice_address_description">您的已配對裝置的位址,這個應用程式用此位址來確定何時連線到您的手機。</string>
|
||||
<string name="settings_maindevice_address_none">無</string>
|
||||
<string name="settings_maindevice_model_label">你的裝置型號</string>
|
||||
<string name="settings_maindevice_model_description">你的主要裝置型號。這能協助這個應用程式在未連線到你的手機時辨識你的裝置。</string>
|
||||
<string name="settings_maindevice_model_label">您的裝置型號</string>
|
||||
<string name="settings_maindevice_model_description">您的主要裝置型號,這能幫助這個應用程式在未連線到您的手機時辨識您的裝置。</string>
|
||||
<string name="settings_popup_caseopen_label">顯示彈出式視窗</string>
|
||||
<string name="settings_popup_caseopen_description">充電盒開啟時顯示彈出式視窗 (實驗性)</string>
|
||||
<string name="settings_onepod_mode_label">單耳模式</string>
|
||||
@@ -48,9 +48,9 @@
|
||||
<string name="debug_debuglog_file_label">已記錄的記錄檔</string>
|
||||
<string name="debug_debuglog_record_action">記錄偵錯記錄</string>
|
||||
<string name="settings_support_installid_label">安裝 ID</string>
|
||||
<string name="settings_support_installid_desc">自動傳送的錯誤報告是匿名的。如果開發人員需要找出你的錯誤報告將分享你的安裝 ID。</string>
|
||||
<string name="settings_support_installid_desc">自動傳送的錯誤報告是匿名的。如果開發人員需要找出您的錯誤報告將分享你的安裝 ID。</string>
|
||||
<string name="settings_support_label">支援</string>
|
||||
<string name="settings_support_description">如果你需要協助。</string>
|
||||
<string name="settings_support_description">如果您需要協助。</string>
|
||||
<string name="issue_tracker_label">問題追蹤器</string>
|
||||
<string name="issue_tracker_description">一個用於錯誤回報和功能需求的公用問題追蹤器 (僅英文)。</string>
|
||||
<string name="discord_label">Discord</string>
|
||||
@@ -73,7 +73,7 @@
|
||||
<string name="settings_compatibility_mode_label">相容模式</string>
|
||||
<string name="settings_compatibility_mode_description">停用最佳化以提高相容性。請在未看到任何資料時開啟。</string>
|
||||
<string name="help_translate_label">翻譯</string>
|
||||
<string name="help_translate_description">協助翻譯為你的最愛語言。</string>
|
||||
<string name="help_translate_description">協助翻譯為您的最愛語言。</string>
|
||||
<string name="translators_thanks_title">翻譯人員</string>
|
||||
<string name="translators_thanks_description">人工知能</string>
|
||||
</resources>
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
<item name="tint">?android:attr/colorControlNormal</item>
|
||||
</style>
|
||||
|
||||
<style name="PodInfoItemIcon.Popup">
|
||||
<item name="android:layout_height">24dp</item>
|
||||
<item name="android:layout_width">24dp</item>
|
||||
</style>
|
||||
|
||||
<style name="PodInfoItemText" parent="TextAppearance.MaterialComponents.Body2">
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import com.android.build.gradle.LibraryExtension
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.time.Instant
|
||||
@@ -122,4 +125,30 @@ fun getBugSnagApiKey(
|
||||
}
|
||||
|
||||
return System.getenv("BUGSNAG_API_KEY") ?: bugsnagProps.getProperty("bugsnag.apikey")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use extra["useBugsnag"] = true per flavor to enable
|
||||
*/
|
||||
fun <T> T.setupBugsnagPlugin() where T : Project {
|
||||
fun Project.`android`(configure: Action<com.android.build.gradle.internal.dsl.BaseAppModuleExtension>): Unit =
|
||||
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure("android", configure)
|
||||
|
||||
val key = "useBugsnag"
|
||||
|
||||
android {
|
||||
productFlavors {
|
||||
forEach {
|
||||
val paramString = gradle.startParameter.taskRequests.toString().toLowerCase(Locale.ROOT)
|
||||
val useBugsnag = if (it.extra.has(key)) it.extra[key] as Boolean else false
|
||||
|
||||
if (paramString.contains(it.name) && useBugsnag) {
|
||||
println("Bugsnag plugin (com.bugsnag.android.gradle) applied to ${it.name} ($paramString)")
|
||||
apply(plugin = "com.bugsnag.android.gradle")
|
||||
} else {
|
||||
println("Bugsnag plugin (com.bugsnag.android.gradle) NOT applied to ${it.name} ($paramString)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
CAPod is a companion app for AirPods.
|
||||
CAPod - رفيق سماعات AirPod.
|
||||
|
||||
Features:
|
||||
الميزات:
|
||||
|
||||
* Battery level for pods and cases.
|
||||
* Charging status for pods and case.
|
||||
* Additional infos about connection, microphone and case.
|
||||
* Can receive and show all nearby devices.
|
||||
* Ear detection with automatic play/pause.
|
||||
* Automatically connect phone and AirPods.
|
||||
* Show popup when case is opened.
|
||||
* مستوى البطارية الخاص بالسماعات وعُلبها.
|
||||
* حالة الشحن الخاص بالسماعات وعُلبها.
|
||||
* معلومات إضافية حول حالة الاتصال، الميكروفون والعُلبة.
|
||||
* يمكن عرض واستقبال جميع الأجهزة القريبة.
|
||||
* مُستشعر الأذن مع التشغيل التلقائي/الإيقاف المؤقت.
|
||||
* توصيل الهاتف و سماعات AirPods بشكل تلقائي.
|
||||
* إظهار إشعار مُنبثق عند فتح علبة السماعات.
|
||||
|
||||
CAPod is ad-free. Some features require an in-app purchase.
|
||||
CAPod خالي من الإعلانات. بعض الميزات تتطلب الشراء داخل التطبيق.
|
||||
|
||||
Most popular AirPods and Beats devices are supported.
|
||||
If your device is similar to AirPods but not yet supported, send me a short mail.
|
||||
يدعم الأجهزة الأكثر شيوعًا مثل AirPods و Beats.
|
||||
إذا كان جهازك مشابهًا لأجهزة AirPods ولكنه غير مدعوم في التطبيق بعد فأرسل لي رسالة إلكترونية قصيرة.
|
||||
|
||||
Got a cool idea for a new feature? Reach out!
|
||||
هل لديك فكرة رائعة لمِيزة جديدة؟ تواصل!
|
||||
@@ -1 +1 @@
|
||||
CAPod is a companion app for AirPods on Android.
|
||||
CAPod هو تطبيق مُصاحب لسماعات AirPods على الأندرويد.
|
||||
@@ -1 +1 @@
|
||||
CAPod - Companion for AirPods
|
||||
CAPod - رفيق سماعات AirPod
|
||||
@@ -0,0 +1,2 @@
|
||||
Bugfixes and performance improvements.
|
||||
¯\_(ツ)_/¯
|
||||
@@ -1,3 +1,2 @@
|
||||
Now with more widgets!
|
||||
But also bugfixes and performance improvements.
|
||||
Bugfixes and performance improvements.
|
||||
¯\_(ツ)_/¯
|
||||
@@ -13,6 +13,6 @@ CAPod 是一個能提供 AirPods 相關功能的應用程式。
|
||||
CAPod 是無廣告的應用程式。 一些功能需要應用內購。
|
||||
|
||||
支援大部分流行的 AirPods 和 Beats 裝置。
|
||||
如果你的裝置和 AirPods 相似但不支援,請寄給我一封郵件。
|
||||
如果您的裝置和 AirPods 相似但並不支援,請寄給我一封郵件。
|
||||
|
||||
有新功能的好點子? 與我溝通一下吧!
|
||||
+20
@@ -360,6 +360,25 @@ do-versionfile() {
|
||||
git add VERSION
|
||||
}
|
||||
|
||||
# Update a version file that can be parsed by third-parties, e.g. F-Droid
|
||||
do-fastlane-changelog() {
|
||||
CHANGELOGS_DIR="fastlane/metadata/android/en-US/changelogs"
|
||||
NEW_CHANGELOG="$CHANGELOGS_DIR/$V_CODE.txt"
|
||||
|
||||
[ -f "$NEW_CHANGELOG" ] && return
|
||||
|
||||
echo -e "\n${S_NOTICE}Creating new default fastlane changelog file for $V_CODE...\n"
|
||||
|
||||
cp "$CHANGELOGS_DIR/default.txt" "$NEW_CHANGELOG"
|
||||
|
||||
cat "$NEW_CHANGELOG"
|
||||
|
||||
echo -e "\n\n${I_OK} ${S_NOTICE}${ACTION_MSG} [${S_NORM}$NEW_CHANGELOG${S_NOTICE}] file"
|
||||
|
||||
# Stage file for commit
|
||||
git add "$CHANGELOGS_DIR/$V_CODE.txt"
|
||||
}
|
||||
|
||||
# Does the release branch already exist?
|
||||
check-branch-exist() {
|
||||
[ "$FLAG_NOBRANCH" = true ] && return
|
||||
@@ -448,6 +467,7 @@ echo -e "\n${S_LIGHT}––––––"
|
||||
# Update steps
|
||||
do-version-properties
|
||||
do-versionfile
|
||||
do-fastlane-changelog
|
||||
do-branch
|
||||
do-commit
|
||||
create-tag "${V_NAME}" "${REL_NOTE}"
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
### Updated by release.sh ###
|
||||
project.versioning.major=2
|
||||
project.versioning.minor=7
|
||||
project.versioning.patch=0
|
||||
project.versioning.minor=8
|
||||
project.versioning.patch=1
|
||||
project.versioning.build=0
|
||||
#############################
|
||||
|
||||
Reference in New Issue
Block a user