Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2.0] [Android] Handle geolocation requests #148

Merged
merged 7 commits into from
Dec 18, 2024

Conversation

markmur
Copy link
Contributor

@markmur markmur commented Dec 17, 2024

What changes are you making?

Fixes #129

sequenceDiagram
    participant Webview
    participant CheckoutSheetKit
    participant NativeModule
    participant App

    Webview->>CheckoutSheetKit: Request geolocation permissions
    CheckoutSheetKit->>NativeModule: onGeolocationShowPrompt(origin, callback)
    NativeModule->>NativeModule: Store origin and callback for later
    NativeModule->>App: Emit "geolocationRequest" event
    App->>App: Request geolocation permissions
    App->>NativeModule: Invoke native callback with result
    NativeModule->>CheckoutSheetKit: invoke the original prompt
Loading

PR Checklist

Important

@markmur markmur force-pushed the markmur/android-location-permissions branch 15 times, most recently from a3df394 to bbf5cc4 Compare December 17, 2024 23:19
@markmur markmur force-pushed the markmur/android-location-permissions branch from bbf5cc4 to f037c3a Compare December 17, 2024 23:21
@markmur markmur requested a review from kiftio December 18, 2024 10:19
@markmur markmur changed the title Handle geolocation requests on Android [Android] Handle geolocation requests Dec 18, 2024
@markmur markmur marked this pull request as ready for review December 18, 2024 11:29
@markmur markmur requested a review from a team as a code owner December 18, 2024 11:29
@markmur markmur requested a review from Copilot December 18, 2024 11:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 9 changed files in this pull request and generated 1 comment.

Files not reviewed (3)
  • modules/@shopify/checkout-sheet-kit/android/gradle.properties: Language not supported
  • sample/android/gradle.properties: Language not supported
  • README.md: Evaluated as low risk
Comments suppressed due to low confidence (5)

modules/@shopify/checkout-sheet-kit/android/src/main/java/com/shopify/reactnative/checkoutsheetkit/CustomCheckoutEventProcessor.java:83

  • Minor spelling mistake in the comment: 'retainGeolocationForFutureRequests' should be 'retainGeolocationForFutureRequests'.
public void onGeolocationPermissionsShowPrompt(@NonNull String origin, @NonNull GeolocationPermissions.Callback callback) {

modules/@shopify/checkout-sheet-kit/android/src/main/java/com/shopify/reactnative/checkoutsheetkit/CustomCheckoutEventProcessor.java:144

  • The HashMap should specify generic types as HashMap<String, Object> for better type safety.
private Map<String, Object> populateErrorDetails(CheckoutException checkoutError) {

modules/@shopify/checkout-sheet-kit/android/src/main/java/com/shopify/reactnative/checkoutsheetkit/ShopifyCheckoutSheetKitModule.java:287

  • The getConfig and setConfig methods are duplicated in the file. This seems unintentional and should be corrected.
  public void getConfig(Promise promise) {

modules/@shopify/checkout-sheet-kit/src/index.ts:78

  • The type of geolocationCallback should be Maybe to match the return type of addEventListener.
private geolocationCallback: Maybe<EventSubscription>;

modules/@shopify/checkout-sheet-kit/src/index.ts:252

  • The requestGeolocation method should handle cases where both permissions are denied explicitly.
const results = await PermissionsAndroid.requestMultiple([coarse, fine]);

@markmur markmur force-pushed the markmur/android-location-permissions branch from 2284e69 to a5a3560 Compare December 18, 2024 11:55
@markmur markmur force-pushed the markmur/android-location-permissions branch from e7d2da7 to 67c7678 Compare December 18, 2024 12:22
@markmur markmur requested a review from Copilot December 18, 2024 12:23

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 10 changed files in this pull request and generated no comments.

Files not reviewed (4)
  • modules/@shopify/checkout-sheet-kit/android/gradle.properties: Language not supported
  • sample/android/gradle.properties: Language not supported
  • modules/@shopify/checkout-sheet-kit/src/context.tsx: Evaluated as low risk
  • sample/src/App.tsx: Evaluated as low risk
@markmur markmur force-pushed the markmur/android-location-permissions branch from 67c7678 to ee73733 Compare December 18, 2024 12:29
@markmur markmur changed the title [Android] Handle geolocation requests [3.2.0] [Android] Handle geolocation requests Dec 18, 2024
@markmur markmur force-pushed the markmur/android-location-permissions branch from b920239 to d121244 Compare December 18, 2024 12:36
@markmur markmur force-pushed the markmur/android-location-permissions branch from d121244 to d58ea8b Compare December 18, 2024 12:39
@markmur markmur requested a review from a team December 18, 2024 13:25
@markmur markmur merged commit bb5d30e into main Dec 18, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use my location button doesn't work (iOS and Adroid)
2 participants