Skip to content

Commit 4c6e44d

Browse files
authored
feat: Update sample app UI to compose (#116)
1 parent 115313e commit 4c6e44d

Some content is hidden

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

43 files changed

+1787
-1806
lines changed

.github/workflows/dependabot-automerge.yml

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,4 @@ on:
99
jobs:
1010
automerge-dependabot:
1111
name: "Automerge Dependabot PR"
12-
if: >
13-
github.event.workflow_run.event == 'pull_request' &&
14-
github.event.workflow_run.conclusion == 'success' &&
15-
github.actor == 'dependabot[bot]'
16-
env:
17-
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
18-
GIT_AUTHOR_NAME: mparticle-automation
19-
GIT_AUTHOR_EMAIL: [email protected]
20-
GIT_COMMITTER_NAME: mparticle-automation
21-
GIT_COMMITTER_EMAIL: [email protected]
22-
runs-on: ubuntu-latest
23-
steps:
24-
- name: 'Download artifact'
25-
uses: actions/[email protected]
26-
with:
27-
script: |
28-
var artifacts = await github.actions.listWorkflowRunArtifacts({
29-
owner: context.repo.owner,
30-
repo: context.repo.repo,
31-
run_id: ${{ github.event.workflow_run.id }},
32-
});
33-
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
34-
return artifact.name == "pr"
35-
})[0];
36-
var download = await github.actions.downloadArtifact({
37-
owner: context.repo.owner,
38-
repo: context.repo.repo,
39-
artifact_id: matchArtifact.id,
40-
archive_format: 'zip',
41-
});
42-
var fs = require('fs');
43-
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
44-
- run: unzip pr.zip
45-
- name: 'Automerge PR'
46-
uses: actions/github-script@v3
47-
with:
48-
github-token: ${{ secrets.GITHUB_TOKEN }}
49-
script: |
50-
var fs = require('fs');
51-
var issue_number = Number(fs.readFileSync('./NR'));
52-
await github.pulls.merge({
53-
owner: context.repo.owner,
54-
repo: context.repo.repo,
55-
pull_number: issue_number,
56-
merge_method: 'rebase'
57-
});
12+
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-automerge.yml@main

.github/workflows/pull-request-app-checks.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
confirm-folder-changes:
1515
name: "Confirm changes in sample app folder"
16-
runs-on: ubuntu-18.04
16+
runs-on: ubuntu-latest
1717
steps:
1818
- name: "Checkout Sample Apps"
1919
uses: actions/checkout@v2
@@ -35,7 +35,7 @@ jobs:
3535
instrumented-tests:
3636
name: "Instrumented Tests"
3737
timeout-minutes: 30
38-
runs-on: macos-11
38+
runs-on: macos-latest
3939
needs: confirm-folder-changes
4040
steps:
4141
- name: "Checkout Branch"
@@ -63,7 +63,7 @@ jobs:
6363
unit-tests:
6464
name: "Unit Tests"
6565
timeout-minutes: 15
66-
runs-on: ubuntu-18.04
66+
runs-on: ubuntu-latest
6767
needs: confirm-folder-changes
6868
steps:
6969
- name: "Checkout Branch"
@@ -88,7 +88,7 @@ jobs:
8888
lint-checks:
8989
name: "Lint Checks"
9090
timeout-minutes: 15
91-
runs-on: macos-11
91+
runs-on: macos-latest
9292
needs: confirm-folder-changes
9393
steps:
9494
- name: "Checkout Branch"
@@ -113,7 +113,7 @@ jobs:
113113
kotlin-lint-checks:
114114
name: "Kotlin Lint Checks"
115115
timeout-minutes: 15
116-
runs-on: macos-11
116+
runs-on: macos-latest
117117
needs: confirm-folder-changes
118118
steps:
119119
- name: "Checkout Branch"

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
create-release-branch:
1919
name: "Create Release Branch"
20-
runs-on: ubuntu-18.04
20+
runs-on: ubuntu-latest
2121
needs: confirm-public-repo-main-branch
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
@@ -47,7 +47,7 @@ jobs:
4747
semantic-release:
4848
name: "Semantic Release"
4949
needs: create-release-branch
50-
runs-on: macos-11
50+
runs-on: macos-latest
5151
env:
5252
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
5353
GIT_AUTHOR_NAME: mparticle-automation
@@ -102,7 +102,7 @@ jobs:
102102
sync-repository:
103103
name: "Sync Repository"
104104
needs: semantic-release
105-
runs-on: ubuntu-18.04
105+
runs-on: ubuntu-latest
106106
steps:
107107
- name: "Checkout main branch"
108108
uses: actions/checkout@v2

core-sdk-samples/higgs-shop-sample-app/app/build.gradle.kts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ android {
2323
}
2424
buildFeatures {
2525
dataBinding = true
26-
viewBinding = true
26+
compose = true
27+
}
28+
composeOptions {
29+
kotlinCompilerExtensionVersion = "1.3.1"
2730
}
2831
buildTypes {
2932
getByName("release") {
@@ -41,6 +44,16 @@ android {
4144
}
4245

4346
dependencies {
47+
48+
// Compose
49+
val composeVersion = "1.2.1"
50+
implementation("androidx.compose.runtime:runtime:$composeVersion")
51+
implementation("androidx.compose.ui:ui:$composeVersion")
52+
implementation("androidx.compose.material:material:$composeVersion")
53+
implementation("androidx.compose.ui:ui-tooling:$composeVersion")
54+
implementation("androidx.compose.runtime:runtime-livedata:$composeVersion")
55+
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$composeVersion")
56+
4457
implementation("androidx.appcompat:appcompat:1.4.1")
4558
implementation("androidx.fragment:fragment:1.3.6")
4659
implementation("androidx.fragment:fragment-ktx:1.3.6")
@@ -49,7 +62,7 @@ dependencies {
4962
implementation("androidx.recyclerview:recyclerview:1.2.1")
5063
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1")
5164
implementation("com.google.android.material:material:1.5.0")
52-
implementation("com.mparticle:android-core:5.44.2")
65+
implementation("com.mparticle:android-core:5.45.0")
5366

5467
implementation("androidx.navigation:navigation-fragment:2.3.5")
5568
implementation("androidx.navigation:navigation-ui:2.3.5")
@@ -75,14 +88,15 @@ dependencies {
7588
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.3.1")
7689
implementation("androidx.navigation:navigation-fragment-ktx:2.3.5")
7790
implementation("androidx.navigation:navigation-ui-ktx:2.3.5")
91+
debugImplementation("androidx.compose.ui:ui-tooling:1.1.1")
7892

79-
val roomVersion = "2.4.1"
93+
val roomVersion = "2.4.3"
8094
implementation("androidx.room:room-runtime:$roomVersion")
81-
annotationProcessor("androidx.room:room-compiler:$roomVersion")
95+
// annotationProcessor("androidx.room:room-compiler:$roomVersion")
8296
kapt("androidx.room:room-compiler:$roomVersion")
8397
// ksp("androidx.room:room-compiler:$roomVersion")
8498
implementation("androidx.room:room-ktx:$roomVersion")
85-
// implementation("androidx.room:room-rxjava2:$roomVersion")
99+
implementation("androidx.room:room-rxjava2:$roomVersion")
86100
// implementation("androidx.room:room-rxjava3:$roomVersion")
87101
// implementation("androidx.room:room-guava:$roomVersion")
88102
// implementation("androidx.room:room-paging:2.4.1")
@@ -105,6 +119,6 @@ dependencies {
105119

106120
fun buildVersionCode(): Int {
107121
val df = SimpleDateFormat("yyyyMMddHH")
108-
df.setTimeZone(TimeZone.getTimeZone("EST"))
122+
df.timeZone = TimeZone.getTimeZone("EST")
109123
return df.format(Date()).toInt()
110124
}

core-sdk-samples/higgs-shop-sample-app/app/src/androidTest/kotlin/com/mparticle/example/higgsshopsampleapp/ExampleInstrumentedTests.kt

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@ package com.mparticle.example.higgsshopsampleapp
22

33
import android.content.Intent
44
import androidx.test.core.app.ApplicationProvider
5-
import androidx.test.espresso.Espresso.onView
6-
import androidx.test.espresso.action.ViewActions.click
7-
import androidx.test.espresso.assertion.ViewAssertions.matches
8-
import androidx.test.espresso.matcher.ViewMatchers.withId
9-
import androidx.test.espresso.matcher.ViewMatchers.withText
105
import androidx.test.ext.junit.rules.activityScenarioRule
116
import androidx.test.filters.LargeTest
127
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
138
import androidx.test.platform.app.InstrumentationRegistry
149
import com.mparticle.example.higgsshopsampleapp.activities.LandingActivity
1510
import com.mparticle.example.higgsshopsampleapp.activities.MainActivity
1611
import com.mparticle.example.higgsshopsampleapp.repositories.ProductsRepository
17-
import org.junit.Assert.*
12+
import org.junit.Assert.assertEquals
13+
import org.junit.Assert.assertNotNull
1814
import org.junit.Rule
1915
import org.junit.Test
2016
import org.junit.runner.RunWith
@@ -39,17 +35,6 @@ class ExampleInstrumentedTests {
3935
assertEquals("com.mparticle.example.higgsshopsampleapp", appContext.packageName)
4036
}
4137

42-
@Test
43-
fun testShowLandingCTA() {
44-
onView(withId(R.id.landing_cta)).check(matches(withText(R.string.landing_cta)))
45-
}
46-
47-
@Test
48-
fun testClickLandingCTA() {
49-
onView(withId(R.id.landing_cta)).perform(click())
50-
onView(withId(R.id.tv_shop_header)).check(matches(withText(R.string.shop_title)))
51-
}
52-
5338
@Test
5439
fun testProductJsonFileExists() {
5540
val file: InputStream =

0 commit comments

Comments
 (0)