This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//imports are missing | |
class CardsListPresenterTest { | |
private lateinit var presenter: CardsListPresenter | |
private val view = mock<CardsListContact.View>() | |
private val repository = mock<Repository>() | |
private val scheduleProvider = ImmediateSchedulerProvider() | |
// ... some other tests | |
@Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//contract which declare action of Presenter and MVP View | |
interface AddEditCardContract { | |
interface Presenter : BasePresenter { | |
fun getCreditCardLogo(creditCardNumber: String) | |
fun validateCreditCardNumber(creditCardNumber: String) | |
fun validateCreditCardHolder(creditCardHolder: String) | |
fun validateCreditCardExpiryDate(creditExpiryDate: String) | |
fun validateCreditCardCVV(creditCVV: String) | |
fun validateCreditCardTypeAndPriority(creditCardType: String, creditCardPriority: String) | |
fun saveCreditCard(number: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface AddEditCardContract { | |
interface Presenter : BasePresenter { | |
fun getCreditCardLogo(creditCardNumber: String) | |
fun validateCreditCardNumber(creditCardNumber: String) | |
fun validateCreditCardHolder(creditCardHolder: String) | |
fun validateCreditCardExpiryDate(creditExpiryDate: String) | |
fun validateCreditCardCVV(creditCVV: String) | |
fun validateCreditCardTypeAndPriority(creditCardType: String, creditCardPriority: String) | |
fun saveCreditCard(number: String, | |
holderName: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MVP View | |
class AddEditCardFragment : BaseFragment<AddEditCardContract.Presenter>(), AddEditCardContract.View { | |
// ...Android lifecycle methods | |
override fun setPresenter(presenter: AddEditCardContract.Presenter) { | |
mPresenter = presenter | |
} | |
override fun showCreditCardLogo(creditCardEnum: CreditCardEnum) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddEditCardPresenter(override val repository: DataSource, | |
val view: AddEditCardContract.View, | |
override val schedulerProvider: BaseSchedulerProvider, | |
override val mCompositeDisposable: CompositeDisposable = CompositeDisposable()) : AddEditCardContract.Presenter { | |
init { | |
view.setPresenter(this) | |
} | |
override fun subscribe() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class LocalDataSource private constructor() : DataSource, AnkoLogger { | |
private val authorizeTokenAlias = "authorizeTokenAlias" | |
private val conversationIdAlias = "conversationIdAlias" | |
companion object { | |
private var INSTANCE: LocalDataSource? = null | |
fun getInstance(): LocalDataSource { | |
if (INSTANCE == null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class RemoteDataSource private constructor() : DataSource { | |
private val service by lazy { | |
RetrofitService.create() | |
} | |
companion object { | |
private var INSTANCE: RemoteDataSource? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class Repository private constructor( | |
remoteDataSource: DataSource, | |
localDataSource: DataSource) | |
: DataSource { | |
private val mRemoteDataSource = remoteDataSource | |
private val mLocalDataSource = localDataSource | |
companion object { | |
private var INSTANCE: Repository? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface RetrofitService { | |
companion object { | |
fun create(): DevGetVoilaService { | |
val clientBuilder = OkHttpClient.Builder().apply { | |
val loggingInterceptor = HttpLoggingInterceptor() | |
loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY | |
addInterceptor(loggingInterceptor) | |
addInterceptor(AuthenticationInterceptor()) | |
addInterceptor(AuditInterceptor()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subprojects { | |
project.configurations.all { | |
resolutionStrategy.eachDependency { details -> | |
if (details.requested.group == 'com.android.support' | |
&& !details.requested.name.contains('multidex') ) { | |
details.useVersion "26.1.0" | |
} | |
} | |
} | |
} |
OlderNewer