Skip to content

Commit

Permalink
[improvements] Code improvements to facilitate the increase of code c…
Browse files Browse the repository at this point in the history
…overage (#135)

* [improvements] Migrated code to Kotlin to improve it

* [improvements] Migrated code to Kotlin to improve it

* [fix] Fix compile errors

* [fix] Improved DeviceUtils code

* [fix] Fixed nullability of context

* [feature] More code cleanup

* [fix] Fix annotations on firebase analytics

* [fix] Fixed unit tests

* [fix] Fixed unit tests

* [fix] Fixed unit tests

* [fix] Cleared warnings, fixed unit tests

* [fix] Improved WeakRunnable code

* [fix] Fixed unit tests

* [fix] Cleared warnings

* [fix] Cleared warnings

* [fix] Cleared warnings

* [fix] Cleared warnings

* [fix] Fix compile errors

* [fix] Fixed unit tests

* [fix] Fixed unit tests

* [fix] Cleaned up code

* [fix] Fixed unit tests

* [fix] Attempt at fixing robolectric

* [docs] README cleanup

* [improvements] Post code cleanup test fixes
* revert to using EnvironmentProvider.application as the new ApplicationProvider was not playing nice with Powermock
* add MockitoHelper to deal with non-nullable values in argument matchers
* add includeAndroidResources to gradle.properites according to Robolectric migration docs

* [fix] Code fixs accordings to code review (indentation mainly)

* [fix] Code fixs accordings to code review (indentation mainly)

* [fix] Code fixs accordings to code review (indentation mainly)

* [fix] Code fixs accordings to code review (indentation mainly)

* [fix] Fix missing unit tests

* [fix] Fix missing unit tests

* [fix] Attempt to fix sonarqube

* [ci/cd] Updated build tools / sdk version

* [ci/cd] Updated sonarqube versions

* [ci/cd] Updated gradle and sonarqube vars

* [ci/cd] Updated jacoco version and added workaround to fix gradle/gradle#5184

* [ci/cd] Updated to openjdk13

* [ci/cd] Removed jacocoTestReport config

* [ci/cd] Updated to openjdk12

* [ci/cd] Updated to openjdk11

* [ci/cd] changed to oracle jdk 11

* [ci/cd] Removed jdk

* [fix] FIxed unit tests (FileProvider mocks)

* [fix] Code cleanup

* [fix] Fixed unit tests & code cleanup

* [fix] Fixed unit tests

* [fix] Fixed sonarqube path

* [fix] Fixed sonarqube path

Co-authored-by: Maja Trzebiatowska <maja.trzebiatowska@mindera.com>
  • Loading branch information
neteinstein and MajaTrzebiatowska authored Jul 3, 2020
1 parent d3fe0d1 commit 8c3b416
Show file tree
Hide file tree
Showing 88 changed files with 4,290 additions and 5,296 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: android
jdk: oraclejdk8
dist: trusty


before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand All @@ -15,10 +16,10 @@ android:
components:
# The BuildTools version used by your project
- tools
- build-tools-28.0.3
- build-tools-29.0.2

# The SDK version used to compile your project
- android-28
- android-29

# Repos needed
- extra-android-m2repository
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ You are using [Base module](https://github.com/Mindera/skeletoid/blob/master/bas

## Notes

- We are moving to a full Kotlin world, but you might still find some Java along the road.
- We move fast and we break things.. but we are friendly. Please drop us an issue/feature request and we will address it asap.
8 changes: 2 additions & 6 deletions analytics-firebase/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ android {

}

testOptions {
unitTests {
includeAndroidResources = true
}
}

buildTypes {

debug {
Expand All @@ -45,6 +39,8 @@ android {

dependencies {

annotationProcessor 'com.google.auto.value:auto-value:1.5.2'

//Depends on Base Skeletoid
api project(path: ':base')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object AppRatingInitializer {
callback?.let { this.callback = it }
controller.setupConditions(countsPerTimeInterval, promptTimeInterval)
if (shouldSchedulePrompt) {
controller.schedulePromptDialogJob()
controller.schedulePromptDialogJob(context)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ class AppRatingController {
store.alreadyRated = true
}
AppRatingDialogResponse.RATE_LATER -> {
schedulePromptDialogJob()
schedulePromptDialogJob(context)
}
}
}

/**
* Schedules a job to prompt the rating dialog after the promptTimeInterval.
*/
fun schedulePromptDialogJob() {
promptTimeInterval?.let { AppRatingJobInitializer.schedule(it) }
fun schedulePromptDialogJob(context: Context) {
promptTimeInterval?.let { AppRatingJobInitializer.schedule(context, it) }
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mindera.skeletoid.apprating.job

import android.content.Context
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import com.mindera.skeletoid.apprating.job.AppRatingJob.Companion.JOB_TAG
Expand All @@ -12,12 +13,12 @@ object AppRatingJobInitializer {
*
* @param delay Delay used to start the work
*/
fun schedule(delay: Long) {
fun schedule(context: Context, delay: Long) {
val job = OneTimeWorkRequest.Builder(AppRatingJob::class.java)
.setInitialDelay(delay, TimeUnit.DAYS)
.addTag(JOB_TAG)
.build()

WorkManager.getInstance().enqueue(job)
WorkManager.getInstance(context).enqueue(job)
}
}
22 changes: 12 additions & 10 deletions base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ android {

testOptions {
unitTests.returnDefaultValues = true
unitTests.includeAndroidResources = true
}

configurations {
Expand All @@ -58,29 +59,30 @@ dependencies {

api "androidx.annotation:annotation:$appcompatVersion"

implementation ("androidx.loader:loader:$loaderVersion")
implementation("androidx.loader:loader:$loaderVersion")

implementation ("androidx.vectordrawable:vectordrawable-animated:$vectorDrawableVersion")
implementation("androidx.vectordrawable:vectordrawable-animated:$vectorDrawableVersion")

implementation ("androidx.legacy:legacy-support-core-utils:$androidLegacyVersion")
implementation("androidx.legacy:legacy-support-core-utils:$androidLegacyVersion")

implementation ("androidx.appcompat:appcompat:$appcompatVersion")
implementation("androidx.appcompat:appcompat:$appcompatVersion")

api "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
api ("io.reactivex.rxjava2:rxandroid:$rxAndroidVersion")
api("io.reactivex.rxjava2:rxandroid:$rxAndroidVersion")

testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"

testImplementation "junit:junit:$junitVersion"
testImplementation "org.jetbrains.kotlin:kotlin-test:$rootProject.kotlinVersion"
testImplementation ("org.mockito:mockito-core:$mockitoVersion")
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "androidx.test:core:$androidCoreTest"

testImplementation ("org.powermock:powermock-module-junit4:$powermockVersion")
testImplementation ("org.powermock:powermock-module-junit4-rule:$powermockVersion")
testImplementation("org.powermock:powermock-module-junit4:$powermockVersion")
testImplementation("org.powermock:powermock-module-junit4-rule:$powermockVersion")

testImplementation ("org.powermock:powermock-api-mockito2:$powermockVersion")
testImplementation("org.powermock:powermock-api-mockito2:$powermockVersion")
testImplementation "org.powermock:powermock-classloading-xstream:$powermockVersion"
testImplementation ("org.robolectric:robolectric:$robolectricVersion")
testImplementation("org.robolectric:robolectric:$robolectricVersion")
}

apply from: "../jacoco.gradle"
Expand Down
155 changes: 0 additions & 155 deletions base/src/main/java/com/mindera/skeletoid/analytics/Analytics.java

This file was deleted.

Loading

0 comments on commit 8c3b416

Please sign in to comment.