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
19 changes: 9 additions & 10 deletions buildSrc/src/main/kotlin/options.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

private fun Int.toJavaVersion(): String = when(this) {
8 -> "1.8"
else -> toString()
private fun Int.toJavaVersion(): JvmTarget = when(this) {
8 -> JvmTarget.JVM_1_8
else -> JvmTarget.fromTarget(this.toString())
}
fun Project.configureCompilerOptions(jvmVersion: Int = 11) {
tasks.withType(KotlinCompile::class.java).configureEach {
it.kotlinOptions {
(this as? KotlinJvmOptions)?.let {
it.jvmTarget = jvmVersion.toJavaVersion()
}
tasks.withType(KotlinCompilationTask::class.java).configureEach {
it.compilerOptions {
(this as? KotlinJvmCompilerOptions)?.jvmTarget?.value(jvmVersion.toJavaVersion())
}
}

Expand Down
23 changes: 12 additions & 11 deletions service/src/main/kotlin/androidmakers/service/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fun main(@Suppress("UNUSED_PARAMETER") args: Array<String>) {
* Block to get the data just after boot
*/
runBlocking {
Sessionize.importAndroidMakers2024()
Sessionize.importAndroidMakers2025()
}
/**
* And then update every 5min.
Expand All @@ -42,7 +42,7 @@ fun main(@Suppress("UNUSED_PARAMETER") args: Array<String>) {
GlobalScope.launch {
while (true) {
delay(5.minutes)
Sessionize.importAndroidMakers2024()
Sessionize.importAndroidMakers2025()
}
}

Expand All @@ -57,10 +57,10 @@ fun main(@Suppress("UNUSED_PARAMETER") args: Array<String>) {
routing {
val executableSchema = androidmakers.graphql.AndroidMakersExecutableSchemaBuilder().build()
post("/graphql") {
call.respondGraphQL(executableSchema)
call.respondGraphQL2(executableSchema)
}
get("/graphql") {
call.respondGraphQL(executableSchema)
call.respondGraphQL2(executableSchema)
}
get(Regex("/sandbox/?")) {
call.respondRedirect(call.url { path("/sandbox/index.html") })
Expand Down Expand Up @@ -92,19 +92,21 @@ private fun Any?.toJsonElement(): JsonElement {
}
}

private suspend fun PipelineContext<Unit, ApplicationCall>.apolloCall(executableSchema: ExecutableSchema) {
val authResult = call.firebaseUid()
private suspend fun RoutingCall.respondGraphQL2(executableSchema: ExecutableSchema) {
val authResult = firebaseUid()
var uid: String? =null
when (authResult) {
is FirebaseUidResult.Error -> {
call.respondText(ContentType.parse("application/json"), HttpStatusCode.Unauthorized) {
respondText(ContentType.parse("application/json"), HttpStatusCode.Unauthorized) {
mapOf("type" to "signout", "firebaseError" to authResult.code).toJsonString()
}
return
}
FirebaseUidResult.Expired -> {
call.respondText(ContentType.parse("application/json"), HttpStatusCode.Unauthorized) {
respondText(ContentType.parse("application/json"), HttpStatusCode.Unauthorized) {
mapOf("type" to "refresh").toJsonString()
}
return
}
is FirebaseUidResult.SignedIn -> {
uid = authResult.uid
Expand All @@ -113,8 +115,8 @@ private suspend fun PipelineContext<Unit, ApplicationCall>.apolloCall(executable
uid = null
}
}
val context = call.context(uid)
call.respondGraphQL(executableSchema, context) {
val context = context(uid)
respondGraphQL(executableSchema, context) {
var maxAge = context.maxAge()

if (it?.errors != null) {
Expand All @@ -129,7 +131,6 @@ private suspend fun PipelineContext<Unit, ApplicationCall>.apolloCall(executable
}
}
}

}

private fun ApplicationCall.firebaseUid(): FirebaseUidResult {
Expand Down
74 changes: 19 additions & 55 deletions service/src/main/kotlin/androidmakers/service/sessionize.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import okhttp3.Request
import okhttp3.executeAsync
import java.util.concurrent.atomic.AtomicReference

@Suppress("UNCHECKED_CAST")
private fun <T> Any?.cast() = this as T
private val Any?.asBoolean: Boolean get() = cast()
private val Any?.asList: List<Any?> get() = cast()
Expand Down Expand Up @@ -78,22 +79,22 @@ object Sessionize {
val d = data.get()
if (d == null) {
runBlocking {
importAndroidMakers2024()
importAndroidMakers2025()
}
}
return data.get()
}

private suspend fun getData(): SessionizeData {
return getData(
url = "https://sessionize.com/api/v2/ok1n6jgj/view/All",
gridSmartUrl = "https://sessionize.com/api/v2/ok1n6jgj/view/GridSmart",
url = "https://sessionize.com/api/v2/g4o6gyjr/view/All",
gridSmartUrl = null,
config = Conference(
id = "androidmakers2024",
name = "AndroidMakers by droidcon 2024",
id = "androidmakers2025",
name = "AndroidMakers by droidcon 2025",
timezone = "Europe/Paris",
themeColor = "0xffFB5C49",
days = listOf(LocalDate(2024, Month.APRIL, 25), LocalDate(2024, Month.APRIL, 26))
days = listOf(LocalDate(2025, Month.APRIL, 10), LocalDate(2025, Month.APRIL, 11))
),
venues = listOf(
Venue(
Expand Down Expand Up @@ -136,10 +137,10 @@ object Sessionize {
title = "silver",
partners = listOf(
Partner(
name = "bitrise",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/bitrise.png",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/bitrise_dark.png",
url = "https://bitrise.io/?utm_source=sponsorship&utm_medium=referral&utm_campaign=androidmakers-paris-2024&utm_content=droidcon-homepage"
name = "happn",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/happn_light.png",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/happn_dark.png",
url = "https://www.happn.com/fr/"
),
Partner(
name = "zimperium",
Expand All @@ -159,8 +160,8 @@ object Sessionize {
url = "https://appvestor.com/"
),
Partner(
name = "koin",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/koin.png",
name = "kotzilla",
logoUrl = "https://kotzilla.io/kotzillaLogo.webp",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/koin_dark.png",
url = "https://www.kotzilla.io/"
),
Expand All @@ -170,12 +171,6 @@ object Sessionize {
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/runway_dark.png",
url = "https://runway.team/"
),
Partner(
name = "yavin",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/yavin.png",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/yavin_dark.png",
url = "https://yavin.com/"
),
)
),
PartnerGroup(
Expand All @@ -189,34 +184,17 @@ object Sessionize {
)
)
),
PartnerGroup(
title = "lanyard",
partners = listOf(
Partner(
name = "amo",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/amo.png",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/amo_dark.png",
url = "amo.co"
)
)
),
PartnerGroup(
title = "community",
partners = listOf(
Partner(
name = "DevCafé",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/devcafe.png",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/devcafe_dark.png",
url = "https://twitter.com/DevCafeYt"
),
Partner(
name = "Groundbreaker",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/groundbreaker.png",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/groundbreaker_dark.png",
url = "https://groundbreaker.org/"
),
Partner(
name = "leboncoin",
name = "leboncointech",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/leboncoin.png",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/leboncoin_dark.png",
url = "https://medium.com/leboncoin-tech-blog"
Expand All @@ -234,18 +212,18 @@ object Sessionize {
url = "https://www.linkedin.com/company/womentechmakers/"
),
Partner(
name = "Women who code",
logoUrl = "https://storage.googleapis.com/androidmakers-static/partners/women who code.png",
logoUrlDark = "https://storage.googleapis.com/androidmakers-static/partners/women who code_dark.png",
url = "https://womenwhocode.com/"
name = "Duchess France",
logoUrl = "https://www.duchess-france.fr/assets/bandeau.jpeg",
logoUrlDark = "https://www.duchess-france.fr/assets/bandeau.jpeg",
url = "https://www.duchess-france.fr"
)
)

)
)
)
}
suspend fun importAndroidMakers2024() {
suspend fun importAndroidMakers2025() {
try {
this.data.set(getData())
} catch (e: Exception) {
Expand All @@ -254,20 +232,6 @@ object Sessionize {
}


private suspend fun getLinks(id: String): List<Link> {
val data =
getJsonUrl("https://raw.githubusercontent.com/paug/AndroidMakersBackend/main/service-graphql/src/main/resources/links.json")

return data.asMap.get(id)?.asList.orEmpty()
.map {
Link(
LinkType.valueOf(it.asMap.get("type").asString),
it.asMap.get("url").asString
)
}
}


/**
* @param gridSmartUrl extra json to get the service sessions from. The service sessions are not always in the View/All url
*/
Expand Down
2 changes: 1 addition & 1 deletion sessionize/src/main/kotlin/sessionize/Sessionize.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private val json = Json {
}

fun sessionizeData(): SeData {
val url = "https://sessionize.com/api/v2/ok1n6jgj/view/All"
val url = "https://sessionize.com/api/v2/g4o6gyjr/view/All"

return Request.Builder()
.get()
Expand Down