Skip to content

Commit

Permalink
Merge pull request #132 from stadiamaps/feat/revisions-matching-ios
Browse files Browse the repository at this point in the history
Android - Updating ComposeUI for closer parity to iOS/SwiftUI
  • Loading branch information
ianthetechie authored Jul 4, 2024
2 parents 94afe1e + f9c37b1 commit 642a560
Show file tree
Hide file tree
Showing 31 changed files with 600 additions and 249 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android/**/snapshots/**/*.png filter=lfs diff=lfs merge=lfs -text
157 changes: 152 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,170 @@ jobs:
run: touch local.properties
working-directory: android

- name: Check formatting
run: ./gradlew ktfmtCheck
working-directory: android

- name: Build with Gradle
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build
working-directory: android

check-ktfmt:

runs-on: macos-13
permissions:
contents: read
packages: read

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
working-directory: android

- name: Install cargo-ndk
run: cargo install cargo-ndk

- name: Touch local.properties (required for cargo-ndk)
run: touch local.properties
working-directory: android

- name: Verify Kotlin formatting
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew ktfmtCheck
working-directory: android

test:

runs-on: macos-13
permissions:
contents: read
packages: read

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
working-directory: android

- name: Install cargo-ndk
run: cargo install cargo-ndk

- name: Touch local.properties (required for cargo-ndk)
run: touch local.properties
working-directory: android

- name: Unit test
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew test
working-directory: android

verify-snapshots:

runs-on: macos-13
permissions:
contents: read
packages: read

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
working-directory: android

- name: Install cargo-ndk
run: cargo install cargo-ndk

- name: Touch local.properties (required for cargo-ndk)
run: touch local.properties
working-directory: android

- name: Verify snapshots
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew verifyPaparazziDebug
working-directory: android

- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: paparazzi-report.html
path: android/composeui/build/reports/paparazzi/debug/index.html
retention-days: 5

connected-check:

runs-on: macos-13
permissions:
contents: read
packages: read

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
working-directory: android

- name: Install cargo-ndk
run: cargo install cargo-ndk

- name: Touch local.properties (required for cargo-ndk)
run: touch local.properties
working-directory: android

- name: Run Connected Checks
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 30
avd-name: macOS-13-x86-aosp-atd-30
arch: x86
target: aosp_atd
script: ./gradlew connectedCheck
working-directory: android
working-directory: android
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if useLocalFramework {
path: "./common/target/ios/libferrostar-rs.xcframework"
)
} else {
let releaseTag = "0.2.1"
let releaseTag = "0.3.0"
let releaseChecksum = "a418f35aefea487429e147167c1f738d4894c72a193582832071408bc63f8f31"
binaryTarget = .binaryTarget(
name: "FerrostarCoreRS",
Expand Down
9 changes: 5 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.4.0' apply false
id 'com.android.library' version '8.4.0' apply false
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
id 'com.android.application' version '8.4.2' apply false
id 'com.android.library' version '8.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
id 'com.github.willir.rust.cargo-ndk-android' version '0.3.4' apply false
id 'com.ncorti.ktfmt.gradle' version '0.17.0' apply false
id 'app.cash.paparazzi' version '1.3.4' apply false
id 'maven-publish'
}

Expand All @@ -23,5 +24,5 @@ publishing {

allprojects {
group = "com.stadiamaps.ferrostar"
version = "0.2.1"
version = "0.3.0"
}
19 changes: 10 additions & 9 deletions android/composeui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'com.ncorti.ktfmt.gradle'
id 'app.cash.paparazzi'
}

android {
Expand Down Expand Up @@ -33,7 +34,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.8'
kotlinCompilerExtensionVersion '1.5.14'
}
publishing {
singleVariant('release') {
Expand All @@ -47,11 +48,11 @@ dependencies {
// For as long as we support API 25; once we can raise support to 26, all is fine
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

implementation 'androidx.core:core-ktx:1.12.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation platform('androidx.compose:compose-bom:2024.03.00')
implementation 'androidx.core:core-ktx:1.13.1'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.9.24')
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.activity:activity-compose:1.9.0'
implementation platform('androidx.compose:compose-bom:2024.06.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
Expand All @@ -61,9 +62,9 @@ dependencies {

testImplementation 'junit:junit:4.13.2'

androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2024.03.00')
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation platform('androidx.compose:compose-bom:2024.06.00')

debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.stadiamaps.ferrostar.composeui

import android.icu.util.ULocale
import com.stadiamaps.ferrostar.composeui.formatting.LocalizedDistanceFormatter
import org.junit.Assert
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.stadiamaps.ferrostar.composeui

import android.icu.util.ULocale
import com.stadiamaps.ferrostar.composeui.formatting.DistanceMeasurementSystem
import com.stadiamaps.ferrostar.composeui.formatting.LocalizedDistanceFormatter
import org.junit.Assert
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.stadiamaps.ferrostar.composeui

import android.icu.util.ULocale
import com.stadiamaps.ferrostar.composeui.formatting.LocalizedDistanceFormatter
import org.junit.Assert.assertEquals
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.stadiamaps.ferrostar.composeui

import android.icu.util.ULocale
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.stadiamaps.ferrostar.composeui.formatting.LocalizedDistanceFormatter
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
Expand Down
Loading

0 comments on commit 642a560

Please sign in to comment.