Skip to content

Commit

Permalink
v2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Gematik-Entwicklung authored and more2503 committed Dec 19, 2023
1 parent 778f13a commit 947465a
Show file tree
Hide file tree
Showing 18 changed files with 398 additions and 145 deletions.
5 changes: 5 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Release 2.0.3
- iOS Support
- multiple test identities
- better logging

# Release 1.0.7

- GSIA GitHub Release
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id("com.android.application").version("8.0.0").apply(false)
id("com.android.library").version("8.0.0").apply(false)
kotlin("android").version("1.8.21").apply(false)
kotlin("multiplatform").version("1.8.21").apply(false)
kotlin("multiplatform").version("1.9.10").apply(false)
}

buildscript {
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
18 changes: 9 additions & 9 deletions gsia_Android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ android {
applicationId = "de.gematik.gsia.android"
minSdk = 28
targetSdk = 34
versionCode = 10007
versionName = "1.0.7"
versionCode = 20003
versionName = "2.0.3"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.7"
kotlinCompilerExtensionVersion = "1.5.3"
}
packaging {
resources {
Expand All @@ -40,12 +40,12 @@ android {

dependencies {
implementation(project(":shared"))
implementation("androidx.compose.ui:ui:1.5.1")
implementation("androidx.compose.ui:ui-tooling:1.5.1")
implementation("androidx.compose.ui:ui-tooling-preview:1.5.1")
implementation("androidx.compose.foundation:foundation:1.5.1")
implementation("androidx.compose.material:material:1.5.1")
implementation("androidx.activity:activity-compose:1.7.2")
implementation("androidx.compose.ui:ui:1.5.4")
implementation("androidx.compose.ui:ui-tooling:1.5.4")
implementation("androidx.compose.ui:ui-tooling-preview:1.5.4")
implementation("androidx.compose.foundation:foundation:1.5.4")
implementation("androidx.compose.material:material:1.5.4")
implementation("androidx.activity:activity-compose:1.8.1")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.2")
implementation("io.ktor:ktor-client-okhttp:2.3.4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@
*
*/

package de.gematik.gsia
import shared
import SwiftUI

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.painter.Painter
import io.ktor.http.Url

actual fun getAppName(): String {
TODO("Not yet implemented")
}

@Composable
internal actual fun getGematikLogoPainter(): Painter {
TODO("Not yet implemented")
struct ComposeView: UIViewControllerRepresentable {
var universalLink: URL?

func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {
}

func makeUIViewController(context: Context) -> some UIViewController {
AppKt.MainViewController(url: universalLink?.absoluteString)
}
}

actual fun executeDeeplink(context: Any?, uri: String) {
}
15 changes: 12 additions & 3 deletions gsia_iOS/gsia_iOS/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,24 @@ import SwiftUI
import shared

struct ContentView: View {
let greet = Greeting().greet()
@State var universalLink: URL?

var body: some View {
Text(greet)
VStack {
if let universalLink = universalLink {
ComposeView(universalLink: universalLink)
} else {
Text("loading")
}
}
.onOpenURL(perform: { url in
universalLink = url
})
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
}
6 changes: 3 additions & 3 deletions gsia_iOS/gsia_iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
</dict>
<key>UILaunchScreen</key>
<dict/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand All @@ -42,7 +44,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UILaunchScreen</key>
<dict/>
</dict>
</plist>
</plist>
11 changes: 11 additions & 0 deletions gsia_iOS/gsia_iOS/gsia_iOS.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:kk.dev.gematik.solutions?mode=developer</string>
<string>applinks:gsi.dev.gematik.solutions?mode=developer</string>
</array>
</dict>
</plist>
8 changes: 6 additions & 2 deletions gsia_iOS/gsia_iOS/iOSApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
*/

import SwiftUI
import shared

@main
struct iOSApp: App {
var body: some Scene {
WindowGroup {
ContentView()
ContentView()
.onOpenURL { url in
print(url)
}
}
}
}
}
22 changes: 18 additions & 4 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ plugins {

id("org.jetbrains.compose") version "1.5.3"

id("dev.icerock.mobile.multiplatform-resources")
// id("dev.icerock.mobile.multiplatform-resources")
}

/*
multiplatformResources {
multiplatformResourcesPackage = "de.gematik.common"
}
*/

@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class)
kotlin {
Expand All @@ -25,16 +27,20 @@ kotlin {

/* iOS app will be added in near future
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach {
it.binaries.framework {
baseName = "shared"
isStatic = true
}
}
*/

iosArm64().binaries.framework {
baseName = "shared"
isStatic = true
}

sourceSets {
val ktorVersion = "2.3.4"

Expand All @@ -57,22 +63,30 @@ kotlin {
}
}

val iosMain by getting {
dependencies {
implementation("io.ktor:ktor-client-ios:$ktorVersion")
}
}

val androidMain by getting {
dependencies {
implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
implementation("androidx.activity:activity-compose:1.7.2")
implementation("androidx.activity:activity-compose:1.8.1")
}

}
}
}

/*
dependencies {
commonMainApi("dev.icerock.moko:resources:0.22.0")
commonMainApi("dev.icerock.moko:resources-compose:0.22.0") // for compose multiplatform
commonTestImplementation("dev.icerock.moko:resources-test:0.22.0") // for testing
}
*/

android {
namespace = "de.gematik.gsia"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import android.net.Uri
import androidx.core.content.ContextCompat.startActivity
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.painter.Painter
import dev.icerock.moko.resources.ImageResource
import dev.icerock.moko.resources.compose.painterResource

@Composable
internal actual fun getGematikLogoPainter(): Painter {
return painterResource(ImageResource(R.drawable.gematik))
// return painterResource(ImageResource(R.drawable.gematik))
TODO("Not yet implemented")
}

actual fun executeDeeplink(context: Any?, uri: String) {
Expand Down
23 changes: 11 additions & 12 deletions shared/src/commonMain/kotlin/de/gematik/gsia/HttpController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import io.ktor.client.HttpClient
import io.ktor.client.request.get
import io.ktor.client.request.header
import io.ktor.client.statement.HttpResponse
import io.ktor.client.statement.bodyAsText
import io.ktor.http.URLBuilder
import io.ktor.http.Url

Expand All @@ -35,31 +36,29 @@ class HttpController {
/**
* sends Authorization Request to sektoraler IDP (GSI). (see App-App Flow 6)
* @param redirectUrl Url to the sektoraler IDP
* @param requestUri Identifier for sektoraler IDP to map our authorization request to the first one initialized by the Anwendungsfrontend (Callee App)
* @param requestUri Identifier for sektoraler IDP to map our authorization request to the first
* one initialized by the Anwendungsfrontend (Callee App)
* @param userId userId is optional because the userId is constant for GSI
* @return AUTH_CODE (can later be redeemed for an ACCESS_TOKEN)
* @return redirect to DiGA containing AUTH_CODE
*/
suspend fun authorizationRequest(redirectUrl: String, requestUri: String, userId: String = "12345678"): Pair<String, String> {
suspend fun authorizationRequest(redirectUrl: String, requestUri: String, userId: String = "12345678"): String {

val url = Url("$redirectUrl?user_id=$userId&request_uri=$requestUri")
println("App-App-Flow Nr 6 TX: $url")
val response: HttpResponse = client.get(url) {
header("X-Authorization", X_AUTH_HEADER)
}

println("Response Body: ${response.bodyAsText()}")
println("Response: $response")

val redirect = URLBuilder(response.headers["Location"] ?: "").build()

println("App-App-Flow Nr 7 RX: $redirect")

redirect.parameters["code"] ?: throw Exception("No AuthCode Recevied")
redirect.parameters["state"] ?: throw Exception("No State Recevied")

return Pair(redirect.parameters["code"].toString(), redirect.parameters["state"].toString())
}

suspend fun sendRequest(request: Url): HttpResponse {
val response = client.get(request) {
header("X-Authorization", X_AUTH_HEADER)
}

return response
return redirect.toString()
}
}
Loading

0 comments on commit 947465a

Please sign in to comment.