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

fix import settings #4228

Open
wants to merge 2 commits into
base: r4.9
Choose a base branch
from
Open

fix import settings #4228

wants to merge 2 commits into from

Conversation

Skalii
Copy link
Collaborator

@Skalii Skalii commented Dec 19, 2024

No description provided.

refactoring enum settings;
@Skalii Skalii marked this pull request as draft December 19, 2024 21:12
@Skalii Skalii marked this pull request as ready for review December 21, 2024 08:49
{
NSString *prefId = [self getPrefId];
if (customId && customId.length > 0)
prefId = [prefId stringByAppendingString:customId];

return [[_settings registerIntPreference:prefId defValue:EOASunriseSunsetTimeLeft] makeProfile];
return [[_settings registerBooleanPreference:prefId defValue:YES] makeProfile];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did Integer become Boolean?

@@ -59,7 +59,7 @@ final class GradientUiHelper: NSObject {
case .slope:
typeValue = "°"
case .height:
if let formattedValue = OAOsmAndFormatter.getFormattedAlt(value, mc: OAAppSettings.sharedManager().metricSystem.get()) {
if let formattedValue = OAOsmAndFormatter.getFormattedAlt(value, mc: EOAMetricsConstant(rawValue: Int(OAAppSettings.sharedManager().metricSystem.get()))!) {
Copy link
Contributor

Choose a reason for hiding this comment

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

force unwrap

@@ -85,15 +85,15 @@ final class GradientUiHelper: NSObject {
switch colorizationType {
case .speed:
if analysis.maxSpeed != 0 {
type = OASpeedConstant.toShortString(OAAppSettings.sharedManager().speedSystem.get())
type = OASpeedConstant.toShortString(EOASpeedConstant(rawValue: Int(OAAppSettings.sharedManager().speedSystem.get()))!)
Copy link
Contributor

Choose a reason for hiding this comment

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

up

stringValue = Self.formatValue(value, multiplier: analysis.maxSpeed)
}
case .elevation:
let minElevation = analysis.minElevation
let maxElevation = analysis.maxElevation + maxAltitudeAddition
if minElevation != 99999.0 && maxElevation != -100.0 {
let calculatedValue = value == 0 ? minElevation : minElevation + (value * (maxElevation - minElevation))
if let formattedValue = OAOsmAndFormatter.getFormattedAlt(calculatedValue, mc: OAAppSettings.sharedManager().metricSystem.get()) {
if let formattedValue = OAOsmAndFormatter.getFormattedAlt(calculatedValue, mc: EOAMetricsConstant(rawValue: Int(OAAppSettings.sharedManager().metricSystem.get()))!) {
Copy link
Contributor

Choose a reason for hiding this comment

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

up

{
return [super get:mode];
enumClasses = [NSMutableArray array];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why in load? (sharedManager init)

{
[super set:rateUsState mode:mode];
[enumClasses addObject:self.class];
Copy link
Contributor

Choose a reason for hiding this comment

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

Using + (void)load is not the most optimal solution in Objective-C. It's better to use a direct initializer

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.

2 participants