Skip to content

Commit 33f95f5

Browse files
author
Saumya Macwan
committed
Unused imports are released
1 parent 08611e5 commit 33f95f5

4 files changed

Lines changed: 71 additions & 12 deletions

File tree

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id("com.android.application") version "8.1.1" apply false
43
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
54
id("com.android.library") version "8.1.1" apply false
65
}

gradle.properties

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ kotlin.code.style=official
2020
# Enables namespacing of each library's R class so that its R class includes only the
2121
# resources declared in the library itself and none from the library's dependencies,
2222
# thereby reducing the size of the R class for that library
23-
android.nonTransitiveRClass=true
23+
android.nonTransitiveRClass=true
24+
25+
ossrhUsername=x1skAg+F
26+
ossrhPassword=dQNxzQIMN5odbs8pSOFoBkA+U1nJ1RYKHJyBaMVV5E8j
27+
28+
mavenCentralUsername=saumya10
29+
mavenCentralPassword=h4hGH*64Zf%DmWV

network_logger/build.gradle.kts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ plugins {
22
id("com.android.library")
33
id("org.jetbrains.kotlin.android")
44
kotlin("kapt")
5+
id("maven-publish")
56
}
67

8+
group = "com.sam"
9+
version = "1.0.0"
10+
711
android {
812
namespace = "com.sam.network_logger"
913
compileSdk = 33
@@ -80,4 +84,56 @@ dependencies {
8084
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
8185
compilerOptions.freeCompilerArgs.add("-opt-in=androidx.compose.material3.ExperimentalMaterial3Api")
8286
compilerOptions.freeCompilerArgs.add("-opt-in=androidx.compose.foundation.ExperimentalFoundationApi")
87+
}
88+
89+
publishing {
90+
publications {
91+
create<MavenPublication>("NetworkLogger") {
92+
groupId = "com.sam"
93+
artifactId = "network-logger"
94+
version = "1.0.0"
95+
96+
pom {
97+
licenses {
98+
license {
99+
name.set("The Apache License, Version 2.0")
100+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
101+
}
102+
}
103+
developers {
104+
developer {
105+
id.set("sam829")
106+
name.set("Sam Macwan")
107+
email.set("macwansaumya2@gmail.com")
108+
}
109+
}
110+
scm {
111+
connection.set("scm:git:git://github.com/sam829/network_logging.git")
112+
developerConnection.set("scm:git:ssh://github.com/sam829/network_logging.git")
113+
}
114+
}
115+
116+
afterEvaluate {
117+
from(components["release"])
118+
}
119+
}
120+
}
121+
122+
repositories {
123+
maven {
124+
name = "MavenCentral"
125+
/*url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
126+
credentials {
127+
username = project.findProperty("ossrhUsername")?.toString()
128+
?: System.getenv("OSSRH_USERNAME")
129+
password = project.findProperty("ossrhPassword")?.toString()
130+
?: System.getenv("OSSRH_PASSWORD")
131+
}*/
132+
url = uri("https://repo1.maven.org/maven2/")
133+
credentials {
134+
username = project.findProperty("mavenCentralUsername")?.toString()
135+
password = project.findProperty("mavenCentralPassword")?.toString()
136+
}
137+
}
138+
}
83139
}

network_logger/src/main/kotlin/com/sam/network_logger/ui/bottomsheet/LogSheet.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import androidx.compose.runtime.derivedStateOf
2121
import androidx.compose.runtime.getValue
2222
import androidx.compose.runtime.mutableStateOf
2323
import androidx.compose.runtime.remember
24-
import androidx.compose.runtime.rememberCoroutineScope
2524
import androidx.compose.runtime.saveable.rememberSaveable
2625
import androidx.compose.runtime.setValue
2726
import androidx.compose.ui.Alignment
@@ -36,8 +35,6 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
3635
import com.sam.network_logger.data.source.local.LoggerDatabase
3736
import com.sam.network_logger.data.source.local.entity.NetworkCall
3837
import com.sam.network_logger.helpers.startListeningToAccelerometer
39-
import kotlinx.coroutines.Dispatchers
40-
import kotlinx.coroutines.launch
4138

4239
@Composable
4340
fun LogsSheet(
@@ -47,7 +44,7 @@ fun LogsSheet(
4744
var selectedNetworkCall: NetworkCall? by remember { mutableStateOf(null) }
4845
val isDetailView by remember { derivedStateOf { selectedNetworkCall != null } }
4946

50-
val scope = rememberCoroutineScope()
47+
// val scope = rememberCoroutineScope()
5148

5249
val lifecycleOwner = LocalLifecycleOwner.current
5350
val context = LocalContext.current
@@ -57,10 +54,10 @@ fun LogsSheet(
5754
.collectAsStateWithLifecycle(initialValue = emptyList())
5855

5956
BackHandler(enabled = isDetailView || isSheetOpen) {
60-
if(!isDetailView) {
57+
if (!isDetailView) {
6158
isSheetOpen = false
6259
}
63-
if(isDetailView) {
60+
if (isDetailView) {
6461
selectedNetworkCall = null
6562
}
6663
}
@@ -69,11 +66,11 @@ fun LogsSheet(
6966
val observer = LifecycleEventObserver { _, event ->
7067
startListeningToAccelerometer(context, event) { isSheetOpen = true }
7168
if (event == Lifecycle.Event.ON_CREATE) {
72-
scope.launch(Dispatchers.IO) {
69+
/*scope.launch(Dispatchers.IO) {
7370
if (!networkDao.getAllNetworkCall().isNullOrEmpty()) {
7471
networkDao.nukeNetworkCalls()
7572
}
76-
}
73+
}*/
7774
}
7875
}
7976
lifecycleOwner.lifecycle.addObserver(observer)
@@ -141,13 +138,14 @@ fun LogsSheet(
141138
) {
142139
LogList(
143140
materialTheme = materialTheme,
144-
data = data.filter { it.requestUrl?.contains(query) == true },
141+
data = data.filter { it.requestUrl?.contains(query) == true }
142+
.reversed(),
145143
onItemClick = { selectedNetworkCall = it }
146144
)
147145
}
148146
LogList(
149147
materialTheme = materialTheme,
150-
data = data,
148+
data = data.reversed(),
151149
onItemClick = { selectedNetworkCall = it }
152150
)
153151
}

0 commit comments

Comments
 (0)