Compare commits

...

57 commits

Author SHA1 Message Date
2f5ebb28f6
Update changelog
Some checks failed
Build & Test / Validate (pull_request) Successful in 18s
Build & Test / Run Unit Tests (pull_request) Failing after 14m43s
Build & Test / Run UI Tests (pull_request) Has been skipped
2024-11-06 21:12:46 -07:00
6569ac64b2
Fix opening files from external apps
I somehow missed this when migrating to compose and worse yet, didn't have any tests covering it. That's been remedied now so hopefully it continues to work well into the future

Closes #90
2024-11-06 21:12:20 -07:00
13962a11d7
Improve animations for predictive back 2024-11-06 21:01:36 -07:00
380280686a
Consolidate androidx navigation versions 2024-11-06 20:50:37 -07:00
53df7da0aa Update dependency androidx.navigation:navigation-runtime-ktx to v2.8.3 2024-11-07 03:49:15 +00:00
9e8c65396e
Disable ObsoleteLintCustomCheck 2024-11-06 20:48:29 -07:00
730bf3f7d8
Opt in to predictive back gestures 2024-11-06 20:47:16 -07:00
80b18b242e Update dependency com.autonomousapps.dependency-analysis to v2.4.2
All checks were successful
Build & Test / Validate (pull_request) Successful in 18s
Build & Test / Run Unit Tests (pull_request) Successful in 16m8s
Build & Test / Run UI Tests (pull_request) Successful in 19m42s
2024-11-04 00:03:17 +00:00
1a4e5b8e9e Update acra to v5.12.0
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m55s
Build & Test / Run UI Tests (pull_request) Successful in 18m0s
2024-11-03 18:02:40 +00:00
29469df9c6 Update androidGradlePlugin to v8.7.2
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 15m7s
Build & Test / Run UI Tests (pull_request) Successful in 19m18s
2024-11-02 02:03:05 +00:00
0d30c2b40d Update dependency com.autonomousapps.dependency-analysis to v2.4.1
All checks were successful
Build & Test / Validate (pull_request) Successful in 16s
Build & Test / Run Unit Tests (pull_request) Successful in 15m6s
Build & Test / Run UI Tests (pull_request) Successful in 19m42s
2024-11-02 01:03:05 +00:00
055437c052 Update dependency com.autonomousapps.dependency-analysis to v2.4.0
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 12m40s
Build & Test / Run UI Tests (pull_request) Successful in 18m21s
2024-10-31 16:03:39 +00:00
9bc75b475e Update dependency androidx.core:core-ktx to v1.15.0
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m14s
Build & Test / Run UI Tests (pull_request) Successful in 17m51s
2024-10-31 14:03:47 +00:00
1de349e161 Update dependency androidx.lifecycle:lifecycle-viewmodel-ktx to v2.8.7
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m40s
Build & Test / Run UI Tests (pull_request) Successful in 18m7s
2024-10-31 12:03:06 +00:00
20d688d110 Update dependency androidx.compose:compose-bom to v2024.10.01
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m19s
Build & Test / Run UI Tests (pull_request) Successful in 21m8s
2024-10-31 09:03:05 +00:00
554937ae03 Update dependency androidx.compose.material:material-icons-core to v1.7.5
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m13s
Build & Test / Run UI Tests (pull_request) Successful in 18m2s
2024-10-31 05:03:00 +00:00
8e6e305ecf Update dependency androidx.compose.material3:material3-window-size-class-android to v1.3.1
All checks were successful
Build & Test / Validate (pull_request) Successful in 15s
Build & Test / Run Unit Tests (pull_request) Successful in 13m33s
Build & Test / Run UI Tests (pull_request) Successful in 18m1s
2024-10-31 00:03:16 +00:00
c1ba9dcf91 Update animationCore to v1.7.5
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 14m21s
Build & Test / Run UI Tests (pull_request) Successful in 17m42s
2024-10-30 17:02:53 +00:00
9bc220d5bb Update commonMarkVersion to v0.24.0
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 14m4s
Build & Test / Run UI Tests (pull_request) Successful in 18m51s
2024-10-24 20:02:59 +00:00
bb158f0120 Update dependency com.autonomousapps.dependency-analysis to v2.3.0
All checks were successful
Build & Test / Validate (pull_request) Successful in 18s
Build & Test / Run Unit Tests (pull_request) Successful in 14m51s
Build & Test / Run UI Tests (pull_request) Successful in 18m42s
2024-10-24 19:03:03 +00:00
8809d295c4 Update dependency androidx.compose:compose-bom to v2024.10.00
All checks were successful
Build & Test / Validate (pull_request) Successful in 18s
Build & Test / Run Unit Tests (pull_request) Successful in 15m49s
Build & Test / Run UI Tests (pull_request) Successful in 19m17s
2024-10-19 01:04:28 +00:00
7de4996816 Update dependency androidx.test:orchestrator to v1.5.1
All checks were successful
Build & Test / Validate (pull_request) Successful in 16s
Build & Test / Run Unit Tests (pull_request) Successful in 15m47s
Build & Test / Run UI Tests (pull_request) Successful in 19m26s
2024-10-18 23:03:48 +00:00
a4ef52f2cc Update dependency com.google.android.play:review-ktx to v2.0.2
All checks were successful
Build & Test / Validate (pull_request) Successful in 24s
Build & Test / Run Unit Tests (pull_request) Successful in 13m52s
Build & Test / Run UI Tests (pull_request) Successful in 17m38s
2024-10-18 21:09:23 +00:00
ce14205c4f Update dependency com.autonomousapps.dependency-analysis to v2.2.0
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 14m6s
Build & Test / Run UI Tests (pull_request) Successful in 19m32s
2024-10-18 20:06:49 +00:00
41607fba52 Update dependency androidx.compose.material:material-icons-core to v1.7.4
All checks were successful
Build & Test / Validate (pull_request) Successful in 22s
Build & Test / Run Unit Tests (pull_request) Successful in 13m48s
Build & Test / Run UI Tests (pull_request) Successful in 20m50s
2024-10-17 02:06:52 +00:00
ca83a92158 Update androidGradlePlugin to v8.7.1
All checks were successful
Build & Test / Validate (pull_request) Successful in 26s
Build & Test / Run Unit Tests (pull_request) Successful in 15m41s
Build & Test / Run UI Tests (pull_request) Successful in 19m33s
2024-10-16 23:06:57 +00:00
c59faea4d4 Update dependency androidx.activity:activity-ktx to v1.9.3
All checks were successful
Build & Test / Validate (pull_request) Successful in 15s
Build & Test / Run Unit Tests (pull_request) Successful in 14m3s
Build & Test / Run UI Tests (pull_request) Successful in 18m18s
2024-10-16 19:03:08 +00:00
d028c8cb2f Update dependency androidx.compose.animation:animation to v1.7.4
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 14m33s
Build & Test / Run UI Tests (pull_request) Successful in 19m33s
2024-10-16 17:02:48 +00:00
f2f92b2318 Update kotlin to v2.0.21
All checks were successful
Build & Test / Validate (pull_request) Successful in 24s
Build & Test / Run Unit Tests (pull_request) Successful in 15m33s
Build & Test / Run UI Tests (pull_request) Successful in 20m4s
2024-10-10 10:11:20 +00:00
e94b5a67c1 Update dependency com.autonomousapps.dependency-analysis to v2.1.4
All checks were successful
Build & Test / Validate (pull_request) Successful in 18s
Build & Test / Run Unit Tests (pull_request) Successful in 14m29s
Build & Test / Run UI Tests (pull_request) Successful in 19m13s
2024-10-04 20:07:45 +00:00
e386fcd82f Update dependency com.autonomousapps.dependency-analysis to v2.1.3
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m4s
Build & Test / Run UI Tests (pull_request) Successful in 18m1s
2024-10-04 04:03:21 +00:00
cbbef5cf6f
Update changelog 2024-10-03 20:57:15 -06:00
e8eb71e18b
Bump version for release
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 24m51s
Build & Test / Run UI Tests (pull_request) Successful in 21m35s
2024-10-03 16:25:04 -06:00
5abfe147f3 Update dependency com.android.billingclient:billing to v7.1.1
All checks were successful
Build & Test / Validate (pull_request) Successful in 18s
Build & Test / Run Unit Tests (pull_request) Successful in 14m7s
Build & Test / Run UI Tests (pull_request) Successful in 17m54s
2024-10-03 20:01:53 +00:00
24ed864645 Update dependency com.autonomousapps.dependency-analysis to v2.1.2
All checks were successful
Build & Test / Validate (pull_request) Successful in 18s
Build & Test / Run Unit Tests (pull_request) Successful in 13m21s
Build & Test / Run UI Tests (pull_request) Successful in 18m1s
2024-10-03 16:01:53 +00:00
4f36b2f54c Update dependency androidx.compose:compose-bom to v2024.09.03
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m23s
Build & Test / Run UI Tests (pull_request) Successful in 18m19s
2024-10-02 20:02:54 +00:00
b6ee357407 Update dependency androidx.compose.material:material-icons-core to v1.7.3
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 14m29s
Build & Test / Run UI Tests (pull_request) Successful in 18m30s
2024-10-02 18:03:12 +00:00
154ccad9f1 Update animationCore to v1.7.3
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m46s
Build & Test / Run UI Tests (pull_request) Successful in 18m4s
2024-10-02 17:03:22 +00:00
d9032fb686 Update androidGradlePlugin to v8.7.0 2024-10-02 14:46:41 +00:00
9898e09ac6 Update dependency com.autonomousapps.dependency-analysis to v2.1.1
All checks were successful
Build & Test / Validate (pull_request) Successful in 17s
Build & Test / Run Unit Tests (pull_request) Successful in 13m26s
Build & Test / Run UI Tests (pull_request) Successful in 19m20s
2024-10-02 13:03:41 +00:00
4932ac15f8 Fix deprecated usage of gradle-build action 2024-10-02 12:38:20 +00:00
8fd4c8f8fd Update gradle/gradle-build-action action to v3 2024-10-02 12:38:20 +00:00
79b0f9996f Remove dependency on hamcrest core 2024-10-02 12:37:56 +00:00
7024ffc6d6 Update dependency org.hamcrest:hamcrest-core to v3 2024-10-02 12:37:56 +00:00
2f30d2fd6f Only set publishCredentialsFile if not blank 2024-10-02 12:37:17 +00:00
0ade9be784 Only set publishCredentialsFile if present 2024-10-02 12:37:17 +00:00
bf01006004 Update release notes 2024-10-02 12:37:17 +00:00
e5e072e4fe Add publish credentials to keystore.properties.sample 2024-10-02 12:37:17 +00:00
6d34bb6f94 Fix changelog task to use git tag as input 2024-10-02 12:37:17 +00:00
9d26752d2b Opt-in to ExperimentalCoroutinesApi for MarkdownViewModelTest 2024-10-02 12:36:04 +00:00
3f5c6b7ebf Suppress unchecked cast for FakePreferenceHelper#observe
I know it's not great but it works for now
2024-10-02 12:36:04 +00:00
79d609f138 Bump Java version to 11 2024-10-02 12:36:04 +00:00
4271ded6aa Suppress unchecked cast for PreferenceHelper#observe
I know it's not great but it works for now
2024-10-02 12:36:04 +00:00
7f945ba5fe Update HorizontalPager parameters to reflect API changes 2024-10-02 12:36:04 +00:00
12d5fcb834 Update dependency androidx.compose:compose-bom to v2024.09.02 2024-10-02 12:36:04 +00:00
3ac064c02c
Fix deprecated usage of setup-gradle action
All checks were successful
Build & Test / Validate (pull_request) Successful in 27s
Build & Test / Run Unit Tests (pull_request) Successful in 16m36s
Build & Test / Run UI Tests (pull_request) Successful in 20m12s
2024-10-01 20:49:57 -06:00
b0105dc5a4 Update gradle/actions action to v4
Some checks failed
Build & Test / Validate (pull_request) Successful in 16s
Build & Test / Run Unit Tests (pull_request) Failing after 1m1s
Build & Test / Run UI Tests (pull_request) Has been skipped
2024-09-24 02:02:47 +00:00
20 changed files with 143 additions and 90 deletions

View file

@ -15,7 +15,7 @@ jobs:
distribution: 'zulu' distribution: 'zulu'
java-version: '17' java-version: '17'
- name: Validate Gradle Wrapper - name: Validate Gradle Wrapper
uses: https://git.wbrawner.com/gradle/actions/wrapper-validation@v3 uses: https://git.wbrawner.com/gradle/actions/wrapper-validation@v4
unit_tests: unit_tests:
name: Run Unit Tests name: Run Unit Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -30,10 +30,10 @@ jobs:
java-version: '17' java-version: '17'
- name: Setup Android SDK - name: Setup Android SDK
uses: https://git.wbrawner.com/android-actions/setup-android@v3 uses: https://git.wbrawner.com/android-actions/setup-android@v3
- name: Setup Gradle
uses: https://git.wbrawner.com/gradle/actions/setup-gradle@v4
- name: Run unit tests - name: Run unit tests
uses: https://git.wbrawner.com/gradle/actions/setup-gradle@v3 run: ./gradlew check
with:
arguments: check
- name: Publish JUnit Results - name: Publish JUnit Results
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: always() if: always()
@ -55,10 +55,10 @@ jobs:
java-version: '17' java-version: '17'
- name: Setup Android SDK - name: Setup Android SDK
uses: https://git.wbrawner.com/android-actions/setup-android@v3 uses: https://git.wbrawner.com/android-actions/setup-android@v3
- name: Build with Gradle - name: Setup Gradle
uses: https://git.wbrawner.com/gradle/gradle-build-action@v2 uses: https://git.wbrawner.com/gradle/actions/setup-gradle@v4
with: - name: Build APKs
arguments: assemblePlayDebug assemblePlayDebugAndroidTest run: ./gradlew assemblePlayDebug assemblePlayDebugAndroidTest
- name: Grant execute permission for flank_auth.sh - name: Grant execute permission for flank_auth.sh
run: chmod +x flank_auth.sh run: chmod +x flank_auth.sh
- name: Add auth for flank - name: Add auth for flank
@ -67,6 +67,4 @@ jobs:
run: | run: |
./flank_auth.sh ./flank_auth.sh
- name: Run UI tests - name: Run UI tests
uses: https://git.wbrawner.com/gradle/gradle-build-action@v2 run: ./gradlew runFlank
with:
arguments: runFlank

View file

@ -37,7 +37,7 @@ jobs:
distribution: 'zulu' distribution: 'zulu'
java-version: '17' java-version: '17'
- name: Run unit tests - name: Run unit tests
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v3
with: with:
arguments: testPlayDebugUnitTest arguments: testPlayDebugUnitTest
- name: Publish JUnit Results - name: Publish JUnit Results
@ -61,7 +61,7 @@ jobs:
distribution: 'zulu' distribution: 'zulu'
java-version: '17' java-version: '17'
- name: Build with Gradle - name: Build with Gradle
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v3
with: with:
arguments: assemblePlayDebug assemblePlayDebugAndroidTest arguments: assemblePlayDebug assemblePlayDebugAndroidTest
- name: Grant execute permission for flank_auth.sh - name: Grant execute permission for flank_auth.sh
@ -72,6 +72,6 @@ jobs:
run: | run: |
./flank_auth.sh ./flank_auth.sh
- name: Run UI tests - name: Run UI tests
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v3
with: with:
arguments: runFlank arguments: runFlank

View file

@ -21,6 +21,7 @@ try {
keystoreProperties["keyPassword"] = "" keystoreProperties["keyPassword"] = ""
keystoreProperties["storeFile"] = File.createTempFile("temp", ".tmp").absolutePath keystoreProperties["storeFile"] = File.createTempFile("temp", ".tmp").absolutePath
keystoreProperties["storePassword"] = "" keystoreProperties["storePassword"] = ""
keystoreProperties["publishCredentialsFile"] = ""
} }
android { android {
@ -37,18 +38,18 @@ android {
} }
compileSdk = libs.versions.maxSdk.get().toInt() compileSdk = libs.versions.maxSdk.get().toInt()
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
defaultConfig { defaultConfig {
applicationId = "com.wbrawner.simplemarkdown" applicationId = "com.wbrawner.simplemarkdown"
minSdk = libs.versions.minSdk.get().toInt() minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.maxSdk.get().toInt() targetSdk = libs.versions.maxSdk.get().toInt()
versionCode = 44 versionCode = 45
versionName = "1.0.2" versionName = "2024.10.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["clearPackageData"] = "true" testInstrumentationRunnerArguments["clearPackageData"] = "true"
buildConfigField("boolean", "ENABLE_CUSTOM_CSS", "true") buildConfigField("boolean", "ENABLE_CUSTOM_CSS", "true")
@ -98,7 +99,11 @@ android {
} }
} }
lint { lint {
disable += listOf("AndroidGradlePluginVersion", "GradleDependency") disable += listOf(
"AndroidGradlePluginVersion",
"GradleDependency",
"ObsoleteLintCustomCheck"
)
warningsAsErrors = true warningsAsErrors = true
} }
} }
@ -108,6 +113,9 @@ play {
enabled.set(false) enabled.set(false)
track.set("production") track.set("production")
defaultToAppBundles.set(true) defaultToAppBundles.set(true)
(keystoreProperties["publishCredentialsFile"] as? String)?.ifBlank { null }?.let {
serviceAccountCredentials.set(file(it))
}
} }
dependencies { dependencies {
@ -154,7 +162,6 @@ dependencies {
androidTestImplementation(libs.androidx.core) androidTestImplementation(libs.androidx.core)
androidTestImplementation(libs.androidx.monitor) androidTestImplementation(libs.androidx.monitor)
androidTestImplementation(libs.junit) androidTestImplementation(libs.junit)
androidTestImplementation(libs.hamcrest.core)
implementation(libs.androidx.activity.ktx) implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.activity.ktx) implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.animation.core) implementation(libs.androidx.animation.core)

View file

@ -182,6 +182,29 @@ class MarkdownTests {
} }
} }
@Test
fun launchWithContentUriTest() = runTest {
val markdownText = "# UI Testing\n\nThe quick brown fox jumped over the lazy dog."
file.outputStream().writer().use { it.write(markdownText) }
val fileUri = FileProvider.getUriForFile(
getApplicationContext(),
"${BuildConfig.APPLICATION_ID}.fileprovider",
file
)
ActivityScenario.launch<MainActivity>(
Intent(
Intent.ACTION_VIEW,
fileUri,
getInstrumentation().targetContext,
MainActivity::class.java
)
)
onMainScreen(composeRule) {
awaitIdle()
checkMarkdownEquals(markdownText)
checkTitleEquals("temp.md")
}
}
@Test @Test
fun openEditAndSaveMarkdownTest() = runTest { fun openEditAndSaveMarkdownTest() = runTest {

View file

@ -7,6 +7,7 @@
<application <application
android:name=".MarkdownApplication" android:name=".MarkdownApplication"
android:allowBackup="true" android:allowBackup="true"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:resizeableActivity="true" android:resizeableActivity="true"
@ -14,7 +15,7 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.App.Starting" android:theme="@style/Theme.App.Starting"
tools:ignore="AllowBackup" tools:ignore="AllowBackup"
tools:targetApi="n"> tools:targetApi="tiramisu">
<activity android:name=".MainActivity" <activity android:name=".MainActivity"
android:exported="true" android:exported="true"
android:label="@string/app_name_short"> android:label="@string/app_name_short">

View file

@ -8,12 +8,11 @@ import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.animation.AnimatedContentTransitionScope import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.core.EaseIn import androidx.compose.animation.core.EaseIn
import androidx.compose.animation.core.LinearEasing import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.scaleOut
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Help import androidx.compose.material.icons.automirrored.filled.Help
import androidx.compose.material.icons.filled.Edit import androidx.compose.material.icons.filled.Edit
@ -108,13 +107,9 @@ class MainActivity : AppCompatActivity(), ActivityCompat.OnRequestPermissionsRes
towards = AnimatedContentTransitionScope.SlideDirection.Start towards = AnimatedContentTransitionScope.SlideDirection.Start
) )
}, },
popEnterTransition = { EnterTransition.None }, popEnterTransition = { fadeIn() },
popExitTransition = { popExitTransition = {
fadeOut( scaleOut(targetScale = 0.9f) + slideOutOfContainer(
animationSpec = tween(
300, easing = LinearEasing
)
) + slideOutOfContainer(
animationSpec = tween(300, easing = EaseIn), animationSpec = tween(300, easing = EaseIn),
towards = AnimatedContentTransitionScope.SlideDirection.End towards = AnimatedContentTransitionScope.SlideDirection.End
) )

View file

@ -14,7 +14,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@ -50,9 +49,6 @@ class MarkdownViewModel(
private val saveMutex = Mutex() private val saveMutex = Mutex()
init { init {
viewModelScope.launch {
load(null)
}
preferenceHelper.observe<Boolean>(Preference.LOCK_SWIPING) preferenceHelper.observe<Boolean>(Preference.LOCK_SWIPING)
.onEach { .onEach {
_state.value = _state.value.copy(lockSwiping = it) _state.value = _state.value.copy(lockSwiping = it)

View file

@ -4,7 +4,6 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@ -62,6 +61,7 @@ import com.wbrawner.simplemarkdown.MarkdownViewModel
import com.wbrawner.simplemarkdown.ParameterizedText import com.wbrawner.simplemarkdown.ParameterizedText
import com.wbrawner.simplemarkdown.R import com.wbrawner.simplemarkdown.R
import com.wbrawner.simplemarkdown.Route import com.wbrawner.simplemarkdown.Route
import com.wbrawner.simplemarkdown.utility.activity
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
@ -87,6 +87,10 @@ fun MainScreen(
val alert by viewModel.collectAsState(EditorState::alert, null) val alert by viewModel.collectAsState(EditorState::alert, null)
val saveCallback by viewModel.collectAsState(EditorState::saveCallback, null) val saveCallback by viewModel.collectAsState(EditorState::saveCallback, null)
val lockSwiping by viewModel.collectAsState(EditorState::lockSwiping, false) val lockSwiping by viewModel.collectAsState(EditorState::lockSwiping, false)
val intentData = LocalContext.current.activity?.intent?.data
LaunchedEffect(intentData) {
viewModel.load(intentData?.toString())
}
LaunchedEffect(enableAutosave) { LaunchedEffect(enableAutosave) {
if (!enableAutosave) return@LaunchedEffect if (!enableAutosave) return@LaunchedEffect
while (isActive) { while (isActive) {
@ -327,7 +331,7 @@ private fun MainScreen(
} }
@Composable @Composable
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
private fun TabbedMarkdownEditor( private fun TabbedMarkdownEditor(
initialMarkdown: String, initialMarkdown: String,
markdown: String, markdown: String,
@ -349,7 +353,7 @@ private fun TabbedMarkdownEditor(
} }
HorizontalPager( HorizontalPager(
modifier = Modifier.fillMaxSize(1f), state = pagerState, modifier = Modifier.fillMaxSize(1f), state = pagerState,
beyondBoundsPageCount = 1, beyondViewportPageCount = 1,
userScrollEnabled = !lockSwiping userScrollEnabled = !lockSwiping
) { page -> ) { page ->
val keyboardController = LocalSoftwareKeyboardController.current val keyboardController = LocalSoftwareKeyboardController.current

View file

@ -1,11 +1,11 @@
package com.wbrawner.simplemarkdown.utility package com.wbrawner.simplemarkdown.utility
import android.app.Activity
import android.content.Context import android.content.Context
import android.content.ContextWrapper
import android.content.res.AssetManager import android.content.res.AssetManager
import android.net.Uri import android.net.Uri
import android.provider.OpenableColumns import android.provider.OpenableColumns
import android.view.View
import android.view.inputmethod.InputMethodManager
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.io.Reader import java.io.Reader
@ -41,3 +41,11 @@ suspend fun Uri.getName(context: Context): String {
} }
return fileName ?: "Untitled.md" return fileName ?: "Untitled.md"
} }
@Suppress("RecursivePropertyAccessor")
val Context.activity: Activity?
get() = when (this) {
is Activity -> this
is ContextWrapper -> baseContext.activity
else -> null
}

View file

@ -47,6 +47,7 @@ class AndroidPreferenceHelper(context: Context, private val coroutineScope: Coro
} }
} }
@Suppress("UNCHECKED_CAST")
override fun <T> observe(preference: Preference): StateFlow<T> = states[preference]!!.asStateFlow() as StateFlow<T> override fun <T> observe(preference: Preference): StateFlow<T> = states[preference]!!.asStateFlow() as StateFlow<T>
} }

View file

@ -0,0 +1,2 @@
- Fix opening files from external apps
- Update dependencies

View file

@ -1,5 +0,0 @@
- Fix crash on markdown preview
- Persist preference for Lock Swiping
- Enable gestures on nav drawer when open
- Close navigation drawer on back press
- Various dependency updates

View file

@ -23,6 +23,7 @@ class FakePreferenceHelper: PreferenceHelper {
preferences[preference] = value preferences[preference] = value
} }
@Suppress("UNCHECKED_CAST")
override fun <T> observe(preference: Preference): StateFlow<T> = override fun <T> observe(preference: Preference): StateFlow<T> =
preferenceFlow(preference) as StateFlow<T> preferenceFlow(preference) as StateFlow<T>
} }

View file

@ -23,6 +23,7 @@ import timber.log.Timber
import java.io.File import java.io.File
import java.net.URI import java.net.URI
@OptIn(ExperimentalCoroutinesApi::class)
class MarkdownViewModelTest { class MarkdownViewModelTest {
private lateinit var fileHelper: FakeFileHelper private lateinit var fileHelper: FakeFileHelper
private lateinit var preferenceHelper: FakePreferenceHelper private lateinit var preferenceHelper: FakePreferenceHelper

View file

@ -2,25 +2,37 @@ package com.wbrawner.releasehelper
import org.gradle.api.DefaultTask import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty import org.gradle.api.file.RegularFileProperty
import org.gradle.api.internal.provider.Providers
import org.gradle.api.model.ObjectFactory import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.ProviderFactory
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskAction
import javax.inject.Inject import javax.inject.Inject
private const val CHANGELOG_PATH = "src/play/play/release-notes/en-US/default.txt" private const val CHANGELOG_PATH = "src/play/play/release-notes/en-US/production.txt"
abstract class ChangelogTask @Inject constructor(objectFactory: ObjectFactory) : DefaultTask() { abstract class ChangelogTask @Inject constructor(
objectFactory: ObjectFactory,
providers: ProviderFactory,
) : DefaultTask() {
@get:OutputFile @get:OutputFile
val changelogFile: RegularFileProperty = objectFactory.fileProperty() val changelogFile: RegularFileProperty = objectFactory.fileProperty()
@get:Input
@Suppress("UnstableApiUsage")
val latestTag: String = providers.exec {
commandLine("git" , "describe", "--tags", "--abbrev=0")
}.standardOutput.asText.get()
init { init {
changelogFile.set(project.layout.projectDirectory.file(CHANGELOG_PATH)) changelogFile.set(project.layout.projectDirectory.file(CHANGELOG_PATH))
} }
@TaskAction @TaskAction
fun execute() { fun execute() {
val latestTag = "git describe --tags --abbrev=0".execute() val changelog = "git log --format=\"%B\" ${latestTag.trim()}..".execute()
val changelog = "git log --format=\"%B\" ${latestTag.first().trim()}..".execute()
logger.info("Latest tag: $latestTag") logger.info("Latest tag: $latestTag")
logger.info("Changelog: ${changelog.joinToString("\n")}") logger.info("Changelog: ${changelog.joinToString("\n")}")
changelogFile.get().asFile.writer().use { writer -> changelogFile.get().asFile.writer().use { writer ->

View file

@ -41,14 +41,18 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
lint { lint {
disable += listOf("AndroidGradlePluginVersion", "GradleDependency") disable += listOf(
"AndroidGradlePluginVersion",
"GradleDependency",
"ObsoleteLintCustomCheck"
)
warningsAsErrors = true warningsAsErrors = true
} }
} }

View file

@ -27,14 +27,18 @@ android {
compose = true compose = true
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
lint { lint {
disable += listOf("AndroidGradlePluginVersion", "GradleDependency") disable += listOf(
"AndroidGradlePluginVersion",
"GradleDependency",
"ObsoleteLintCustomCheck"
)
warningsAsErrors = true warningsAsErrors = true
} }
} }

View file

@ -1,37 +1,34 @@
[versions] [versions]
acra = "5.11.4" acra = "5.12.0"
activityKtx = "1.9.2" activityKtx = "1.9.3"
animationCore = "1.7.2" animationCore = "1.7.5"
appcompat = "1.7.0" appcompat = "1.7.0"
billing = "7.1.0" billing = "7.1.1"
browser = "1.8.0" browser = "1.8.0"
commonMarkVersion = "0.23.0" commonMarkVersion = "0.24.0"
composeBom = "2024.08.00" composeBom = "2024.10.01"
core = "1.6.1" core = "1.6.1"
coreKtx = "1.13.1" coreKtx = "1.15.0"
coreSplashscreen = "1.0.1" coreSplashscreen = "1.0.1"
coroutines = "1.9.0" coroutines = "1.9.0"
dependencyAnalysis = "2.1.0" dependencyAnalysis = "2.4.2"
espressoVersion = "3.6.1" espressoVersion = "3.6.1"
fladle = "0.17.5" fladle = "0.17.5"
googleServices = "4.4.2" googleServices = "4.4.2"
firebaseCrashlyticsGradle = "3.0.2" firebaseCrashlyticsGradle = "3.0.2"
androidGradlePlugin = "8.5.2" androidGradlePlugin = "8.7.2"
hamcrestCore = "1.3"
junit = "4.13.2" junit = "4.13.2"
kotlin = "2.0.20" kotlin = "2.0.21"
lifecycleViewmodelKtx = "2.8.6" lifecycleViewmodelKtx = "2.8.7"
material = "1.12.0" material = "1.12.0"
material3WindowSizeClassAndroid = "1.3.0" material3WindowSizeClassAndroid = "1.3.1"
materialIconsCore = "1.7.2" materialIconsCore = "1.7.5"
maxSdk = "35" maxSdk = "35"
minSdk = "23" minSdk = "23"
monitor = "1.7.2" monitor = "1.7.2"
navigationCommon = "2.7.7" navigation = "2.8.3"
navigationRuntimeKtx = "2.7.7" orchestrator = "1.5.1"
navigationVersion = "2.7.7" play = "2.0.2"
orchestrator = "1.5.0"
play = "2.0.1"
preferenceKtx = "1.2.1" preferenceKtx = "1.2.1"
robolectric = "4.13" robolectric = "4.13"
runner = "1.6.2" runner = "1.6.2"
@ -65,9 +62,9 @@ androidx-material-icons-extended = { module = "androidx.compose.material:materia
androidx-material3 = { module = "androidx.compose.material3:material3" } androidx-material3 = { module = "androidx.compose.material3:material3" }
androidx-material3-windowsizeclass = { module = "androidx.compose.material3:material3-window-size-class-android", version.ref = "material3WindowSizeClassAndroid" } androidx-material3-windowsizeclass = { module = "androidx.compose.material3:material3-window-size-class-android", version.ref = "material3WindowSizeClassAndroid" }
androidx-monitor = { module = "androidx.test:monitor", version.ref = "monitor" } androidx-monitor = { module = "androidx.test:monitor", version.ref = "monitor" }
androidx-navigation-common = { module = "androidx.navigation:navigation-common", version.ref = "navigationCommon" } androidx-navigation-common = { module = "androidx.navigation:navigation-common", version.ref = "navigation" }
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationVersion" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation" }
androidx-navigation-runtime-ktx = { module = "androidx.navigation:navigation-runtime-ktx", version.ref = "navigationRuntimeKtx" } androidx-navigation-runtime-ktx = { module = "androidx.navigation:navigation-runtime-ktx", version.ref = "navigation" }
androidx-orchestrator = { module = "androidx.test:orchestrator", version.ref = "orchestrator" } androidx-orchestrator = { module = "androidx.test:orchestrator", version.ref = "orchestrator" }
androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preferenceKtx" } androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preferenceKtx" }
androidx-runner = { module = "androidx.test:runner", version.ref = "runner" } androidx-runner = { module = "androidx.test:runner", version.ref = "runner" }
@ -92,7 +89,6 @@ commonmark-ext-yaml-front-matter = { module = "org.commonmark:commonmark-ext-yam
compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" } compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
foundation = { module = "androidx.compose.foundation:foundation" } foundation = { module = "androidx.compose.foundation:foundation" }
foundation-layout = { module = "androidx.compose.foundation:foundation-layout" } foundation-layout = { module = "androidx.compose.foundation:foundation-layout" }
hamcrest-core = { module = "org.hamcrest:hamcrest-core", version.ref = "hamcrestCore" }
junit = { module = "junit:junit", version.ref = "junit" } junit = { module = "junit:junit", version.ref = "junit" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" } kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }

View file

@ -2,3 +2,4 @@ storePassword=
keyPassword= keyPassword=
keyAlias= keyAlias=
storeFile= storeFile=
publishCredentialsFile=

View file

@ -24,17 +24,21 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
buildFeatures { buildFeatures {
compose = true compose = true
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
lint { lint {
disable += listOf("AndroidGradlePluginVersion", "GradleDependency") disable += listOf(
"AndroidGradlePluginVersion",
"GradleDependency",
"ObsoleteLintCustomCheck"
)
warningsAsErrors = true warningsAsErrors = true
} }
} }