Skip to content

Commit

Permalink
Update dependencies, release notes
Browse files Browse the repository at this point in the history
As usual, painful as hell and took me 2 hours.
kotlin-allopen fails with mockito for no reason, half of the tests don't pass!
  • Loading branch information
maltaisn committed Aug 30, 2023
1 parent ef1c90a commit 5bb976f
Show file tree
Hide file tree
Showing 31 changed files with 118 additions and 115 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## v1.5.2 (TBD)
## v1.5.3 (TBD)
- Nothing.

## v1.5.2 (2023-08-27)
- Allow creating note from shared file.
- Fixed share action not working if used more than once during execution.
- Fixed automatic bullet insertion adding bullets when bullet char was preceded by non whitespace.
Expand Down
17 changes: 9 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id "com.android.application"
id "kotlin-android"
id "org.jetbrains.kotlin.plugin.serialization"
id "kotlin-allopen"
id "org.jetbrains.kotlin.plugin.allopen"
id "androidx.navigation.safeargs.kotlin"
id "com.github.triplet.play"
id "com.github.breadmoirai.github-release"
Expand All @@ -13,15 +13,15 @@ plugins {

android {
namespace "com.maltaisn.notes"
compileSdkVersion 33
buildToolsVersion "33.0.1"

defaultConfig {
applicationId "com.maltaisn.notes"
minSdkVersion 21
targetSdkVersion 33
versionCode 10502
versionName "1.5.2"
compileSdk 34
buildToolsVersion = "34.0.0"
targetSdkVersion 34
versionCode 10503
versionName "1.5.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -35,6 +35,7 @@ android {

buildFeatures {
viewBinding = true
buildConfig = true
}

sourceSets {
Expand Down Expand Up @@ -163,7 +164,7 @@ dependencies {
androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoVersion"
}

tasks.getByName("build") {
tasks.named("build") {
// don't test, don't lint, don't run detekt for build task.
setDependsOn(getDependsOn().findAll { it != "check" })
}
Expand All @@ -179,7 +180,7 @@ if (file("publishing.gradle").exists()) {
apply from: "publishing.gradle"
}

task takeScreenshots(type: Exec) {
tasks.register("takeScreenshots", Exec) {
commandLine "./screenshots.sh"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ import com.maltaisn.notes.model.entity.Reminder
import com.maltaisn.notesshared.dateFor
import com.maltaisn.notesshared.testNote
import com.maltaisn.recurpicker.Recurrence
import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.mock
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.Json
import org.intellij.lang.annotations.Language
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import java.security.KeyStore
import javax.crypto.spec.SecretKeySpec
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ object ScreenshotHelper {
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_PICTURES + File.separator + "screenshot_")
val imageUri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues)!!
val fos = resolver.openOutputStream(imageUri)
fos.use {
fos?.use {
capture.compress(Bitmap.CompressFormat.PNG, 100, it)
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/debug/kotlin/com/maltaisn/notes/OpenForTesting.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@

package com.maltaisn.notes

@Target(AnnotationTarget.ANNOTATION_CLASS)
@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS)
annotation class OpenClass

@OpenClass
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/kotlin/com/maltaisn/notes/model/NotesDatabase.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -59,12 +59,12 @@ abstract class NotesDatabase : RoomDatabase() {
const val VERSION = 4

val MIGRATION_1_2 = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
// By removing the sync feature, some data is now useless.
// - Deleted notes table
// - Synced flag on notes
// - UUID flag on notes (unique ID across devices)
database.apply {
db.apply {
execSQL("DROP TABLE deleted_notes")
execSQL("""CREATE TABLE notes_temp (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
type INTEGER NOT NULL, title TEXT NOT NULL, content TEXT NOT NULL, metadata TEXT NOT NULL,
Expand All @@ -79,8 +79,8 @@ abstract class NotesDatabase : RoomDatabase() {
}

val MIGRATION_2_3 = object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.apply {
override fun migrate(db: SupportSQLiteDatabase) {
db.apply {
// Add pinned column to notes table. 'unpinned' for active notes, 'can't pin' for others.
execSQL("ALTER TABLE notes ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0")
execSQL("UPDATE notes SET pinned = 1 WHERE status == 0")
Expand All @@ -106,8 +106,8 @@ abstract class NotesDatabase : RoomDatabase() {
}

val MIGRATION_3_4 = object : Migration(3, 4) {
override fun migrate(database: SupportSQLiteDatabase) {
database.apply {
override fun migrate(db: SupportSQLiteDatabase) {
db.apply {
// Add hidden attribute for labels
execSQL("ALTER TABLE labels ADD COLUMN hidden INTEGER NOT NULL DEFAULT 0")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package com.maltaisn.notes.model

import android.content.Context
import android.content.SharedPreferences
import androidx.annotation.OpenForTesting
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import com.maltaisn.notes.OpenForTesting
import com.maltaisn.notes.R
import com.maltaisn.notes.model.entity.NoteType
import com.maltaisn.notes.ui.AppTheme
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@

package com.maltaisn.notes.model

import com.maltaisn.notes.OpenForTesting
import androidx.annotation.OpenForTesting
import com.maltaisn.notes.model.entity.Note
import com.maltaisn.recurpicker.RecurrenceFinder
import kotlinx.coroutines.flow.first
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,6 @@ package com.maltaisn.notes.model.converter

import androidx.room.TypeConverter
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encoding.Decoder
Expand All @@ -28,7 +27,6 @@ import java.util.Date
import java.util.Locale
import java.util.TimeZone

@Serializer(forClass = Date::class)
object DateTimeConverter : KSerializer<Date> {

private val threadLocalDateFormat = ThreadLocal<SimpleDateFormat>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,6 @@ import com.maltaisn.notes.model.BadDataException
import com.maltaisn.notes.model.entity.NoteMetadata
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerializationException
import kotlinx.serialization.Serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encoding.Decoder
Expand All @@ -33,7 +32,6 @@ import kotlinx.serialization.json.Json
* When serialized, metadata JSON in itself encoded into a JSON string. This wouldn't be
* necessary but it simplifies the server's job. Also metadata *could* eventually not be JSON.
*/
@Serializer(forClass = NoteMetadata::class)
object NoteMetadataConverter : KSerializer<NoteMetadata> {

private val json = Json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,13 +19,11 @@ package com.maltaisn.notes.model.converter
import androidx.room.TypeConverter
import com.maltaisn.notes.model.entity.NoteStatus
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

@Serializer(forClass = NoteStatus::class)
object NoteStatusConverter : KSerializer<NoteStatus> {

@TypeConverter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,13 +19,11 @@ package com.maltaisn.notes.model.converter
import androidx.room.TypeConverter
import com.maltaisn.notes.model.entity.NoteType
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

@Serializer(forClass = NoteType::class)
object NoteTypeConverter : KSerializer<NoteType> {

@TypeConverter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,13 +19,11 @@ package com.maltaisn.notes.model.converter
import androidx.room.TypeConverter
import com.maltaisn.notes.model.entity.PinnedStatus
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

@Serializer(forClass = PinnedStatus::class)
object PinnedStatusConverter : KSerializer<PinnedStatus> {

@TypeConverter
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/kotlin/com/maltaisn/notes/ui/Event.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -48,9 +48,9 @@ class Event<out T>(private val content: T) {
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
if (event?.hasBeenHandled == false) {
onEventUnhandledContent(event.requireUnhandledContent())
override fun onChanged(value: Event<T>) {
if (!value.hasBeenHandled) {
onEventUnhandledContent(value.requireUnhandledContent())
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/play/release-notes/en-US/production.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
- Ask to confirm before opening links.
- Small bug fixes.
- Translations update.
- Added Chinese translation.
4 changes: 1 addition & 3 deletions app/src/main/play/release-notes/fr-CA/production.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
- Demande de confirmation avant d'ouvrir un lien.
- Correction de bugs mineurs.
- Mise à jour des traductions.
- Ajout d'une traduction en chinois.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Nicolas Maltais
* Copyright 2023 Nicolas Maltais
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,8 +33,8 @@ fun <T> LiveData<T>.getOrAwaitValue(time: Duration = 1.seconds): T {
var data: T? = null
val latch = CountDownLatch(1)
val observer = object : Observer<T> {
override fun onChanged(o: T?) {
data = o
override fun onChanged(value: T) {
data = value
latch.countDown()
this@getOrAwaitValue.removeObserver(this)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ import com.maltaisn.notesshared.listNote
import com.maltaisn.notesshared.model.MockLabelsRepository
import com.maltaisn.notesshared.model.MockNotesRepository
import com.maltaisn.notesshared.testNote
import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.whenever
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever
import java.util.Date
import kotlin.random.Random
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ import com.maltaisn.notesshared.MainCoroutineRule
import com.maltaisn.notesshared.model.MockLabelsRepository
import com.maltaisn.notesshared.model.MockNotesRepository
import com.maltaisn.notesshared.testNote
import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.mock
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import kotlin.test.assertEquals
import kotlin.test.assertTrue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ import com.maltaisn.notesshared.model.MockLabelsRepository
import com.maltaisn.notesshared.model.MockNotesRepository
import com.maltaisn.notesshared.testNote
import com.maltaisn.recurpicker.Recurrence
import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.mock
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import java.util.Date
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand Down
Loading

0 comments on commit 5bb976f

Please sign in to comment.