Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Dec 27, 2024
1 parent 0a8c8b5 commit bbb89c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ public static MauiApp CreateMauiApp()
.UseMauiApp<App>()
//#if (framework == 'net9.0')
.UseInAppReviews()
.UseAppStoreInfo()
.UseAppStoreInfo(config =>
{
config.CountryCode = CultureInfoManager.GetCurrentRegion().TwoLetterISORegionName.ToLowerInvariant();
})
.UseAndroidInAppUpdates()
//#endif
//#if (sentry == true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public partial class PhoneService
// Get region from Cloudflare "CF-IPCountry" header if available, otherwise use UI culture's region if multilingual is enabled, or fallback to the default region.
var region = httpContextAccessor.HttpContext!.Request.Headers.TryGetValue("CF-IPCountry", out var value)
? value.ToString()
: new RegionInfo((CultureInfoManager.MultilingualEnabled ? CultureInfo.CurrentUICulture : CultureInfoManager.DefaultCulture).Name).TwoLetterISORegionName;
: CultureInfoManager.GetCurrentRegion().TwoLetterISORegionName;

var parsedPhoneNumber = phoneNumberUtil.Parse(phoneNumber, region);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public static CultureInfo CreateCultureInfo(string name)
return cultureInfo;
}

public static RegionInfo GetCurrentRegion()
{
return new RegionInfo((MultilingualEnabled ? CultureInfo.CurrentUICulture : DefaultCulture).Name);
}

public void SetCurrentCulture(string cultureName)
{
var cultureInfo = SupportedCultures.FirstOrDefault(sc => string.Equals(sc.Culture.Name, cultureName, StringComparison.InvariantCultureIgnoreCase)).Culture ?? DefaultCulture;
Expand Down

0 comments on commit bbb89c7

Please sign in to comment.