mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-19 15:34:26 +01:00
Add Firebase gradle configuration
This commit is contained in:
7
.github/workflows/deploy-all.yml
vendored
7
.github/workflows/deploy-all.yml
vendored
@@ -8,9 +8,8 @@ jobs:
|
|||||||
generateReadme:
|
generateReadme:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: main
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -26,9 +25,8 @@ jobs:
|
|||||||
needs: generateReadme
|
needs: generateReadme
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: main
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- shell: bash
|
- shell: bash
|
||||||
env:
|
env:
|
||||||
@@ -42,6 +40,7 @@ jobs:
|
|||||||
SONATYPE_STATING_PROFILE_ID: ${{ secrets.SONATYPE_STATING_PROFILE_ID }}
|
SONATYPE_STATING_PROFILE_ID: ${{ secrets.SONATYPE_STATING_PROFILE_ID }}
|
||||||
run: |
|
run: |
|
||||||
pwd
|
pwd
|
||||||
|
echo "${{ secrets.GOOGLE_SERVICES }}" > lib_analytics/src/main/res/values/keys.xml
|
||||||
echo "${{ secrets.KEYSTORE_FILE }}" > keystore.asc
|
echo "${{ secrets.KEYSTORE_FILE }}" > keystore.asc
|
||||||
gpg -d --passphrase "${{ secrets.KEYSTORE_FILE_PSWD }}" --batch keystore.asc > keystore
|
gpg -d --passphrase "${{ secrets.KEYSTORE_FILE_PSWD }}" --batch keystore.asc > keystore
|
||||||
echo "${{ secrets.GPG_FILE }}" > sec.gpg.asc
|
echo "${{ secrets.GPG_FILE }}" > sec.gpg.asc
|
||||||
|
|||||||
3
.github/workflows/deploy-to-play-store.yml
vendored
3
.github/workflows/deploy-to-play-store.yml
vendored
@@ -5,7 +5,7 @@ jobs:
|
|||||||
restorePassword:
|
restorePassword:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- shell: bash
|
- shell: bash
|
||||||
@@ -20,6 +20,7 @@ jobs:
|
|||||||
SONATYPE_STATING_PROFILE_ID: ${{ secrets.SONATYPE_STATING_PROFILE_ID }}
|
SONATYPE_STATING_PROFILE_ID: ${{ secrets.SONATYPE_STATING_PROFILE_ID }}
|
||||||
run: |
|
run: |
|
||||||
pwd
|
pwd
|
||||||
|
echo "${{ secrets.GOOGLE_SERVICES }}" > lib_analytics/src/main/res/values/keys.xml
|
||||||
echo "${{ secrets.KEYSTORE_FILE }}" > keystore.asc
|
echo "${{ secrets.KEYSTORE_FILE }}" > keystore.asc
|
||||||
gpg -d --passphrase "${{ secrets.KEYSTORE_FILE_PSWD }}" --batch keystore.asc > keystore
|
gpg -d --passphrase "${{ secrets.KEYSTORE_FILE_PSWD }}" --batch keystore.asc > keystore
|
||||||
echo "${{ secrets.GPG_FILE }}" > sec.gpg.asc
|
echo "${{ secrets.GPG_FILE }}" > sec.gpg.asc
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ plugins {
|
|||||||
id 'kotlin-parcelize'
|
id 'kotlin-parcelize'
|
||||||
id 'kotlin-kapt'
|
id 'kotlin-kapt'
|
||||||
id 'dagger.hilt.android.plugin'
|
id 'dagger.hilt.android.plugin'
|
||||||
|
id 'com.google.firebase.crashlytics'
|
||||||
}
|
}
|
||||||
apply from: rootProject.file("gradle/git-tag-version.gradle")
|
apply from: rootProject.file("gradle/git-tag-version.gradle")
|
||||||
|
|
||||||
@@ -64,8 +65,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation libs.nordic.theme
|
|
||||||
|
|
||||||
//Hilt requires to implement every module in the main app module
|
//Hilt requires to implement every module in the main app module
|
||||||
//https://github.com/google/dagger/issues/2123
|
//https://github.com/google/dagger/issues/2123
|
||||||
implementation project(':profile_bps')
|
implementation project(':profile_bps')
|
||||||
@@ -79,11 +78,13 @@ dependencies {
|
|||||||
|
|
||||||
implementation project(':profile_uart')
|
implementation project(':profile_uart')
|
||||||
|
|
||||||
|
implementation project(":lib_analytics")
|
||||||
implementation project(":lib_theme")
|
implementation project(":lib_theme")
|
||||||
implementation project(":lib_utils")
|
implementation project(":lib_utils")
|
||||||
implementation project(":lib_service")
|
implementation project(":lib_service")
|
||||||
implementation project(":lib_log")
|
implementation project(":lib_log")
|
||||||
|
|
||||||
|
implementation libs.nordic.theme
|
||||||
implementation libs.nordic.ble.common
|
implementation libs.nordic.ble.common
|
||||||
implementation libs.nordic.ui.scanner
|
implementation libs.nordic.ui.scanner
|
||||||
implementation libs.nordic.navigation
|
implementation libs.nordic.navigation
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
|
import no.nordicsemi.android.analytics.ProfileOpenEvent
|
||||||
import no.nordicsemi.android.logger.LoggerAppRunner
|
import no.nordicsemi.android.logger.LoggerAppRunner
|
||||||
import no.nordicsemi.android.nrftoolbox.BuildConfig
|
import no.nordicsemi.android.nrftoolbox.BuildConfig
|
||||||
import no.nordicsemi.android.nrftoolbox.ProfileDestination
|
import no.nordicsemi.android.nrftoolbox.ProfileDestination
|
||||||
@@ -56,12 +57,14 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
FeatureButton(R.drawable.ic_gls, R.string.gls_module, R.string.gls_module_full) {
|
FeatureButton(R.drawable.ic_gls, R.string.gls_module, R.string.gls_module_full) {
|
||||||
viewModel.openProfile(ProfileDestination.GLS)
|
viewModel.openProfile(ProfileDestination.GLS)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.GLS)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_bps, R.string.bps_module, R.string.bps_module_full) {
|
FeatureButton(R.drawable.ic_bps, R.string.bps_module, R.string.bps_module_full) {
|
||||||
viewModel.openProfile(ProfileDestination.BPS)
|
viewModel.openProfile(ProfileDestination.BPS)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.BPS)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -76,36 +79,42 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
FeatureButton(R.drawable.ic_csc, R.string.csc_module, R.string.csc_module_full, state.isCSCModuleRunning) {
|
FeatureButton(R.drawable.ic_csc, R.string.csc_module, R.string.csc_module_full, state.isCSCModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.CSC)
|
viewModel.openProfile(ProfileDestination.CSC)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.CSC)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_hrs, R.string.hrs_module, R.string.hrs_module_full, state.isHRSModuleRunning) {
|
FeatureButton(R.drawable.ic_hrs, R.string.hrs_module, R.string.hrs_module_full, state.isHRSModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.HRS)
|
viewModel.openProfile(ProfileDestination.HRS)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.HRS)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_hts, R.string.hts_module, R.string.hts_module_full, state.isHTSModuleRunning) {
|
FeatureButton(R.drawable.ic_hts, R.string.hts_module, R.string.hts_module_full, state.isHTSModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.HTS)
|
viewModel.openProfile(ProfileDestination.HTS)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.HTS)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_rscs, R.string.rscs_module, R.string.rscs_module_full, state.isRSCSModuleRunning) {
|
FeatureButton(R.drawable.ic_rscs, R.string.rscs_module, R.string.rscs_module_full, state.isRSCSModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.RSCS)
|
viewModel.openProfile(ProfileDestination.RSCS)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.RSCS)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_cgm, R.string.cgm_module, R.string.cgm_module_full, state.isCGMModuleRunning) {
|
FeatureButton(R.drawable.ic_cgm, R.string.cgm_module, R.string.cgm_module_full, state.isCGMModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.CGMS)
|
viewModel.openProfile(ProfileDestination.CGMS)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.CGMS)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_prx, R.string.prx_module, R.string.prx_module_full, state.isPRXModuleRunning) {
|
FeatureButton(R.drawable.ic_prx, R.string.prx_module, R.string.prx_module_full, state.isPRXModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.PRX)
|
viewModel.openProfile(ProfileDestination.PRX)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.PRX)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -120,6 +129,7 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
FeatureButton(R.drawable.ic_uart, R.string.uart_module, R.string.uart_module_full, state.isUARTModuleRunning) {
|
FeatureButton(R.drawable.ic_uart, R.string.uart_module, R.string.uart_module_full, state.isUARTModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.UART)
|
viewModel.openProfile(ProfileDestination.UART)
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.UART)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -139,6 +149,7 @@ fun HomeScreen() {
|
|||||||
} else {
|
} else {
|
||||||
uriHandler.openUri(DFU_LINK)
|
uriHandler.openUri(DFU_LINK)
|
||||||
}
|
}
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.DFU)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -149,6 +160,7 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
FeatureButton(R.drawable.ic_logger, R.string.logger_module, R.string.logger_module_full, null, loggerDescription) {
|
FeatureButton(R.drawable.ic_logger, R.string.logger_module, R.string.logger_module_full, null, loggerDescription) {
|
||||||
viewModel.openLogger()
|
viewModel.openLogger()
|
||||||
|
viewModel.logEvent(ProfileOpenEvent.LOGGER)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.ProfileOpenEvent
|
||||||
import no.nordicsemi.android.cgms.repository.CGMRepository
|
import no.nordicsemi.android.cgms.repository.CGMRepository
|
||||||
import no.nordicsemi.android.csc.repository.CSCRepository
|
import no.nordicsemi.android.csc.repository.CSCRepository
|
||||||
import no.nordicsemi.android.hrs.service.HRSRepository
|
import no.nordicsemi.android.hrs.service.HRSRepository
|
||||||
@@ -33,7 +35,8 @@ class HomeViewModel @Inject constructor(
|
|||||||
prxRepository: PRXRepository,
|
prxRepository: PRXRepository,
|
||||||
rscsRepository: RSCSRepository,
|
rscsRepository: RSCSRepository,
|
||||||
uartRepository: UARTRepository,
|
uartRepository: UARTRepository,
|
||||||
private val loggerAppRunner: LoggerAppRunner
|
private val loggerAppRunner: LoggerAppRunner,
|
||||||
|
private val analytics: AppAnalytics
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
private val _state = MutableStateFlow(HomeViewState())
|
private val _state = MutableStateFlow(HomeViewState())
|
||||||
@@ -80,4 +83,8 @@ class HomeViewModel @Inject constructor(
|
|||||||
fun openLogger() {
|
fun openLogger() {
|
||||||
loggerAppRunner.runLogger()
|
loggerAppRunner.runLogger()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun logEvent(event: ProfileOpenEvent) {
|
||||||
|
analytics.logEvent(event)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.1.3'
|
classpath 'com.android.tools.build:gradle:7.1.3'
|
||||||
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
|
classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
|
||||||
classpath "com.google.dagger:hilt-android-gradle-plugin:2.40.4"
|
classpath "com.google.dagger:hilt-android-gradle-plugin:2.40.4"
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
#Mon Feb 14 14:46:55 CET 2022
|
#Mon Feb 14 14:46:55 CET 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
11
lib_analytics/build.gradle
Normal file
11
lib_analytics/build.gradle
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
apply from: rootProject.file("library.gradle")
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'no.nordicsemi.android.analytics'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation platform('com.google.firebase:firebase-bom:29.2.1')
|
||||||
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
|
implementation 'com.google.firebase:firebase-crashlytics'
|
||||||
|
}
|
||||||
7
lib_analytics/src/main/AndroidManifest.xml
Normal file
7
lib_analytics/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package no.nordicsemi.android.analytics
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.google.firebase.analytics.FirebaseAnalytics
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import javax.inject.Inject
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
class AppAnalytics @Inject constructor(
|
||||||
|
@ApplicationContext
|
||||||
|
private val context: Context
|
||||||
|
) {
|
||||||
|
|
||||||
|
private val firebase by lazy { FirebaseAnalytics.getInstance(context) }
|
||||||
|
|
||||||
|
fun logEvent(event: ProfileOpenEvent) {
|
||||||
|
firebase.logEvent(event.firebaseName, null)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package no.nordicsemi.android.analytics
|
||||||
|
|
||||||
|
enum class ProfileOpenEvent(internal val firebaseName: String) {
|
||||||
|
BPS("BPS_PROFILE_OPEN"),
|
||||||
|
CGMS("CGMS_PROFILE_OPEN"),
|
||||||
|
CSC("CSC_PROFILE_OPEN"),
|
||||||
|
GLS("GLS_PROFILE_OPEN"),
|
||||||
|
HRS("HRS_PROFILE_OPEN"),
|
||||||
|
HTS("HTS_PROFILE_OPEN"),
|
||||||
|
PRX("PRX_PROFILE_OPEN"),
|
||||||
|
RSCS("RSCS_PROFILE_OPEN"),
|
||||||
|
UART("UART_PROFILE_OPEN"),
|
||||||
|
|
||||||
|
DFU("DFU_PROFILE_OPEN"),
|
||||||
|
LOGGER("LOGGER_PROFILE_OPEN"),
|
||||||
|
}
|
||||||
@@ -94,6 +94,7 @@ include ':profile_prx'
|
|||||||
include ':profile_rscs'
|
include ':profile_rscs'
|
||||||
include ':profile_uart'
|
include ':profile_uart'
|
||||||
|
|
||||||
|
include ':lib_analytics'
|
||||||
include ':lib_service'
|
include ':lib_service'
|
||||||
include ':lib_theme'
|
include ':lib_theme'
|
||||||
include ':lib_utils'
|
include ':lib_utils'
|
||||||
|
|||||||
Reference in New Issue
Block a user