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

[Feature]: add method getDouble to Config #7634

Open
2 of 3 tasks
robingenz opened this issue Aug 30, 2024 · 2 comments · May be fixed by #7638
Open
2 of 3 tasks

[Feature]: add method getDouble to Config #7634

robingenz opened this issue Aug 30, 2024 · 2 comments · May be fixed by #7638
Labels
platform: android platform: ios type: feature request A new feature, enhancement, or improvement

Comments

@robingenz
Copy link
Contributor

robingenz commented Aug 30, 2024

Description

There is currently no way to get a configuration value of type Double.

Platforms

  • iOS
  • Android
  • Web

Request or proposed solution

Add a new method getDouble to PluginConfig.swift:

@objc public func getDouble(_ configKey: String, _ defaultValue: Double) -> Double {
    if let val = (self.config)[keyPath: KeyPath(configKey)] as? Double {
        return val
    }
    return defaultValue
}

Alternatives

No response

Additional Information

No response

@jcesarmobile jcesarmobile changed the title [Feature]: add method getDouble to PluginConfig.swift [Feature]: add method getDouble to Config Sep 2, 2024
@jcesarmobile
Copy link
Member

If this feature is added should be added for both iOS and Android.

For your linked PR, I don't think you need a getDouble anyway since the config value is an integer and you get it as an integer on Android side, so it's better to cast it as you did rather than use a getDouble method to get an integer.

@jcesarmobile jcesarmobile added the type: feature request A new feature, enhancement, or improvement label Sep 2, 2024
@ionitron-bot ionitron-bot bot removed the triage label Sep 2, 2024
@robingenz robingenz linked a pull request Sep 3, 2024 that will close this issue
@robingenz
Copy link
Contributor Author

I've created a PR for Android and iOS: #7638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: android platform: ios type: feature request A new feature, enhancement, or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants