Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ $ ./gradlew build

## Update client

* Run `./gradlew generateSwaggerCode`
* Delete `client/settings.gradle` (client is a gradle sub project and must not have a settings.gradle)
* Delete `repositories` block from `client/build.gradle`
* Delete `implementation "com.sun.xml.ws:jaxws-rt:x.x.x“` from `client/build.gradle`
* Insert missing bracket in `retryingIntercept` method of class `src/main/java/com/github/gotify/client/auth/OAuth`
* Run `./gradlew openApiGenerate`
* Commit changes

## Versioning
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
compileSdk = 36
defaultConfig {
applicationId = "com.github.gotify"
minSdk = 23
minSdk = 26
targetSdk = 36
versionCode = 34
versionName = "2.9.0"
Expand Down Expand Up @@ -101,7 +101,7 @@ dependencies {

implementation("com.google.code.gson:gson:2.13.1")
implementation("com.squareup.retrofit2:retrofit:3.0.0")
implementation("org.threeten:threetenbp:1.7.1")

}

configurations {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/github/gotify/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import java.net.MalformedURLException
import java.net.URI
import java.net.URISyntaxException
import java.net.URL
import java.time.OffsetDateTime
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import org.threeten.bp.OffsetDateTime
import org.tinylog.kotlin.Logger

internal object Utils {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ internal class InitializationActivity : AppCompatActivity() {
private fun authenticated(user: User) {
Logger.info("Authenticated as ${user.name}")

settings.setUser(user.name, user.isAdmin)
settings.setUser(user.name, user.admin)
requestVersion {
splashScreenActive = false
startActivity(Intent(this, MessagesActivity::class.java))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import com.github.gotify.databinding.MessageItemCompactBinding
import com.github.gotify.messages.provider.MessageWithImage
import io.noties.markwon.Markwon
import java.text.DateFormat
import java.time.OffsetDateTime
import java.util.Date
import org.threeten.bp.OffsetDateTime

internal class ListMessageAdapter(
private val context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ internal class WebSocketService : Service() {
messages.forEach { message ->
if (lastReceivedMessage.get() < message.id) {
lastReceivedMessage.set(message.id)
highestPriority = highestPriority.coerceAtLeast(message.priority)
highestPriority = highestPriority.coerceAtLeast(message.priority ?: 0L)
}
broadcast(message)
}
Expand All @@ -256,9 +256,9 @@ internal class WebSocketService : Service() {
broadcast(message)
showNotification(
message.id,
message.title,
message.title ?: "",
message.message,
message.priority,
message.priority ?: 0L,
message.extras,
message.appid
)
Expand Down
33 changes: 18 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import com.android.build.gradle.internal.tasks.factory.dependsOn
import java.io.File
import java.net.URI

plugins {
id("com.android.application") version "8.11.0" apply false
id("org.jetbrains.kotlin.android") version "2.2.0" apply false
id("org.hidetake.swagger.generator") version "2.19.2"
id("org.openapi.generator") version "7.19.0"
}

fun download(url: String, filename: String) {
Expand All @@ -29,19 +28,23 @@ tasks.register("downloadSpec") {
}
}

swaggerSources {
create("swagger") {
setInputFile(file("$projectDir/build/gotify.spec.json"))
code.apply {
language = "java"
configFile = file("$projectDir/swagger.config.json")
outputDir = file("$projectDir/client")
}
}
openApiGenerate {
generatorName.set("java")
inputSpec.set("$projectDir/build/gotify.spec.json")
outputDir.set("$projectDir/client")
apiPackage.set("com.github.gotify.client.api")
modelPackage.set("com.github.gotify.client.model")
configOptions.set(mapOf(
"library" to "retrofit2",
"hideGenerationTimestamp" to "true",
"dateLibrary" to "java8"
))
generateApiTests.set(false)
generateModelTests.set(false)
generateApiDocumentation.set(false)
generateModelDocumentation.set(false)
}

dependencies {
"swaggerCodegen"("io.swagger.codegen.v3:swagger-codegen-cli:3.0.63")
tasks.named("openApiGenerate").configure {
dependsOn("downloadSpec")
}

tasks.named("generateSwaggerCode").dependsOn("downloadSpec")
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
build.gradle
build.sbt
gradle/**
gradlew
gradlew.bat
pom.xml
settings.gradle
.github/**
.travis.yml
api/openapi.yaml

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
Expand Down
37 changes: 37 additions & 0 deletions client/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.gitignore
README.md
git_push.sh
gradle.properties
src/main/AndroidManifest.xml
src/main/java/com/github/gotify/client/ApiClient.java
src/main/java/com/github/gotify/client/CollectionFormats.java
src/main/java/com/github/gotify/client/JSON.java
src/main/java/com/github/gotify/client/ServerConfiguration.java
src/main/java/com/github/gotify/client/ServerVariable.java
src/main/java/com/github/gotify/client/StringUtil.java
src/main/java/com/github/gotify/client/api/ApplicationApi.java
src/main/java/com/github/gotify/client/api/ClientApi.java
src/main/java/com/github/gotify/client/api/HealthApi.java
src/main/java/com/github/gotify/client/api/MessageApi.java
src/main/java/com/github/gotify/client/api/PluginApi.java
src/main/java/com/github/gotify/client/api/UserApi.java
src/main/java/com/github/gotify/client/api/VersionApi.java
src/main/java/com/github/gotify/client/auth/ApiKeyAuth.java
src/main/java/com/github/gotify/client/auth/HttpBasicAuth.java
src/main/java/com/github/gotify/client/auth/HttpBearerAuth.java
src/main/java/com/github/gotify/client/auth/OAuthOkHttpClient.java
src/main/java/com/github/gotify/client/model/Application.java
src/main/java/com/github/gotify/client/model/ApplicationParams.java
src/main/java/com/github/gotify/client/model/Client.java
src/main/java/com/github/gotify/client/model/ClientParams.java
src/main/java/com/github/gotify/client/model/CreateUserExternal.java
src/main/java/com/github/gotify/client/model/Error.java
src/main/java/com/github/gotify/client/model/Health.java
src/main/java/com/github/gotify/client/model/Message.java
src/main/java/com/github/gotify/client/model/PagedMessages.java
src/main/java/com/github/gotify/client/model/Paging.java
src/main/java/com/github/gotify/client/model/PluginConf.java
src/main/java/com/github/gotify/client/model/UpdateUserExternal.java
src/main/java/com/github/gotify/client/model/User.java
src/main/java/com/github/gotify/client/model/UserPass.java
src/main/java/com/github/gotify/client/model/VersionInfo.java
1 change: 1 addition & 0 deletions client/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.19.0
1 change: 0 additions & 1 deletion client/.swagger-codegen/VERSION

This file was deleted.

17 changes: 0 additions & 17 deletions client/.travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# swagger-java-client
# openapi-java-client

## Requirements

Expand All @@ -24,9 +24,9 @@ After the client library is installed/deployed, you can use it in your Maven pro

```xml
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-java-client</artifactId>
<version>1.0.0</version>
<groupId>org.openapitools</groupId>
<artifactId>openapi-java-client</artifactId>
<version>2.0.2</version>
<scope>compile</scope>
</dependency>

Expand Down
43 changes: 15 additions & 28 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,39 @@ plugins {
}

ext {
oltu_version = "1.0.2"
retrofit_version = "2.7.1"
swagger_annotations_version = "2.0.0"
junit_version = "4.12"
threetenbp_version = "1.4.1"
json_fire_version = "1.8.3"
oltu_version = "1.0.1"
retrofit_version = "2.11.0"
jakarta_annotation_version = "1.3.5"
swagger_annotations_version = "2.2.28"
junit_version = "5.10.3"
json_fire_version = "1.9.0"
}

dependencies {
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version"
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation ("org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"){
exclude group:'org.apache.oltu.oauth2' , module: 'org.apache.oltu.oauth2.common'
exclude group: 'org.json', module: 'json'
}
implementation "org.json:json:20180130"
implementation "io.gsonfire:gson-fire:$json_fire_version"
implementation "org.threeten:threetenbp:$threetenbp_version"

testImplementation "junit:junit:$junit_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
}

group = 'io.swagger'
version = '1.0.0'
description = 'Swagger Java'

java.sourceCompatibility = 11
java.targetCompatibility = 11
group = 'org.openapitools'
version = '2.0.2'

tasks.register('testsJar', Jar) {
archiveClassifier = 'tests'
from(sourceSets.test.output)
}

java {
withSourcesJar()
withJavadocJar()
}
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11

publishing {
publications {
maven(MavenPublication) {
from(components.java)
artifact(testsJar)
artifactId = 'openapi-java-client'
from components.java
}
}
}
Expand Down
22 changes: 0 additions & 22 deletions client/build.sbt

This file was deleted.

13 changes: 0 additions & 13 deletions client/docs/Application.md

This file was deleted.

Loading
Loading