Repo Created
This commit is contained in:
parent
eb305e2886
commit
a8c22c65db
4784 changed files with 329907 additions and 2 deletions
47
play-services-nearby/core/package/build.gradle
Normal file
47
play-services-nearby/core/package/build.gradle
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
dependencies {
|
||||
implementation project(':play-services-base-core')
|
||||
implementation project(':play-services-nearby-core')
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"
|
||||
implementation "androidx.preference:preference:$preferenceVersion"
|
||||
}
|
||||
|
||||
android {
|
||||
namespace "org.microg.gms.nearby.core.pkg"
|
||||
|
||||
compileSdkVersion androidCompileSdk
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
|
||||
defaultConfig {
|
||||
versionName version
|
||||
minSdkVersion androidMinSdk
|
||||
targetSdkVersion androidTargetSdk
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs = ['src/main/kotlin']
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable 'MissingTranslation'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = 1.8
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
|
||||
<permission
|
||||
android:name="com.google.android.gms.nearby.exposurenotification.EXPOSURE_CALLBACK"
|
||||
android:protectionLevel="normal" />
|
||||
|
||||
<application>
|
||||
<meta-data
|
||||
android:name="org.microg.gms.ui.settings.entry:nearby-exposurenotifications"
|
||||
android:value="org.microg.gms.nearby.exposurenotification.ui.ExposureNotificationsSettingsProvider" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.nearby.exposurenotification.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import androidx.annotation.Keep
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.navigation.NavController
|
||||
import com.google.android.gms.nearby.exposurenotification.ExposureNotificationClient
|
||||
import org.microg.gms.ui.settings.SettingsProvider
|
||||
import org.microg.gms.nearby.core.R
|
||||
import org.microg.gms.nearby.exposurenotification.ExposureDatabase
|
||||
import org.microg.gms.nearby.exposurenotification.ExposurePreferences
|
||||
import org.microg.gms.ui.settings.SettingsProvider.Companion.Entry
|
||||
import org.microg.gms.ui.settings.SettingsProvider.Companion.Group.OTHER
|
||||
|
||||
@Keep
|
||||
object ExposureNotificationsSettingsProvider : SettingsProvider {
|
||||
override fun getEntriesStatic(context: Context): List<Entry> {
|
||||
if (SDK_INT < 21) return emptyList()
|
||||
if (!ExposurePreferences(context).enabled) return emptyList()
|
||||
return getEntries(context)
|
||||
}
|
||||
|
||||
override suspend fun getEntriesDynamic(context: Context): List<Entry> {
|
||||
if (SDK_INT < 21) return emptyList()
|
||||
if (!ExposurePreferences(context).enabled) {
|
||||
if (ExposureDatabase.with(context) { it.isEmpty }) {
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
return getEntries(context)
|
||||
}
|
||||
|
||||
private fun getEntries(context: Context) = listOf(
|
||||
Entry(
|
||||
key = "pref_exposure",
|
||||
group = OTHER,
|
||||
navigationId = R.id.exposureNotificationsFragment,
|
||||
title = context.getString(R.string.service_name_exposure),
|
||||
summary = if (ExposurePreferences(context).enabled) {
|
||||
context.getString(org.microg.gms.base.core.R.string.service_status_enabled_short)
|
||||
} else {
|
||||
context.getString(org.microg.gms.base.core.R.string.service_status_disabled_short)
|
||||
},
|
||||
icon = AppCompatResources.getDrawable(context, R.drawable.ic_virus_outline)
|
||||
)
|
||||
)
|
||||
|
||||
override fun preProcessSettingsIntent(intent: Intent) {
|
||||
if (ExposureNotificationClient.ACTION_EXPOSURE_NOTIFICATION_SETTINGS == intent.action && intent.data == null) {
|
||||
intent.data = Uri.parse("x-gms-settings://exposure-notifications")
|
||||
}
|
||||
}
|
||||
|
||||
override fun extendNavigation(navController: NavController) {
|
||||
navController.graph.addAll(navController.navInflater.inflate(R.navigation.nav_nearby))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue