diff --git a/githubAppUpdate/build.gradle.kts b/githubAppUpdate/build.gradle.kts index fec517d..0ff39f3 100644 --- a/githubAppUpdate/build.gradle.kts +++ b/githubAppUpdate/build.gradle.kts @@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { id("com.android.library") id("maven-publish") + kotlin("plugin.serialization") version "2.3.20" } android { @@ -10,6 +11,7 @@ android { compileSdk = 36 defaultConfig { minSdk = 23 + consumerProguardFiles("proguard-rules.pro") } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -31,12 +33,12 @@ base { dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.3.20") - implementation("com.google.code.gson:gson:2.13.2") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1") implementation("androidx.work:work-runtime-ktx:2.11.2") implementation("com.squareup.retrofit2:retrofit:3.0.0") implementation("androidx.appcompat:appcompat:1.7.1") - implementation("com.squareup.retrofit2:converter-gson:3.0.0") + implementation("com.squareup.retrofit2:converter-kotlinx-serialization:3.0.0") implementation("androidx.preference:preference-ktx:1.2.1") api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2") api("androidx.lifecycle:lifecycle-runtime-ktx:2.10.0") diff --git a/githubAppUpdate/proguard-rules.pro b/githubAppUpdate/proguard-rules.pro index 06e711f..af0f8c1 100644 --- a/githubAppUpdate/proguard-rules.pro +++ b/githubAppUpdate/proguard-rules.pro @@ -1,7 +1,7 @@ # Keep Kotlin metadata for coroutines -keep class kotlin.Metadata { *; } -keepattributes RuntimeVisibleAnnotations --keepattributes *Annotation* +-keepattributes *Annotation*,InnerClasses,AnnotationDefault # Keep coroutine related classes -keepclassmembernames class kotlinx.** { @@ -14,7 +14,6 @@ # Don't obfuscate Kotlin metadata -keepattributes SourceFile,LineNumberTable --renamesourcefileattribute SourceFile # Keep synthetic methods for Kotlin coroutines -keepclassmembers class ** { @@ -31,3 +30,35 @@ # Keep lifecycle coroutine scope -keep class androidx.lifecycle.** { *; } -keepclassmembers class androidx.lifecycle.** { *; } + +##------------------ kotlinx.serialization ------------------ + +# Keep @Serializable companion objects and their serializer() methods +-if @kotlinx.serialization.Serializable class ** +-keepclassmembers class <1> { + static <1>$Companion Companion; +} + +# Keep serializer() on named companion objects of serializable classes +-if @kotlinx.serialization.Serializable class ** { + static **$* *; +} +-keepclassmembers class <2>$<3> { + kotlinx.serialization.KSerializer serializer(...); +} + +# Keep INSTANCE.serializer() for serializable objects +-if @kotlinx.serialization.Serializable class ** { + public static ** INSTANCE; +} +-keepclassmembers class <1> { + public static <1> INSTANCE; + kotlinx.serialization.KSerializer serializer(...); +} + +# Keep serialization descriptor fields +-keepclassmembers class kotlinx.serialization.internal.** { *; } + +# Suppress notes about kotlinx.serialization internals +-dontnote kotlinx.serialization.** +-dontwarn kotlinx.serialization.** diff --git a/githubAppUpdate/src/main/java/info/hannes/github/AppUpdateHelper.kt b/githubAppUpdate/src/main/java/info/hannes/github/AppUpdateHelper.kt index 07f97ca..4555e74 100644 --- a/githubAppUpdate/src/main/java/info/hannes/github/AppUpdateHelper.kt +++ b/githubAppUpdate/src/main/java/info/hannes/github/AppUpdateHelper.kt @@ -68,7 +68,7 @@ object AppUpdateHelper { prefs.edit { putLong(key, System.currentTimeMillis()) } versionList.body()?.firstOrNull()?.let { release -> - val assetApk = release.assets.find { it.name.endsWith("release.apk") } + val assetApk = release.assets.find { it.name?.endsWith("release.apk") == true } Log.d("AppUpdateHelper", release.tagName + " > " + currentVersionName + " " + (release.tagName > currentVersionName)) if (release.tagName > currentVersionName) { @@ -96,7 +96,7 @@ object AppUpdateHelper { val versionList = requestVersionsSync(gitRepoUrl, token) versionList.body()?.firstOrNull()?.let { release -> - val assetApk = release.assets.find { it.name.endsWith("release.apk") } + val assetApk = release.assets.find { it.name?.endsWith("release.apk") == true } Log.d("AppUpdateHelper", release.tagName + " > " + currentVersionName + " " + (release.tagName > currentVersionName)) val text = "You use version $currentVersionName\n" + @@ -112,12 +112,12 @@ object AppUpdateHelper { } } - private fun requestVersionsSync(gitRepoUrl: String, token: String? = null): Response> { + private fun requestVersionsSync(gitRepoUrl: String, token: String? = null): Response> { val client = GithubClient(HttpLoggingInterceptor.Level.BODY, token) return client.github.getGithubVersions(gitRepoUrl.user(), gitRepoUrl.repo()).execute() } - private suspend fun requestGithubVersions(gitRepoUrl: String, token: String? = null): Response> { + private suspend fun requestGithubVersions(gitRepoUrl: String, token: String? = null): Response> { val versionList = withContext(Dispatchers.Default) { val client = GithubClient(HttpLoggingInterceptor.Level.BODY, token) client.github.getGithubVersions(gitRepoUrl.user(), gitRepoUrl.repo()).execute() @@ -147,7 +147,7 @@ object AppUpdateHelper { dialog.dismiss() } .setPositiveButton(activity.getString(R.string.showRelease)) { dialog, _ -> - val uriUrl = release.htmlUrl.toUri() + val uriUrl = release.htmlUrl.orEmpty().toUri() Log.d("open", uriUrl.toString()) activity.startActivity(Intent(Intent.ACTION_VIEW, uriUrl)) dialog.dismiss() @@ -155,7 +155,7 @@ object AppUpdateHelper { assetApk?.let { dialog.setNeutralButton(activity.getString(R.string.directDownload)) { dialog, _ -> - val uriUrl = it.browserDownloadUrl.toUri() + val uriUrl = it.browserDownloadUrl.orEmpty().toUri() Log.d("open", uriUrl.toString()) activity.startActivity(Intent(Intent.ACTION_VIEW, uriUrl)) dialog.dismiss() diff --git a/githubAppUpdate/src/main/java/info/hannes/github/GithubRestServiceCreationHelper.kt b/githubAppUpdate/src/main/java/info/hannes/github/GithubRestServiceCreationHelper.kt index 74a11fe..fad12be 100644 --- a/githubAppUpdate/src/main/java/info/hannes/github/GithubRestServiceCreationHelper.kt +++ b/githubAppUpdate/src/main/java/info/hannes/github/GithubRestServiceCreationHelper.kt @@ -1,23 +1,23 @@ package info.hannes.github -import com.google.gson.Gson -import com.google.gson.GsonBuilder +import kotlinx.serialization.json.Json +import okhttp3.MediaType.Companion.toMediaType import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit -import retrofit2.converter.gson.GsonConverterFactory +import retrofit2.converter.kotlinx.serialization.asConverterFactory internal object GithubRestServiceCreationHelper { private var httpLoggingInterceptor: HttpLoggingInterceptor = HttpLoggingInterceptor() - init { - httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.NONE + private val json = Json { + ignoreUnknownKeys = true + coerceInputValues = true } - private fun createGson(): Gson { - return GsonBuilder().serializeNulls() - .create() + init { + httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.NONE } fun createGithubService(retrofitInterface: Class, logLevel: HttpLoggingInterceptor.Level, token: String? = null): T { @@ -34,11 +34,10 @@ internal object GithubRestServiceCreationHelper { val client = clientHttp .build() - val gson = createGson() val retrofit = Retrofit.Builder() .baseUrl("https://api.github.com") .client(client) - .addConverterFactory(GsonConverterFactory.create(gson)) + .addConverterFactory(json.asConverterFactory("application/json; charset=UTF-8".toMediaType())) .build() return retrofit.create(retrofitInterface) diff --git a/githubAppUpdate/src/main/java/info/hannes/github/IGithub.java b/githubAppUpdate/src/main/java/info/hannes/github/IGithub.java deleted file mode 100644 index c6817ce..0000000 --- a/githubAppUpdate/src/main/java/info/hannes/github/IGithub.java +++ /dev/null @@ -1,19 +0,0 @@ -package info.hannes.github; - -import java.util.List; - -import info.hannes.github.model.GithubVersion; -import retrofit2.Call; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.Path; - -public interface IGithub { - - @GET("/repos/{githubUser}/{githubRepo}/releases") - @Headers("Accept: application/json") - Call> getGithubVersions( - @Path("githubUser") String githubUser, - @Path("githubRepo") String githubRepo); - -} diff --git a/githubAppUpdate/src/main/java/info/hannes/github/IGithub.kt b/githubAppUpdate/src/main/java/info/hannes/github/IGithub.kt new file mode 100644 index 0000000..3b16450 --- /dev/null +++ b/githubAppUpdate/src/main/java/info/hannes/github/IGithub.kt @@ -0,0 +1,16 @@ +package info.hannes.github + +import info.hannes.github.model.GithubVersion +import retrofit2.Call +import retrofit2.http.GET +import retrofit2.http.Headers +import retrofit2.http.Path + +interface IGithub { + @GET("/repos/{githubUser}/{githubRepo}/releases") + @Headers("Accept: application/json") + fun getGithubVersions( + @Path("githubUser") githubUser: String, + @Path("githubRepo") githubRepo: String + ): Call> +} diff --git a/githubAppUpdate/src/main/java/info/hannes/github/Notify.kt b/githubAppUpdate/src/main/java/info/hannes/github/Notify.kt index 193f60b..d149600 100755 --- a/githubAppUpdate/src/main/java/info/hannes/github/Notify.kt +++ b/githubAppUpdate/src/main/java/info/hannes/github/Notify.kt @@ -42,7 +42,7 @@ internal object Notify { //the message that will be displayed as the ticker val ticker = "$contentTitle $messageString" - val showUrl = release.htmlUrl.toUri() + val showUrl = release.htmlUrl.orEmpty().toUri() val showPendingIntent = PendingIntent.getActivity(context, 0, Intent(Intent.ACTION_VIEW, showUrl), PENDING_INTENT_FLAGS) //build the notification @@ -58,7 +58,7 @@ internal object Notify { .addAction(R.drawable.githib_logo, context.getString(R.string.showRelease), showPendingIntent) assetApk?.let { - val uriUrl = it.browserDownloadUrl.toUri() + val uriUrl = it.browserDownloadUrl.orEmpty().toUri() val directPendingIntent = PendingIntent.getActivity(context, 0, Intent(Intent.ACTION_VIEW, uriUrl), PENDING_INTENT_FLAGS) notificationCompat.addAction(R.drawable.githib_logo, context.getString(R.string.directDownload), directPendingIntent) } diff --git a/githubAppUpdate/src/main/java/info/hannes/github/model/Asset.java b/githubAppUpdate/src/main/java/info/hannes/github/model/Asset.java deleted file mode 100644 index 3a54567..0000000 --- a/githubAppUpdate/src/main/java/info/hannes/github/model/Asset.java +++ /dev/null @@ -1,152 +0,0 @@ -package info.hannes.github.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -public class Asset { - - @SerializedName("url") - @Expose - private String url; - @SerializedName("id") - @Expose - private Integer id; - @SerializedName("node_id") - @Expose - private String nodeId; - @SerializedName("name") - @Expose - private String name; - @SerializedName("label") - @Expose - private String label; - @SerializedName("uploader") - @Expose - private Uploader uploader; - @SerializedName("content_type") - @Expose - private String contentType; - @SerializedName("state") - @Expose - private String state; - @SerializedName("size") - @Expose - private Integer size; - @SerializedName("download_count") - @Expose - private Integer downloadCount; - @SerializedName("created_at") - @Expose - private String createdAt; - @SerializedName("updated_at") - @Expose - private String updatedAt; - @SerializedName("browser_download_url") - @Expose - private String browserDownloadUrl; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public Uploader getUploader() { - return uploader; - } - - public void setUploader(Uploader uploader) { - this.uploader = uploader; - } - - public String getContentType() { - return contentType; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public Integer getSize() { - return size; - } - - public void setSize(Integer size) { - this.size = size; - } - - public Integer getDownloadCount() { - return downloadCount; - } - - public void setDownloadCount(Integer downloadCount) { - this.downloadCount = downloadCount; - } - - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - public String getBrowserDownloadUrl() { - return browserDownloadUrl; - } - - public void setBrowserDownloadUrl(String browserDownloadUrl) { - this.browserDownloadUrl = browserDownloadUrl; - } - -} diff --git a/githubAppUpdate/src/main/java/info/hannes/github/model/Asset.kt b/githubAppUpdate/src/main/java/info/hannes/github/model/Asset.kt new file mode 100644 index 0000000..33cfc97 --- /dev/null +++ b/githubAppUpdate/src/main/java/info/hannes/github/model/Asset.kt @@ -0,0 +1,21 @@ +package info.hannes.github.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Asset( + @SerialName("url") val url: String? = null, + @SerialName("id") val id: Int? = null, + @SerialName("node_id") val nodeId: String? = null, + @SerialName("name") val name: String? = null, + @SerialName("label") val label: String? = null, + @SerialName("uploader") val uploader: Uploader? = null, + @SerialName("content_type") val contentType: String? = null, + @SerialName("state") val state: String? = null, + @SerialName("size") val size: Int? = null, + @SerialName("download_count") val downloadCount: Int? = null, + @SerialName("created_at") val createdAt: String? = null, + @SerialName("updated_at") val updatedAt: String? = null, + @SerialName("browser_download_url") val browserDownloadUrl: String? = null, +) diff --git a/githubAppUpdate/src/main/java/info/hannes/github/model/Author.java b/githubAppUpdate/src/main/java/info/hannes/github/model/Author.java deleted file mode 100644 index 8fbd51d..0000000 --- a/githubAppUpdate/src/main/java/info/hannes/github/model/Author.java +++ /dev/null @@ -1,207 +0,0 @@ -package info.hannes.github.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -public class Author { - - @SerializedName("login") - @Expose - private String login; - @SerializedName("id") - @Expose - private Integer id; - @SerializedName("node_id") - @Expose - private String nodeId; - @SerializedName("avatar_url") - @Expose - private String avatarUrl; - @SerializedName("gravatar_id") - @Expose - private String gravatarId; - @SerializedName("url") - @Expose - private String url; - @SerializedName("html_url") - @Expose - private String htmlUrl; - @SerializedName("followers_url") - @Expose - private String followersUrl; - @SerializedName("following_url") - @Expose - private String followingUrl; - @SerializedName("gists_url") - @Expose - private String gistsUrl; - @SerializedName("starred_url") - @Expose - private String starredUrl; - @SerializedName("subscriptions_url") - @Expose - private String subscriptionsUrl; - @SerializedName("organizations_url") - @Expose - private String organizationsUrl; - @SerializedName("repos_url") - @Expose - private String reposUrl; - @SerializedName("events_url") - @Expose - private String eventsUrl; - @SerializedName("received_events_url") - @Expose - private String receivedEventsUrl; - @SerializedName("type") - @Expose - private String type; - @SerializedName("site_admin") - @Expose - private Boolean siteAdmin; - - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public String getAvatarUrl() { - return avatarUrl; - } - - public void setAvatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - } - - public String getGravatarId() { - return gravatarId; - } - - public void setGravatarId(String gravatarId) { - this.gravatarId = gravatarId; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getHtmlUrl() { - return htmlUrl; - } - - public void setHtmlUrl(String htmlUrl) { - this.htmlUrl = htmlUrl; - } - - public String getFollowersUrl() { - return followersUrl; - } - - public void setFollowersUrl(String followersUrl) { - this.followersUrl = followersUrl; - } - - public String getFollowingUrl() { - return followingUrl; - } - - public void setFollowingUrl(String followingUrl) { - this.followingUrl = followingUrl; - } - - public String getGistsUrl() { - return gistsUrl; - } - - public void setGistsUrl(String gistsUrl) { - this.gistsUrl = gistsUrl; - } - - public String getStarredUrl() { - return starredUrl; - } - - public void setStarredUrl(String starredUrl) { - this.starredUrl = starredUrl; - } - - public String getSubscriptionsUrl() { - return subscriptionsUrl; - } - - public void setSubscriptionsUrl(String subscriptionsUrl) { - this.subscriptionsUrl = subscriptionsUrl; - } - - public String getOrganizationsUrl() { - return organizationsUrl; - } - - public void setOrganizationsUrl(String organizationsUrl) { - this.organizationsUrl = organizationsUrl; - } - - public String getReposUrl() { - return reposUrl; - } - - public void setReposUrl(String reposUrl) { - this.reposUrl = reposUrl; - } - - public String getEventsUrl() { - return eventsUrl; - } - - public void setEventsUrl(String eventsUrl) { - this.eventsUrl = eventsUrl; - } - - public String getReceivedEventsUrl() { - return receivedEventsUrl; - } - - public void setReceivedEventsUrl(String receivedEventsUrl) { - this.receivedEventsUrl = receivedEventsUrl; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Boolean getSiteAdmin() { - return siteAdmin; - } - - public void setSiteAdmin(Boolean siteAdmin) { - this.siteAdmin = siteAdmin; - } - -} diff --git a/githubAppUpdate/src/main/java/info/hannes/github/model/Author.kt b/githubAppUpdate/src/main/java/info/hannes/github/model/Author.kt new file mode 100644 index 0000000..bec55c1 --- /dev/null +++ b/githubAppUpdate/src/main/java/info/hannes/github/model/Author.kt @@ -0,0 +1,26 @@ +package info.hannes.github.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Author( + @SerialName("login") val login: String? = null, + @SerialName("id") val id: Int? = null, + @SerialName("node_id") val nodeId: String? = null, + @SerialName("avatar_url") val avatarUrl: String? = null, + @SerialName("gravatar_id") val gravatarId: String? = null, + @SerialName("url") val url: String? = null, + @SerialName("html_url") val htmlUrl: String? = null, + @SerialName("followers_url") val followersUrl: String? = null, + @SerialName("following_url") val followingUrl: String? = null, + @SerialName("gists_url") val gistsUrl: String? = null, + @SerialName("starred_url") val starredUrl: String? = null, + @SerialName("subscriptions_url") val subscriptionsUrl: String? = null, + @SerialName("organizations_url") val organizationsUrl: String? = null, + @SerialName("repos_url") val reposUrl: String? = null, + @SerialName("events_url") val eventsUrl: String? = null, + @SerialName("received_events_url") val receivedEventsUrl: String? = null, + @SerialName("type") val type: String? = null, + @SerialName("site_admin") val siteAdmin: Boolean? = null, +) diff --git a/githubAppUpdate/src/main/java/info/hannes/github/model/GithubVersion.java b/githubAppUpdate/src/main/java/info/hannes/github/model/GithubVersion.java deleted file mode 100644 index bbc27fd..0000000 --- a/githubAppUpdate/src/main/java/info/hannes/github/model/GithubVersion.java +++ /dev/null @@ -1,209 +0,0 @@ -package info.hannes.github.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -public class GithubVersion { - - @SerializedName("url") - @Expose - private String url; - @SerializedName("assets_url") - @Expose - private String assetsUrl; - @SerializedName("upload_url") - @Expose - private String uploadUrl; - @SerializedName("html_url") - @Expose - private String htmlUrl; - @SerializedName("id") - @Expose - private Integer id; - @SerializedName("node_id") - @Expose - private String nodeId; - @SerializedName("tag_name") - @Expose - private String tagName; - @SerializedName("target_commitish") - @Expose - private String targetCommitish; - @SerializedName("name") - @Expose - private Object name; - @SerializedName("draft") - @Expose - private Boolean draft; - @SerializedName("author") - @Expose - private Author author; - @SerializedName("prerelease") - @Expose - private Boolean prerelease; - @SerializedName("created_at") - @Expose - private String createdAt; - @SerializedName("published_at") - @Expose - private String publishedAt; - @SerializedName("assets") - @Expose - private List assets = null; - @SerializedName("tarball_url") - @Expose - private String tarballUrl; - @SerializedName("zipball_url") - @Expose - private String zipballUrl; - @SerializedName("body") - @Expose - private Object body; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getAssetsUrl() { - return assetsUrl; - } - - public void setAssetsUrl(String assetsUrl) { - this.assetsUrl = assetsUrl; - } - - public String getUploadUrl() { - return uploadUrl; - } - - public void setUploadUrl(String uploadUrl) { - this.uploadUrl = uploadUrl; - } - - public String getHtmlUrl() { - return htmlUrl; - } - - public void setHtmlUrl(String htmlUrl) { - this.htmlUrl = htmlUrl; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public String getTagName() { - return tagName; - } - - public void setTagName(String tagName) { - this.tagName = tagName; - } - - public String getTargetCommitish() { - return targetCommitish; - } - - public void setTargetCommitish(String targetCommitish) { - this.targetCommitish = targetCommitish; - } - - public Object getName() { - return name; - } - - public void setName(Object name) { - this.name = name; - } - - public Boolean getDraft() { - return draft; - } - - public void setDraft(Boolean draft) { - this.draft = draft; - } - - public Author getAuthor() { - return author; - } - - public void setAuthor(Author author) { - this.author = author; - } - - public Boolean getPrerelease() { - return prerelease; - } - - public void setPrerelease(Boolean prerelease) { - this.prerelease = prerelease; - } - - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - public String getPublishedAt() { - return publishedAt; - } - - public void setPublishedAt(String publishedAt) { - this.publishedAt = publishedAt; - } - - public List getAssets() { - return assets; - } - - public void setAssets(List assets) { - this.assets = assets; - } - - public String getTarballUrl() { - return tarballUrl; - } - - public void setTarballUrl(String tarballUrl) { - this.tarballUrl = tarballUrl; - } - - public String getZipballUrl() { - return zipballUrl; - } - - public void setZipballUrl(String zipballUrl) { - this.zipballUrl = zipballUrl; - } - - public Object getBody() { - return body; - } - - public void setBody(Object body) { - this.body = body; - } - -} diff --git a/githubAppUpdate/src/main/java/info/hannes/github/model/GithubVersion.kt b/githubAppUpdate/src/main/java/info/hannes/github/model/GithubVersion.kt new file mode 100644 index 0000000..d308106 --- /dev/null +++ b/githubAppUpdate/src/main/java/info/hannes/github/model/GithubVersion.kt @@ -0,0 +1,26 @@ +package info.hannes.github.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class GithubVersion( + @SerialName("url") val url: String? = null, + @SerialName("assets_url") val assetsUrl: String? = null, + @SerialName("upload_url") val uploadUrl: String? = null, + @SerialName("html_url") val htmlUrl: String? = null, + @SerialName("id") val id: Int? = null, + @SerialName("node_id") val nodeId: String? = null, + @SerialName("tag_name") val tagName: String = "", + @SerialName("target_commitish") val targetCommitish: String? = null, + @SerialName("name") val name: String? = null, + @SerialName("draft") val draft: Boolean? = null, + @SerialName("author") val author: Author? = null, + @SerialName("prerelease") val prerelease: Boolean? = null, + @SerialName("created_at") val createdAt: String? = null, + @SerialName("published_at") val publishedAt: String? = null, + @SerialName("assets") val assets: List = emptyList(), + @SerialName("tarball_url") val tarballUrl: String? = null, + @SerialName("zipball_url") val zipballUrl: String? = null, + @SerialName("body") val body: String? = null, +) diff --git a/githubAppUpdate/src/main/java/info/hannes/github/model/Uploader.java b/githubAppUpdate/src/main/java/info/hannes/github/model/Uploader.java deleted file mode 100644 index 56d8bf8..0000000 --- a/githubAppUpdate/src/main/java/info/hannes/github/model/Uploader.java +++ /dev/null @@ -1,207 +0,0 @@ -package info.hannes.github.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -public class Uploader { - - @SerializedName("login") - @Expose - private String login; - @SerializedName("id") - @Expose - private Integer id; - @SerializedName("node_id") - @Expose - private String nodeId; - @SerializedName("avatar_url") - @Expose - private String avatarUrl; - @SerializedName("gravatar_id") - @Expose - private String gravatarId; - @SerializedName("url") - @Expose - private String url; - @SerializedName("html_url") - @Expose - private String htmlUrl; - @SerializedName("followers_url") - @Expose - private String followersUrl; - @SerializedName("following_url") - @Expose - private String followingUrl; - @SerializedName("gists_url") - @Expose - private String gistsUrl; - @SerializedName("starred_url") - @Expose - private String starredUrl; - @SerializedName("subscriptions_url") - @Expose - private String subscriptionsUrl; - @SerializedName("organizations_url") - @Expose - private String organizationsUrl; - @SerializedName("repos_url") - @Expose - private String reposUrl; - @SerializedName("events_url") - @Expose - private String eventsUrl; - @SerializedName("received_events_url") - @Expose - private String receivedEventsUrl; - @SerializedName("type") - @Expose - private String type; - @SerializedName("site_admin") - @Expose - private Boolean siteAdmin; - - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public String getAvatarUrl() { - return avatarUrl; - } - - public void setAvatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - } - - public String getGravatarId() { - return gravatarId; - } - - public void setGravatarId(String gravatarId) { - this.gravatarId = gravatarId; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getHtmlUrl() { - return htmlUrl; - } - - public void setHtmlUrl(String htmlUrl) { - this.htmlUrl = htmlUrl; - } - - public String getFollowersUrl() { - return followersUrl; - } - - public void setFollowersUrl(String followersUrl) { - this.followersUrl = followersUrl; - } - - public String getFollowingUrl() { - return followingUrl; - } - - public void setFollowingUrl(String followingUrl) { - this.followingUrl = followingUrl; - } - - public String getGistsUrl() { - return gistsUrl; - } - - public void setGistsUrl(String gistsUrl) { - this.gistsUrl = gistsUrl; - } - - public String getStarredUrl() { - return starredUrl; - } - - public void setStarredUrl(String starredUrl) { - this.starredUrl = starredUrl; - } - - public String getSubscriptionsUrl() { - return subscriptionsUrl; - } - - public void setSubscriptionsUrl(String subscriptionsUrl) { - this.subscriptionsUrl = subscriptionsUrl; - } - - public String getOrganizationsUrl() { - return organizationsUrl; - } - - public void setOrganizationsUrl(String organizationsUrl) { - this.organizationsUrl = organizationsUrl; - } - - public String getReposUrl() { - return reposUrl; - } - - public void setReposUrl(String reposUrl) { - this.reposUrl = reposUrl; - } - - public String getEventsUrl() { - return eventsUrl; - } - - public void setEventsUrl(String eventsUrl) { - this.eventsUrl = eventsUrl; - } - - public String getReceivedEventsUrl() { - return receivedEventsUrl; - } - - public void setReceivedEventsUrl(String receivedEventsUrl) { - this.receivedEventsUrl = receivedEventsUrl; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Boolean getSiteAdmin() { - return siteAdmin; - } - - public void setSiteAdmin(Boolean siteAdmin) { - this.siteAdmin = siteAdmin; - } - -} diff --git a/githubAppUpdate/src/main/java/info/hannes/github/model/Uploader.kt b/githubAppUpdate/src/main/java/info/hannes/github/model/Uploader.kt new file mode 100644 index 0000000..0925cc6 --- /dev/null +++ b/githubAppUpdate/src/main/java/info/hannes/github/model/Uploader.kt @@ -0,0 +1,26 @@ +package info.hannes.github.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Uploader( + @SerialName("login") val login: String? = null, + @SerialName("id") val id: Int? = null, + @SerialName("node_id") val nodeId: String? = null, + @SerialName("avatar_url") val avatarUrl: String? = null, + @SerialName("gravatar_id") val gravatarId: String? = null, + @SerialName("url") val url: String? = null, + @SerialName("html_url") val htmlUrl: String? = null, + @SerialName("followers_url") val followersUrl: String? = null, + @SerialName("following_url") val followingUrl: String? = null, + @SerialName("gists_url") val gistsUrl: String? = null, + @SerialName("starred_url") val starredUrl: String? = null, + @SerialName("subscriptions_url") val subscriptionsUrl: String? = null, + @SerialName("organizations_url") val organizationsUrl: String? = null, + @SerialName("repos_url") val reposUrl: String? = null, + @SerialName("events_url") val eventsUrl: String? = null, + @SerialName("received_events_url") val receivedEventsUrl: String? = null, + @SerialName("type") val type: String? = null, + @SerialName("site_admin") val siteAdmin: Boolean? = null, +)