forked from zhufucdev/MotionEmulator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
509 additions
and
115 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'org.jetbrains.kotlin.jvm' | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(11) | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:${kotlinx_serialization_version}" | ||
implementation "io.ktor:ktor-client-core-jvm:${ktor_version}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.zhufucdev.api | ||
|
||
import io.ktor.client.HttpClient | ||
import io.ktor.client.call.body | ||
import io.ktor.client.request.get | ||
import io.ktor.client.request.parameter | ||
import io.ktor.client.request.url | ||
import io.ktor.http.isSuccess | ||
|
||
suspend fun HttpClient.getReleaseAsset( | ||
apiUri: String, | ||
product: String, | ||
current: String, | ||
architect: String? | ||
): ReleaseAsset? { | ||
val req = get { | ||
url(apiUri) | ||
parameter("product", product) | ||
parameter("current", current) | ||
if (architect != null) { | ||
parameter("arch", architect) | ||
} | ||
} | ||
if (!req.status.isSuccess()) { | ||
return null | ||
} | ||
return req.body<ReleaseAsset>() | ||
} | ||
|
||
suspend fun HttpClient.findAsset( | ||
apiUri: String, | ||
vararg category: String, | ||
current: String? = null, | ||
architect: String? = null | ||
): List<ProductQuery> { | ||
val req = get { | ||
url(apiUri) | ||
parameter("category", category.joinToString(",")) | ||
if (current != null) { | ||
parameter("current", current) | ||
} | ||
if (architect != null) { | ||
parameter("arch", architect) | ||
} | ||
} | ||
if (!req.status.isSuccess()) { | ||
return emptyList() | ||
} | ||
return req.body<List<ProductQuery>>() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.zhufucdev.api | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ProductQuery(val name: String, val key: String, val category: List<String>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.zhufucdev.api | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ReleaseAsset(val versionName: String, val productName: String, val url: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
.../zhufucdev/motion_emulator/AMapConvert.kt → .../motion_emulator/extension/AMapConvert.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/zhufucdev/motion_emulator/extension/Constants.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.zhufucdev.motion_emulator.extension | ||
|
||
import com.zhufucdev.motion_emulator.BuildConfig | ||
|
||
const val FILE_PROVIDER_AUTHORITY = "${BuildConfig.APPLICATION_ID}.file_provider" |
2 changes: 1 addition & 1 deletion
2
...ucdev/motion_emulator/GoogleMapConvert.kt → ...on_emulator/extension/GoogleMapConvert.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/zhufucdev/motion_emulator/extension/Updater.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.zhufucdev.motion_emulator.extension | ||
|
||
import android.content.Context | ||
import com.zhufucdev.motion_emulator.BuildConfig | ||
import java.io.File | ||
|
||
fun Updater(product: String, context: Context) = com.zhufucdev.update.Updater( | ||
BuildConfig.SERVER_URI, | ||
product, | ||
context, | ||
File(context.externalCacheDir, "update") | ||
) | ||
|
||
fun Updater(context: Context) = Updater(BuildConfig.PRODUCT, context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
app/src/main/java/com/zhufucdev/motion_emulator/provider/Scheduler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.