From ccd0831304133295867924a2a44ceacc4c24d3a5 Mon Sep 17 00:00:00 2001 From: rvenky125 Date: Wed, 21 Feb 2024 11:07:11 +0530 Subject: [PATCH] code cleanup --- device-info/build.gradle.kts | 2 +- device-info/device_info.podspec | 2 +- .../resolver/DeviceIdResolver.kt | 6 ++-- .../com/famas/kmp_device_info/DeviceInfo.kt | 31 ------------------- gradle/libs.versions.toml | 25 --------------- 5 files changed, 5 insertions(+), 61 deletions(-) diff --git a/device-info/build.gradle.kts b/device-info/build.gradle.kts index cee5421..18caf53 100644 --- a/device-info/build.gradle.kts +++ b/device-info/build.gradle.kts @@ -17,7 +17,7 @@ kotlin { iosSimulatorArm64() cocoapods { - summary = "Some description for the Shared Module" + summary = "This module provides device info" homepage = "Link to the Shared Module homepage" version = "1.0" ios.deploymentTarget = "16.0" diff --git a/device-info/device_info.podspec b/device-info/device_info.podspec index f2e215f..1580818 100644 --- a/device-info/device_info.podspec +++ b/device-info/device_info.podspec @@ -5,7 +5,7 @@ Pod::Spec.new do |spec| spec.source = { :http=> ''} spec.authors = '' spec.license = '' - spec.summary = 'Some description for the Shared Module' + spec.summary = 'This module provides device info' spec.vendored_frameworks = 'build/cocoapods/framework/device_info.framework' spec.libraries = 'c++' spec.ios.deployment_target = '16.0' diff --git a/device-info/src/androidMain/kotlin/com/famas/kmp_device_info/resolver/DeviceIdResolver.kt b/device-info/src/androidMain/kotlin/com/famas/kmp_device_info/resolver/DeviceIdResolver.kt index d9fb6c0..10b0495 100644 --- a/device-info/src/androidMain/kotlin/com/famas/kmp_device_info/resolver/DeviceIdResolver.kt +++ b/device-info/src/androidMain/kotlin/com/famas/kmp_device_info/resolver/DeviceIdResolver.kt @@ -46,9 +46,9 @@ class DeviceIdResolver(private val context: Context) { setInstanceIdInPrefs(instanceId) return instanceId } - val uUIDInstanceId: String + private val uUIDInstanceId: String get() = UUID.randomUUID().toString() - val instanceIdFromPrefs: String? + private val instanceIdFromPrefs: String? get() { val prefs = getRNDISharedPreferences( context @@ -56,7 +56,7 @@ class DeviceIdResolver(private val context: Context) { return prefs.getString("instanceId", Build.UNKNOWN) } - fun setInstanceIdInPrefs(instanceId: String?) { + private fun setInstanceIdInPrefs(instanceId: String?) { val editor = getRNDISharedPreferences( context ).edit() diff --git a/device-info/src/commonMain/kotlin/com/famas/kmp_device_info/DeviceInfo.kt b/device-info/src/commonMain/kotlin/com/famas/kmp_device_info/DeviceInfo.kt index 3b67bb9..a84bd61 100644 --- a/device-info/src/commonMain/kotlin/com/famas/kmp_device_info/DeviceInfo.kt +++ b/device-info/src/commonMain/kotlin/com/famas/kmp_device_info/DeviceInfo.kt @@ -3,7 +3,6 @@ package com.famas.kmp_device_info import kotlin.coroutines.cancellation.CancellationException expect class DeviceInfo { - @Throws(NotAvailableToPlatformException::class) fun isEmulator(): Boolean fun getFontScale(): Float @@ -12,7 +11,6 @@ expect class DeviceInfo { fun getIpAddress(): String? - @Throws(NotAvailableToPlatformException::class) fun isCameraPresent(): Boolean? fun getMacAddress(): String @@ -37,10 +35,8 @@ expect class DeviceInfo { fun isAirplaneMode(): Boolean - @Throws(NotAvailableToPlatformException::class) fun hasGms(): Boolean - @Throws(NotAvailableToPlatformException::class) fun hasHms(): Boolean fun hasSystemFeature(feature: String?): Boolean @@ -53,45 +49,34 @@ expect class DeviceInfo { fun getAvailableLocationProviders(): Map - @Throws(NotAvailableToPlatformException::class) fun getInstallReferrer(): String? fun getInstallerPackageName(): String fun getFirstInstallTime(): Double - @Throws(NotAvailableToPlatformException::class) fun getLastUpdateTime(): Double fun getDeviceName(): String - @Throws(NotAvailableToPlatformException::class) fun getSerialNumber(): String - @Throws(NotAvailableToPlatformException::class) fun getDevice(): String fun getBuildId(): String - @Throws(NotAvailableToPlatformException::class) fun getApiLevel(): Int - @Throws(NotAvailableToPlatformException::class) fun getBootloader(): String - @Throws(NotAvailableToPlatformException::class) fun getDisplay(): String - @Throws(NotAvailableToPlatformException::class) fun getFingerprint(): String - @Throws(NotAvailableToPlatformException::class) fun getHardware(): String - @Throws(NotAvailableToPlatformException::class) fun getHost(): String - @Throws(NotAvailableToPlatformException::class) fun getProduct(): String fun getTags(): String @@ -100,60 +85,44 @@ expect class DeviceInfo { fun getSystemManufacturer(): String - @Throws(NotAvailableToPlatformException::class) fun getCodename(): String - @Throws(NotAvailableToPlatformException::class) fun getIncremental(): String fun getUniqueId(): String - @Throws(NotAvailableToPlatformException::class) fun getAndroidId(): String - @Throws(NotAvailableToPlatformException::class) fun getMaxMemory(): Double fun getTotalMemory(): Double - @Throws(NotAvailableToPlatformException::class) fun getInstanceId(): String? - @Throws(NotAvailableToPlatformException::class) fun getBaseOs(): String - @Throws(NotAvailableToPlatformException::class) fun getPreviewSdkInt(): String - @Throws(NotAvailableToPlatformException::class) fun getSecurityPatch(): String - @Throws(NotAvailableToPlatformException::class, CancellationException::class) suspend fun getUserAgent(): String? - @Throws(NotAvailableToPlatformException::class) fun getPhoneNumber(): String fun getSupportedAbis(): List - @Throws(NotAvailableToPlatformException::class) fun getSupported32BitAbis(): List - @Throws(NotAvailableToPlatformException::class) fun getSupported64BitAbis(): List - @Throws(NotAvailableToPlatformException::class) fun getSupportedMediaTypeList(): List - @Throws(NotAvailableToPlatformException::class) fun isLowRamDevice(): Boolean fun isDisplayZoomed(): Boolean - @Throws(NotAvailableToPlatformException::class) fun getBrightness(): Float - @Throws(NotAvailableToPlatformException::class, CancellationException::class) suspend fun getDeviceToken(): String? fun getInfoConstants(): InfoConstants diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4079a73..de5264a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,34 +1,9 @@ [versions] agp = "8.2.0" kotlin = "1.9.20" -compose = "1.6.1" -compose-compiler = "1.5.4" -compose-material3 = "1.1.2" -androidx-activityCompose = "1.8.0" -core-ktx = "1.12.0" -junit = "4.13.2" -androidx-test-ext-junit = "1.1.5" -espresso-core = "3.5.1" -lifecycle-runtime-ktx = "2.6.2" -compose-bom = "2023.08.00" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } -androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } -compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } -compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } -compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } -compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" } -compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" } -core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" } -junit = { group = "junit", name = "junit", version.ref = "junit" } -androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" } -espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" } -lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle-runtime-ktx" } -compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" } -ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } -ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } -ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } [plugins] androidApplication = { id = "com.android.application", version.ref = "agp" }