diff --git a/iphone/Maps/main.mm b/iphone/Maps/main.mm index 2098824d1c..d0f07129c4 100644 --- a/iphone/Maps/main.mm +++ b/iphone/Maps/main.mm @@ -1,3 +1,4 @@ +#import #import "Common.h" #import "MapsAppDelegate.h" @@ -16,7 +17,25 @@ int main(int argc, char * argv[]) #elif OMIM_PRODUCTION my::SetLogMessageFn(platform::LogMessageFabric); #endif - LOG(LINFO, ("maps.me started, detected CPU cores:", GetPlatform().CpuCores())); + auto & p = GetPlatform(); + LOG(LINFO, ("maps.me started, detected CPU cores:", p.CpuCores())); + + p.SetPushWooshSender([](string const & tag, vector const & values) { + if (values.empty() || tag.empty()) + return; + PushNotificationManager * pushManager = [PushNotificationManager pushManager]; + if (values.size() == 1) + { + [pushManager setTags:@{ @(tag.c_str()) : @(values.front().c_str()) }]; + } + else + { + NSMutableArray * tags = [@[] mutableCopy]; + for (auto const & value : values) + [tags addObject:@(value.c_str())]; + [pushManager setTags:@{ @(tag.c_str()) : tags }]; + } + }); int retVal; @autoreleasepool diff --git a/platform/platform.hpp b/platform/platform.hpp index b654c3e75c..0e1c09f405 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -54,6 +54,7 @@ public: }; using TFilesWithType = vector>; + using TPushWooshSenderFn = function const & values)>; protected: /// Usually read-only directory for application resources @@ -86,6 +87,9 @@ protected: /// Returns last system call error as EError. static EError ErrnoToError(); + /// Callback fucntion for setting PushWoosh tags. + TPushWooshSenderFn m_pushwooshSender; + public: Platform(); @@ -224,6 +228,7 @@ public: void SetupMeasurementSystem() const; + void SetPushWooshSender(TPushWooshSenderFn const & fn) { m_pushwooshSender = fn; } void SendPushWooshTag(string const & tag); void SendPushWooshTag(string const & tag, string const & value); void SendPushWooshTag(string const & tag, vector const & values); diff --git a/platform/platform_ios.mm b/platform/platform_ios.mm index babe36072a..acd3c96b06 100644 --- a/platform/platform_ios.mm +++ b/platform/platform_ios.mm @@ -283,7 +283,8 @@ void Platform::SendPushWooshTag(string const & tag, string const & value) void Platform::SendPushWooshTag(string const & tag, vector const & values) { - //TODO: implement + if (m_pushwooshSender) + m_pushwooshSender(tag, values); } ////////////////////////////////////////////////////////////////////////