|
| 1 | +// |
| 2 | +// BrazeConstants.swift |
| 3 | +// TealiumBraze |
| 4 | +// |
| 5 | +// Created by Christina S on 9/21/20. |
| 6 | +// Copyright © 2020 Tealium. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | +import Foundation |
| 10 | + |
| 11 | +public enum BrazeConstants { |
| 12 | + |
| 13 | + static let commandName = "command_name" |
| 14 | + static let separator: Character = "," |
| 15 | + static let commandId = "braze" |
| 16 | + static let description = "Braze Remote Command" |
| 17 | + |
| 18 | + enum Commands: String { |
| 19 | + case initialize = "initialize" |
| 20 | + case userIdentifier = "useridentifier" |
| 21 | + case userAlias = "useralias" |
| 22 | + case userAttribute = "userattribute" |
| 23 | + case facebookUser = "facebookuser" |
| 24 | + case twitterUser = "twitteruser" |
| 25 | + case setCustomAttribute = "setcustomattribute" |
| 26 | + case unsetCustomAttribute = "unsetcustomattribute" |
| 27 | + case setCustomArrayAttribute = "setcustomarrayattribute" |
| 28 | + case appendCustomArrayAttribute = "appendcustomarrayattribute" |
| 29 | + case removeCustomArrayAttribute = "removecustomarrayattribute" |
| 30 | + case emailNotification = "emailnotification" |
| 31 | + case pushNotification = "pushnotification" |
| 32 | + case incrementCustomAttribute = "incrementcustomattribute" |
| 33 | + case logCustomEvent = "logcustomevent" |
| 34 | + case logPurchase = "logpurchase" |
| 35 | + case setLastKnownLocation = "setlastknownlocation" |
| 36 | + case enableSDK = "enablesdk" |
| 37 | + case wipeData = "wipedata" |
| 38 | + } |
| 39 | + |
| 40 | + enum Keys { |
| 41 | + static let apiKey = "api_key" |
| 42 | + static let launchOptions = "launch_options" |
| 43 | + static let pushToken = "push_token" |
| 44 | + static let userAttribute = "user_attributes" |
| 45 | + static let userIdentifier = "user_id" |
| 46 | + static let userAlias = "user_alias" |
| 47 | + static let aliasLabel = "alias_label" |
| 48 | + static let customAttribute = "set_custom_attribute" |
| 49 | + static let customArrayAttribute = "set_custom_array_attribute" |
| 50 | + static let appendCustomArrayAttribute = "append_custom_array_attribute" |
| 51 | + static let removeCustomArrayAttribute = "remove_custom_array_attribute" |
| 52 | + static let unsetCustomAttribute = "unset_custom_attribute" |
| 53 | + static let incrementCustomAttribute = "increment_custom_attribute" |
| 54 | + static let emailNotification = "email_notification" |
| 55 | + static let pushNotification = "push_notification" |
| 56 | + static let eventKey = "event" |
| 57 | + static let eventProperties = "event_properties" |
| 58 | + static let eventName = "event_name" |
| 59 | + static let productIdentifier = "product_id" |
| 60 | + static let currency = "order_currency" |
| 61 | + static let price = "product_unit_price" |
| 62 | + static let quantity = "quantity" |
| 63 | + static let purchaseKey = "purchase" |
| 64 | + static let purchaseProperties = "purchase_properties" |
| 65 | + static let facebookUser = "facebook_user" |
| 66 | + static let twitterUser = "twitter_user" |
| 67 | + static let enableSDK = "enable_sdk" |
| 68 | + static let sessionTimeout = "session_timeout" |
| 69 | + static let disableLocation = "disable_location" |
| 70 | + static let enableGeofences = "enable_geofences" |
| 71 | + static let triggerIntervalSeconds = "trigger_interval_seconds" |
| 72 | + static let latitude = "location_latitude" |
| 73 | + static let longitude = "location_longitude" |
| 74 | + static let horizontalAccuracy = "location_horizontal_accuracy" |
| 75 | + static let altitude = "location_altitude" |
| 76 | + static let verticalAccuracy = "location_vertical_accuracy" |
| 77 | + static let requestProcessingPolicy = "request_processing_policy" |
| 78 | + static let flushInterval = "flush_interval" |
| 79 | + static let enableAdvertiserTracking = "enable_advertiser_tracking" |
| 80 | + static let enableDeepLinkHandling = "enable_deep_link_handling" |
| 81 | + static let customEndpoint = "custom_endpoint" |
| 82 | + static let deviceOptions = "device_options" |
| 83 | + static let pushStoryIdentifier = "push_story_identifier" |
| 84 | + } |
| 85 | + |
| 86 | + enum Options { |
| 87 | + static let ABKRequestProcessingPolicyOptionKey = "ABKRequestProcessingPolicyOptionKey" |
| 88 | + static let ABKFlushIntervalOptionKey = "ABKFlushIntervalOptionKey" |
| 89 | + static let ABKEnableAutomaticLocationCollectionKey = "ABKEnableAutomaticLocationCollectionKey" |
| 90 | + static let ABKEnableGeofencesKey = "ABKEnableGeofencesKey" |
| 91 | + static let ABKIDFADelegateKey = "ABKIDFADelegateKey" |
| 92 | + static let ABKEndpointKey = "ABKEndpointKey" |
| 93 | + static let ABKURLDelegateKey = "ABKURLDelegateKey" |
| 94 | + static let ABKSessionTimeoutKey = "ABKSessionTimeoutKey" |
| 95 | + static let ABKMinimumTriggerTimeIntervalKey = "ABKMinimumTriggerTimeIntervalKey" |
| 96 | + static let ABKDeviceWhitelistKey = "ABKDeviceWhitelistKey" |
| 97 | + static let ABKPushStoryAppGroupKey = "ABKPushStoryAppGroupKey" |
| 98 | + } |
| 99 | + |
| 100 | + enum SocialMedia { |
| 101 | + static let userInfo = "user_info" |
| 102 | + static let friendsCount = "friends_count" |
| 103 | + static let likes = "likes" |
| 104 | + static let userDescription = "description" |
| 105 | + static let twitterName = "twitter_name" |
| 106 | + static let profileImageUrl = "profile_image_url" |
| 107 | + static let screenName = "screen_name" |
| 108 | + static let followersCount = "followers_count" |
| 109 | + static let statusesCount = "statuses_count" |
| 110 | + static let twitterId = "twitter_id" |
| 111 | + } |
| 112 | + |
| 113 | +} |
| 114 | + |
| 115 | +public enum AppboyUserAttribute: String, CaseIterable { |
| 116 | + case firstName = "first_name" |
| 117 | + case lastName = "last_name" |
| 118 | + case email |
| 119 | + case dateOfBirth = "date_of_birth" |
| 120 | + case country |
| 121 | + case language |
| 122 | + case homeCity = "home_city" |
| 123 | + case phone |
| 124 | + case avatarImageURL = "avatar_image_url" |
| 125 | + case gender |
| 126 | +} |
| 127 | + |
| 128 | +public enum AppboyUserGenderType: Int { |
| 129 | + case male |
| 130 | + case female |
| 131 | + case other |
| 132 | + case unknown |
| 133 | + case notApplicable |
| 134 | + case preferNotToSay |
| 135 | + |
| 136 | + static func from(_ value: String) -> AppboyUserGenderType { |
| 137 | + let lowercasedGender = value.lowercased() |
| 138 | + if lowercasedGender == "male" { |
| 139 | + return .male |
| 140 | + } else if lowercasedGender == "female" { |
| 141 | + return .female |
| 142 | + } else if lowercasedGender == "other" { |
| 143 | + return .other |
| 144 | + } else if lowercasedGender == "unknown" { |
| 145 | + return .unknown |
| 146 | + } else if lowercasedGender == "notapplicable" || lowercasedGender == "not_applicable" { |
| 147 | + return .notApplicable |
| 148 | + } else { |
| 149 | + return .preferNotToSay |
| 150 | + } |
| 151 | + } |
| 152 | +} |
| 153 | + |
| 154 | +public enum AppboyNotificationSubscription: String { |
| 155 | + case optedIn |
| 156 | + case subscribed |
| 157 | + case unsubscribed |
| 158 | + |
| 159 | + static func from(_ value: String) -> AppboyNotificationSubscription? { |
| 160 | + let lowercasedSubscription = value.lowercased() |
| 161 | + if lowercasedSubscription == "optedin" { |
| 162 | + return .optedIn |
| 163 | + } else if lowercasedSubscription == "subscribed" { |
| 164 | + return .subscribed |
| 165 | + } else if lowercasedSubscription == "unsubscribed" { |
| 166 | + return .unsubscribed |
| 167 | + } else { |
| 168 | + return nil |
| 169 | + } |
| 170 | + } |
| 171 | +} |
0 commit comments