Skip to content

Commit

Permalink
Migration to latest dependencies, BLEK, Koltin serialization, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
philips77 committed Aug 31, 2024
1 parent 01f0e3a commit e506eea
Show file tree
Hide file tree
Showing 76 changed files with 450 additions and 942 deletions.
14 changes: 8 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ plugins {
alias(libs.plugins.nordic.hilt)
}

if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
if (gradle.startParameter.taskRequests.toString().contains("Release")) {
apply(plugin = "com.google.gms.google-services")
apply(plugin = "com.google.firebase.crashlytics")
}
Expand All @@ -53,7 +53,6 @@ dependencies {
implementation(project(":profile_hts"))
implementation(project(":profile_prx"))
implementation(project(":profile_rscs"))

implementation(project(":profile_uart"))

implementation(project(":lib_analytics"))
Expand All @@ -62,16 +61,19 @@ dependencies {
implementation(project(":lib_service"))
implementation(project(":lib_scanner"))

implementation(libs.nordic.core)
implementation(libs.nordic.ui)
implementation(libs.nordic.theme)
implementation(libs.nordic.navigation)
implementation(libs.nordic.blek.uiscanner)
implementation(libs.nordic.uilogger)
implementation(libs.nordic.logger)
implementation(libs.nordic.permissions.ble)
implementation(libs.nordic.analytics)


implementation(libs.nordic.blek.uiscanner)
implementation(libs.nordic.blek.client)

// Pass SLF4J logs to Timber
implementation(libs.slf4j.timber)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.iconsExtended)
Expand Down
20 changes: 0 additions & 20 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@

# Simple XML
-dontwarn javax.xml.**

-keep public class org.simpleframework.**{ *; }
-keep class org.simpleframework.xml.**{ *; }
-keep class org.simpleframework.xml.core.**{ *; }
-keep class org.simpleframework.xml.util.**{ *; }

-keepattributes Signature
-keepattributes *Annotation*

# Ignore our XML Serialization classes
-keep public class your.annotated.pojo.models.*{
public protected private *;
}

# Crashlytics
-keepattributes SourceFile,LineNumberTable # Keep file names and line numbers.
-keep public class * extends java.lang.Exception # Optional: Keep custom exceptions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import no.nordicsemi.android.analytics.AppAnalytics
import no.nordicsemi.android.analytics.AppOpenEvent
import no.nordicsemi.android.gls.GLSServer
import no.nordicsemi.android.uart.UartServer
import timber.log.Timber
import javax.inject.Inject

@HiltAndroidApp
Expand All @@ -54,6 +55,8 @@ class NrfToolboxApplication : Application() {
override fun onCreate() {
super.onCreate()

Timber.plant(Timber.DebugTree())

analytics.logEvent(AppOpenEvent)

uartServer.start(this)
Expand Down
21 changes: 0 additions & 21 deletions app/src/main/java/no/nordicsemi/android/nrftoolbox/AppModule.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,16 @@
package no.nordicsemi.android.nrftoolbox.view

import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.colorResource
import no.nordicsemi.android.common.analytics.view.AnalyticsPermissionButton
import no.nordicsemi.android.nrftoolbox.R
import no.nordicsemi.android.common.ui.view.NordicAppBar

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TitleAppBar(text: String) {
SmallTopAppBar(
NordicAppBar(
title = { Text(text, maxLines = 2) },
colors = TopAppBarDefaults.smallTopAppBarColors(
scrolledContainerColor = MaterialTheme.colorScheme.primary,
containerColor = colorResource(id = R.color.appBarColor),
titleContentColor = MaterialTheme.colorScheme.onPrimary,
actionIconContentColor = MaterialTheme.colorScheme.onPrimary,
navigationIconContentColor = MaterialTheme.colorScheme.onPrimary,
),
actions = {
AnalyticsPermissionButton()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ import javax.inject.Inject

@HiltViewModel
class HomeViewModel @Inject constructor(
@ApplicationContext
private val context: Context,
@ApplicationContext private val context: Context,
private val navigationManager: Navigator,
private val activitySignals: ActivitySignals,
activitySignals: ActivitySignals,
cgmRepository: CGMRepository,
cscRepository: CSCRepository,
hrsRepository: HRSRepository,
Expand Down Expand Up @@ -114,7 +113,7 @@ class HomeViewModel @Inject constructor(
}

fun openLogger() {
LoggerLauncher.launch(context)
LoggerLauncher.launch(context, null)
}

fun logEvent(event: ProfileOpenEvent) {
Expand Down
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.kapt) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.secrets) apply false
alias(libs.plugins.protobuf) apply false
Expand Down
37 changes: 3 additions & 34 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,37 +1,6 @@
#
# Copyright (c) 2022, Nordic Semiconductor
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

#Mon Feb 14 14:46:55 CET 2022
#Thu Aug 29 13:13:59 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion lib_service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {

dependencies {
implementation(project(":lib_ui"))

implementation(libs.nordic.blek.uiscanner)
implementation(libs.nordic.blek.core)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ const val DEVICE_DATA = "device-data"

interface ServiceManager {

fun <T> startService(service: Class<T>, device: ServerDevice)
}
fun <T> startService(service: Class<T>, device: ServerDevice, profile: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class ServiceManagerHiltModule {

@Provides
fun createServiceManager(
@ApplicationContext
context: Context,
@ApplicationContext context: Context,
): ServiceManager {
return ServiceManagerImpl(context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import no.nordicsemi.android.kotlin.ble.core.ServerDevice
import javax.inject.Inject

class ServiceManagerImpl @Inject constructor(
@ApplicationContext
private val context: Context
@ApplicationContext private val context: Context
): ServiceManager {

override fun <T> startService(service: Class<T>, device: ServerDevice) {
override fun <T> startService(service: Class<T>, device: ServerDevice, profile: String) {
val intent = Intent(context, service).apply {
putExtra(DEVICE_DATA, device)
}
Expand Down
2 changes: 1 addition & 1 deletion lib_ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ android {
}

dependencies {
implementation(libs.nordic.uilogger)
implementation(libs.nordic.ui)
implementation(libs.nordic.theme)
implementation(libs.nordic.logger)

Expand Down

This file was deleted.

This file was deleted.

45 changes: 0 additions & 45 deletions lib_ui/src/main/java/no/nordicsemi/android/ui/view/StringConst.kt

This file was deleted.

Loading

0 comments on commit e506eea

Please sign in to comment.