admob icon indicating copy to clipboard operation
admob copied to clipboard

feat(settings): add globalSettings of common method

Open rdlabo opened this issue 3 years ago • 5 comments

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

rdlabo avatar Jun 06 '21 08:06 rdlabo

Todo: change value of volume to enum.

rdlabo avatar Jun 06 '21 10:06 rdlabo

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

rdlabo avatar Jun 07 '21 00:06 rdlabo

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.

distante avatar Jun 07 '21 05:06 distante

@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?

rdlabo avatar Jul 09 '21 01:07 rdlabo

@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) {}

distante avatar Jul 19 '21 06:07 distante

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

ecc521 avatar Feb 16 '23 02:02 ecc521

This should be closable now, since #228 has been merged.

ecc521 avatar Mar 09 '23 14:03 ecc521

https://github.com/capacitor-community/admob/pull/228

rdlabo avatar Mar 10 '23 10:03 rdlabo