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

feat!: Allow the OAuth provider labels to be overridden on SupaSocialsAuth #101

Merged
merged 6 commits into from
Jun 20, 2024

Conversation

dshukertjr
Copy link
Member

What kind of change does this PR introduce?

Adds a localization feature to override the OAuth provider name

SupaSocialsAuth(
  socialProviders: const [OAuthProvider.azure],
  localization: const SupaSocialsAuthLocalization(
    oAuthButtonLabels: {
      OAuthProvider.azure: 'Continue with Microsoft (Azure)'
    },
  ),
  onSuccess: (session) {
    // sHandle success
  },
),

Closes #87

@dshukertjr dshukertjr requested a review from FatumaA June 19, 2024 08:26
@FatumaA
Copy link
Collaborator

FatumaA commented Jun 19, 2024

Hi,
Continue with is not translated in SupaSocialsAuthLocalization, fixed that in the commit. But I don't think we need "forgot password" in supasocialsauth, removed it in the second commit. Should be simple to revert incase I overlooked something.

../lib/src/components/supa_socials_auth.dart:388:39: Error: The getter 'continueWith' isn't defined for the class 'SupaSocialsAuthLocalization'.
 - 'SupaSocialsAuthLocalization' is from 'package:supabase_auth_ui/src/localizations/supa_socials_auth_localization.dart' ('../lib/src/localizations/supa_socials_auth_localization.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'continueWith'.
                      '${localization.continueWith} ${socialProvider.labelText}'), 

@henry2man
Copy link
Contributor

LGTM! 🚀

@dshukertjr
Copy link
Member Author

Great catch about not needing forgot password.

Thanks for fixing the code, and sorry that I failed to explain this, but removing the continue with was intentional.

Currently, the label on the OAuth login buttons are limited in the format of ${continueWithLocalization} ${ProviderName}, but not every language can follow the format, and I thought there should be a way to just override the entire thing.

That is why I decided to return the text including the continue with on the labelText, and now we can just override the entire button text using the new oAuthButtonLabels property.

@dshukertjr dshukertjr requested a review from FatumaA June 19, 2024 13:59
@FatumaA
Copy link
Collaborator

FatumaA commented Jun 19, 2024

Should be good to merge 😊

@dshukertjr dshukertjr merged commit 383dce7 into main Jun 20, 2024
1 check passed
@dshukertjr dshukertjr deleted the feat/social-label-override branch June 20, 2024 01:28
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.

FR: Override social provider names in SupaSocialsAuth ("Azure" --> "Microsoft (Azure)" for example)
3 participants