Repository navigation
feat!: Android-only location button and getLocationButtonState() - #119
Conversation
OS-pedrogustavobilro
left a comment
There was a problem hiding this comment.
Leaving a few comments, several are non-blocker and technically don't need to be addressed here.
Did minor updates in the example app + updated geolocation library with ionic-team/ion-android-geolocation#20
| textType: textType(element), | ||
| backgroundColor: colorStyle(style, STYLE_PROPERTIES.backgroundColor, '#0B57D0'), | ||
| textColor, | ||
| iconTint: colorStyle(style, STYLE_PROPERTIES.iconTint, textColor), | ||
| strokeColor: colorStyle(style, STYLE_PROPERTIES.strokeColor, '#000000'), | ||
| cornerRadius, | ||
| strokeWidth: pixelStyle(style, STYLE_PROPERTIES.strokeWidth, 0, 3, 0), | ||
| maximumAge: nonNegativeIntegerAttribute(element, 'maximum-age', 0), | ||
| timeout: nonNegativeIntegerAttribute(element, 'timeout', 10_000, 1), | ||
| maximumAge: nonNegativeIntegerAttribute(element, 'maximum-age', 3_000), | ||
| timeout: nonNegativeIntegerAttribute(element, 'timeout', 5_000, 1), | ||
| enableLocationFallback: booleanAttribute(element, 'enable-location-fallback', true), |
There was a problem hiding this comment.
To me personally, this is one of those cases where OutSystems and Capacitor could diverge.
Currently for getCurrentPosition, OutSystems has 5_000 and 3_000 for timeout and maximumAge, while capacitor has 10_000 and 0. I don't see why we can't have that here too, to keep consistency with the default values that the existing plugin methods already have.
The same thing could even apply to having the os-location-button not be hidden in iOS and web here, as long as it was hidden for OutSystems. But that case I'm more leaning towards leaving as-is, because of the limitations around lack of localization, which we could aim at solving with additional properties that wouldn't apply to Android, but yeah in that case developers are better off having their own component to configure however they like. Plus it's simpler for us that way.
But I think the default values for timeout and maximumAge we could leave as before.
Does that make sense?
There was a problem hiding this comment.
Yeah good catch! I switched it back to 10_000 and 0. And yeah, I went through the same thought process for it being hidden on iOS and web 😂 I think we leave it as-is for now.
There was a problem hiding this comment.
Not needed to be done in this PR, but I might do after this PR is merged -> We probably don't need the iOS version of the app anymore. I mean what it would verify is that the button doesn't render, but don't think that's really worth it having 10 or 20 more files in the "final" PR. We can at least check that it doesn't appear on web, which is good enough for me.
But let me know if you agree / disagree. Might be thinking too much about small stuff here 😅
Maybe checking the visibility on iOS / web could be covered by a quick test?
There was a problem hiding this comment.
I think it is ok to remove. We can probably just add a test that getLocationButtonState() returns unavailable on those platforms
|
LGTM! merging. |
45a7133
into
feat/RMET-5199/location-button
Description
os-location-buttonis Android only. On iOS and web the element is hidden (display: none), and the replica is removed.getLocationButtonState()returnssystem(Android 17 and later),compat(older Android), orunavailable(iOS and web). It replaces the privatenativeIslandsLocationButtonCapabilitiescall.text-typeuse-precise-location,timeout5000,maximum-age3000, and width 100%.onlyForLocationButtonflag.Context
RMET-5585, option B of [UX] Android location button. The OutSystems wrapper maps the three states to
AVAILABLE_SYSTEM,AVAILABLE_COMPATandUNAVAILABLE.onlyForLocationButtonneeded no code changes. On Android 17:coarseLocationreportsgrantedandlocationreportsdenied. It doesn't prompt again on later calls.Older versions ignore the flag.
Not covered by this PR:
#RRGGBB.Type of changes
Platforms affected
Tests
Lint, unit tests, build and Android lint pass. Example app checks:
system. The button returns a position with and without the flag. It still works after the element is removed and re-added (UX open item 2).compat. The button returns a position with and without the flag.unavailable, and nothing renders.unavailable. Nothing renders, even with a border and height set on the element.MABS 13 sample (LocationSampleAppRMET5199 with this branch bundled in), API 37 emulator:
system. The button shows with the OutSystems properties. Allow returns the position to the screen, Don't allow sendsgranted: false, and atext-typechange updates the label.