admob
admob copied to clipboard
feat(settings): add globalSettings of common method
Add global settings method. This can call anywhere. https://developers.google.com/admob/android/global-settings
close https://github.com/capacitor-community/admob/issues/50
Todo: change value of volume to enum.
I agree volume must be enum .
@distante I remembered that enum can't use numeric name at key. And if use string, use use Volume['0.1']
.
This is not simple, so I think volume should use only type:
https://github.com/capacitor-community/admob/pull/108/commits/9df9a4b47ba41c3f73bbc8d578c723095bdedae0
Hi @rdlabo, I sorry I meant an enum for the possible global settings keys on the native side. I I should have been more specific.
I would let it like you did it first, and just try to do this if the possible global settings augment from 2 to more.
Using number
is OK for the Typescript interface I think.
@distance Sorry late reply.
volume is 0.0 - 1.0, that isn't very common in implementations, so I'll list it in TypeScript as well. And Enum can't use float at key. So implements will be this:
public enum VolumeEnum: Float {
case ZERO = 0.0
case ONE = 0.1
}
And
switch (volume) {
case 0.0:
setVolume = VolumeEnum.ZERO.rawValue
break;
case 0.1:
setVolume = VolumeEnum.ONE.rawValue
break;
...
Is this code what you intend?
@distance Sorry late reply.
volume is 0.0 - 1.0, that isn't very common in implementations, so I'll list it in TypeScript as well. And Enum can't use float at key. So implements will be this:
public enum VolumeEnum: Float { case ZERO = 0.0 case ONE = 0.1 }
And
switch (volume) { case 0.0: setVolume = VolumeEnum.ZERO.rawValue break; case 0.1: setVolume = VolumeEnum.ONE.rawValue break; ...
Is this code what you intend?
Hi, sorry for the late reply!
I meant something like this:
if (call.getFloat(GlobalSettingsEnum.Volume) != null) {}
Any updates on this PR? Feels like it should be pretty simple, especially as the code pretty much works in it's present form - the admob config calls are simple, and the config settings should be pretty similar to existing configuration options
Happy to take a shot at a new PR if it would be helpful, though I'm not all that good with either java or swift.
Update: PR submitted at https://github.com/capacitor-community/admob/pull/228
This should be closable now, since #228 has been merged.
https://github.com/capacitor-community/admob/pull/228