Skip to content

Commit

Permalink
restored constants to avoid breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Espinola committed Jun 7, 2024
1 parent b5879ea commit dc692d5
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 24 deletions.
12 changes: 6 additions & 6 deletions ExampleSwift/ExampleSwift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class AppDelegate : UIResponder, UIApplicationDelegate {

public static func createUserIdentifiers() -> [String: Any] {
[
ATTNIdentifierType.phone: "+15671230987",
ATTNIdentifierType.email: "[email protected]",
ATTNIdentifierType.clientUserId: "APP_USER_ID",
ATTNIdentifierType.shopifyId: "207119551",
ATTNIdentifierType.klaviyoId: "555555",
ATTNIdentifierType.customIdentifiers: ["customId": "customIdValue"]
IDENTIFIER_TYPE_PHONE: "+15671230987",
IDENTIFIER_TYPE_EMAIL: "[email protected]",
IDENTIFIER_TYPE_CLIENT_USER_ID: "APP_USER_ID",
IDENTIFIER_TYPE_SHOPIFY_ID: "207119551",
IDENTIFIER_TYPE_KLAVIYO_ID: "555555",
IDENTIFIER_TYPE_CUSTOM_IDENTIFIERS: ["customId": "customIdValue"]
]
}
}
8 changes: 8 additions & 0 deletions Framework/ATTNSDKFramework.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#import <Foundation/Foundation.h>

FOUNDATION_EXPORT double ATTNSDKFrameworkVersionNumber;

FOUNDATION_EXPORT const unsigned char ATTNSDKFrameworkVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <attentive_ios_sdk/PublicHeader.h>
#import <attentive_ios_sdk_framework/ATTNConstants.h>
5 changes: 5 additions & 0 deletions Framework/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
framework module attentive_ios_sdk_framework {
umbrella header "ATTNSDKFramework.h"
export *
module * { export * }
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
name: "ATTNSDKFramework",
path: "Sources",
resources: [ .process("Resources") ],
publicHeadersPath: "include"
publicHeadersPath: "Public/Objc/Include"
)
]
)
5 changes: 5 additions & 0 deletions Sources/Public/ATTNEventTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ public final class ATTNEventTracker: NSObject {
_sharedInstance = ATTNEventTracker(sdk: sdk)
}

@available(swift, deprecated: 1.0, message: "Please use record(event: ATTNEvent) instead.")
@objc(recordEvent:)
public func record(_ event: ATTNEvent) {
sdk.send(event: event)
}

public func record(event: ATTNEvent) {
sdk.send(event: event)
}

@objc
public static func sharedInstance() -> ATTNEventTracker? {
assert(_sharedInstance != nil, "ATTNEventTracker must be setup before being used")
Expand Down
33 changes: 33 additions & 0 deletions Sources/Public/Objc/ATTNConstants.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// ATTNConstants.m
// attentive-ios-sdk-framework
//
// Created by Vladimir - Work on 2024-05-28.
//

#import "ATTNConstants.h"

// Status passed to ATTNCreativeTriggerCompletionHandler when the creative is opened sucessfully
NSString *const CREATIVE_TRIGGER_STATUS_OPENED = @"CREATIVE_TRIGGER_STATUS_OPENED";
// Status passed to ATTNCreativeTriggerCompletionHandler when the creative is closed sucessfully
NSString *const CREATIVE_TRIGGER_STATUS_CLOSED = @"CREATIVE_TRIGGER_STATUS_CLOSED";
// Status passed to the ATTNCreativeTriggerCompletionHandler when the Creative has been triggered but it is not
// opened successfully. This can happen if there is no available mobile app creative, if the creative
// is fatigued, if the creative call has been timed out, or if an unknown exception occurs.
NSString *const CREATIVE_TRIGGER_STATUS_NOT_OPENED = @"CREATIVE_TRIGGER_STATUS_NOT_OPENED";
// Status passed to the ATTNCreativeTriggerCompletionHandler when the Creative is not closed due to an unknown
// exception
NSString *const CREATIVE_TRIGGER_STATUS_NOT_CLOSED = @"CREATIVE_TRIGGER_STATUS_NOT_CLOSED";

// Your unique identifier for the user - this should be consistent across the user's lifetime, for example a database id
NSString *const IDENTIFIER_TYPE_CLIENT_USER_ID = @"clientUserId";
// The user's phone number in E.164 format
NSString *const IDENTIFIER_TYPE_PHONE = @"phone";
// The user's email
NSString *const IDENTIFIER_TYPE_EMAIL = @"email";
// The user's Shopify Customer ID
NSString *const IDENTIFIER_TYPE_SHOPIFY_ID = @"shopifyId";
// The user's Klaviyo ID
NSString *const IDENTIFIER_TYPE_KLAVIYO_ID = @"klaviyoId";
// Key-value pairs of custom identifier names and values (both NSStrings) to associate with this user
NSString *const IDENTIFIER_TYPE_CUSTOM_IDENTIFIERS = @"customIdentifiers";
38 changes: 38 additions & 0 deletions Sources/Public/Objc/Include/ATTNConstants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// ATTNConstants.h
// attentive-ios-sdk-framework
//
// Created by Vladimir - Work on 2024-05-28.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/// Status passed to `ATTNCreativeTriggerCompletionHandler` when the creative is opened successfully
extern NSString *const CREATIVE_TRIGGER_STATUS_OPENED __attribute__((deprecated("Please use ATTNCreativeTriggerStatus.opened instead.")));
/// Status passed to `ATTNCreativeTriggerCompletionHandler` when the creative is closed sucessfully
extern NSString *const CREATIVE_TRIGGER_STATUS_CLOSED __attribute__((deprecated("Please use ATTNCreativeTriggerStatus.closed instead.")));
/** Status passed to the`ATTNCreativeTriggerCompletionHandler` when the Creative has been triggered but it is not
opened successfully. This can happen if there is no available mobile app creative, if the creative
is fatigued, if the creative call has been timed out, or if an unknown exception occurs.
*/
extern NSString *const CREATIVE_TRIGGER_STATUS_NOT_OPENED __attribute__((deprecated("Please use ATTNCreativeTriggerStatus.notOpened instead.")));
/// Status passed to the `ATTNCreativeTriggerCompletionHandler` when the Creative is not closed due to an unknown exception
extern NSString *const CREATIVE_TRIGGER_STATUS_NOT_CLOSED __attribute__((deprecated("Please use ATTNCreativeTriggerStatus.notClosed instead.")));


/// Your unique identifier for the user - this should be consistent across the user's lifetime, for example a database id
extern NSString *const IDENTIFIER_TYPE_CLIENT_USER_ID __attribute__((deprecated("Please use ATTNIdentifierType.clientUserId instead.")));
/// The user's phone number in E.164 format
extern NSString *const IDENTIFIER_TYPE_PHONE __attribute__((deprecated("Please use ATTNIdentifierType.phone instead.")));
/// The user's email
extern NSString *const IDENTIFIER_TYPE_EMAIL __attribute__((deprecated("Please use ATTNIdentifierType.email instead.")));
/// The user's Shopify Customer ID
extern NSString *const IDENTIFIER_TYPE_SHOPIFY_ID __attribute__((deprecated("Please use ATTNIdentifierType.shopifyId instead.")));
/// The user's Klaviyo ID
extern NSString *const IDENTIFIER_TYPE_KLAVIYO_ID __attribute__((deprecated("Please use ATTNIdentifierType.klaviyoId instead.")));
/// Key-value pairs of custom identifier names and values (both Strings) to associate with this user
extern NSString *const IDENTIFIER_TYPE_CUSTOM_IDENTIFIERS __attribute__((deprecated("Please use ATTNIdentifierType.customIdentifiers instead.")));

NS_ASSUME_NONNULL_END
34 changes: 32 additions & 2 deletions attentive-ios-sdk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
FBA9FA1B2C0A77AB00C65024 /* ATTNSDKMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBA9F9FD2C0A77AB00C65024 /* ATTNSDKMode.swift */; };
FBA9FA1C2C0A77AB00C65024 /* ATTNUserIdentity.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBA9F9FE2C0A77AB00C65024 /* ATTNUserIdentity.swift */; };
FBA9FA1D2C0A77AB00C65024 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = FBA9FA012C0A77AB00C65024 /* PrivacyInfo.xcprivacy */; };
FBF78AAB2C135E0700596479 /* ATTNSDKFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = FBF78AA92C135E0700596479 /* ATTNSDKFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
FBF78AAE2C135ECD00596479 /* ATTNConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = FBF78AAD2C135ECD00596479 /* ATTNConstants.m */; };
FBF78AAF2C135ECD00596479 /* ATTNConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = FBF78AAC2C135ECD00596479 /* ATTNConstants.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -155,6 +158,10 @@
FBA9F9FD2C0A77AB00C65024 /* ATTNSDKMode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ATTNSDKMode.swift; sourceTree = "<group>"; };
FBA9F9FE2C0A77AB00C65024 /* ATTNUserIdentity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ATTNUserIdentity.swift; sourceTree = "<group>"; };
FBA9FA012C0A77AB00C65024 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
FBF78AA92C135E0700596479 /* ATTNSDKFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATTNSDKFramework.h; path = Framework/ATTNSDKFramework.h; sourceTree = "<group>"; };
FBF78AAA2C135E0700596479 /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; name = module.modulemap; path = Framework/module.modulemap; sourceTree = "<group>"; };
FBF78AAC2C135ECD00596479 /* ATTNConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ATTNConstants.h; sourceTree = "<group>"; };
FBF78AAD2C135ECD00596479 /* ATTNConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ATTNConstants.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -203,6 +210,8 @@
FB0E49E52BFBB1900025E281 /* Package.swift */,
58332EDF292EC26000B1ECF3 /* LICENSE */,
58332EDE292EC26000B1ECF3 /* README.md */,
FBF78AA92C135E0700596479 /* ATTNSDKFramework.h */,
FBF78AAA2C135E0700596479 /* module.modulemap */,
58332EDC292EC25500B1ECF3 /* attentive-ios-sdk.podspec */,
);
name = "Supporting Files";
Expand Down Expand Up @@ -373,6 +382,7 @@
FBA9F9FF2C0A77AB00C65024 /* Public */ = {
isa = PBXGroup;
children = (
FBF78AA82C135D3E00596479 /* Objc */,
FB60AF0F2C123ABB00C61537 /* SDK */,
FBA9F9FA2C0A77AB00C65024 /* Events */,
FBA9F9FB2C0A77AB00C65024 /* ATTNEventTracker.swift */,
Expand Down Expand Up @@ -410,13 +420,32 @@
path = Sources;
sourceTree = "<group>";
};
FBF78AA72C135C7300596479 /* Include */ = {
isa = PBXGroup;
children = (
FBF78AAC2C135ECD00596479 /* ATTNConstants.h */,
);
path = Include;
sourceTree = "<group>";
};
FBF78AA82C135D3E00596479 /* Objc */ = {
isa = PBXGroup;
children = (
FBF78AA72C135C7300596479 /* Include */,
FBF78AAD2C135ECD00596479 /* ATTNConstants.m */,
);
path = Objc;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
58332EBE292EC18800B1ECF3 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
FBF78AAB2C135E0700596479 /* ATTNSDKFramework.h in Headers */,
FBF78AAF2C135ECD00596479 /* ATTNConstants.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -552,6 +581,7 @@
FBA9FA092C0A77AB00C65024 /* ATTNAppInfo.swift in Sources */,
FB35C1792C0E030E009FA048 /* ATTNCreativeTriggerStatus.swift in Sources */,
FBA9FA1B2C0A77AB00C65024 /* ATTNSDKMode.swift in Sources */,
FBF78AAE2C135ECD00596479 /* ATTNConstants.m in Sources */,
FBA9FA072C0A77AB00C65024 /* ATTNEventRequest.swift in Sources */,
FB35C1932C0E524E009FA048 /* ATTNPurchaseEvent+Extension.swift in Sources */,
FB35C18D2C0E3FAA009FA048 /* ATTNUserIdentity+Extension.swift in Sources */,
Expand Down Expand Up @@ -767,7 +797,7 @@
);
MACOSX_DEPLOYMENT_TARGET = 12.6;
MARKETING_VERSION = 1.0;
MODULEMAP_FILE = "";
MODULEMAP_FILE = "$(SRCROOT)/Framework/module.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = "com.attentive.attentive-ios-sdk-local";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -809,7 +839,7 @@
);
MACOSX_DEPLOYMENT_TARGET = 12.6;
MARKETING_VERSION = 1.0;
MODULEMAP_FILE = "";
MODULEMAP_FILE = "$(SRCROOT)/Framework/module.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = "com.attentive.attentive-ios-sdk-local";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = iphoneos;
Expand Down

This file was deleted.

0 comments on commit dc692d5

Please sign in to comment.