Skip to content

Commit

Permalink
Kotlin migration and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Oct 25, 2020
1 parent cf75c74 commit 5bf2975
Show file tree
Hide file tree
Showing 13 changed files with 194 additions and 171 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Android CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Fix gradlew permission
run: chmod +x gradlew
- name: Check
run: ./gradlew check --stacktrace
- name: Assemble
run: ./gradlew assembleDebug --stacktrace
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: app-debug.apk
path: app/build/outputs/apk/debug/app-debug.apk
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

104 changes: 0 additions & 104 deletions app/build.gradle

This file was deleted.

106 changes: 106 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
plugins {
id("com.android.application")
kotlin("android")
kotlin("android.extensions")
kotlin("kapt")
}

val versionMajor = 1
val versionMinor = 8
val versionPatch = 2
val versionBuild = 0

android {
compileSdkVersion(30)
defaultConfig {
applicationId = "fr.smarquis.fcm"
minSdkVersion(16)
targetSdkVersion(30)
versionCode = versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
versionName = "$versionMajor.$versionMinor.$versionPatch"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled = true

javaCompileOptions {
annotationProcessorOptions {
argument("room.schemaLocation", "$projectDir/schemas")
argument("room.incremental", "true")
argument("room.expandProjection", "true")
}
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
testOptions {
unitTests.isIncludeAndroidResources = true
unitTests.isReturnDefaultValues = true
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10")

/* AndroidX */
implementation("androidx.appcompat:appcompat:1.3.0-alpha02")
implementation("androidx.constraintlayout:constraintlayout:2.0.2")
implementation("androidx.core:core-ktx:1.5.0-alpha04")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.2.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0")
implementation("androidx.preference:preference-ktx:1.1.1")
implementation("androidx.recyclerview:recyclerview:1.2.0-alpha06")
implementation("androidx.transition:transition:1.3.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
androidTestImplementation("androidx.test.ext:junit:1.1.2")

/* Material Design */
implementation("com.google.android.material:material:1.3.0-alpha03")

/* Firebase */
implementation("com.google.firebase:firebase-core:17.5.1")
implementation("com.google.firebase:firebase-messaging:20.3.0")
implementation("com.google.firebase:firebase-database:19.5.1")

/* Koin: Dependency Injection */
val koin = "2.1.6"
implementation("org.koin:koin-android:$koin")
implementation("org.koin:koin-android-scope:$koin")
implementation("org.koin:koin-android-viewmodel:$koin")
testImplementation("org.koin:koin-test:$koin")
androidTestImplementation("org.koin:koin-test:$koin")

/* Moshi: JSON parsing */
val moshi = "1.11.0"
implementation("com.squareup.moshi:moshi-adapters:$moshi")
implementation("com.squareup.moshi:moshi-kotlin:$moshi")
kapt("com.squareup.moshi:moshi-kotlin-codegen:$moshi")

/* Room: SQLite persistence */
val room = "2.2.5"
implementation("androidx.room:room-runtime:$room")
kapt("androidx.room:room-compiler:$room")
implementation("androidx.room:room-ktx:$room")
testImplementation("androidx.room:room-testing:$room")

/* Kotlin Coroutines */
val coroutines = "1.4.0-M1"
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutines")

/* JUnit */
testImplementation("junit:junit:4.13.1")

}

apply(plugin = "com.google.gms.google-services")
2 changes: 2 additions & 0 deletions app/src/main/java/fr/smarquis/fcm/data/model/Message.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package fr.smarquis.fcm.data.model

import androidx.annotation.Keep
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity
@Keep
data class Message(
@PrimaryKey
@ColumnInfo(name = "messageId") val messageId: String,
Expand Down
Loading

0 comments on commit 5bf2975

Please sign in to comment.