forked from organicmaps/organicmaps
[ios] Added custom fields to Push filtering.
This commit is contained in:
parent
b81b9b214f
commit
6a5be94792
3 changed files with 25 additions and 4 deletions
|
@ -42,6 +42,11 @@ static NSString * const kOldWatchUserEventKey = @"OldWatchUser";
|
|||
static NSString * const kUDWatchEventAlreadyTracked = @"WatchEventAlreadyTracked";
|
||||
static NSString * const kPushDeviceTokenLogEvent = @"iOSPushDeviceToken";
|
||||
static NSString * const kIOSIDFA = @"IFA";
|
||||
static NSString * const kBundleVersion = @"BundleVersion";
|
||||
|
||||
extern string const kCountryCodeKey;
|
||||
extern string const kUniqueIdKey;
|
||||
extern string const kLanguageKey;
|
||||
|
||||
/// Adds needed localized strings to C++ code
|
||||
/// @TODO Refactor localization mechanism to make it simpler
|
||||
|
@ -133,11 +138,18 @@ void InitLocalizedStrings()
|
|||
|
||||
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
|
||||
{
|
||||
PFInstallation * const currentInstallation = [PFInstallation currentInstallation];
|
||||
PFInstallation * currentInstallation = [PFInstallation currentInstallation];
|
||||
[currentInstallation setDeviceTokenFromData:deviceToken];
|
||||
NSUUID const * const advertisingId = [AppInfo sharedInfo].advertisingId;
|
||||
AppInfo * appInfo = [AppInfo sharedInfo];
|
||||
NSUUID * advertisingId = appInfo.advertisingId;
|
||||
if (advertisingId)
|
||||
[currentInstallation setObject:advertisingId.UUIDString forKey:kIOSIDFA];
|
||||
[currentInstallation setObject:appInfo.countryCode forKey:@(kCountryCodeKey.c_str())];
|
||||
[currentInstallation setObject:appInfo.uniqueId forKey:@(kUniqueIdKey.c_str())];
|
||||
NSString * languageId = appInfo.languageId;
|
||||
if (languageId)
|
||||
[currentInstallation setObject:languageId forKey:@(kLanguageKey.c_str())];
|
||||
[currentInstallation setObject:appInfo.bundleVersion forKey:kBundleVersion];
|
||||
[currentInstallation saveInBackground];
|
||||
|
||||
[Alohalytics logEvent:kPushDeviceTokenLogEvent withValue:currentInstallation.deviceToken];
|
||||
|
|
|
@ -13,5 +13,6 @@
|
|||
@property (nonatomic, readonly) NSString * bundleVersion;
|
||||
@property (nonatomic, readonly) NSString * deviceInfo;
|
||||
@property (nonatomic, readonly) NSUUID * advertisingId;
|
||||
@property (nonatomic, readonly) NSString * languageId;
|
||||
|
||||
@end
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
#import <AdSupport/ASIdentifierManager.h>
|
||||
#include "../../../platform/settings.hpp"
|
||||
|
||||
static string const kCountryCodeKey = "CountryCode";
|
||||
static string const kUniqueIdKey = "UniqueId";
|
||||
extern string const kCountryCodeKey = "CountryCode";
|
||||
extern string const kUniqueIdKey = "UniqueId";
|
||||
extern string const kLanguageKey = "Language";
|
||||
|
||||
static string const kLaunchCountKey = "LaunchCount";
|
||||
static NSString * const kAppInfoFirstLaunchDateKey = @"AppInfoFirstLaunchDate";
|
||||
|
||||
|
@ -172,4 +174,10 @@ static NSString * const kAppInfoFirstLaunchDateKey = @"AppInfoFirstLaunchDate";
|
|||
return _advertisingId;
|
||||
}
|
||||
|
||||
- (NSString *)languageId
|
||||
{
|
||||
NSArray * languages = [NSLocale preferredLanguages];
|
||||
return languages.count == 0 ? nil : languages[0];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Reference in a new issue