This file contains hidden or 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
#!/bin/bash | |
# Script which handles starting the UI build container, then building the UI inside of it. | |
# This expects to be run from a bamboo task, hence the $bamboo_X variables. Set these locally if you want to run it locally. | |
# Call it with no args to start the container | |
# Call it with 'build' to run the build, test, and upload process | |
set -euo pipefail | |
echo "Starting build now" | |
This file contains hidden or 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
apply plugin: 'com.android.application' | |
apply plugin: 'com.github.triplet.play' | |
android { | |
compileSdkVersion 28 | |
buildToolsVersion "28.0.3" | |
defaultConfig { | |
applicationId "au.com.auspost.app" | |
minSdkVersion 28 |
This file contains hidden or 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
override fun equals(other: Any?): Boolean { | |
// same type | |
if (other == null || other !is Consignment) { | |
return false | |
} | |
// null id | |
return if (id == null) { | |
other.id == null |
This file contains hidden or 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 App : Application() { | |
val appConfigManager: AppConfigManager by inject() | |
override fun onCreate() { | |
super.onCreate() | |
KTP.openRootScope() | |
.openSubScope(APPSCOPE) | |
.installModules(AppModule(this)) |
This file contains hidden or 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 AppModule(val application: Application) : Module() { | |
init { | |
val context = application.applicationContext | |
bind(Application::class.java).toInstance(application) | |
bind(Context::class.java).toInstance(context) | |
bind(AppConfigManager::class.java).toInstance(AppConfigManager()) | |
} | |
} |
This file contains hidden or 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 PayBillActivity() : BaseActivity(R.layout.activity_pay_bill) { | |
val payBillManager: IPayBillManager by inject() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
KTP.openRootScope() | |
.openSubScope(APPSCOPE) | |
.openSubScope(this) | |
.installModules(module { bind<IPayBillManager>().toClass<PayBillManager>()}) | |
.closeOnDestroy(this) |
This file contains hidden or 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 CustomerActivity : BaseActivity(R.layout.activity_customer) { | |
@Inject lateinit var customerManager: CustomerManager | |
override fun onCreate(savedInstanceState: Bundle?) { | |
KTP.openRootScope() | |
.openSubScope(APPSCOPE) | |
.openSubScope(this) | |
.supportScopeAnnotation(ActivityScope::class.java) |
This file contains hidden or 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
@Singleton | |
class CustomerManager @Inject constructor (val customerDao: CustomerDao) { | |
fun getCustomerDetails(): Single<Customer> { | |
return customerDao.getCustomerDetails() | |
} | |
} |
This file contains hidden or 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
abstract class BaseActivity(@LayoutRes contentLayoutId: Int) : AppCompatActivity(contentLayoutId) { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
getScope().supportScopeAnnotation(ActivityScope::class.java) | |
.installModules(ActivityModule(this)) | |
.closeOnDestroy(this) | |
.inject(this) | |
} |
This file contains hidden or 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 PayBillActivity() : BaseActivity(R.layout.activity_pay_bill) { | |
val payBillManager: IPayBillManager by inject() | |
override fun getScope(): Scope { | |
return super.getScope().installModules(module { | |
bind<IPayBillDao>().toClass<PayBillDao>() | |
bind<IPayBillManager>().toClass<PayBillManager>() | |
}) | |
} |