Skip to content

Commit

Permalink
Merge pull request #350 from Adventech/develop
Browse files Browse the repository at this point in the history
Latest release
  • Loading branch information
TinasheMzondiwa authored Aug 18, 2022
2 parents 35f0800 + e210476 commit f7d9307
Show file tree
Hide file tree
Showing 211 changed files with 2,654 additions and 1,648 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/on_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
java-version: '11'

- name: Decrypt secrets
run: ./release/decrypt-secrets.sh
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
java-version: '11'

- name: Decrypt secrets
run: ./release/decrypt-secrets.sh
Expand Down
54 changes: 25 additions & 29 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,40 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
api-level: [23]
api-level: [29]
target: [google_apis]

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Gradle cache
uses: actions/cache@v2
uses: gradle/gradle-build-action@v2

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

# - name: AVD cache
# uses: actions/cache@v2
# id: avd-cache
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-${{ matrix.api-level }}
#
# - name: create AVD and generate snapshot for caching
# if: steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: ${{ matrix.api-level }}
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: false
# script: echo "Generated AVD snapshot for caching."

- name: Set up JDK 11
uses: actions/setup-java@v1
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
java-version: 11
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Execute Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
Expand Down
123 changes: 60 additions & 63 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,15 @@
* THE SOFTWARE.
*/

import dependencies.Dependencies
import dependencies.Dependencies.AndroidX
import dependencies.Dependencies.Kotlin
import dependencies.Dependencies.Hilt
import dependencies.TestAndroidDependencies
import dependencies.Versions
import extensions.addTestsDependencies
import extensions.readPropertyValue
import java.io.FileInputStream
import java.util.Properties

plugins {
id(BuildPlugins.Android.APPLICATION)
id(BuildPlugins.Kotlin.ANDROID)
id(BuildPlugins.Kotlin.KAPT)
id(BuildPlugins.DAGGER_HILT)
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
id("dagger.hilt.android.plugin")
}

val useReleaseKeystore = file(BuildAndroidConfig.KEYSTORE_PROPS_FILE).exists()
Expand Down Expand Up @@ -82,7 +75,7 @@ android {
load(FileInputStream(file(BuildAndroidConfig.KEYSTORE_PROPS_FILE)))
}

create(BuildType.RELEASE) {
create("release") {
storeFile = file(keyProps.getProperty("release.keystore"))
storePassword = keyProps.getProperty("release.keystore.password")
keyAlias = keyProps.getProperty("key.alias")
Expand All @@ -92,26 +85,26 @@ android {
}

buildTypes {
getByName(BuildType.RELEASE) {
getByName("release") {
isShrinkResources = true
isMinifyEnabled = true
proguardFiles("proguard-rules.pro")
if (useReleaseKeystore) {
signingConfig = signingConfigs.getByName(BuildType.RELEASE)
signingConfig = signingConfigs.getByName("release")
}

ndk { debugSymbolLevel = "FULL" }
}
}

compileOptions {
sourceCompatibility = JavaOptions.version
targetCompatibility = JavaOptions.version
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaOptions.version.toString()
freeCompilerArgs = freeCompilerArgs + KotlinOptions.COROUTINES
jvmTarget = libs.versions.jvmTarget.get()
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
}

testOptions {
Expand All @@ -120,7 +113,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = Versions.COMPOSE
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}

buildFeatures {
Expand All @@ -139,50 +132,54 @@ android {
}

dependencies {
implementation(project(BuildModules.Common.AUTH))
implementation(project(BuildModules.Common.CORE))
implementation(project(BuildModules.Common.DESIGN))
implementation(project(BuildModules.Common.DESIGN_COMPOSE))
implementation(project(BuildModules.Common.LESSONS_DATA))
implementation(project(BuildModules.Common.NETWORK))
implementation(project(BuildModules.Common.STORAGE))
implementation(project(BuildModules.Common.TRANSLATIONS))
implementation(project(BuildModules.Features.APP_WIDGETS))
implementation(project(BuildModules.Features.ACCOUNT))
implementation(project(BuildModules.Features.BIBLE))
implementation(project(BuildModules.Features.LESSONS))
implementation(project(BuildModules.Features.MEDIA))
implementation(project(BuildModules.Features.PDF))
implementation(project(BuildModules.Features.SETTINGS))

implementation(Kotlin.COROUTINES)
implementation(Kotlin.COROUTINES_ANDROID)

implementation(Dependencies.MATERIAL)
implementation(AndroidX.CORE)
implementation(AndroidX.APPCOMPAT)
implementation(AndroidX.CONSTRAINT_LAYOUT)
implementation(AndroidX.ACTIVITY)
implementation(AndroidX.FRAGMENT_KTX)
implementation(AndroidX.LIFECYCLE_VIEWMODEL)
implementation(AndroidX.LIFECYCLE_EXTENSIONS)
implementation(AndroidX.START_UP)

implementation(Hilt.ANDROID)
kapt(Hilt.COMPILER)

implementation(Dependencies.PLAY_AUTH)

implementation(Dependencies.TIMBER)

implementation(Dependencies.JODA)

implementation(Dependencies.Compose.tooling)

addTestsDependencies()
testImplementation(project(BuildModules.Libraries.TEST_UTILS))
androidTestImplementation(project(BuildModules.Libraries.TEST_UTILS))
androidTestImplementation(TestAndroidDependencies.Espresso.contrib) {
implementation(project(":common:auth"))
implementation(project(":common:core"))
implementation(project(":common:design"))
implementation(project(":common:design-compose"))
implementation(project(":common:lessons-data"))
implementation(project(":common:network"))
implementation(project(":common:storage"))
implementation(project(":common:translations"))
implementation(project(":features:app-widgets"))
implementation(project(":features:account"))
implementation(project(":features:bible"))
implementation(project(":features:lessons"))
implementation(project(":features:media"))
implementation(project(":features:pdf"))
implementation(project(":features:settings"))

implementation(libs.kotlin.coroutines)
implementation(libs.kotlin.coroutines.android)

implementation(libs.google.material)
implementation(libs.androidx.core)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.activity)
implementation(libs.androidx.fragment)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.extensions)
implementation(libs.androidx.startup)
implementation(libs.androidx.work)
implementation(libs.androidx.hilt.work)
kapt(libs.androidx.hilt.compiler)

implementation(libs.google.hilt.android)
kapt(libs.google.hilt.compiler)

implementation(libs.google.play.auth)

implementation(libs.timber)

implementation(libs.joda.android)

testImplementation(libs.bundles.testing.common)
testImplementation(project(":libraries:test_utils"))
kaptTest(libs.google.hilt.compiler)
androidTestImplementation(libs.bundles.testing.android.common)
kaptAndroidTest(libs.google.hilt.compiler)
androidTestImplementation(project(":libraries:test_utils"))
androidTestImplementation(libs.test.androidx.espresso.contrib) {
exclude(group = "org.checkerframework", module = "checker")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class SSReadPdfActivityTest {
scenario?.close()
}

@Test @Ignore("flaky")
@Test
@Ignore("flaky")
fun launchPdfScreen() = launch(
listOf(
LessonPdf(
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
android:name="com.cryart.sabbathschool.initializer.TimberInitializer"
android:value="androidx.startup" />

<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />

</provider>

<!-- Reminder -->
Expand Down
13 changes: 12 additions & 1 deletion app/src/main/java/com/cryart/sabbathschool/SSApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,25 @@ package com.cryart.sabbathschool

import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject

@HiltAndroidApp
class SSApp : Application() {
class SSApp : Application(), Configuration.Provider {

@Inject
lateinit var workerFactory: HiltWorkerFactory

override fun onCreate() {
super.onCreate()

AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
}

override fun getWorkManagerConfiguration() =
Configuration.Builder()
.setWorkerFactory(workerFactory)
.build()
}
4 changes: 2 additions & 2 deletions app/src/main/java/com/cryart/sabbathschool/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object AppModule {
alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager,
notificationManager = NotificationManagerCompat.from(context),
context = context,
ssPrefs = ssPrefs,
ssPrefs = ssPrefs
)

@Provides
Expand All @@ -57,6 +57,6 @@ object AppModule {
@Provides
fun provideAppConfig() = AppConfig(
BuildConfig.VERSION_NAME,
BuildConfig.WEB_CLIENT_ID,
BuildConfig.WEB_CLIENT_ID
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import javax.inject.Singleton
class AppNavigatorImpl @Inject constructor(
private val ssPrefs: SSPrefs,
private val authRepository: AuthRepository,
private val dispatcherProvider: DispatcherProvider,
private val dispatcherProvider: DispatcherProvider
) : AppNavigator, CoroutineScope by MainScope() {

private suspend fun isSignedIn(): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ class DailyReminderManager constructor(
create: Boolean
): PendingIntent? = Intent(context, ReminderReceiver::class.java).let { intent ->
val flag = if (create) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_IMMUTABLE
else
} else {
PendingIntent.FLAG_UPDATE_CURRENT
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_NO_CREATE or PendingIntent.FLAG_IMMUTABLE
else
} else {
PendingIntent.FLAG_NO_CREATE
}
}

PendingIntent.getBroadcast(context, 0, intent, flag)
Expand Down Expand Up @@ -112,14 +114,17 @@ class DailyReminderManager constructor(
val contentIntent = Intent(context, SplashActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_IMMUTABLE
else
} else {
PendingIntent.FLAG_CANCEL_CURRENT
}

val pendingIntent = PendingIntent.getActivity(
context, 0,
contentIntent, flag
context,
0,
contentIntent,
flag
)

val builder = NotificationCompat.Builder(context, CHANNEL_ID)
Expand Down
Loading

0 comments on commit f7d9307

Please sign in to comment.