Skip to content
Snippets Groups Projects
Verified Commit d335afb6 authored by Torsten Grote's avatar Torsten Grote
Browse files

Move webserver to core

parent f27d03a1
No related branches found
No related tags found
1 merge request!7Move Ktor to core
Pipeline #7212 failed
......@@ -66,11 +66,6 @@ dependencies {
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
def ktorVersion = '1.6.2'
implementation "io.ktor:ktor-server-core:$ktorVersion"
implementation "io.ktor:ktor-server-netty:$ktorVersion"
implementation "ch.qos.logback:logback-classic:1.2.5"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
......
......
......@@ -7,7 +7,7 @@ import android.os.IBinder
import androidx.core.content.ContextCompat
import dagger.hilt.android.AndroidEntryPoint
import org.briarproject.mailbox.android.MailboxNotificationManager.Companion.NOTIFICATION_MAIN_ID
import org.briarproject.mailbox.server.WebServerManager
import org.briarproject.mailbox.core.server.WebServerManager
import javax.inject.Inject
@AndroidEntryPoint
......@@ -27,6 +27,7 @@ class MailboxService : Service() {
@Inject
internal lateinit var notificationManager: MailboxNotificationManager
@Inject
internal lateinit var webServerManager: WebServerManager
......
......
......@@ -11,6 +11,14 @@ targetCompatibility = 1.8
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "com.google.dagger:dagger:$hilt_version"
kapt "com.google.dagger:dagger-compiler:$hilt_version"
def ktorVersion = '1.6.2'
implementation "io.ktor:ktor-server-core:$ktorVersion"
implementation "io.ktor:ktor-server-netty:$ktorVersion"
implementation "ch.qos.logback:logback-classic:1.2.5"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$junit_version"
......
......
package org.briarproject.mailbox.server
package org.briarproject.mailbox.core.server
import android.os.Build
import io.ktor.application.Application
import io.ktor.application.call
import io.ktor.http.ContentType
......@@ -10,6 +9,6 @@ import io.ktor.routing.routing
internal fun Application.configureRouting() = routing {
get("/") {
call.respondText("All good here in ${Build.MODEL}", ContentType.Text.Plain)
call.respondText("Hello world!", ContentType.Text.Plain)
}
}
package org.briarproject.mailbox.server
package org.briarproject.mailbox.core.server
import android.content.Context
import dagger.hilt.android.qualifiers.ApplicationContext
import io.ktor.application.install
import io.ktor.features.CallLogging
import io.ktor.server.engine.embeddedServer
......@@ -14,9 +12,7 @@ import javax.inject.Inject
import javax.inject.Singleton
@Singleton
internal class WebServerManager @Inject constructor(
@ApplicationContext private val ctx: Context,
) {
class WebServerManager @Inject constructor() {
internal companion object {
private const val PORT = 8888
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment