admin-ch / CovidCertificate-SDK-Kotlin

CovidCertificate SDK for Kotlin
Mozilla Public License 2.0
4 stars 4 forks source link

Add helper methods to pretty print the PersonName #60

Closed goebelUB closed 2 years ago

goebelUB commented 2 years ago

This is in preparation to fixing https://github.com/admin-ch/CovidCertificate-App-Android/issues/370.

Since there are a lot of these printing/formatting occurrences in the wallet app, it makes sense to pull them out into helpers. And since they are somewhat tied to the PersonName class, I think it makes more sense to have them here in the SDK rather than in the app. Also integrators can reuse them if they are in the SDK.

I decided NOT to strip the trailing white space if the givenName is null (see the comments in the test). The case should be rare enough (at least in Switzerland?), so I don't want to pay the overhead of a trim() function call or introduce more if-else complexity. The trailing whitespace shouldn't hurt in the UI. But feel free to convince me of the opposite :)

github-actions[bot] commented 2 years ago

Unit Test Results

  13 files  +1    13 suites  +1   3s :stopwatch: ±0s 665 tests +8  665 :heavy_check_mark: +8  0 :zzz: ±0  0 :x: ±0 

Results for commit 77f2054a. ± Comparison against base commit da86d27d.