build.gradle optimization

This commit is contained in:
Milos Kozak 2022-11-09 12:20:03 +01:00
parent 1c95cb107d
commit efd4d43a50
21 changed files with 149 additions and 143 deletions

View file

@ -9,7 +9,6 @@ plugins {
apply from: "${project.rootDir}/core/android_dependencies.gradle"
apply from: "${project.rootDir}/core/android_module_dependencies.gradle"
apply from: "${project.rootDir}/core/test_dependencies.gradle"
apply from: "${project.rootDir}/core/jacoco_global.gradle"
android {

View file

@ -9,8 +9,6 @@ plugins {
apply from: "${project.rootDir}/core/android_dependencies.gradle"
apply from: "${project.rootDir}/core/android_module_dependencies.gradle"
//apply from: "${project.rootDir}/core/test_dependencies.gradle"
//apply from: "${project.rootDir}/core/jacoco_global.gradle"
android {

View file

@ -213,12 +213,18 @@ dependencies {
/* Dagger2 - We are going to use dagger.android which includes
* support for Activity and fragment injection so we need to include
* the following dependencies */
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
/* Dagger2 - default dependency */
kapt "com.google.dagger:dagger-compiler:$dagger_version"
// MainApp
api "com.uber.rxdogtag2:rxdogtag:2.0.1"
// Overview
api 'com.google.android.flexbox:flexbox:3.0.0'
// APS
api 'org.mozilla:rhino:1.7.14'
}
apply from: "${project.rootDir}/core/test_dependencies.gradle"

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.utils.buildHelper
import android.os.Build
import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.R
import info.nightscout.interfaces.Config
import javax.inject.Inject
import javax.inject.Singleton
@ -20,4 +21,5 @@ class ConfigImpl @Inject constructor() : Config {
override val currentDeviceModelString =
Build.MANUFACTURER + " " + Build.MODEL + " (" + Build.DEVICE + ")"
override val appName: Int = R.string.app_name
}

View file

@ -13,6 +13,7 @@ import info.nightscout.automation.R
import info.nightscout.automation.elements.InputString
import info.nightscout.automation.elements.LabelWithElement
import info.nightscout.automation.elements.LayoutBuilder
import info.nightscout.interfaces.Config
import info.nightscout.rx.bus.RxBus
import org.json.JSONObject
import javax.inject.Inject
@ -23,6 +24,7 @@ class ActionAlarm(injector: HasAndroidInjector) : Action(injector) {
@Inject lateinit var context: Context
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var timerUtil: TimerUtil
@Inject lateinit var config: Config
var text = InputString()
@ -38,7 +40,7 @@ class ActionAlarm(injector: HasAndroidInjector) : Action(injector) {
override fun doAction(callback: Callback) {
timerUtil.scheduleReminder(10, text.value.takeIf { it.isNotBlank() }
?: rh.gs(R.string.app_name))
?: rh.gs(config.appName))
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
}

View file

@ -23,8 +23,6 @@ android {
}
dependencies {
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"

View file

@ -7,7 +7,6 @@ plugins {
id 'com.hiya.jacoco-android'
}
apply from: 'core_dependencies.gradle'
apply from: "${project.rootDir}/core/android_dependencies.gradle"
apply from: "${project.rootDir}/core/android_module_dependencies.gradle"
apply from: "${project.rootDir}/core/allopen_dependencies.gradle"
@ -20,6 +19,76 @@ dependencies {
implementation project(':app-wear-shared:shared')
implementation project(':database')
implementation project(':interfaces')
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-guava:$coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutines_version"
api "androidx.activity:activity-ktx:$activity_version"
api "androidx.appcompat:appcompat:$appcompat_version"
api 'androidx.biometric:biometric:1.1.0'
api "androidx.browser:browser:1.4.0"
api 'androidx.cardview:cardview:1.0.0'
api "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
api "androidx.core:core-ktx:$core_version"
api "androidx.fragment:fragment-ktx:$fragmentktx_version"
api 'androidx.legacy:legacy-support-v13:1.0.0'
api 'androidx.legacy:legacy-support-v4:1.0.0'
api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
api "androidx.lifecycle:lifecycle-process:$lifecycle_version"
api "androidx.navigation:navigation-fragment-ktx:$nav_version"
api "androidx.navigation:navigation-runtime-ktx:$nav_version"
api "androidx.navigation:navigation-ui-ktx:$nav_version"
api 'androidx.percentlayout:percentlayout:1.0.0'
api "androidx.preference:preference-ktx:$preferencektx_version"
api 'androidx.recyclerview:recyclerview:1.2.1'
api 'androidx.gridlayout:gridlayout:1.0.0'
api "com.google.android.material:material:$material_version"
api "com.google.dagger:dagger-android:$dagger_version"
api "com.google.dagger:dagger-android-support:$dagger_version"
api "com.google.android.gms:play-services-wearable:$play_services_wearable_version"
api "com.google.android.gms:play-services-location:$play_services_location_version"
api 'com.google.guava:guava:31.1-jre'
api "androidx.work:work-rxjava3:$work_version"
//Firebase
api platform('com.google.firebase:firebase-bom:30.5.0')
api "com.google.firebase:firebase-analytics-ktx"
api "com.google.firebase:firebase-crashlytics-ktx"
// StatsActivity not in use now
// api "com.google.firebase:firebase-messaging-ktx"
// api 'com.google.firebase:firebase-auth-ktx'
// api 'com.google.firebase:firebase-database-ktx'
//CryptoUtil
api 'com.madgag.spongycastle:core:1.58.0.0'
api "com.google.crypto.tink:tink-android:$tink_version"
// pumpCommon
api "com.google.code.gson:gson:$gson_version"
//WorkManager
api "androidx.work:work-runtime:$work_version"
api "androidx.work:work-runtime-ktx:$work_version"
// api "androidx.work:work-rxjava3:$work_version"
api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
api "commons-codec:commons-codec:$commonscodec_version"
}
android {

View file

@ -1,96 +0,0 @@
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-guava:$coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutines_version"
api "androidx.core:core-ktx:$core_version"
api 'androidx.legacy:legacy-support-v13:1.0.0'
api 'androidx.legacy:legacy-support-v4:1.0.0'
api "androidx.appcompat:appcompat:$appcompat_version"
api "androidx.preference:preference-ktx:$preferencektx_version"
api 'androidx.biometric:biometric:1.1.0'
api "androidx.browser:browser:1.4.0"
api "androidx.activity:activity-ktx:$activity_version"
api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
api "androidx.lifecycle:lifecycle-process:$lifecycle_version"
api 'androidx.cardview:cardview:1.0.0'
api 'androidx.recyclerview:recyclerview:1.2.1'
api 'androidx.gridlayout:gridlayout:1.0.0'
api 'androidx.percentlayout:percentlayout:1.0.0'
api "com.google.android.material:material:$material_version"
api "com.google.dagger:dagger-android:$dagger_version"
api "com.google.dagger:dagger-android-support:$dagger_version"
//Firebase
api platform('com.google.firebase:firebase-bom:30.5.0')
api "com.google.firebase:firebase-analytics-ktx"
api "com.google.firebase:firebase-crashlytics-ktx"
api "com.google.firebase:firebase-messaging-ktx"
api 'com.google.firebase:firebase-auth-ktx'
api 'com.google.firebase:firebase-database-ktx'
//RxBus
api "io.reactivex.rxjava3:rxjava:$rxjava_version"
api "io.reactivex.rxjava3:rxkotlin:$rxkotlin_version"
api "io.reactivex.rxjava3:rxandroid:$rxandroid_version"
api "org.apache.commons:commons-lang3:$commonslang3_version"
api "commons-codec:commons-codec:$commonscodec_version"
api "com.uber.rxdogtag2:rxdogtag:2.0.1"
//CryptoUtil
api 'com.madgag.spongycastle:core:1.58.0.0'
api "com.google.crypto.tink:tink-android:$tink_version"
//db
api "com.j256.ormlite:ormlite-core:$ormLite_version"
api "com.j256.ormlite:ormlite-android:$ormLite_version"
// pumpCommon
api "com.google.code.gson:gson:$gson_version"
//WorkManager
api "androidx.work:work-runtime:$work_version"
api "androidx.work:work-runtime-ktx:$work_version"
api "androidx.work:work-rxjava3:$work_version"
api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
// new for tidepool
api "com.squareup.okhttp3:okhttp:$okhttp3_version"
api "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"
api "com.squareup.retrofit2:retrofit:$retrofit2_version"
api "com.squareup.retrofit2:adapter-rxjava3:$retrofit2_version"
api "com.squareup.retrofit2:converter-gson:$retrofit2_version"
api "androidx.fragment:fragment-ktx:$fragmentktx_version"
api "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
api "androidx.navigation:navigation-runtime-ktx:$nav_version"
api "androidx.navigation:navigation-fragment-ktx:$nav_version"
api "androidx.navigation:navigation-ui-ktx:$nav_version"
api "com.google.android.gms:play-services-wearable:$play_services_wearable_version"
api "com.google.android.gms:play-services-location:$play_services_location_version"
api 'com.google.android.flexbox:flexbox:3.0.0'
api("io.socket:socket.io-client:1.0.0") {
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"
}
api 'com.google.guava:guava:31.1-jre'
api 'org.mozilla:rhino:1.7.14'
api 'com.github.kenglxn.QRGen:android:2.6.0'
api 'com.eatthepath:java-otp:0.3.1'
api "commons-codec:commons-codec:$commonscodec_version"
// Phone checker
// updating to 0.0.9 prevents AAPS from build
api 'com.scottyab:rootbeer-lib:0.0.8'
}

View file

@ -23,7 +23,7 @@ fun String.hexStringToByteArray(): ByteArray {
val result = ByteArray(length / 2)
val lowerCased = this.lowercase(Locale.getDefault())
for (i in 0 until length step 2) {
for (i in indices step 2) {
val firstIndex = HEX_CHARS.indexOf(lowerCased[i])
val secondIndex = HEX_CHARS.indexOf(lowerCased[i + 1])

View file

@ -4,17 +4,17 @@ import android.content.Context
import android.os.Environment
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.core.R
import info.nightscout.interfaces.Config
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils
import info.nightscout.androidaps.plugins.general.maintenance.formats.*
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.interfaces.storage.Storage
import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.data.maintenance.PrefMetadata
import info.nightscout.interfaces.data.maintenance.PrefMetadataMap
import info.nightscout.interfaces.data.maintenance.PrefsFile
import info.nightscout.interfaces.data.maintenance.PrefsImportDir
import info.nightscout.interfaces.data.maintenance.PrefsMetadataKey
import info.nightscout.interfaces.data.maintenance.PrefsStatus
import info.nightscout.interfaces.storage.Storage
import info.nightscout.shared.interfaces.ResourceHelper
import org.joda.time.DateTime
import org.joda.time.Days
import org.joda.time.Hours
@ -94,10 +94,6 @@ class PrefFileListProvider @Inject constructor(
return checkMetadata(encryptedPrefsFormat.loadMetadata(contents))
}
@Suppress("unused") fun legacyFile(): File {
return File(path, rh.gs(R.string.app_name) + "Preferences")
}
fun ensureExportDirExists(): File {
if (!aapsPath.exists()) {
aapsPath.mkdirs()

View file

@ -13,26 +13,24 @@ import android.os.PowerManager
import android.provider.Settings
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.activities.DaggerAppCompatActivityWithResult
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.PluginBase
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.interfaces.SmsCommunicator
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.rx.bus.RxBus
import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.SmsCommunicator
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.shared.interfaces.ResourceHelper
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class AndroidPermissionImpl @Inject constructor(
val rh: ResourceHelper,
val rxBus: RxBus,
val injector: HasAndroidInjector,
val activePlugin: ActivePlugin
private val rh: ResourceHelper,
private val activePlugin: ActivePlugin,
private val config: Config
) : AndroidPermission {
private var permissionBatteryOptimizationFailed = false
@ -129,7 +127,7 @@ class AndroidPermissionImpl @Inject constructor(
if (permissionNotGranted(activity, Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS))
activePlugin.activeOverview.addNotification(
id = Notification.PERMISSION_BATTERY,
text = rh.gs(R.string.need_whitelisting, rh.gs(R.string.app_name)),
text = rh.gs(R.string.need_whitelisting, rh.gs(config.appName)),
level = Notification.URGENT,
actionButtonId = R.string.request
) { askForPermission(activity, arrayOf(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) }

View file

@ -40,7 +40,7 @@ class QueueThread internal constructor(
private var mWakeLock: PowerManager.WakeLock? = null
init {
mWakeLock = (context.getSystemService(Context.POWER_SERVICE) as PowerManager).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, rh.gs(R.string.app_name) + ":QueueThread")
mWakeLock = (context.getSystemService(Context.POWER_SERVICE) as PowerManager).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, rh.gs(config.appName) + ":QueueThread")
}
override fun run() {

View file

@ -11,4 +11,5 @@ interface Config {
val VERSION_NAME: String
val DEBUG: Boolean
val currentDeviceModelString : String
val appName: Int
}

View file

@ -22,4 +22,7 @@ dependencies {
implementation project(':interfaces')
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
api "com.squareup.okhttp3:okhttp:$okhttp3_version"
api "com.squareup.retrofit2:retrofit:$retrofit2_version"
}

View file

@ -23,4 +23,28 @@ dependencies {
implementation project(':core')
implementation project(':interfaces')
implementation project(':ns-sdk')
// Actions
api 'androidx.gridlayout:gridlayout:1.0.0'
// NSClient, Tidepool
api("io.socket:socket.io-client:1.0.0") {
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"
}
api "com.squareup.okhttp3:okhttp:$okhttp3_version"
api "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"
// api "com.squareup.retrofit2:retrofit:$retrofit2_version"
api "com.squareup.retrofit2:adapter-rxjava3:$retrofit2_version"
api "com.squareup.retrofit2:converter-gson:$retrofit2_version"
// Phone checker
// updating to 0.0.9 prevents AAPS from build
api 'com.scottyab:rootbeer-lib:0.0.8'
//SmsCommunicator
api 'com.eatthepath:java-otp:0.3.1'
api 'com.github.kenglxn.QRGen:android:2.6.0'
}

View file

@ -22,6 +22,12 @@ android {
moduleName "BleCommandUtil"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
}
dependencies {

View file

@ -26,14 +26,18 @@ android {
}
dependencies {
implementation project(':libraries')
implementation project(':core')
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
implementation project(':libraries')
implementation project(':interfaces')
implementation project(':core')
api "androidx.room:room-ktx:$room_version"
api "androidx.room:room-runtime:$room_version"
api "androidx.room:room-rxjava3:$room_version"
kapt "androidx.room:room-compiler:$room_version"
api "com.squareup.okhttp3:okhttp:$okhttp3_version"
api "com.squareup.retrofit2:retrofit:$retrofit2_version"
api "com.squareup.retrofit2:converter-gson:$retrofit2_version"
}

View file

@ -8,7 +8,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.pump.core.utils.ByteUtil
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import okhttp3.internal.and
import org.joda.time.LocalDateTime
import java.util.Arrays
@ -190,10 +189,9 @@ class MedtronicCGMSHistoryDecoder constructor(
}
private fun decodeCalBGForGH(entry: CGMSHistoryEntry) {
val amount: Int = entry.getRawDataByIndex(3) and 32 shl 3 or entry.getRawDataByIndexInt(5)
val amount: Int = entry.getRawDataByIndex(3).toInt() and 32 shl 3 or entry.getRawDataByIndexInt(5)
//
val originType: String
originType = when (entry.getRawDataByIndexInt(3) shr 5 and 3) {
val originType: String = when (entry.getRawDataByIndexInt(3) shr 5 and 3) {
0x00 -> "rf"
else -> "unknown"
}

View file

@ -11,6 +11,7 @@ apply from: "${project.rootDir}/core/android_module_dependencies.gradle"
apply from: "${project.rootDir}/core/allopen_dependencies.gradle"
apply from: "${project.rootDir}/core/test_dependencies.gradle"
apply from: "${project.rootDir}/core/jacoco_global.gradle"
android {
namespace 'info.nightscout.androidaps.plugins.pump.omnipod.common'
}
@ -21,4 +22,6 @@ dependencies {
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
implementation project(':interfaces')
api "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
}

View file

@ -2,19 +2,15 @@ package info.nightscout.ui.activities
import android.os.Bundle
import android.widget.ArrayAdapter
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.FirebaseDatabase
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.stats.TddCalculator
import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.InstanceId
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.shared.SafeParse
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.utils.DateUtil
import info.nightscout.ui.R
import info.nightscout.ui.databinding.ActivitySurveyBinding
import info.nightscout.ui.defaultProfile.DefaultProfile
@ -92,7 +88,7 @@ class SurveyActivity : NoSplashAppCompatActivity() {
val specificProfile = profileStore.getSpecificProfile(profileName)
r.profileJson = specificProfile.toString()
/*
val auth = FirebaseAuth.getInstance()
auth.signInAnonymously()
.addOnCompleteListener(this) { task ->
@ -110,6 +106,7 @@ class SurveyActivity : NoSplashAppCompatActivity() {
// ...
}
*/
finish()
}
}

View file

@ -127,8 +127,6 @@ dependencies {
implementation "com.google.dagger:dagger-android:$dagger_version"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
}