diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 168cb5b6..1007342a 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -3,6 +3,7 @@ import com.isupatches.android.wisefy.build.Dependencies
import com.isupatches.android.wisefy.build.Versions
import com.isupatches.android.wisefy.build.compose
import com.isupatches.android.wisefy.build.dagger
+import com.isupatches.android.wisefy.build.gitCommitHash
import com.isupatches.android.wisefy.build.navigation
plugins {
@@ -25,10 +26,24 @@ android {
minSdk = BuildVersions.MIN_SDK
targetSdk = BuildVersions.TARGET_SDK
- versionCode = BuildVersions.MODULE_VERSION_CODE
- versionName = BuildVersions.MODULE_VERSION_NAME
+ versionCode = BuildVersions.Sample.VERSION_CODE
+ versionName = BuildVersions.Sample.VERSION_NAME
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+
+ buildConfigField("String", "GIT_HASH", "\"${gitCommitHash()}\"")
+
+ buildConfigField("String", "WISEFY_CORE_VERSION","\"${BuildVersions.WISEFY_CORE_VERSION}\"")
+ buildConfigField("String", "WISEFY_ACCESS_POINTS_VERSION","\"${BuildVersions.WISEFY_ACCESS_POINTS_VERSION}\"")
+ buildConfigField("String", "WISEFY_ADD_NETWORK_VERSION","\"${BuildVersions.WISEFY_ADD_NETWORK_VERSION}\"")
+ buildConfigField("String", "WISEFY_NETWORK_CONNECTION_VERSION","\"${BuildVersions.WISEFY_NETWORK_CONNECTION_VERSION}\"")
+ buildConfigField("String", "WISEFY_NETWORK_INFO_VERSION","\"${BuildVersions.WISEFY_NETWORK_INFO_VERSION}\"")
+ buildConfigField("String", "WISEFY_REMOVE_NETWORK_VERSION","\"${BuildVersions.WISEFY_REMOVE_NETWORK_VERSION}\"")
+ buildConfigField("String", "WISEFY_SAVED_NETWORKS_VERSION","\"${BuildVersions.WISEFY_SAVED_NETWORKS_VERSION}\"")
+ buildConfigField("String", "WISEFY_SIGNAL_VERSION","\"${BuildVersions.WISEFY_SIGNAL_VERSION}\"")
+ buildConfigField("String", "WISEFY_WIFI_VERSION","\"${BuildVersions.WISEFY_WIFI_VERSION}\"")
+ buildConfigField("String", "WISEFY_VERSION", "\"${BuildVersions.WISEFY_VERSION}\"")
+ buildConfigField("String", "WISEFY_KTX_VERSION", "\"${BuildVersions.WISEFY_KTX_VERSION}\"")
}
signingConfigs {
diff --git a/app/src/main/java/com/isupatches/android/wisefy/sample/main/HomeScreen.kt b/app/src/main/java/com/isupatches/android/wisefy/sample/main/HomeScreen.kt
index 35fdf419..6bab77f1 100644
--- a/app/src/main/java/com/isupatches/android/wisefy/sample/main/HomeScreen.kt
+++ b/app/src/main/java/com/isupatches/android/wisefy/sample/main/HomeScreen.kt
@@ -20,6 +20,9 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
@@ -33,10 +36,12 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
+import com.isupatches.android.wisefy.sample.BuildConfig
import com.isupatches.android.wisefy.sample.R
import com.isupatches.android.wisefy.sample.ui.primitives.WisefySampleSizes
import com.isupatches.android.wisefy.sample.ui.theme.WisefySampleTheme
+
@Composable
internal fun HomeScreen() {
WisefySampleTheme {
@@ -46,7 +51,6 @@ internal fun HomeScreen() {
.verticalScroll(rememberScrollState())
.padding(
top = WisefySampleSizes.WisefySampleTopMargin,
- bottom = WisefySampleSizes.WisefySampleBottomMargin,
start = WisefySampleSizes.WisefySampleHorizontalMargins,
end = WisefySampleSizes.WisefySampleHorizontalMargins
)
@@ -80,6 +84,209 @@ internal fun HomeScreen() {
)
}
}
+ Row(
+ modifier =
+ Modifier.padding(
+ top = WisefySampleSizes.XLarge,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(R.string.core_version_args, BuildConfig.WISEFY_CORE_VERSION),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(R.string.accesspoints_version_args, BuildConfig.WISEFY_ACCESS_POINTS_VERSION),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(R.string.addnetwork_version_args, BuildConfig.WISEFY_ADD_NETWORK_VERSION),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(
+ R.string.networkconnection_version_args,
+ BuildConfig.WISEFY_NETWORK_CONNECTION_VERSION
+ ),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(R.string.networkinfo_version_args, BuildConfig.WISEFY_NETWORK_INFO_VERSION),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(
+ R.string.removenetwork_version_args,
+ BuildConfig.WISEFY_REMOVE_NETWORK_VERSION
+ ),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(
+ R.string.savednetworks_version_args,
+ BuildConfig.WISEFY_SAVED_NETWORKS_VERSION
+ ),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(R.string.signal_version_args, BuildConfig.WISEFY_SIGNAL_VERSION),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(R.string.wifi_version_args, BuildConfig.WISEFY_WIFI_VERSION),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ Modifier
+ .padding(
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(R.string.wisefy_version_args, BuildConfig.WISEFY_VERSION),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(
+ modifier = Modifier
+ .padding(
+ bottom = WisefySampleSizes.XLarge,
+ top = WisefySampleSizes.Small,
+ start = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Large
+ )
+ ) {
+ Text(
+ text = stringResource(R.string.wisefy_ktx_version_args, BuildConfig.WISEFY_KTX_VERSION),
+ style = MaterialTheme.typography.body2,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ Row(Modifier.weight(1f)) {
+ Spacer(modifier = Modifier.fillMaxSize())
+ }
+ Row {
+ Box(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(
+ top = WisefySampleSizes.Large,
+ start = WisefySampleSizes.Medium,
+ bottom = WisefySampleSizes.Large,
+ end = WisefySampleSizes.Medium
+ ),
+ contentAlignment = Alignment.BottomCenter
+ ) {
+ Text(
+ text = stringResource(
+ R.string.author_and_version_args,
+ BuildConfig.VERSION_NAME,
+ BuildConfig.VERSION_CODE,
+ BuildConfig.GIT_HASH
+ ),
+ style = MaterialTheme.typography.caption,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colors.onBackground
+ )
+ }
+ }
}
}
}
diff --git a/app/src/main/java/com/isupatches/android/wisefy/sample/ui/components/navigation/WisefySampleBottomNavigation.kt b/app/src/main/java/com/isupatches/android/wisefy/sample/ui/components/navigation/WisefySampleBottomNavigation.kt
index 4a791e21..0531beba 100644
--- a/app/src/main/java/com/isupatches/android/wisefy/sample/ui/components/navigation/WisefySampleBottomNavigation.kt
+++ b/app/src/main/java/com/isupatches/android/wisefy/sample/ui/components/navigation/WisefySampleBottomNavigation.kt
@@ -59,13 +59,13 @@ internal fun WisefySampleBottomNavigation(navController: NavController) {
},
label = {
Text(
- text = stringResource(item.stringResId),
+ text = "",
style = WisefySampleTypography.caption
)
},
selectedContentColor = MaterialTheme.colors.onPrimary,
unselectedContentColor = MaterialTheme.colors.onPrimary.copy(UNSELECTED_NAVIGATION_ITEM_ALPHA),
- alwaysShowLabel = true,
+ alwaysShowLabel = false,
selected = currentRoute == item.route,
onClick = {
navController.navigate(item.route) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 37db10ff..5d9bb287 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -60,4 +60,18 @@
Show password
Invalid RSSI input
+
+ Patches Barrett - v%1$s build %2$s-%3$s
+
+ wisefy:core:%s
+ wisefy:accesspoints:%s
+ wisefy:addnetwork:%s
+ wisefy:networkconnection:%s
+ wisefy:networkinfo:%s
+ wisefy:removenetwork:%s
+ wisefy:savednetworks:%s
+ wisefy:signal:%s
+ wisefy:wifi:%s
+ wisefy:%s
+ wisefy:ktx:%s
diff --git a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/BuildVersions.kt b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/BuildVersions.kt
index 0543f81a..5360d560 100644
--- a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/BuildVersions.kt
+++ b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/BuildVersions.kt
@@ -22,6 +22,20 @@ object BuildVersions {
const val TARGET_SDK: Int = 33
const val MIN_SDK: Int = 23
- const val MODULE_VERSION_CODE: Int = 18
- const val MODULE_VERSION_NAME: String = "5.0.0"
+ object Sample {
+ const val VERSION_CODE: Int = 18
+ const val VERSION_NAME: String = "5.0.0"
+ }
+
+ const val WISEFY_CORE_VERSION: String = "5.0.0"
+ const val WISEFY_ACCESS_POINTS_VERSION: String = "5.0.0"
+ const val WISEFY_ADD_NETWORK_VERSION: String = "5.0.0"
+ const val WISEFY_NETWORK_CONNECTION_VERSION: String = "5.0.0"
+ const val WISEFY_NETWORK_INFO_VERSION: String = "5.0.0"
+ const val WISEFY_REMOVE_NETWORK_VERSION: String = "5.0.0"
+ const val WISEFY_SAVED_NETWORKS_VERSION: String = "5.0.0"
+ const val WISEFY_SIGNAL_VERSION: String = "5.0.0"
+ const val WISEFY_WIFI_VERSION: String = "5.0.0"
+ const val WISEFY_VERSION: String = "5.0.0"
+ const val WISEFY_KTX_VERSION: String = "5.0.0"
}
diff --git a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/GitFunctions.kt b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/GitFunctions.kt
new file mode 100644
index 00000000..74eb9bf5
--- /dev/null
+++ b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/GitFunctions.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2022 Patches Barrett
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.isupatches.android.wisefy.build
+
+import java.io.ByteArrayOutputStream
+import java.io.OutputStream
+import org.gradle.api.Project
+
+/*
+ * https://stackoverflow.com/questions/28498688/gradle-script-to-autoversion-and-include-the-commit-hash-in-android
+ */
+fun Project.gitCommitHash(): String {
+ val stdout: OutputStream = ByteArrayOutputStream()
+ exec {
+ commandLine("git", "rev-parse", "--short", "HEAD")
+ standardOutput = stdout
+ }
+ return stdout.toString().trim()
+}
diff --git a/wisefy/accesspoints/build.gradle.kts b/wisefy/accesspoints/build.gradle.kts
index c1769e38..139cf460 100644
--- a/wisefy/accesspoints/build.gradle.kts
+++ b/wisefy/accesspoints/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_ACCESS_POINTS_VERSION
android {
namespace = "com.isupatches.android.wisefy.accesspoints"
diff --git a/wisefy/addnetwork/build.gradle.kts b/wisefy/addnetwork/build.gradle.kts
index d6666c58..6f15772a 100644
--- a/wisefy/addnetwork/build.gradle.kts
+++ b/wisefy/addnetwork/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_ADD_NETWORK_VERSION
android {
namespace = "com.isupatches.android.wisefy.addnetwork"
diff --git a/wisefy/build.gradle.kts b/wisefy/build.gradle.kts
index 6751f5a7..603b3bfd 100644
--- a/wisefy/build.gradle.kts
+++ b/wisefy/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_VERSION
android {
namespace = "com.isupatches.android.wisefy"
diff --git a/wisefy/core/build.gradle.kts b/wisefy/core/build.gradle.kts
index 59fb83e3..b2f4a4f9 100644
--- a/wisefy/core/build.gradle.kts
+++ b/wisefy/core/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_CORE_VERSION
android {
namespace = "com.isupatches.android.wisefy.core"
diff --git a/wisefy/ktx/build.gradle.kts b/wisefy/ktx/build.gradle.kts
index 5f9ce917..8292ba8f 100644
--- a/wisefy/ktx/build.gradle.kts
+++ b/wisefy/ktx/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_KTX_VERSION
android {
namespace = "com.isupatches.android.wisefy.ktx"
diff --git a/wisefy/networkconnection/build.gradle.kts b/wisefy/networkconnection/build.gradle.kts
index eb974b0e..5d336d00 100644
--- a/wisefy/networkconnection/build.gradle.kts
+++ b/wisefy/networkconnection/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_NETWORK_CONNECTION_VERSION
android {
namespace = "com.isupatches.android.wisefy.networkconnection"
diff --git a/wisefy/networkinfo/build.gradle.kts b/wisefy/networkinfo/build.gradle.kts
index f59f7722..541b4968 100644
--- a/wisefy/networkinfo/build.gradle.kts
+++ b/wisefy/networkinfo/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_NETWORK_INFO_VERSION
android {
namespace = "com.isupatches.android.wisefy.networkinfo"
diff --git a/wisefy/removenetwork/build.gradle.kts b/wisefy/removenetwork/build.gradle.kts
index 00724420..aaf02a5c 100644
--- a/wisefy/removenetwork/build.gradle.kts
+++ b/wisefy/removenetwork/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_REMOVE_NETWORK_VERSION
android {
namespace = "com.isupatches.android.wisefy.removenetwork"
diff --git a/wisefy/savednetworks/build.gradle.kts b/wisefy/savednetworks/build.gradle.kts
index 9d4a3a28..8e521d19 100644
--- a/wisefy/savednetworks/build.gradle.kts
+++ b/wisefy/savednetworks/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_SAVED_NETWORKS_VERSION
android {
namespace = "com.isupatches.android.wisefy.savednetworks"
diff --git a/wisefy/savednetworks/src/main/java/com/isupatches/android/wisefy/savednetworks/os/impls/DefaultSavedNetworkApiImpl.kt b/wisefy/savednetworks/src/main/java/com/isupatches/android/wisefy/savednetworks/os/impls/DefaultSavedNetworkApiImpl.kt
index 25f92876..1b27b736 100644
--- a/wisefy/savednetworks/src/main/java/com/isupatches/android/wisefy/savednetworks/os/impls/DefaultSavedNetworkApiImpl.kt
+++ b/wisefy/savednetworks/src/main/java/com/isupatches/android/wisefy/savednetworks/os/impls/DefaultSavedNetworkApiImpl.kt
@@ -44,7 +44,7 @@ internal class DefaultSavedNetworkApiImpl(
@Suppress("Deprecation")
@RequiresPermission(allOf = [ACCESS_FINE_LOCATION, ACCESS_WIFI_STATE])
override fun getSavedNetworks(): List {
- val savedNetworkConfigurations = wifiManager.configuredNetworks
+ val savedNetworkConfigurations = wifiManager.configuredNetworks ?: emptyList()
logger.d(LOG_TAG, "Saved network configurations: $savedNetworkConfigurations")
return savedNetworkConfigurations
}
diff --git a/wisefy/signal/build.gradle.kts b/wisefy/signal/build.gradle.kts
index 65ecc23c..6d483256 100644
--- a/wisefy/signal/build.gradle.kts
+++ b/wisefy/signal/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_SIGNAL_VERSION
android {
namespace = "com.isupatches.android.wisefy.signal"
diff --git a/wisefy/wifi/build.gradle.kts b/wisefy/wifi/build.gradle.kts
index 63623479..e5cf054a 100644
--- a/wisefy/wifi/build.gradle.kts
+++ b/wisefy/wifi/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
}
group = PublishingConstants.GROUP_ID
-version = BuildVersions.MODULE_VERSION_NAME
+version = BuildVersions.WISEFY_WIFI_VERSION
android {
namespace = "com.isupatches.android.wisefy.wifi"