Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ local.properties
*.log

# Android Studio captures folder
captures/
captures/


*.exec

*.hprof
4 changes: 2 additions & 2 deletions android-library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ task sourcesJar(type: Jar) {
}

dependencies {
implementation "com.google.android.material:material:$androidMaterialVersion"
implementation "com.hyperwallet.android:core-sdk:$hyperwalletCoreVersion"

api "com.hyperwallet.android:core-sdk:$hyperwalletCoreVersion"
Copy link

@vshcherbyna-epam vshcherbyna-epam Jul 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use implementation here?
In this case all APIs from the core will be accessible through the ui module when vendor implements ui-sdk.
It will look ambiguous. @fmattos-hw @peter-joseph Could you add your thoughts here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im good with api since thats exactly what we are trying to do, please refer to api vs. implementation document, 1 quick example of this is that our sdk core models and constants can be easily accessible in consuming app (like demo app)

implementation "com.google.android.material:material:$androidMaterialVersion"
implementation "androidx.test.espresso:espresso-idling-resource:$espressoVersion"

androidTestImplementation "androidx.test.ext:junit:$extJunitVerson"
Expand Down
File renamed without changes.
File renamed without changes.
82 changes: 82 additions & 0 deletions commonrepository/config/jacoco-settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apply plugin: 'jacoco'

final def jacocoVersion = "0.8.2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, can we have a consistent declaration of props in root directory? (when I searched jacocoVersion it seems that its been defined in all modules), can we add it to hyperwallet-android-ui-sdk/build.gradle ?


jacoco {
toolVersion = jacocoVersion
}

android {
testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}
}
}

def fileFilter = ['**/BuildConfig.*',
'**/com/hyperwallet/android/ui/common/repository/EspressoIdlingResource.*',
'**/com/hyperwallet/android/ui/common/repository/Event.*'
]

def debugClassPaths = [
'**/intermediates/javac/debug/*/classes/**'
]

final def coverageSourceDirs = ["$project.projectDir/src/main/java/*"]

task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {

group = 'Reporting'
description = 'Generate Jacoco coverage reports.'

reports {
html {
enabled = true
destination file("$buildDir/reports/jacoco")
}
}

classDirectories = fileTree(
dir: "${buildDir}",
includes: debugClassPaths,
excludes: fileFilter
)

additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files("${buildDir}/jacoco/testDebugUnitTest.exec")
}

task jacocoTestCoverageVerification(type: JacocoCoverageVerification, dependsOn: 'jacocoTestReport') {

group = 'Verification'
classDirectories = fileTree(
dir: "${buildDir}",
includes: debugClassPaths,
excludes: fileFilter
)
additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files("${buildDir}/jacoco/testDebugUnitTest.exec")

violationRules {
setFailOnViolation(true)

rule {
element = 'CLASS'
limit {
value = 'COVEREDRATIO'
counter = 'BRANCH'
minimum = 0.65
}
}
}
}

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions commonrepository/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest package="com.hyperwallet.android.common" />
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hyperwallet.android.ui.common.util;
package com.hyperwallet.android.ui.common.repository;

import androidx.test.espresso.IdlingResource;
import androidx.test.espresso.idling.CountingIdlingResource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.hyperwallet.android.ui.common.viewmodel;
package com.hyperwallet.android.ui.common.repository;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down
1 change: 1 addition & 0 deletions commonui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
6 changes: 6 additions & 0 deletions commonui/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apply from: "$rootProject.projectDir/android-library.gradle"
apply from: "$rootProject.projectDir/publish.gradle"

dependencies {
implementation project(':commonrepository')
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ android {
def fileFilter = ['**/BuildConfig.*',
'**/com/hyperwallet/android/ui/common/view/error/DefaultErrorDialogFragment.*',
'**/com/hyperwallet/android/ui/common/view/HorizontalDividerItemDecorator.*',
'**/com/hyperwallet/android/ui/common/view/OneClickListener.*',
'**/com/hyperwallet/android/ui/common/util/EspressoIdlingResource.*',
'**/com/hyperwallet/android/ui/common/viewmodel/Event.*'
'**/com/hyperwallet/android/ui/common/view/OneClickListener.*'
]

def debugClassPaths = [
Expand Down
7 changes: 7 additions & 0 deletions commonui/config/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="VectorPath" severity="ignore"/>
<issue id="RtlEnabled">
<ignore regexp="(AndroidManifest).xml"/>
</issue>
</lint>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
/**
* Detail interface for having a list UI with detail information through navigation
*/
public interface ListDetailNavigator<Event> {
public interface ListDetailNavigator<T> {

/**
* Navigate action
*
* @param e Navigation event
*/
void navigate(Event e);
void navigate(T e);
}
6 changes: 1 addition & 5 deletions publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ publishing {
publications {
hyperwalletUiPublish(MavenPublication) {
groupId = hyperwalletGroupId
if (project.name == "ui") {
artifactId = "ui-sdk"
} else {
artifactId = project.name
}
artifactId = project.name

version = version

Expand Down
1 change: 1 addition & 0 deletions receiptrepository/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
8 changes: 2 additions & 6 deletions receiptrepository/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ apply from: "$rootProject.projectDir/android-library.gradle"
apply from: "$rootProject.projectDir/publish.gradle"

dependencies {
implementation project(":common")

implementation "androidx.legacy:legacy-support-v4:$legacySupportV4Version"
implementation "androidx.paging:paging-runtime:$pagingRuntimeVersion"
api project(':commonrepository')

testImplementation "org.robolectric:robolectric:$robolectricVersion"

androidTestImplementation "androidx.test:rules:$testRulesVersion"
androidTestImplementation "com.squareup.okhttp3:mockwebserver:$mockServerVersion"
androidTestImplementation "com.squareup.leakcanary:leakcanary-android-instrumentation:$leakcanaryVersion"
androidTestImplementation "com.squareup.leakcanary:leakcanary-support-fragment:$leakcanaryVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import com.hyperwallet.android.model.paging.HyperwalletPageList;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.model.receipt.ReceiptQueryParam;
import com.hyperwallet.android.ui.common.util.EspressoIdlingResource;
import com.hyperwallet.android.ui.common.viewmodel.Event;
import com.hyperwallet.android.ui.common.repository.EspressoIdlingResource;
import com.hyperwallet.android.ui.common.repository.Event;
import com.hyperwallet.android.util.DateUtil;

import java.util.Calendar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

import com.hyperwallet.android.model.HyperwalletErrors;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.ui.common.viewmodel.Event;
import com.hyperwallet.android.ui.common.repository.Event;


public interface PrepaidCardReceiptRepository {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.hyperwallet.android.model.HyperwalletErrors;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.ui.common.viewmodel.Event;
import com.hyperwallet.android.ui.common.repository.Event;

public class PrepaidCardReceiptRepositoryImpl implements PrepaidCardReceiptRepository {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import com.hyperwallet.android.model.paging.HyperwalletPageList;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.model.receipt.ReceiptQueryParam;
import com.hyperwallet.android.ui.common.util.EspressoIdlingResource;
import com.hyperwallet.android.ui.common.viewmodel.Event;
import com.hyperwallet.android.ui.common.repository.EspressoIdlingResource;
import com.hyperwallet.android.ui.common.repository.Event;

import java.util.Calendar;

Expand Down Expand Up @@ -117,7 +117,7 @@ public void loadBefore(@NonNull final LoadParams<Integer> params,

/**
* @see PageKeyedDataSource#loadAfter(LoadParams, LoadCallback)
* */
*/
@Override
public void loadAfter(@NonNull final LoadParams<Integer> params,
final @NonNull LoadCallback<Integer, Receipt> callback) {
Expand Down Expand Up @@ -168,7 +168,7 @@ public Handler getHandler() {

/**
* Facilitates retry when network is down; any error that we can have a retry operation
* */
*/
void retry() {
if (mLoadInitialCallback != null) {
loadInitial(mLoadInitialParams, mLoadInitialCallback);
Expand All @@ -181,7 +181,7 @@ void retry() {
* Retrieve reference of Hyperwallet errors inorder for consumers to observe on data changes
*
* @return Live event data of {@link HyperwalletErrors}
* */
*/
public LiveData<Event<HyperwalletErrors>> getErrors() {
return mErrors;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import com.hyperwallet.android.model.HyperwalletErrors;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.ui.common.viewmodel.Event;
import com.hyperwallet.android.ui.common.repository.Event;

/**
* Receipt Repository Contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import com.hyperwallet.android.model.HyperwalletErrors;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.ui.common.viewmodel.Event;
import com.hyperwallet.android.ui.common.repository.Event;

/**
* {@link UserReceiptRepository} implementation
Expand Down Expand Up @@ -72,7 +72,7 @@ public LiveData<Boolean> isLoading() {

/**
* @see UserReceiptRepository#getErrors()
* */
*/
@Override
public LiveData<Event<HyperwalletErrors>> getErrors() {
if (mErrorsLiveData == null) {
Expand All @@ -83,7 +83,7 @@ public LiveData<Event<HyperwalletErrors>> getErrors() {

/**
* @see UserReceiptRepository#retryLoadReceipt()
* */
*/
@Override
public void retryLoadReceipt() {
if (mReceiptDataSourceLiveData.getValue() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.hyperwallet.android.model.paging.HyperwalletPageList;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.model.receipt.ReceiptQueryParam;
import com.hyperwallet.android.ui.rule.HyperwalletExternalResourceManager;
import com.hyperwallet.android.ui.receipt.rule.HyperwalletExternalResourceManager;
import com.hyperwallet.android.util.DateUtil;

import org.hamcrest.Matchers;
Expand All @@ -55,20 +55,19 @@
@RunWith(RobolectricTestRunner.class)
public class PrepaidCardReceiptDataSourceTest {

// can't be mocked due to params.key is of type Integer and autoboxing will not work with null to 0
private final PageKeyedDataSource.LoadParams<Date> mLoadAfterParams = new PageKeyedDataSource.LoadParams<>(
new Date(), 10);
@Rule
public MockitoRule mMockito = MockitoJUnit.rule();
@Rule
public HyperwalletExternalResourceManager mExternalResourceManager = new HyperwalletExternalResourceManager();

@Mock
private Hyperwallet mHyperwallet;
@Mock
private PageKeyedDataSource.LoadInitialParams<Date> mInitialParams;
@Mock
private PageKeyedDataSource.LoadInitialCallback<Date, Receipt> mInitialCallback;
// can't be mocked due to params.key is of type Integer and autoboxing will not work with null to 0
private final PageKeyedDataSource.LoadParams<Date> mLoadAfterParams = new PageKeyedDataSource.LoadParams<>(
new Date(), 10);
@Mock
private PageKeyedDataSource.LoadCallback<Date, Receipt> mLoadAfterCallback;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import com.hyperwallet.android.model.HyperwalletErrors;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.ui.common.viewmodel.Event;
import com.hyperwallet.android.ui.common.repository.Event;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.hyperwallet.android.model.paging.HyperwalletPageList;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.model.receipt.ReceiptQueryParam;
import com.hyperwallet.android.ui.rule.HyperwalletExternalResourceManager;
import com.hyperwallet.android.ui.receipt.rule.HyperwalletExternalResourceManager;

import org.hamcrest.Matchers;
import org.json.JSONObject;
Expand All @@ -52,20 +52,19 @@
@RunWith(RobolectricTestRunner.class)
public class UserReceiptDataSourceTest {

// can't be mocked due to params.key is of type Integer and autoboxing will not work with null to 0
private final PageKeyedDataSource.LoadParams<Integer> mLoadAfterParams =
new PageKeyedDataSource.LoadParams<>(10, 10);
@Rule
public MockitoRule mMockito = MockitoJUnit.rule();
@Rule
public HyperwalletExternalResourceManager mExternalResourceManager = new HyperwalletExternalResourceManager();

@Mock
private Hyperwallet mHyperwallet;
@Mock
private PageKeyedDataSource.LoadInitialParams<Integer> mInitialParams;
@Mock
private PageKeyedDataSource.LoadInitialCallback<Integer, Receipt> mInitialCallback;
// can't be mocked due to params.key is of type Integer and autoboxing will not work with null to 0
private final PageKeyedDataSource.LoadParams<Integer> mLoadAfterParams =
new PageKeyedDataSource.LoadParams<>(10, 10);
@Mock
private PageKeyedDataSource.LoadCallback<Integer, Receipt> mLoadAfterCallback;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import com.hyperwallet.android.model.HyperwalletErrors;
import com.hyperwallet.android.model.receipt.Receipt;
import com.hyperwallet.android.ui.common.viewmodel.Event;
import com.hyperwallet.android.ui.common.repository.Event;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Loading