Update AngConfigManager.kt

This commit is contained in:
MrMalekfar authored and GitHub committed 2024-02-29 09:23:46 +03:30
1 parent e80cce9696
commit 486f3ffc96
1 file changed
+6 -2
@@ -987,7 +987,11 @@ object AngConfigManager {
&& server.contains("routing") && server.contains("routing")
) { ) {
try { try {
val gson = GsonBuilder().setPrettyPrinting().create() //val gson = GsonBuilder().setPrettyPrinting().create()
val gson = new GsonBuilder()
.setLenient()
.setPrettyPrinting()
.create();
val serverList: Array<V2rayConfig> = val serverList: Array<V2rayConfig> =
Gson().fromJson(server, Array<V2rayConfig>::class.java) Gson().fromJson(server, Array<V2rayConfig>::class.java)
if (serverList.isNotEmpty()) { if (serverList.isNotEmpty()) {
@@ -1001,7 +1005,7 @@ object AngConfigManager {
config.subscriptionId = subid config.subscriptionId = subid
config.fullConfig = srv config.fullConfig = srv
val key = MmkvManager.encodeServerConfig("", config) val key = MmkvManager.encodeServerConfig("", config)
serverRawStorage?.encode(key, Gson.toJson(srv)) serverRawStorage?.encode(key, gson.toJson(srv))
count += 1 count += 1
} }
} }