Skip to content

Commit a93b36c

Browse files
authored
Add v4 tutorial (#42)
1 parent 0327856 commit a93b36c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1744
-15
lines changed

.github/workflows/pr.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ jobs:
2626
working-directory: ./views/final
2727
run: |
2828
./gradlew assembleDebug
29+
- name: Build v4 tutorial
30+
working-directory: ./v4/final
31+
run: |
32+
./gradlew assembleDebug

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

v4/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Apollo Kotlin Tutorial
2+
3+
Repository for the [Apollo Kotlin](https://github.com/apollographql/apollo-kotlin) tutorial, using [Jetpack Compose](https://developer.android.com/jetpack/compose).
4+
5+
- [start](./start): the starter project with the boilerplate and UI code already written but no Apollo Kotlin code.
6+
- [final](./final): the final state of the application with all functionality

v4/final/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.idea
2+
.gradle
3+
.DS_Store
4+
build
5+
captures
6+
.externalNativeBuild
7+
.cxx
8+
local.properties

v4/final/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Apollo Kotlin Tutorial
2+
3+
Repository for the [Apollo Kotlin](https://github.com/apollographql/apollo-kotlin) tutorial, using [Jetpack Compose](https://developer.android.com/jetpack/compose).
4+
5+
This is the final state of the application with all functionality.

v4/final/app/build.gradle.kts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
plugins {
2+
id("com.android.application")
3+
id("org.jetbrains.kotlin.android")
4+
id("com.apollographql.apollo3").version("4.0.0-SNAPSHOT")
5+
}
6+
7+
android {
8+
namespace = "com.example.rocketreserver"
9+
compileSdk = 33
10+
11+
defaultConfig {
12+
applicationId = "com.example.rocketreserver"
13+
minSdk = 24
14+
targetSdk = 33
15+
versionCode = 1
16+
versionName = "1.0"
17+
18+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19+
vectorDrawables {
20+
useSupportLibrary = true
21+
}
22+
}
23+
24+
buildTypes {
25+
release {
26+
isMinifyEnabled = false
27+
proguardFiles(
28+
getDefaultProguardFile("proguard-android-optimize.txt"),
29+
"proguard-rules.pro"
30+
)
31+
}
32+
}
33+
compileOptions {
34+
sourceCompatibility(JavaVersion.VERSION_1_8)
35+
targetCompatibility(JavaVersion.VERSION_1_8)
36+
}
37+
kotlinOptions {
38+
jvmTarget = "1.8"
39+
}
40+
buildFeatures {
41+
compose = true
42+
}
43+
composeOptions {
44+
kotlinCompilerExtensionVersion = "1.4.3"
45+
}
46+
packagingOptions {
47+
resources {
48+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
49+
}
50+
}
51+
}
52+
53+
dependencies {
54+
implementation("androidx.core:core-ktx:1.9.0")
55+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.0")
56+
implementation("androidx.activity:activity-compose:1.6.1")
57+
implementation(platform("androidx.compose:compose-bom:2023.01.00"))
58+
implementation("androidx.compose.ui:ui")
59+
implementation("androidx.compose.ui:ui-graphics")
60+
implementation("androidx.compose.ui:ui-tooling-preview")
61+
implementation("androidx.compose.material3:material3")
62+
implementation("androidx.navigation:navigation-compose:2.5.3")
63+
implementation("androidx.security:security-crypto:1.1.0-alpha05")
64+
implementation("io.coil-kt:coil-compose:2.2.2")
65+
66+
implementation("com.apollographql.apollo3:apollo-runtime")
67+
68+
testImplementation("junit:junit:4.13.2")
69+
androidTestImplementation("androidx.test.ext:junit:1.1.5")
70+
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
71+
androidTestImplementation(platform("androidx.compose:compose-bom:2022.10.00"))
72+
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
73+
debugImplementation("androidx.compose.ui:ui-tooling")
74+
debugImplementation("androidx.compose.ui:ui-test-manifest")
75+
}
76+
77+
apollo {
78+
service("service") {
79+
packageName.set("com.example.rocketreserver")
80+
}
81+
}

v4/final/app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.example.rocketreserver
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.example.rocketreserver", appContext.packageName)
23+
}
24+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
<application
8+
android:allowBackup="true"
9+
android:dataExtractionRules="@xml/data_extraction_rules"
10+
android:fullBackupContent="@xml/backup_rules"
11+
android:icon="@mipmap/ic_launcher"
12+
android:label="@string/app_name"
13+
android:networkSecurityConfig="@xml/network_security_config"
14+
android:roundIcon="@mipmap/ic_launcher_round"
15+
android:supportsRtl="true"
16+
android:theme="@style/Theme.RocketReserver"
17+
tools:targetApi="31">
18+
<activity
19+
android:name=".MainActivity"
20+
android:exported="true"
21+
android:label="@string/app_name"
22+
android:theme="@style/Theme.RocketReserver">
23+
<intent-filter>
24+
<action android:name="android.intent.action.MAIN" />
25+
26+
<category android:name="android.intent.category.LAUNCHER" />
27+
</intent-filter>
28+
</activity>
29+
</application>
30+
31+
</manifest>

0 commit comments

Comments
 (0)