Skip to content

Commit ada944d

Browse files
committed
Retrieve packageName from context
1 parent 9f5290b commit ada944d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

android/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ buildscript {
1111
dependencies {
1212
classpath("com.android.tools.build:gradle:8.7.0")
1313
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
14-
1514
}
1615
}
1716

android/src/main/kotlin/click/vpnclient/engine/flutter/VpnClientEngineFlutterPlugin.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class VpnclientEngineFlutterPlugin :
5050
try {
5151
singboxCore = SingBoxCore(config)
5252
} catch (e: Exception) {
53-
Log.e(packageName, "Failed to initialize sing-box", e)
53+
Log.e(context.packageName, "Failed to initialize sing-box", e)
5454
}
5555
}
5656

@@ -69,7 +69,7 @@ class VpnclientEngineFlutterPlugin :
6969
singboxCore?.start()
7070
result.success(true)
7171
} catch (e: Exception) {
72-
Log.e(packageName, "Failed to start sing-box", e)
72+
Log.e(context.packageName, "Failed to start sing-box", e)
7373
result.error("START_ERROR", "Failed to start sing-box", e.message)
7474
}
7575
}
@@ -87,7 +87,7 @@ class VpnclientEngineFlutterPlugin :
8787
singboxCore = null // Release sing-box instance after stopping
8888
result.success(true)
8989
} catch (e: Exception) {
90-
Log.e(packageName, "Failed to stop sing-box", e)
90+
Log.e(context.packageName, "Failed to stop sing-box", e)
9191
result.error("STOP_ERROR", "Failed to stop sing-box", e.message)
9292
}
9393
}
@@ -100,7 +100,7 @@ class VpnclientEngineFlutterPlugin :
100100
val status = singboxCore?.getStatus() ?: "stopped"
101101
result.success(status)
102102
} catch (e: Exception) {
103-
Log.e(packageName, "Failed to get sing-box status", e)
103+
Log.e(context.packageName, "Failed to get sing-box status", e)
104104
result.error(
105105
"STATUS_ERROR",
106106
"Failed to get sing-box status",
@@ -128,7 +128,7 @@ class SingBoxCore(
128128
// Load the sing-box configuration from the provided string
129129
Singbox.setConfig(config)
130130
} catch (e: Exception) {
131-
Log.e(packageName, "Error initializing SingBox: ${e.message}")
131+
Log.e(context.packageName, "Error initializing SingBox: ${e.message}")
132132
throw e
133133
}
134134
}
@@ -145,7 +145,7 @@ class SingBoxCore(
145145
throw Exception("Error starting SingBox: $err")
146146
}
147147
} catch (e: Exception) {
148-
Log.e(packageName, "Error starting SingBox: ${e.message}")
148+
Log.e(context.packageName, "Error starting SingBox: ${e.message}")
149149
throw e
150150
}
151151
}
@@ -159,7 +159,7 @@ class SingBoxCore(
159159
// Stop the SingBox core
160160
Singbox.stop()
161161
} catch (e: Exception) {
162-
Log.e(packageName, "Error stopping SingBox: ${e.message}")
162+
Log.e(context.packageName, "Error stopping SingBox: ${e.message}")
163163
throw e
164164
}
165165
}

0 commit comments

Comments
 (0)