├── .gitignore ├── LICENSE ├── README.md ├── androidApp ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── jetbrains │ │ └── handson │ │ └── androidApp │ │ └── MainActivity.kt │ └── res │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── iosApp ├── iosApp.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── iosApp │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── ContentView.swift │ ├── Info.plist │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── RocketLaunchRow.swift │ └── SceneDelegate.swift ├── iosAppTests │ ├── Info.plist │ └── iosAppTests.swift └── iosAppUITests │ ├── Info.plist │ └── iosAppUITests.swift ├── settings.gradle.kts └── shared ├── build.gradle.kts └── src ├── androidMain ├── AndroidManifest.xml └── kotlin │ └── com │ └── jetbrains │ └── handson │ └── kmm │ └── shared │ └── cache │ └── DatabaseDriverFactory.kt ├── commonMain ├── kotlin │ └── com │ │ └── jetbrains │ │ └── handson │ │ └── kmm │ │ └── shared │ │ ├── SpaceXSDK.kt │ │ ├── cache │ │ ├── Database.kt │ │ └── DatabaseDriverFactory.kt │ │ ├── entity │ │ └── Entity.kt │ │ └── network │ │ └── SpaceXApi.kt └── sqldelight │ └── com │ └── jetbrains │ └── handson │ └── kmm │ └── shared │ └── cache │ └── AppDatabase.sq └── iosMain └── kotlin └── com └── jetbrains └── handson └── kmm └── shared └── cache └── DatabaseDriverFactory.kt /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | *.iml 3 | .idea/ 4 | build/ 5 | out/ 6 | local.properties 7 | .DS_Store 8 | xcuserdata/ 9 | Pods/ 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of resources Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by resources 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as resources whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not resources Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom resources Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You resources perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You resources perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including resources 83 | cross-claim or counterclaim in resources lawsuit) alleging that the Work 84 | or resources Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (resources) You must give any other recipients of the Work or 95 | Derivative Works resources copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes resources "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include resources readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within resources NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within resources display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as resources whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as resources 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge resources fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that resources 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain resources copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) 2 | [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0) 3 | 4 | 5 | # Networking and data storage with Kotlin Multiplatform Mobile 6 | 7 | This repository is the code corresponding to the hands-on lab [Networking and data storage with Kotlin Multiplatform Mobile](https://play.kotlinlang.org/hands-on/Networking%20and%20data%20storage%20with%20Kotlin%20Multiplatform%20Mobile/01_introduction). 8 | -------------------------------------------------------------------------------- /androidApp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | kotlin("android") 4 | id("kotlin-android-extensions") 5 | } 6 | group = "com.jetbrains.handson" 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | gradlePluginPortal() 11 | google() 12 | jcenter() 13 | mavenCentral() 14 | } 15 | dependencies { 16 | implementation(project(":shared")) 17 | implementation("com.google.android.material:material:1.2.1") 18 | implementation("androidx.appcompat:appcompat:1.2.0") 19 | implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") 20 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9") 21 | implementation("androidx.core:core-ktx:1.3.1") 22 | 23 | 24 | implementation("androidx.compose.ui:ui:1.0.0-alpha02") 25 | implementation("androidx.ui:ui-tooling:1.0.0-alpha02") 26 | implementation("androidx.compose.foundation:foundation:1.0.0-alpha02") 27 | implementation("androidx.compose.material:material:1.0.0-alpha02") 28 | } 29 | android { 30 | compileSdkVersion(29) 31 | defaultConfig { 32 | applicationId = "com.jetbrains.handson.androidApp" 33 | minSdkVersion(24) 34 | targetSdkVersion(29) 35 | versionCode = 1 36 | versionName = "1.0" 37 | } 38 | buildTypes { 39 | getByName("release") { 40 | isMinifyEnabled = false 41 | } 42 | } 43 | 44 | composeOptions { 45 | kotlinCompilerVersion = "1.4.0" 46 | kotlinCompilerExtensionVersion = "1.0.0-alpha02" 47 | } 48 | 49 | buildFeatures { 50 | compose = true 51 | } 52 | 53 | 54 | compileOptions { 55 | sourceCompatibility = JavaVersion.VERSION_1_8 56 | targetCompatibility = JavaVersion.VERSION_1_8 57 | } 58 | 59 | kotlinOptions { 60 | jvmTarget = JavaVersion.VERSION_1_8.toString() 61 | } 62 | } 63 | 64 | tasks.withType { 65 | kotlinOptions { 66 | jvmTarget = JavaVersion.VERSION_1_8.toString() 67 | freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check") 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /androidApp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /androidApp/src/main/java/com/jetbrains/handson/androidApp/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.androidApp 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import androidx.compose.foundation.Box 6 | import androidx.compose.foundation.Text 7 | import androidx.compose.foundation.layout.* 8 | import androidx.compose.foundation.lazy.LazyColumnFor 9 | import androidx.compose.foundation.shape.RoundedCornerShape 10 | import androidx.compose.material.Card 11 | import androidx.compose.material.CircularProgressIndicator 12 | import androidx.compose.material.MaterialTheme 13 | import androidx.compose.runtime.* 14 | import androidx.compose.ui.Alignment 15 | import androidx.compose.ui.Modifier 16 | import androidx.compose.ui.platform.setContent 17 | import androidx.compose.ui.res.colorResource 18 | import androidx.compose.ui.res.stringResource 19 | import androidx.compose.ui.unit.dp 20 | import com.jetbrains.handson.kmm.shared.SpaceXSDK 21 | import com.jetbrains.handson.kmm.shared.cache.DatabaseDriverFactory 22 | import com.jetbrains.handson.kmm.shared.entity.RocketLaunch 23 | 24 | 25 | class MainActivity : AppCompatActivity() { 26 | private val sdk = SpaceXSDK(DatabaseDriverFactory(this)) 27 | 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | super.onCreate(savedInstanceState) 30 | title = "SpaceX Launches" 31 | 32 | setContent { 33 | MaterialTheme { 34 | MainLayout(sdk) 35 | } 36 | } 37 | } 38 | } 39 | 40 | sealed class UiState { 41 | object Loading : UiState() 42 | data class Success(val data: T) : UiState() 43 | data class Error(val exception: Exception) : UiState() 44 | } 45 | 46 | 47 | @Composable 48 | fun MainLayout(sdk: SpaceXSDK) { 49 | val uiState = remember { mutableStateOf>>(UiState.Loading)} 50 | 51 | launchInComposition { 52 | try { 53 | val launches = sdk.getLaunches(false) 54 | uiState.value = UiState.Success(sdk.getLaunches(true)) 55 | } catch(e: Exception) { 56 | uiState.value = UiState.Error(e) 57 | } 58 | } 59 | 60 | when (val uiStateValue = uiState.value) { 61 | is UiState.Loading -> { 62 | Box(modifier = Modifier.fillMaxSize().wrapContentSize(Alignment.Center)) { 63 | CircularProgressIndicator() 64 | } 65 | } 66 | is UiState.Success -> { 67 | LazyColumnFor(items = uiStateValue.data) { launch -> 68 | LaunchView(launch) 69 | } 70 | } 71 | is UiState.Error -> { 72 | Text(uiStateValue.exception.localizedMessage) 73 | } 74 | } 75 | } 76 | 77 | @Composable 78 | fun LaunchView(launch: RocketLaunch) { 79 | Card(shape = RoundedCornerShape(8.dp), modifier = Modifier.padding(8.dp).fillMaxWidth()) { 80 | Column(modifier = Modifier.padding(16.dp)) { 81 | Text(stringResource(R.string.mission_name_field, launch.missionName), modifier = Modifier.padding(8.dp)) 82 | LaunchSuccessView(launch) 83 | Text(stringResource(R.string.launch_year_field, launch.launchYear), modifier = Modifier.padding(8.dp)) 84 | Text(stringResource(R.string.details_field, launch.details ?: ""), modifier = Modifier.padding(8.dp)) 85 | } 86 | } 87 | } 88 | 89 | @Composable 90 | fun LaunchSuccessView(launch: RocketLaunch) { 91 | val launchSuccess = launch.launchSuccess 92 | if (launchSuccess != null ) { 93 | if (launchSuccess) { 94 | Text(stringResource(R.string.successful), color = colorResource(R.color.colorSuccessful), modifier = Modifier.padding(8.dp)) 95 | } else { 96 | Text(stringResource(R.string.unsuccessful), color = colorResource(R.color.colorUnsuccessful), modifier = Modifier.padding(8.dp)) 97 | } 98 | } else { 99 | Text(stringResource(R.string.no_data), color = colorResource(R.color.colorNoData), modifier = Modifier.padding(8.dp)) 100 | } 101 | } -------------------------------------------------------------------------------- /androidApp/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #37474f 4 | #102027 5 | #62727b 6 | 7 | #4BB543 8 | #FC100D 9 | #615F5F 10 | -------------------------------------------------------------------------------- /androidApp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | KmmApp 4 | 5 | Successful 6 | Unsuccessful 7 | No data 8 | 9 | Launch year: %s 10 | Launch name: %s 11 | Launch success: %s 12 | Launch details: %s 13 | -------------------------------------------------------------------------------- /androidApp/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | gradlePluginPortal() 4 | jcenter() 5 | google() 6 | mavenCentral() 7 | } 8 | 9 | val kotlinVersion = "1.4.0" 10 | val sqlDelightVersion: String by project 11 | 12 | dependencies { 13 | classpath("com.android.tools.build:gradle:4.0.1") 14 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") 15 | classpath("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") 16 | classpath("com.squareup.sqldelight:gradle-plugin:$sqlDelightVersion") 17 | } 18 | } 19 | group = "com.jetbrains.handson" 20 | version = "1.0-SNAPSHOT" 21 | 22 | repositories { 23 | mavenCentral() 24 | } 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | xcodeproj=./iosApp 3 | android.useAndroidX=true 4 | kotlin.mpp.enableGranularSourceSetsMetadata=true 5 | kotlin.native.enableDependencyPropagation=false 6 | 7 | sqlDelightVersion=1.4.2 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joreilly/kmm-networking-and-data-storage/392cd9db8ee01bc073b3b9c4c472e592037597fd/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Aug 22 22:39:28 MSK 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /iosApp/iosApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 215D840324F4CE180088BFDE /* RocketLaunchRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 215D840224F4CE180088BFDE /* RocketLaunchRow.swift */; }; 11 | 7555FF7F242A565900829871 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF7E242A565900829871 /* AppDelegate.swift */; }; 12 | 7555FF81242A565900829871 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF80242A565900829871 /* SceneDelegate.swift */; }; 13 | 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; 14 | 7555FF85242A565B00829871 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7555FF84242A565B00829871 /* Assets.xcassets */; }; 15 | 7555FF88242A565B00829871 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7555FF87242A565B00829871 /* Preview Assets.xcassets */; }; 16 | 7555FF8B242A565B00829871 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7555FF89242A565B00829871 /* LaunchScreen.storyboard */; }; 17 | 7555FF96242A565B00829871 /* iosAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF95242A565B00829871 /* iosAppTests.swift */; }; 18 | 7555FFA1242A565B00829871 /* iosAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FFA0242A565B00829871 /* iosAppUITests.swift */; }; 19 | 7555FFB2242A642300829871 /* shared.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7555FFB1242A642300829871 /* shared.framework */; }; 20 | 7555FFB3242A642300829871 /* shared.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7555FFB1242A642300829871 /* shared.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 7555FF92242A565B00829871 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 7555FF73242A565900829871 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 7555FF7A242A565900829871; 29 | remoteInfo = iosApp; 30 | }; 31 | 7555FF9D242A565B00829871 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 7555FF73242A565900829871 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 7555FF7A242A565900829871; 36 | remoteInfo = iosApp; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXCopyFilesBuildPhase section */ 41 | 7555FFB4242A642300829871 /* Embed Frameworks */ = { 42 | isa = PBXCopyFilesBuildPhase; 43 | buildActionMask = 2147483647; 44 | dstPath = ""; 45 | dstSubfolderSpec = 10; 46 | files = ( 47 | 7555FFB3242A642300829871 /* shared.framework in Embed Frameworks */, 48 | ); 49 | name = "Embed Frameworks"; 50 | runOnlyForDeploymentPostprocessing = 0; 51 | }; 52 | /* End PBXCopyFilesBuildPhase section */ 53 | 54 | /* Begin PBXFileReference section */ 55 | 215D840224F4CE180088BFDE /* RocketLaunchRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RocketLaunchRow.swift; sourceTree = ""; }; 56 | 7555FF7B242A565900829871 /* iosApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iosApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 7555FF7E242A565900829871 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 58 | 7555FF80242A565900829871 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 59 | 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 60 | 7555FF84242A565B00829871 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 61 | 7555FF87242A565B00829871 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 62 | 7555FF8A242A565B00829871 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 63 | 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | 7555FF91242A565B00829871 /* iosAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iosAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 65 | 7555FF95242A565B00829871 /* iosAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosAppTests.swift; sourceTree = ""; }; 66 | 7555FF97242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 67 | 7555FF9C242A565B00829871 /* iosAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iosAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | 7555FFA0242A565B00829871 /* iosAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosAppUITests.swift; sourceTree = ""; }; 69 | 7555FFA2242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 70 | 7555FFB1242A642300829871 /* shared.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = shared.framework; path = "../shared/build/xcode-frameworks/shared.framework"; sourceTree = ""; }; 71 | /* End PBXFileReference section */ 72 | 73 | /* Begin PBXFrameworksBuildPhase section */ 74 | 7555FF78242A565900829871 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | 7555FFB2242A642300829871 /* shared.framework in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | 7555FF8E242A565B00829871 /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | 7555FF99242A565B00829871 /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 2147483647; 92 | files = ( 93 | ); 94 | runOnlyForDeploymentPostprocessing = 0; 95 | }; 96 | /* End PBXFrameworksBuildPhase section */ 97 | 98 | /* Begin PBXGroup section */ 99 | 7555FF72242A565900829871 = { 100 | isa = PBXGroup; 101 | children = ( 102 | 7555FF7D242A565900829871 /* iosApp */, 103 | 7555FF94242A565B00829871 /* iosAppTests */, 104 | 7555FF9F242A565B00829871 /* iosAppUITests */, 105 | 7555FF7C242A565900829871 /* Products */, 106 | 7555FFB0242A642200829871 /* Frameworks */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | 7555FF7C242A565900829871 /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 7555FF7B242A565900829871 /* iosApp.app */, 114 | 7555FF91242A565B00829871 /* iosAppTests.xctest */, 115 | 7555FF9C242A565B00829871 /* iosAppUITests.xctest */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | 7555FF7D242A565900829871 /* iosApp */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 7555FF7E242A565900829871 /* AppDelegate.swift */, 124 | 7555FF80242A565900829871 /* SceneDelegate.swift */, 125 | 7555FF82242A565900829871 /* ContentView.swift */, 126 | 7555FF84242A565B00829871 /* Assets.xcassets */, 127 | 7555FF89242A565B00829871 /* LaunchScreen.storyboard */, 128 | 7555FF8C242A565B00829871 /* Info.plist */, 129 | 7555FF86242A565B00829871 /* Preview Content */, 130 | 215D840224F4CE180088BFDE /* RocketLaunchRow.swift */, 131 | ); 132 | path = iosApp; 133 | sourceTree = ""; 134 | }; 135 | 7555FF86242A565B00829871 /* Preview Content */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 7555FF87242A565B00829871 /* Preview Assets.xcassets */, 139 | ); 140 | path = "Preview Content"; 141 | sourceTree = ""; 142 | }; 143 | 7555FF94242A565B00829871 /* iosAppTests */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 7555FF95242A565B00829871 /* iosAppTests.swift */, 147 | 7555FF97242A565B00829871 /* Info.plist */, 148 | ); 149 | path = iosAppTests; 150 | sourceTree = ""; 151 | }; 152 | 7555FF9F242A565B00829871 /* iosAppUITests */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 7555FFA0242A565B00829871 /* iosAppUITests.swift */, 156 | 7555FFA2242A565B00829871 /* Info.plist */, 157 | ); 158 | path = iosAppUITests; 159 | sourceTree = ""; 160 | }; 161 | 7555FFB0242A642200829871 /* Frameworks */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 7555FFB1242A642300829871 /* shared.framework */, 165 | ); 166 | name = Frameworks; 167 | sourceTree = ""; 168 | }; 169 | /* End PBXGroup section */ 170 | 171 | /* Begin PBXNativeTarget section */ 172 | 7555FF7A242A565900829871 /* iosApp */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; 175 | buildPhases = ( 176 | 7555FFB5242A651A00829871 /* ShellScript */, 177 | 7555FF77242A565900829871 /* Sources */, 178 | 7555FF78242A565900829871 /* Frameworks */, 179 | 7555FF79242A565900829871 /* Resources */, 180 | 7555FFB4242A642300829871 /* Embed Frameworks */, 181 | ); 182 | buildRules = ( 183 | ); 184 | dependencies = ( 185 | ); 186 | name = iosApp; 187 | productName = iosApp; 188 | productReference = 7555FF7B242A565900829871 /* iosApp.app */; 189 | productType = "com.apple.product-type.application"; 190 | }; 191 | 7555FF90242A565B00829871 /* iosAppTests */ = { 192 | isa = PBXNativeTarget; 193 | buildConfigurationList = 7555FFA8242A565B00829871 /* Build configuration list for PBXNativeTarget "iosAppTests" */; 194 | buildPhases = ( 195 | 7555FF8D242A565B00829871 /* Sources */, 196 | 7555FF8E242A565B00829871 /* Frameworks */, 197 | 7555FF8F242A565B00829871 /* Resources */, 198 | ); 199 | buildRules = ( 200 | ); 201 | dependencies = ( 202 | 7555FF93242A565B00829871 /* PBXTargetDependency */, 203 | ); 204 | name = iosAppTests; 205 | productName = iosAppTests; 206 | productReference = 7555FF91242A565B00829871 /* iosAppTests.xctest */; 207 | productType = "com.apple.product-type.bundle.unit-test"; 208 | }; 209 | 7555FF9B242A565B00829871 /* iosAppUITests */ = { 210 | isa = PBXNativeTarget; 211 | buildConfigurationList = 7555FFAB242A565B00829871 /* Build configuration list for PBXNativeTarget "iosAppUITests" */; 212 | buildPhases = ( 213 | 7555FF98242A565B00829871 /* Sources */, 214 | 7555FF99242A565B00829871 /* Frameworks */, 215 | 7555FF9A242A565B00829871 /* Resources */, 216 | ); 217 | buildRules = ( 218 | ); 219 | dependencies = ( 220 | 7555FF9E242A565B00829871 /* PBXTargetDependency */, 221 | ); 222 | name = iosAppUITests; 223 | productName = iosAppUITests; 224 | productReference = 7555FF9C242A565B00829871 /* iosAppUITests.xctest */; 225 | productType = "com.apple.product-type.bundle.ui-testing"; 226 | }; 227 | /* End PBXNativeTarget section */ 228 | 229 | /* Begin PBXProject section */ 230 | 7555FF73242A565900829871 /* Project object */ = { 231 | isa = PBXProject; 232 | attributes = { 233 | LastSwiftUpdateCheck = 1130; 234 | LastUpgradeCheck = 1130; 235 | ORGANIZATIONNAME = orgName; 236 | TargetAttributes = { 237 | 7555FF7A242A565900829871 = { 238 | CreatedOnToolsVersion = 11.3.1; 239 | }; 240 | 7555FF90242A565B00829871 = { 241 | CreatedOnToolsVersion = 11.3.1; 242 | TestTargetID = 7555FF7A242A565900829871; 243 | }; 244 | 7555FF9B242A565B00829871 = { 245 | CreatedOnToolsVersion = 11.3.1; 246 | TestTargetID = 7555FF7A242A565900829871; 247 | }; 248 | }; 249 | }; 250 | buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; 251 | compatibilityVersion = "Xcode 9.3"; 252 | developmentRegion = en; 253 | hasScannedForEncodings = 0; 254 | knownRegions = ( 255 | en, 256 | Base, 257 | ); 258 | mainGroup = 7555FF72242A565900829871; 259 | productRefGroup = 7555FF7C242A565900829871 /* Products */; 260 | projectDirPath = ""; 261 | projectRoot = ""; 262 | targets = ( 263 | 7555FF7A242A565900829871 /* iosApp */, 264 | 7555FF90242A565B00829871 /* iosAppTests */, 265 | 7555FF9B242A565B00829871 /* iosAppUITests */, 266 | ); 267 | }; 268 | /* End PBXProject section */ 269 | 270 | /* Begin PBXResourcesBuildPhase section */ 271 | 7555FF79242A565900829871 /* Resources */ = { 272 | isa = PBXResourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | 7555FF8B242A565B00829871 /* LaunchScreen.storyboard in Resources */, 276 | 7555FF88242A565B00829871 /* Preview Assets.xcassets in Resources */, 277 | 7555FF85242A565B00829871 /* Assets.xcassets in Resources */, 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | }; 281 | 7555FF8F242A565B00829871 /* Resources */ = { 282 | isa = PBXResourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | 7555FF9A242A565B00829871 /* Resources */ = { 289 | isa = PBXResourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | ); 293 | runOnlyForDeploymentPostprocessing = 0; 294 | }; 295 | /* End PBXResourcesBuildPhase section */ 296 | 297 | /* Begin PBXShellScriptBuildPhase section */ 298 | 7555FFB5242A651A00829871 /* ShellScript */ = { 299 | isa = PBXShellScriptBuildPhase; 300 | buildActionMask = 2147483647; 301 | files = ( 302 | ); 303 | inputFileListPaths = ( 304 | ); 305 | inputPaths = ( 306 | ); 307 | outputFileListPaths = ( 308 | ); 309 | outputPaths = ( 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | shellPath = /bin/sh; 313 | shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:packForXCode -PXCODE_CONFIGURATION=${CONFIGURATION}\n"; 314 | }; 315 | /* End PBXShellScriptBuildPhase section */ 316 | 317 | /* Begin PBXSourcesBuildPhase section */ 318 | 7555FF77242A565900829871 /* Sources */ = { 319 | isa = PBXSourcesBuildPhase; 320 | buildActionMask = 2147483647; 321 | files = ( 322 | 7555FF7F242A565900829871 /* AppDelegate.swift in Sources */, 323 | 7555FF81242A565900829871 /* SceneDelegate.swift in Sources */, 324 | 7555FF83242A565900829871 /* ContentView.swift in Sources */, 325 | 215D840324F4CE180088BFDE /* RocketLaunchRow.swift in Sources */, 326 | ); 327 | runOnlyForDeploymentPostprocessing = 0; 328 | }; 329 | 7555FF8D242A565B00829871 /* Sources */ = { 330 | isa = PBXSourcesBuildPhase; 331 | buildActionMask = 2147483647; 332 | files = ( 333 | 7555FF96242A565B00829871 /* iosAppTests.swift in Sources */, 334 | ); 335 | runOnlyForDeploymentPostprocessing = 0; 336 | }; 337 | 7555FF98242A565B00829871 /* Sources */ = { 338 | isa = PBXSourcesBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | 7555FFA1242A565B00829871 /* iosAppUITests.swift in Sources */, 342 | ); 343 | runOnlyForDeploymentPostprocessing = 0; 344 | }; 345 | /* End PBXSourcesBuildPhase section */ 346 | 347 | /* Begin PBXTargetDependency section */ 348 | 7555FF93242A565B00829871 /* PBXTargetDependency */ = { 349 | isa = PBXTargetDependency; 350 | target = 7555FF7A242A565900829871 /* iosApp */; 351 | targetProxy = 7555FF92242A565B00829871 /* PBXContainerItemProxy */; 352 | }; 353 | 7555FF9E242A565B00829871 /* PBXTargetDependency */ = { 354 | isa = PBXTargetDependency; 355 | target = 7555FF7A242A565900829871 /* iosApp */; 356 | targetProxy = 7555FF9D242A565B00829871 /* PBXContainerItemProxy */; 357 | }; 358 | /* End PBXTargetDependency section */ 359 | 360 | /* Begin PBXVariantGroup section */ 361 | 7555FF89242A565B00829871 /* LaunchScreen.storyboard */ = { 362 | isa = PBXVariantGroup; 363 | children = ( 364 | 7555FF8A242A565B00829871 /* Base */, 365 | ); 366 | name = LaunchScreen.storyboard; 367 | sourceTree = ""; 368 | }; 369 | /* End PBXVariantGroup section */ 370 | 371 | /* Begin XCBuildConfiguration section */ 372 | 7555FFA3242A565B00829871 /* Debug */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ALWAYS_SEARCH_USER_PATHS = NO; 376 | CLANG_ANALYZER_NONNULL = YES; 377 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 379 | CLANG_CXX_LIBRARY = "libc++"; 380 | CLANG_ENABLE_MODULES = YES; 381 | CLANG_ENABLE_OBJC_ARC = YES; 382 | CLANG_ENABLE_OBJC_WEAK = YES; 383 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_COMMA = YES; 386 | CLANG_WARN_CONSTANT_CONVERSION = YES; 387 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 388 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 389 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 390 | CLANG_WARN_EMPTY_BODY = YES; 391 | CLANG_WARN_ENUM_CONVERSION = YES; 392 | CLANG_WARN_INFINITE_RECURSION = YES; 393 | CLANG_WARN_INT_CONVERSION = YES; 394 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 395 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 396 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 397 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 398 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 399 | CLANG_WARN_STRICT_PROTOTYPES = YES; 400 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 401 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | COPY_PHASE_STRIP = NO; 405 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 406 | ENABLE_STRICT_OBJC_MSGSEND = YES; 407 | ENABLE_TESTABILITY = YES; 408 | GCC_C_LANGUAGE_STANDARD = gnu11; 409 | GCC_DYNAMIC_NO_PIC = NO; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_OPTIMIZATION_LEVEL = 0; 412 | GCC_PREPROCESSOR_DEFINITIONS = ( 413 | "DEBUG=1", 414 | "$(inherited)", 415 | ); 416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 418 | GCC_WARN_UNDECLARED_SELECTOR = YES; 419 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 420 | GCC_WARN_UNUSED_FUNCTION = YES; 421 | GCC_WARN_UNUSED_VARIABLE = YES; 422 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 423 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 424 | MTL_FAST_MATH = YES; 425 | ONLY_ACTIVE_ARCH = YES; 426 | SDKROOT = iphoneos; 427 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | }; 430 | name = Debug; 431 | }; 432 | 7555FFA4242A565B00829871 /* Release */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | ALWAYS_SEARCH_USER_PATHS = NO; 436 | CLANG_ANALYZER_NONNULL = YES; 437 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 438 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 439 | CLANG_CXX_LIBRARY = "libc++"; 440 | CLANG_ENABLE_MODULES = YES; 441 | CLANG_ENABLE_OBJC_ARC = YES; 442 | CLANG_ENABLE_OBJC_WEAK = YES; 443 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 444 | CLANG_WARN_BOOL_CONVERSION = YES; 445 | CLANG_WARN_COMMA = YES; 446 | CLANG_WARN_CONSTANT_CONVERSION = YES; 447 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 448 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 449 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 450 | CLANG_WARN_EMPTY_BODY = YES; 451 | CLANG_WARN_ENUM_CONVERSION = YES; 452 | CLANG_WARN_INFINITE_RECURSION = YES; 453 | CLANG_WARN_INT_CONVERSION = YES; 454 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 455 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 456 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 457 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 458 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 459 | CLANG_WARN_STRICT_PROTOTYPES = YES; 460 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 461 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 462 | CLANG_WARN_UNREACHABLE_CODE = YES; 463 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 464 | COPY_PHASE_STRIP = NO; 465 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 466 | ENABLE_NS_ASSERTIONS = NO; 467 | ENABLE_STRICT_OBJC_MSGSEND = YES; 468 | GCC_C_LANGUAGE_STANDARD = gnu11; 469 | GCC_NO_COMMON_BLOCKS = YES; 470 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 471 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 472 | GCC_WARN_UNDECLARED_SELECTOR = YES; 473 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 474 | GCC_WARN_UNUSED_FUNCTION = YES; 475 | GCC_WARN_UNUSED_VARIABLE = YES; 476 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 477 | MTL_ENABLE_DEBUG_INFO = NO; 478 | MTL_FAST_MATH = YES; 479 | SDKROOT = iphoneos; 480 | SWIFT_COMPILATION_MODE = wholemodule; 481 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 482 | VALIDATE_PRODUCT = YES; 483 | }; 484 | name = Release; 485 | }; 486 | 7555FFA6242A565B00829871 /* Debug */ = { 487 | isa = XCBuildConfiguration; 488 | buildSettings = { 489 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 490 | CODE_SIGN_STYLE = Automatic; 491 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; 492 | ENABLE_PREVIEWS = YES; 493 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks"; 494 | INFOPLIST_FILE = iosApp/Info.plist; 495 | LD_RUNPATH_SEARCH_PATHS = ( 496 | "$(inherited)", 497 | "@executable_path/Frameworks", 498 | ); 499 | PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosApp; 500 | PRODUCT_NAME = "$(TARGET_NAME)"; 501 | SWIFT_VERSION = 5.0; 502 | TARGETED_DEVICE_FAMILY = "1,2"; 503 | }; 504 | name = Debug; 505 | }; 506 | 7555FFA7242A565B00829871 /* Release */ = { 507 | isa = XCBuildConfiguration; 508 | buildSettings = { 509 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 510 | CODE_SIGN_STYLE = Automatic; 511 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; 512 | ENABLE_PREVIEWS = YES; 513 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks"; 514 | INFOPLIST_FILE = iosApp/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = ( 516 | "$(inherited)", 517 | "@executable_path/Frameworks", 518 | ); 519 | PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosApp; 520 | PRODUCT_NAME = "$(TARGET_NAME)"; 521 | SWIFT_VERSION = 5.0; 522 | TARGETED_DEVICE_FAMILY = "1,2"; 523 | }; 524 | name = Release; 525 | }; 526 | 7555FFA9242A565B00829871 /* Debug */ = { 527 | isa = XCBuildConfiguration; 528 | buildSettings = { 529 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 530 | BUNDLE_LOADER = "$(TEST_HOST)"; 531 | CODE_SIGN_STYLE = Automatic; 532 | INFOPLIST_FILE = iosAppTests/Info.plist; 533 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 534 | LD_RUNPATH_SEARCH_PATHS = ( 535 | "$(inherited)", 536 | "@executable_path/Frameworks", 537 | "@loader_path/Frameworks", 538 | ); 539 | PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosAppTests; 540 | PRODUCT_NAME = "$(TARGET_NAME)"; 541 | SWIFT_VERSION = 5.0; 542 | TARGETED_DEVICE_FAMILY = "1,2"; 543 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iosApp.app/iosApp"; 544 | }; 545 | name = Debug; 546 | }; 547 | 7555FFAA242A565B00829871 /* Release */ = { 548 | isa = XCBuildConfiguration; 549 | buildSettings = { 550 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 551 | BUNDLE_LOADER = "$(TEST_HOST)"; 552 | CODE_SIGN_STYLE = Automatic; 553 | INFOPLIST_FILE = iosAppTests/Info.plist; 554 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 555 | LD_RUNPATH_SEARCH_PATHS = ( 556 | "$(inherited)", 557 | "@executable_path/Frameworks", 558 | "@loader_path/Frameworks", 559 | ); 560 | PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosAppTests; 561 | PRODUCT_NAME = "$(TARGET_NAME)"; 562 | SWIFT_VERSION = 5.0; 563 | TARGETED_DEVICE_FAMILY = "1,2"; 564 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iosApp.app/iosApp"; 565 | }; 566 | name = Release; 567 | }; 568 | 7555FFAC242A565B00829871 /* Debug */ = { 569 | isa = XCBuildConfiguration; 570 | buildSettings = { 571 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 572 | CODE_SIGN_STYLE = Automatic; 573 | INFOPLIST_FILE = iosAppUITests/Info.plist; 574 | LD_RUNPATH_SEARCH_PATHS = ( 575 | "$(inherited)", 576 | "@executable_path/Frameworks", 577 | "@loader_path/Frameworks", 578 | ); 579 | PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosAppUITests; 580 | PRODUCT_NAME = "$(TARGET_NAME)"; 581 | SWIFT_VERSION = 5.0; 582 | TARGETED_DEVICE_FAMILY = "1,2"; 583 | TEST_TARGET_NAME = iosApp; 584 | }; 585 | name = Debug; 586 | }; 587 | 7555FFAD242A565B00829871 /* Release */ = { 588 | isa = XCBuildConfiguration; 589 | buildSettings = { 590 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 591 | CODE_SIGN_STYLE = Automatic; 592 | INFOPLIST_FILE = iosAppUITests/Info.plist; 593 | LD_RUNPATH_SEARCH_PATHS = ( 594 | "$(inherited)", 595 | "@executable_path/Frameworks", 596 | "@loader_path/Frameworks", 597 | ); 598 | PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosAppUITests; 599 | PRODUCT_NAME = "$(TARGET_NAME)"; 600 | SWIFT_VERSION = 5.0; 601 | TARGETED_DEVICE_FAMILY = "1,2"; 602 | TEST_TARGET_NAME = iosApp; 603 | }; 604 | name = Release; 605 | }; 606 | /* End XCBuildConfiguration section */ 607 | 608 | /* Begin XCConfigurationList section */ 609 | 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { 610 | isa = XCConfigurationList; 611 | buildConfigurations = ( 612 | 7555FFA3242A565B00829871 /* Debug */, 613 | 7555FFA4242A565B00829871 /* Release */, 614 | ); 615 | defaultConfigurationIsVisible = 0; 616 | defaultConfigurationName = Release; 617 | }; 618 | 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { 619 | isa = XCConfigurationList; 620 | buildConfigurations = ( 621 | 7555FFA6242A565B00829871 /* Debug */, 622 | 7555FFA7242A565B00829871 /* Release */, 623 | ); 624 | defaultConfigurationIsVisible = 0; 625 | defaultConfigurationName = Release; 626 | }; 627 | 7555FFA8242A565B00829871 /* Build configuration list for PBXNativeTarget "iosAppTests" */ = { 628 | isa = XCConfigurationList; 629 | buildConfigurations = ( 630 | 7555FFA9242A565B00829871 /* Debug */, 631 | 7555FFAA242A565B00829871 /* Release */, 632 | ); 633 | defaultConfigurationIsVisible = 0; 634 | defaultConfigurationName = Release; 635 | }; 636 | 7555FFAB242A565B00829871 /* Build configuration list for PBXNativeTarget "iosAppUITests" */ = { 637 | isa = XCConfigurationList; 638 | buildConfigurations = ( 639 | 7555FFAC242A565B00829871 /* Debug */, 640 | 7555FFAD242A565B00829871 /* Release */, 641 | ); 642 | defaultConfigurationIsVisible = 0; 643 | defaultConfigurationName = Release; 644 | }; 645 | /* End XCConfigurationList section */ 646 | }; 647 | rootObject = 7555FF73242A565900829871 /* Project object */; 648 | } 649 | -------------------------------------------------------------------------------- /iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /iosApp/iosApp/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | @UIApplicationMain 4 | class AppDelegate: UIResponder, UIApplicationDelegate { 5 | 6 | 7 | 8 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 9 | // Override point for customization after application launch. 10 | return true 11 | } 12 | 13 | // MARK: UISceneSession Lifecycle 14 | 15 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 16 | // Called when a new scene session is being created. 17 | // Use this method to select a configuration to create the new scene with. 18 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 19 | } 20 | 21 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 22 | // Called when the user discards a scene session. 23 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 24 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 25 | } 26 | 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /iosApp/iosApp/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /iosApp/iosApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import shared 3 | 4 | struct ContentView: View { 5 | @ObservedObject private(set) var viewModel: ViewModel 6 | 7 | var body: some View { 8 | NavigationView { 9 | listView() 10 | .navigationBarTitle("SpaceX Launches") 11 | .navigationBarItems(trailing: 12 | Button("Reload") { 13 | self.viewModel.loadLaunches(forceReload: true) 14 | }) 15 | } 16 | } 17 | 18 | private func listView() -> AnyView { 19 | switch viewModel.launches { 20 | case .loading: 21 | return AnyView(Text("Loading...").multilineTextAlignment(.center)) 22 | case .result(let launches): 23 | return AnyView(List(launches) { launch in 24 | RocketLaunchRow(rocketLaunch: launch) 25 | }) 26 | case .error(let description): 27 | return AnyView(Text(description).multilineTextAlignment(.center)) 28 | } 29 | } 30 | } 31 | 32 | extension ContentView { 33 | 34 | enum LoadableLaunches { 35 | case loading 36 | case result([RocketLaunch]) 37 | case error(String) 38 | } 39 | 40 | class ViewModel: ObservableObject { 41 | let sdk: SpaceXSDK 42 | @Published var launches = LoadableLaunches.loading 43 | 44 | init(sdk: SpaceXSDK) { 45 | self.sdk = sdk 46 | self.loadLaunches(forceReload: false) 47 | } 48 | 49 | func loadLaunches(forceReload: Bool) { 50 | self.launches = .loading 51 | sdk.getLaunches(forceReload: forceReload, completionHandler: { launches, error in 52 | if let launches = launches { 53 | self.launches = .result(launches) 54 | } else { 55 | self.launches = .error(error?.localizedDescription ?? "error") 56 | } 57 | }) 58 | } 59 | } 60 | } 61 | 62 | extension RocketLaunch: Identifiable { } 63 | -------------------------------------------------------------------------------- /iosApp/iosApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /iosApp/iosApp/RocketLaunchRow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RocketLaunchRow.swift 3 | // iosApp 4 | // 5 | // Created by Ekaterina.Petrova on 25.08.2020. 6 | // Copyright © 2020 orgName. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import shared 11 | 12 | struct RocketLaunchRow: View { 13 | var rocketLaunch: RocketLaunch 14 | 15 | var body: some View { 16 | HStack() { 17 | VStack(alignment: .leading, spacing: 10.0) { 18 | Text("Launch name: \(rocketLaunch.missionName)") 19 | Text(launchText).foregroundColor(launchColor) 20 | Text("Launch year: \(String(rocketLaunch.launchYear))") 21 | Text("Launch details: \(rocketLaunch.details ?? "")") 22 | } 23 | Spacer() 24 | } 25 | } 26 | } 27 | 28 | extension RocketLaunchRow { 29 | private var launchText: String { 30 | if let isSuccess = rocketLaunch.launchSuccess { 31 | return isSuccess.boolValue ? "Successful" : "Unsuccessful" 32 | } else { 33 | return "No data" 34 | } 35 | } 36 | 37 | private var launchColor: Color { 38 | if let isSuccess = rocketLaunch.launchSuccess { 39 | return isSuccess.boolValue ? Color.green : Color.red 40 | } else { 41 | return Color.gray 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /iosApp/iosApp/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SwiftUI 3 | import shared 4 | 5 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 6 | 7 | var window: UIWindow? 8 | 9 | let sdk = SpaceXSDK(databaseDriverFactory: DatabaseDriverFactory()) 10 | 11 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 12 | 13 | let contentView = ContentView(viewModel: .init(sdk: sdk)) 14 | 15 | // Use a UIHostingController as window root view controller. 16 | if let windowScene = scene as? UIWindowScene { 17 | let window = UIWindow(windowScene: windowScene) 18 | window.rootViewController = UIHostingController(rootView: contentView) 19 | self.window = window 20 | window.makeKeyAndVisible() 21 | } 22 | } 23 | 24 | func sceneDidDisconnect(_ scene: UIScene) { 25 | 26 | } 27 | 28 | func sceneDidBecomeActive(_ scene: UIScene) { 29 | 30 | } 31 | 32 | func sceneWillResignActive(_ scene: UIScene) { 33 | 34 | } 35 | 36 | func sceneWillEnterForeground(_ scene: UIScene) { 37 | 38 | } 39 | 40 | func sceneDidEnterBackground(_ scene: UIScene) { 41 | 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /iosApp/iosAppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /iosApp/iosAppTests/iosAppTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import iosApp 3 | 4 | class iosAppTests: XCTestCase { 5 | 6 | override func setUp() { 7 | // Put setup code here. This method is called before the invocation of each test method in the class. 8 | } 9 | 10 | override func tearDown() { 11 | // Put teardown code here. This method is called after the invocation of each test method in the class. 12 | } 13 | 14 | func testExample() { 15 | // This is an example of a functional test case. 16 | // Use XCTAssert and related functions to verify your tests produce the correct results. 17 | } 18 | 19 | func testPerformanceExample() { 20 | // This is an example of a performance test case. 21 | self.measure { 22 | // Put the code you want to measure the time of here. 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /iosApp/iosAppUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /iosApp/iosAppUITests/iosAppUITests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class appNameUITests: XCTestCase { 4 | 5 | override func setUp() { 6 | // Put setup code here. This method is called before the invocation of each test method in the class. 7 | 8 | // In UI tests it is usually best to stop immediately when a failure occurs. 9 | continueAfterFailure = false 10 | 11 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 12 | } 13 | 14 | override func tearDown() { 15 | // Put teardown code here. This method is called after the invocation of each test method in the class. 16 | } 17 | 18 | func testExample() { 19 | // UI tests must launch the application that they test. 20 | let app = XCUIApplication() 21 | app.launch() 22 | 23 | // Use recording to get started writing UI tests. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testLaunchPerformance() { 28 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 29 | // This measures how long it takes to launch your application. 30 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 31 | XCUIApplication().launch() 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | jcenter() 6 | mavenCentral() 7 | } 8 | resolutionStrategy { 9 | eachPlugin { 10 | if (requested.id.namespace == "com.android" || requested.id.name == "kotlin-android-extensions") { 11 | useModule("com.android.tools.build:gradle:4.0.1") 12 | } 13 | } 14 | } 15 | } 16 | rootProject.name = "KMMApp" 17 | 18 | 19 | include(":androidApp") 20 | include(":shared") 21 | 22 | -------------------------------------------------------------------------------- /shared/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget 2 | 3 | plugins { 4 | kotlin("multiplatform") 5 | kotlin("plugin.serialization") 6 | id("com.android.library") 7 | id("kotlin-android-extensions") 8 | id("com.squareup.sqldelight") 9 | } 10 | 11 | group = "com.jetbrains.handson" 12 | version = "1.0-SNAPSHOT" 13 | 14 | repositories { 15 | gradlePluginPortal() 16 | google() 17 | jcenter() 18 | mavenCentral() 19 | } 20 | kotlin { 21 | android() 22 | ios { 23 | binaries { 24 | framework { 25 | baseName = "shared" 26 | } 27 | } 28 | } 29 | 30 | val ktorVersion = "1.4.0" 31 | val serializationVersion = "1.0.0-RC" 32 | val sqlDelightVersion: String by project 33 | val coroutinesVersion = "1.3.9-native-mt" 34 | 35 | sourceSets { 36 | val commonMain by getting { 37 | dependencies { 38 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") 39 | implementation("io.ktor:ktor-client-core:$ktorVersion") 40 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion") 41 | implementation("io.ktor:ktor-client-serialization:$ktorVersion") 42 | implementation("com.squareup.sqldelight:runtime:$sqlDelightVersion") 43 | } 44 | } 45 | val commonTest by getting { 46 | dependencies { 47 | implementation(kotlin("test-common")) 48 | implementation(kotlin("test-annotations-common")) 49 | } 50 | } 51 | val androidMain by getting { 52 | dependencies { 53 | implementation("io.ktor:ktor-client-android:$ktorVersion") 54 | implementation("com.squareup.sqldelight:android-driver:$sqlDelightVersion") 55 | } 56 | } 57 | val androidTest by getting { 58 | dependencies { 59 | implementation(kotlin("test-junit")) 60 | implementation("junit:junit:4.12") 61 | } 62 | } 63 | val iosMain by getting { 64 | dependencies { 65 | implementation("io.ktor:ktor-client-ios:$ktorVersion") 66 | implementation("com.squareup.sqldelight:native-driver:$sqlDelightVersion") 67 | } 68 | } 69 | val iosTest by getting 70 | } 71 | } 72 | android { 73 | compileSdkVersion(29) 74 | sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") 75 | defaultConfig { 76 | minSdkVersion(24) 77 | targetSdkVersion(29) 78 | versionCode = 1 79 | versionName = "1.0" 80 | } 81 | buildTypes { 82 | getByName("release") { 83 | isMinifyEnabled = false 84 | } 85 | } 86 | } 87 | 88 | sqldelight { 89 | database("AppDatabase") { 90 | packageName = "com.jetbrains.handson.kmm.shared.cache" 91 | } 92 | } 93 | 94 | val packForXcode by tasks.creating(Sync::class) { 95 | group = "build" 96 | val mode = System.getenv("CONFIGURATION") ?: "DEBUG" 97 | val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator" 98 | val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64" 99 | val framework = kotlin.targets.getByName(targetName).binaries.getFramework(mode) 100 | inputs.property("mode", mode) 101 | dependsOn(framework.linkTask) 102 | val targetDir = File(buildDir, "xcode-frameworks") 103 | from({ framework.outputDirectory }) 104 | into(targetDir) 105 | } 106 | tasks.getByName("build").dependsOn(packForXcode) -------------------------------------------------------------------------------- /shared/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /shared/src/androidMain/kotlin/com/jetbrains/handson/kmm/shared/cache/DatabaseDriverFactory.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.kmm.shared.cache 2 | 3 | import android.content.Context 4 | import com.jetbrains.handson.kmm.shared.cache.AppDatabase 5 | import com.squareup.sqldelight.android.AndroidSqliteDriver 6 | import com.squareup.sqldelight.db.SqlDriver 7 | 8 | actual class DatabaseDriverFactory(private val context: Context) { 9 | actual fun createDriver(): SqlDriver { 10 | return AndroidSqliteDriver(AppDatabase.Schema, context, "test.db") 11 | } 12 | } -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/com/jetbrains/handson/kmm/shared/SpaceXSDK.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.kmm.shared 2 | 3 | import com.jetbrains.handson.kmm.shared.cache.Database 4 | import com.jetbrains.handson.kmm.shared.cache.DatabaseDriverFactory 5 | import com.jetbrains.handson.kmm.shared.entity.RocketLaunch 6 | import com.jetbrains.handson.kmm.shared.network.SpaceXApi 7 | 8 | class SpaceXSDK (databaseDriverFactory: DatabaseDriverFactory) { 9 | private val database = Database(databaseDriverFactory) 10 | private val api = SpaceXApi() 11 | 12 | @Throws(Exception::class) suspend fun getLaunches(forceReload: Boolean): List { 13 | val cachedLaunches = database.getAllLaunches() 14 | return if (cachedLaunches.isNotEmpty() && !forceReload) { 15 | cachedLaunches 16 | } else { 17 | api.getAllLaunches().also { 18 | database.clearDatabase() 19 | database.createLaunches(it) 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/com/jetbrains/handson/kmm/shared/cache/Database.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.kmm.shared.cache 2 | 3 | import com.jetbrains.handson.kmm.shared.cache.AppDatabase 4 | import com.jetbrains.handson.kmm.shared.entity.Links 5 | import com.jetbrains.handson.kmm.shared.entity.Rocket 6 | import com.jetbrains.handson.kmm.shared.entity.RocketLaunch 7 | 8 | internal class Database(databaseDriverFactory: DatabaseDriverFactory) { 9 | private val database = AppDatabase(databaseDriverFactory.createDriver()) 10 | private val dbQuery = database.appDatabaseQueries 11 | 12 | internal fun clearDatabase() { 13 | dbQuery.transaction { 14 | dbQuery.removeAllRockets() 15 | dbQuery.removeAllLaunches() 16 | } 17 | } 18 | 19 | internal fun getAllLaunches(): List { 20 | return dbQuery.selectAllLaunchesInfo(::mapLaunchSelecting).executeAsList() 21 | } 22 | 23 | private fun mapLaunchSelecting( 24 | flightNumber: Long, 25 | missionName: String, 26 | launchYear: Int, 27 | rocketId: String, 28 | details: String?, 29 | launchSuccess: Boolean?, 30 | launchDateUTC: String, 31 | missionPatchUrl: String?, 32 | articleUrl: String?, 33 | rocket_id: String?, 34 | name: String?, 35 | type: String? 36 | ): RocketLaunch { 37 | return RocketLaunch( 38 | flightNumber = flightNumber.toInt(), 39 | missionName = missionName, 40 | launchYear = launchYear, 41 | details = details, 42 | launchDateUTC = launchDateUTC, 43 | launchSuccess = launchSuccess, 44 | rocket = Rocket( 45 | id = rocketId, 46 | name = name!!, 47 | type = type!! 48 | ), 49 | links = Links( 50 | missionPatchUrl = missionPatchUrl, 51 | articleUrl = articleUrl 52 | ) 53 | ) 54 | } 55 | 56 | internal fun createLaunches(launches: List) { 57 | dbQuery.transaction { 58 | launches.forEach { launch -> 59 | val rocket = dbQuery.selectRocketById(launch.rocket.id).executeAsOneOrNull() 60 | if (rocket == null) { 61 | insertRocket(launch) 62 | } 63 | 64 | insertLaunch(launch) 65 | } 66 | } 67 | } 68 | 69 | private fun insertRocket(launch: RocketLaunch) { 70 | dbQuery.insertRocket( 71 | id = launch.rocket.id, 72 | name = launch.rocket.name, 73 | type = launch.rocket.type 74 | ) 75 | } 76 | 77 | private fun insertLaunch(launch: RocketLaunch) { 78 | dbQuery.insertLaunch( 79 | flightNumber = launch.flightNumber.toLong(), 80 | missionName = launch.missionName, 81 | launchYear = launch.launchYear, 82 | rocketId = launch.rocket.id, 83 | details = launch.details, 84 | launchSuccess = launch.launchSuccess ?: false, 85 | launchDateUTC = launch.launchDateUTC, 86 | missionPatchUrl = launch.links.missionPatchUrl, 87 | articleUrl = launch.links.articleUrl 88 | ) 89 | } 90 | } -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/com/jetbrains/handson/kmm/shared/cache/DatabaseDriverFactory.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.kmm.shared.cache 2 | 3 | import com.squareup.sqldelight.db.SqlDriver 4 | 5 | expect class DatabaseDriverFactory { 6 | fun createDriver(): SqlDriver 7 | } -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/com/jetbrains/handson/kmm/shared/entity/Entity.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.kmm.shared.entity 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class RocketLaunch( 8 | @SerialName("flight_number") 9 | val flightNumber: Int, 10 | @SerialName("mission_name") 11 | val missionName: String, 12 | @SerialName("launch_year") 13 | val launchYear: Int, 14 | @SerialName("launch_date_utc") 15 | val launchDateUTC: String, 16 | @SerialName("rocket") 17 | val rocket: Rocket, 18 | @SerialName("details") 19 | val details: String?, 20 | @SerialName("launch_success") 21 | val launchSuccess: Boolean?, 22 | @SerialName("links") 23 | val links: Links 24 | ) 25 | 26 | @Serializable 27 | data class Rocket( 28 | @SerialName("rocket_id") 29 | val id: String, 30 | @SerialName("rocket_name") 31 | val name: String, 32 | @SerialName("rocket_type") 33 | val type: String 34 | ) 35 | 36 | @Serializable 37 | data class Links( 38 | @SerialName("mission_patch") 39 | val missionPatchUrl: String?, 40 | @SerialName("article_link") 41 | val articleUrl: String? 42 | ) -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/com/jetbrains/handson/kmm/shared/network/SpaceXApi.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.kmm.shared.network 2 | 3 | import com.jetbrains.handson.kmm.shared.entity.RocketLaunch 4 | import io.ktor.client.HttpClient 5 | import io.ktor.client.features.json.JsonFeature 6 | import io.ktor.client.features.json.serializer.KotlinxSerializer 7 | import io.ktor.client.request.* 8 | import kotlinx.serialization.json.Json 9 | 10 | class SpaceXApi { 11 | private val httpClient = HttpClient { 12 | install(JsonFeature) { 13 | val json = Json { ignoreUnknownKeys = true } 14 | serializer = KotlinxSerializer(json) 15 | } 16 | } 17 | 18 | suspend fun getAllLaunches(): List { 19 | return httpClient.get(LAUNCHES_ENDPOINT) 20 | } 21 | 22 | companion object { 23 | private const val LAUNCHES_ENDPOINT = "https://api.spacexdata.com/v3/launches" 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /shared/src/commonMain/sqldelight/com/jetbrains/handson/kmm/shared/cache/AppDatabase.sq: -------------------------------------------------------------------------------- 1 | CREATE TABLE Launch ( 2 | flightNumber INTEGER NOT NULL, 3 | missionName TEXT NOT NULL, 4 | launchYear INTEGER AS Int NOT NULL DEFAULT 0, 5 | rocketId TEXT NOT NULL, 6 | details TEXT, 7 | launchSuccess INTEGER AS Boolean DEFAULT NULL, 8 | launchDateUTC TEXT NOT NULL, 9 | missionPatchUrl TEXT, 10 | articleUrl TEXT 11 | ); 12 | 13 | CREATE TABLE Rocket ( 14 | id TEXT NOT NULL PRIMARY KEY, 15 | name TEXT NOT NULL, 16 | type TEXT NOT NULL 17 | ); 18 | 19 | insertLaunch: 20 | INSERT INTO Launch(flightNumber, missionName, launchYear, rocketId, details, launchSuccess, launchDateUTC, missionPatchUrl, articleUrl) 21 | VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?); 22 | 23 | insertRocket: 24 | INSERT INTO Rocket(id, name, type) 25 | VALUES(?, ?, ?); 26 | 27 | removeAllLaunches: 28 | DELETE FROM Launch; 29 | 30 | removeAllRockets: 31 | DELETE FROM Rocket; 32 | 33 | selectRocketById: 34 | SELECT * FROM Rocket 35 | WHERE id = ?; 36 | 37 | selectAllLaunchesInfo: 38 | SELECT Launch.*, Rocket.* 39 | FROM Launch 40 | LEFT JOIN Rocket ON Rocket.id == Launch.rocketId; -------------------------------------------------------------------------------- /shared/src/iosMain/kotlin/com/jetbrains/handson/kmm/shared/cache/DatabaseDriverFactory.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.kmm.shared.cache 2 | 3 | import com.jetbrains.handson.kmm.shared.cache.AppDatabase 4 | import com.squareup.sqldelight.db.SqlDriver 5 | import com.squareup.sqldelight.drivers.native.NativeSqliteDriver 6 | 7 | actual class DatabaseDriverFactory { 8 | actual fun createDriver(): SqlDriver { 9 | return NativeSqliteDriver(AppDatabase.Schema, "test.db") 10 | } 11 | } --------------------------------------------------------------------------------