Skip to content

Commit

Permalink
Adds UI to the example client to test the new call
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonis Lilis committed Oct 11, 2023
1 parent 0d77b28 commit b90b05d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
}
}
}
6 changes: 6 additions & 0 deletions example/src/main/res/layout/fragment_domains.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@
android:layout_height="wrap_content"
android:text="Fetch domain price" />

<Button
android:id="@+id/fetch_all_domains"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fetch all domain" />

</LinearLayout>
</ScrollView>

0 comments on commit b90b05d

Please sign in to comment.