globocom / react-native-ua

React Native module for Urban Airship
MIT License
37 stars 33 forks source link

Allow programmatic configuration #39

Closed mikecole20 closed 7 years ago

mikecole20 commented 7 years ago

Purpose

I often end up preferring programmatic setup of Urban Airship (I find it easier when dealing with multiple build environments). This simply adds a method to allow the developer to pass a UAConfig object if they want from the AppDelegate in the iOS app.

Since Android is setup with Autopilot, this can already be achieved by subclassing ReactNativeUAAutoPilot and plugging the subclass in AndroidManifest like so:

      <meta-data
        tools:replace="android:value"
        android:name="com.urbanairship.autopilot"
        android:value="com.my.package.MyAutopilot"/>
evandroeisinger commented 7 years ago

Thanks for your contribution @mikecole20 👍 Could you update the Docs with your improvements?

rlepinski commented 7 years ago

Looks fine to me.

For Android, you can also take advantage of "flavors" to provide alternative airshipconfig.properties or config xml resources.

sbycrosz commented 7 years ago

Hi guys!

Is the docs is all that's pending for this to be merged? @mikecole20 Do you mind if append this PR with the required docs?

-Sam

mikecole20 commented 7 years ago

@sbycrosz I've been meaning to loop back and finish the docs. Feel free to add them in if you have time. You could send me a PR into my branch if that's easier and I'll merge it in.

evandroeisinger commented 7 years ago

@sbycrosz yes! Only the docs is pending this PR.

mikecole20 commented 7 years ago

@evandroeisinger docs are updated. Big thanks to @sbycrosz for taking that on!

evandroeisinger commented 7 years ago

Nice job guys: @mikecole20 and @sbycrosz

evandroeisinger commented 7 years ago

Release 0.1.2: https://www.npmjs.com/package/react-native-ua

mikecole20 commented 7 years ago

Thanks @evandroeisinger, that was fast!