1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#import <MyTrackerSDK/MRMyTracker.h>
#import <Pushwoosh/PushNotificationManager.h>
#import "Common.h"
#import "MapsAppDelegate.h"
#ifdef OMIM_PRODUCTION
# include "fabric_logging.hpp"
#endif
#include "platform/file_logging.hpp"
#include "platform/platform.hpp"
#include "platform/settings.hpp"
void setPushWooshSender()
{
GetPlatform().SetPushWooshSender([](string const & tag, vector<string> 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<NSString *> * tags = [@[] mutableCopy];
for (auto const & value : values)
[tags addObject:@(value.c_str())];
[pushManager setTags:@{ @(tag.c_str()) : tags }];
}
});
}
void setMarketingSender()
{
GetPlatform().SetMarketingSender([](string const & tag, map<string, string> const & params) {
if (tag.empty())
return;
NSMutableDictionary<NSString *, NSString *> * eventParams = [@{} mutableCopy];
NSMutableString * myTrackerEvent = [@(tag.c_str()) mutableCopy];
for (auto const & param : params)
{
NSString * key = @(param.first.c_str());
NSString * value = @(param.second.c_str());
eventParams[key] = value;
[myTrackerEvent appendString:[NSString stringWithFormat:@"_%@_%@", key, value]];
}
[MRMyTracker trackEventWithName:myTrackerEvent];
});
}
int main(int argc, char * argv[])
{
#ifdef MWM_LOG_TO_FILE
my::SetLogMessageFn(LogMessageFile);
#elif OMIM_PRODUCTION
my::SetLogMessageFn(platform::LogMessageFabric);
#endif
auto & p = GetPlatform();
LOG(LINFO, ("maps.me started, detected CPU cores:", p.CpuCores()));
setPushWooshSender();
setMarketingSender();
int retVal;
@autoreleasepool
{
retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([MapsAppDelegate class]));
}
return retVal;
}
|