Skip to content

Commit

Permalink
Address book code cleanup (#1705)
Browse files Browse the repository at this point in the history
* Address book code cleanup

* Code cleanup
  • Loading branch information
Milan-Cerovsky authored Dec 2, 2024
1 parent c1853de commit b424df2
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 519 deletions.
4 changes: 0 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,7 @@ ANDROIDX_WORK_MANAGER_VERSION=2.9.0
ANDROIDX_BROWSER_VERSION=1.8.0
CORE_LIBRARY_DESUGARING_VERSION=2.1.2
FIREBASE_BOM_VERSION_MATCHER=33.1.1
GOOGLE_API_CLIENT_ANDROID_VERSION=1.26.0
GOOGLE_API_SERVICES_DRIVE_VERSION=v3-rev136-1.25.0
GOOGLE_AUTH_LIB_JAVA_VERSION=1.18.0
GOOGLE_HTTP_CLIENT_GSON_VERSION=1.45.0
JACOCO_VERSION=0.8.12
KOTLIN_VERSION=1.9.23
KOTLINX_COROUTINES_VERSION=1.8.0
Expand All @@ -210,7 +207,6 @@ MARKDOWN_VERSION=0.7.3
PLAY_APP_UPDATE_VERSION=2.1.0
PLAY_APP_UPDATE_KTX_VERSION=2.1.0
PLAY_PUBLISHER_API_VERSION=v3-rev20231030-2.0.0
PLAY_SERVICES_AUTH_VERSION=21.2.0
TINK_VERSION=1.15.0
ZCASH_ANDROID_WALLET_PLUGINS_VERSION=1.0.0
ZXING_VERSION=3.5.3
Expand Down
9 changes: 0 additions & 9 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ dependencyResolutionManagement {
val zip321Version = extra["ZIP_321_VERSION"].toString()
val zxingVersion = extra["ZXING_VERSION"].toString()
val koinVersion = extra["KOIN_VERSION"].toString()
val googleHttpClientGsonVersion = extra["GOOGLE_HTTP_CLIENT_GSON_VERSION"].toString()
val googleApiClientAndroidVersion = extra["GOOGLE_API_CLIENT_ANDROID_VERSION"].toString()
val googleApiServicesDriveVersion = extra["GOOGLE_API_SERVICES_DRIVE_VERSION"].toString()
val playServicesAuthVersion = extra["PLAY_SERVICES_AUTH_VERSION"].toString()
val flexaVersion = extra["FLEXA_VERSION"].toString()


Expand All @@ -200,11 +196,6 @@ dependencyResolutionManagement {
version("jacoco", jacocoVersion)
version("java", javaVersion)

library("google-http-client-gson", "com.google.http-client:google-http-client-gson:$googleHttpClientGsonVersion")
library("google-api-client-android", "com.google.api-client:google-api-client-android:$googleApiClientAndroidVersion")
library("google-api-services-drive", "com.google.apis:google-api-services-drive:$googleApiServicesDriveVersion")
library("play-services-auth", "com.google.android.gms:play-services-auth:$playServicesAuthVersion")

// Aliases
library("accompanist-permissions", "com.google.accompanist:accompanist-permissions:$accompanistPermissionsVersion")
library("androidx-activity", "androidx.activity:activity-ktx:$androidxActivityVersion")
Expand Down
14 changes: 0 additions & 14 deletions ui-lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,6 @@ dependencies {
api(libs.androidx.fragment)
api(libs.androidx.fragment.compose)
api(libs.androidx.activity)
// api(libs.google.http.client.gson) {
// exclude(group = "io.grpc")
// }
// api(libs.google.api.client.android) {
// exclude(group = "org.apache.httpcomponents")
// exclude(group = "io.grpc")
// }
// api(libs.google.api.services.drive) {
// exclude(group = "org.apache.httpcomponents")
// exclude(group = "io.grpc")
// }
// api(libs.play.services.auth) {
// exclude(group = "io.grpc")
// }
api(libs.bundles.androidx.biometric)

androidTestImplementation(projects.testLib)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ import org.koin.dsl.module
val dataSourceModule =
module {
singleOf(::LocalAddressBookDataSourceImpl) bind LocalAddressBookDataSource::class
// singleOf(::RemoteAddressBookDataSourceImpl) bind RemoteAddressBookDataSource::class
}
54 changes: 0 additions & 54 deletions ui-lib/src/main/java/co/electriccoin/zcash/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,35 +78,6 @@ class MainActivity : FragmentActivity() {

val configurationOverrideFlow = MutableStateFlow<ConfigurationOverride?>(null)

// private val addressBookRepository by inject<AddressBookRepositoryImpl>()

// private val googleSignInLauncher =
// registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
// when (result.resultCode) {
// RESULT_OK -> {
// addressBookRepository.onGoogleSignInSuccess()
// }
//
// RESULT_CANCELED -> {
// val status = result.data?.extras?.getParcelable<Status>("googleSignInStatus")
// addressBookRepository.onGoogleSignInCancelled(status)
// }
//
// else -> {
// addressBookRepository.onGoogleSignInError()
// }
// }
// }
//
// private val googleConsentLauncher =
// registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
// when (result.resultCode) {
// RESULT_OK -> requestGoogleSignIn()
// RESULT_CANCELED -> addressBookRepository.onGoogleSignInCancelled(null)
// else -> addressBookRepository.onGoogleSignInError()
// }
// }

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Twig.debug { "Activity state: Create" }
Expand All @@ -118,18 +89,6 @@ class MainActivity : FragmentActivity() {
setupUiContent()

monitorForBackgroundSync()

// lifecycleScope.launch {
// addressBookRepository.googleSignInRequest.collect {
// requestGoogleSignIn()
// }
// }
//
// lifecycleScope.launch {
// addressBookRepository.googleRemoteConsentRequest.collect { intent ->
// googleConsentLauncher.launch(intent)
// }
// }
}

override fun onStart() {
Expand All @@ -144,19 +103,6 @@ class MainActivity : FragmentActivity() {
super.onStop()
}

// private fun requestGoogleSignIn() {
// val googleSignInClient =
// GoogleSignIn.getClient(
// this@MainActivity,
// GoogleSignInOptions
// .Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
// .requestScopes(Scope(Scopes.DRIVE_APPFOLDER))
// .build()
// )
//
// googleSignInLauncher.launch(googleSignInClient.signInIntent)
// }

/**
* Sets whether the screen rotation is enabled or screen orientation is locked in the portrait mode.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlinx.coroutines.withContext
import kotlinx.datetime.Clock

interface LocalAddressBookDataSource {
suspend fun getContacts(addressBookKey: AddressBookKey): AddressBook
suspend fun getAddressBook(addressBookKey: AddressBookKey): AddressBook

suspend fun saveContact(
name: String,
Expand Down Expand Up @@ -47,7 +47,7 @@ class LocalAddressBookDataSourceImpl(
) : LocalAddressBookDataSource {
private var addressBook: AddressBook? = null

override suspend fun getContacts(addressBookKey: AddressBookKey): AddressBook =
override suspend fun getAddressBook(addressBookKey: AddressBookKey): AddressBook =
withContext(Dispatchers.IO) {
val addressBook = this@LocalAddressBookDataSourceImpl.addressBook

Expand Down

This file was deleted.

Loading

0 comments on commit b424df2

Please sign in to comment.