diff --git a/example/src/main/java/org/wordpress/android/fluxc/example/DomainsFragment.kt b/example/src/main/java/org/wordpress/android/fluxc/example/DomainsFragment.kt index 7ce73ae4fc..0459ca957a 100644 --- a/example/src/main/java/org/wordpress/android/fluxc/example/DomainsFragment.kt +++ b/example/src/main/java/org/wordpress/android/fluxc/example/DomainsFragment.kt @@ -67,5 +67,24 @@ class DomainsFragment : StoreSelectingFragment() { } } } + + fetch_all_domains.setOnClickListener { + lifecycleScope.launch { + val result = store.fetchAllDomains(noWpCom = false) // fetching wpcom too for debugging purposes + when { + result.isError -> { + prependToLog("Error fetching all domains: ${result.error.message}") + } + else -> { + prependToLog("All domains count: ${result.domains?.size}") + val domains = result.domains + ?.joinToString(separator = "\n") { + "${it.domain} (type: ${it.type}), expiry: ${it.expiry}" + } + prependToLog("Domains:\n$domains") + } + } + } + } } } diff --git a/example/src/main/res/layout/fragment_domains.xml b/example/src/main/res/layout/fragment_domains.xml index eb8cd4adb4..665af58238 100644 --- a/example/src/main/res/layout/fragment_domains.xml +++ b/example/src/main/res/layout/fragment_domains.xml @@ -24,5 +24,11 @@ android:layout_height="wrap_content" android:text="Fetch domain price" /> +