From 2ae222f73cd6d9fe19947cc9fb8d4542e1e36fad Mon Sep 17 00:00:00 2001 From: Nikolay Galizin Date: Wed, 3 Apr 2019 20:13:36 +0700 Subject: [PATCH] update iOS plugin; fix add_inbox_ios_resources.js script --- scripts/add_inbox_ios_resources.js | 10 ++++++++-- src/ios/PushwooshPlugin/Pushwoosh.m | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/scripts/add_inbox_ios_resources.js b/scripts/add_inbox_ios_resources.js index f11a1eb..04fa939 100644 --- a/scripts/add_inbox_ios_resources.js +++ b/scripts/add_inbox_ios_resources.js @@ -1,4 +1,6 @@ -const config = require('react-native/local-cli/core/config'); +require('react-native/setupBabel')(); + +const core = require('react-native/local-cli/core'); const PbxFile = require('xcode/lib/pbxFile'); const path = require('path'); const xcode = require('xcode'); @@ -6,7 +8,8 @@ const fs = require('fs'); const createGroupWithMessage = require('react-native/local-cli/link/ios/createGroupWithMessage'); function pwAddInboxiOSResources() { - const iOSconfig = config.getProjectConfig().ios; + core.configPromise.then(function(config) { + const iOSconfig = config.getProjectConfig().ios; const pw_iOSconfig = config.getDependencyConfig('pushwoosh-react-native-plugin').ios; const project = xcode.project(iOSconfig.pbxprojPath).parseSync(); @@ -31,6 +34,9 @@ function pwAddInboxiOSResources() { iOSconfig.pbxprojPath, project.writeSync() ); + }); + + }; pwAddInboxiOSResources(); diff --git a/src/ios/PushwooshPlugin/Pushwoosh.m b/src/ios/PushwooshPlugin/Pushwoosh.m index ceddfaa..493dafa 100644 --- a/src/ios/PushwooshPlugin/Pushwoosh.m +++ b/src/ios/PushwooshPlugin/Pushwoosh.m @@ -309,6 +309,24 @@ - (PWIInboxStyle *)inboxStyleForDictionary:(NSDictionary *)styleDictionary { style.separatorColor = [RCTConvert UIColor:dividerColorValue]; } + NSNumber *barBackgroundColor = styleDictionary[@"barBackgroundColor"]; + + if (barBackgroundColor) { + style.barBackgroundColor = [RCTConvert UIColor:barBackgroundColor]; + } + + NSNumber *barAccentColor = styleDictionary[@"barAccentColor"]; + + if (barAccentColor) { + style.barAccentColor = [RCTConvert UIColor:barAccentColor]; + } + + NSNumber *barTextColor = styleDictionary[@"barTextColor"]; + + if (barTextColor) { + style.barTextColor = [RCTConvert UIColor:barTextColor]; + } + return style; }