Skip to content

Commit

Permalink
Merge pull request #299 from Adventech/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
TinasheMzondiwa authored Mar 2, 2022
2 parents cc97c12 + a2449d5 commit 734eef9
Show file tree
Hide file tree
Showing 267 changed files with 5,333 additions and 2,163 deletions.
2 changes: 2 additions & 0 deletions .github/labels_config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ci:
- '.github/*'
auth:
- 'common/auth/*'
core:
- 'common/core/*'
design:
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/on_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Upload release asset(s)
on:
release:
types: ["published"]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 30

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

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

- name: Decrypt secrets
run: ./release/decrypt-secrets.sh
env:
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}

- name: Generate build number
run: echo "BUILD_NUMBER=${{github.run_number}}" > app/build_number.properties

- name: Build Release
run: ./gradlew app:bundleRelease --stacktrace

- name: Upload aab
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: app/build/outputs/bundle/release/app-release.aab
asset_name: pb-android-prod-release.aab
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 1 addition & 6 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ jobs:
with:
java-version: 11

- name: Decode Firebase google-services.json
env:
FIREBASE_CONFIG: ${{secrets.FIREBASE_CONFIG}}
run: echo $FIREBASE_CONFIG > app/google-services.json

- name: Decrypt secrets
run: ./release/decrypt-secrets.sh
env:
Expand Down Expand Up @@ -58,7 +53,7 @@ jobs:

- name: Publish to Alpha track
if: github.ref == 'refs/heads/main'
uses: r0adkll/upload-google-play@v1
uses: r0adkll/upload-google-play@v1.0.15
with:
serviceAccountJson: release/play-account.json
packageName: com.cryart.sabbathschool
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ jobs:
with:
java-version: 11

- name: Decode Firebase google-services.json
env:
FIREBASE_CONFIG: ${{secrets.FIREBASE_CONFIG}}
run: echo $FIREBASE_CONFIG > app/google-services.json

- name: Execute Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
with:
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,3 @@ captures/

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
google-services.json
33 changes: 10 additions & 23 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import dependencies.Dependencies
import dependencies.Dependencies.AndroidX
import dependencies.Dependencies.Firebase
import dependencies.Dependencies.Kotlin
import dependencies.Dependencies.Hilt
import dependencies.Versions
Expand All @@ -36,8 +35,6 @@ plugins {
id(BuildPlugins.Kotlin.ANDROID)
id(BuildPlugins.Kotlin.KAPT)
id(BuildPlugins.DAGGER_HILT)
id(BuildPlugins.Google.CRASHLYTICS)
id(BuildPlugins.Google.SERVICES)
}

val useReleaseKeystore = file(BuildAndroidConfig.KEYSTORE_PROPS_FILE).exists()
Expand All @@ -47,6 +44,12 @@ val appVersionCode = readPropertyValue(
defaultValue = "1"
).toInt() + 1490

val webClientId = readPropertyValue(
filePath = "$rootDir/${BuildAndroidConfig.API_KEYS_PROPS_FILE}",
key = "WEB_CLIENT_ID",
defaultValue = ""
)

android {
compileSdk = BuildAndroidConfig.COMPILE_SDK_VERSION

Expand All @@ -68,6 +71,8 @@ android {
listOf("x86", "x86_64", "arm64-v8a", "armeabi-v7a")
)
}

buildConfigField("String", "WEB_CLIENT_ID", "\"$webClientId\"")
}

signingConfigs {
Expand All @@ -94,14 +99,8 @@ android {
signingConfig = signingConfigs.getByName(BuildType.RELEASE)
}

manifestPlaceholders["enableReporting"] = true

ndk { debugSymbolLevel = "FULL" }
}
getByName(BuildType.DEBUG) {

manifestPlaceholders["enableReporting"] = false
}
}

compileOptions {
Expand Down Expand Up @@ -138,9 +137,11 @@ android {
}

dependencies {
implementation(project(BuildModules.Common.AUTH))
implementation(project(BuildModules.Common.CORE))
implementation(project(BuildModules.Common.DESIGN))
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))
Expand All @@ -154,7 +155,6 @@ dependencies {

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

implementation(Dependencies.MATERIAL)
implementation(AndroidX.CORE)
Expand All @@ -164,23 +164,15 @@ dependencies {
implementation(AndroidX.FRAGMENT_KTX)
implementation(AndroidX.LIFECYCLE_VIEWMODEL)
implementation(AndroidX.LIFECYCLE_EXTENSIONS)
implementation(AndroidX.LIFECYCLE_LIVEDATA)
implementation(AndroidX.START_UP)

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

implementation(Dependencies.PLAY_AUTH)

implementation(platform(Firebase.BOM))
implementation(Firebase.ANALYTICS)
implementation(Firebase.AUTH)
implementation(Firebase.CRASHLYTICS)
implementation(Firebase.DATABASE)

implementation(Dependencies.TIMBER)

implementation(Dependencies.Facebook.SDK)
implementation(Dependencies.JODA)

implementation(Dependencies.Compose.tooling)
Expand All @@ -189,8 +181,3 @@ dependencies {
testImplementation(project(BuildModules.Libraries.TEST_UTILS))
androidTestImplementation(project(BuildModules.Libraries.TEST_UTILS))
}

val googleServices = file("google-services.json")
if (!googleServices.exists()) {
com.google.common.io.Files.copy(file("stage-google-services.json"), googleServices)
}
3 changes: 0 additions & 3 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@

-keep class net.danlew.android.joda.R$raw { *; }

#Required for firebase db issue
-keep class org.json.* { *; }

-keepclassmembers class com.cryart.sabbathschool.** {
*;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package app.ss.pdf.ui
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.intent.Intents
import androidx.test.ext.junit.runners.AndroidJUnit4
import app.ss.lessons.data.model.LessonPdf
import app.ss.models.LessonPdf
import app.ss.pdf.PdfReader
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import app.ss.lessons.data.model.Credit
import app.ss.lessons.data.model.Feature
import app.ss.models.Credit
import app.ss.models.Feature
import com.cryart.design.theme.SSTheme
import com.cryart.sabbathschool.lessons.ui.lessons.components.CreditFooterItem
import com.cryart.sabbathschool.lessons.ui.lessons.components.FeatureFooterItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.runners.AndroidJUnit4
import app.ss.lessons.data.model.QuarterlyGroup
import app.ss.models.QuarterlyGroup
import com.cryart.sabbathschool.actions.withCollapsingToolbarTitle
import com.cryart.sabbathschool.lessons.R
import com.cryart.sabbathschool.lessons.ui.quarterlies.list.QuarterliesListActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.cryart.sabbathschool.lessons.ui.quarterlies.QuarterliesActivity
import com.cryart.sabbathschool.ui.login.LoginActivity
import com.google.firebase.auth.FirebaseAuth
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import javax.inject.Inject
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.tasks.await
import org.junit.After
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -48,18 +45,13 @@ class SplashActivityTest {
@get:Rule
var hiltRule = HiltAndroidRule(this)

@Inject
lateinit var firebaseAuth: FirebaseAuth

private var scenario: ActivityScenario<SplashActivity>? = null

@Before
fun setup() {
// Populate @Inject fields in test class
hiltRule.inject()

firebaseAuth.signOut()

Intents.init()
}

Expand All @@ -76,9 +68,9 @@ class SplashActivityTest {
}

@Test
fun shouldLaunchQuarterliesActivity() = runBlocking {
@Ignore("Resolve signed in state")
fun shouldLaunchQuarterliesActivity() {
// Requires signed-in user
firebaseAuth.signInAnonymously().await()

scenario = ActivityScenario.launch(SplashActivity::class.java)
intended(hasComponent(QuarterliesActivity::class.java.name))
Expand Down
24 changes: 0 additions & 24 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,6 @@
android:exported="false"
android:label="@string/ss_about" />

<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:exported="false"
android:label="@string/ss_app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
tools:replace="android:theme" />

<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />

<!-- Initializers -->
<provider
android:name="androidx.startup.InitializationProvider"
Expand All @@ -111,20 +99,8 @@
android:name="com.cryart.sabbathschool.initializer.TimberInitializer"
android:value="androidx.startup" />

<meta-data
android:name="com.cryart.sabbathschool.initializer.AnalyticsInitializer"
android:value="androidx.startup" />

</provider>

<!-- Firebase -->
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="${enableReporting}" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="${enableReporting}" />

<!-- Reminder -->
<receiver
android:name=".reminder.ReminderReceiver"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/com/cryart/sabbathschool/SSApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ package com.cryart.sabbathschool

import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import com.google.firebase.database.ktx.database
import com.google.firebase.ktx.Firebase
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
Expand All @@ -34,7 +32,6 @@ class SSApp : Application() {
override fun onCreate() {
super.onCreate()

Firebase.database.setPersistenceEnabled(true)
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
}
}
29 changes: 8 additions & 21 deletions app/src/main/java/com/cryart/sabbathschool/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ import android.app.AlarmManager
import android.content.Context
import androidx.core.app.NotificationManagerCompat
import com.cryart.sabbathschool.BuildConfig
import com.cryart.sabbathschool.R
import com.cryart.sabbathschool.core.extensions.prefs.SSPrefs
import com.cryart.sabbathschool.core.model.AppConfig
import com.cryart.sabbathschool.reminder.DailyReminderManager
import com.cryart.sabbathschool.settings.DailyReminder
import com.cryart.sabbathschool.ui.login.FacebookLoginManager
import com.cryart.sabbathschool.ui.login.GoogleSignInWrapper
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -43,33 +40,23 @@ import dagger.hilt.components.SingletonComponent
@Module
object AppModule {

@Provides
fun provideGoogleSignInWrapper() = GoogleSignInWrapper()

@Provides
fun provideFacebookLoginManager() = FacebookLoginManager()

@Provides
fun provideReminderManager(
@ApplicationContext context: Context,
ssPrefs: SSPrefs
): DailyReminderManager {
return DailyReminderManager(
alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager,
notificationManager = NotificationManagerCompat.from(context),
context = context,
ssPrefs = ssPrefs,
)
}
): DailyReminderManager = DailyReminderManager(
alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager,
notificationManager = NotificationManagerCompat.from(context),
context = context,
ssPrefs = ssPrefs,
)

@Provides
fun provideDailyReminder(manager: DailyReminderManager): DailyReminder = manager

@Provides
fun provideAppConfig(
@ApplicationContext context: Context,
) = AppConfig(
fun provideAppConfig() = AppConfig(
BuildConfig.VERSION_NAME,
context.getString(R.string.default_web_client_id),
BuildConfig.WEB_CLIENT_ID,
)
}
Loading

0 comments on commit 734eef9

Please sign in to comment.