Skip to content

Commit

Permalink
fix ios setAttribute method (#23)
Browse files Browse the repository at this point in the history
* fix ios setAttribute method
  • Loading branch information
chouaibMo authored Nov 30, 2023
1 parent 633f4ed commit 3847d1c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Editor/ExternalDependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
</repositories>
</androidPackages>
<iosPods>
<iosPod name="Purchasely" version="4.1.4"/>
<iosPod name="Purchasely" version="4.1.5"/>
</iosPods>
</dependencies>
11 changes: 7 additions & 4 deletions Editor/PurchaselyPostProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath)
DisableBitcode(buildPath);

// Debug.Log("Installing for iOS. Adding Purchasely SDK");
// AddPurchaselyFramework(buildPath);
AddPurchaselyFramework(buildPath);
#endif
}
}
Expand All @@ -42,11 +42,14 @@ private static void AddPurchaselyFramework(string path)
string frameworkName = frameworkRawName + ".xcframework";
var src = Path.Combine("Pods", frameworkRawName, "Purchasely/Frameworks", frameworkName);
var frameworkPath = project.AddFile(src, src);
project.AddFileToBuild(mainTargetGUID, frameworkPath);

// Appears to be useless
// project.AddFileToEmbedFrameworks(mainTargetGUID, frameworkPath);
// Check if the framework is already present before adding to embed frameworks
if (!project.ContainsFileByProjectPath(frameworkPath))
{
project.AddFileToEmbedFrameworks(mainTargetGUID, frameworkPath);
}

project.WriteToFile(projPath);
}
Expand Down
2 changes: 1 addition & 1 deletion Native/IOS/PurchaselyBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void _purchaselyUserLogout() {
}

void _purchaselySetAttribute(int attribute, const char* value) {
[Purchasely setAttribute:attribute value:value];
[Purchasely setAttribute:(PLYAttribute)attribute value:[PLYUtils createNSStringFrom:value]];
}

void _purchaselySetStringAttribute(const char* key, const char* value) {
Expand Down
42 changes: 21 additions & 21 deletions Runtime/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,26 @@ public enum PresentationType

public enum PLYAttribute
{
FIREBASE_APP_INSTANCE_ID = 0,
AIRSHIP_CHANNEL_ID = 1,
AIRSHIP_USER_ID = 2,
BATCH_INSTALLATION_ID = 3,
ADJUST_ID = 4,
APPSFLYER_ID = 5,
ONESIGNAL_PLAYER_ID = 6,
MIXPANEL_DISTINCT_ID = 7,
CLEVER_TAP_ID = 8,
SENDINBLUE_USER_EMAIL = 9,
ITERABLE_USER_EMAIL = 10,
ITERABLE_USER_ID = 11,
AT_INTERNET_ID_CLIENT = 12,
MPARTICLE_USER_ID = 13,
CUSTOMERIO_USER_ID = 14,
CUSTOMERIO_USER_EMAIL = 15,
BRANCH_USER_DEVELOPER_IDENTITY = 16,
AMPLITUDE_USER_ID = 17,
AMPLITUDE_DEVICE_ID = 18,
MOENGAGE_UNIQUE_ID = 19,
ONESIGNAL_EXTERNAL_ID = 20,
AMPLITUDE_USER_ID = 0,
AMPLITUDE_DEVICE_ID = 1,
FIREBASE_APP_INSTANCE_ID = 2,
AIRSHIP_CHANNEL_ID = 3,
AIRSHIP_USER_ID = 4,
BATCH_INSTALLATION_ID = 5,
ADJUST_ID = 6,
APPSFLYER_ID = 7,
ONESIGNAL_PLAYER_ID = 8,
MIXPANEL_DISTINCT_ID = 9,
CLEVER_TAP_ID = 10,
SENDINBLUE_USER_EMAIL = 11,
ITERABLE_USER_ID = 12,
ITERABLE_USER_EMAIL = 13,
AT_INTERNET_ID_CLIENT = 14,
MPARTICLE_USER_ID = 15,
BRANCH_USER_DEVELOPER_IDENTITY = 16,
CUSTOMERIO_USER_EMAIL = 17,
CUSTOMERIO_USER_ID = 18,
MOENGAGE_UNIQUE_ID = 19,

}
}
3 changes: 3 additions & 0 deletions Samples~/purchasely-demo/Scripts/PurchaselyDemoController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ private void OnPurchaselyStart(bool success, string error)
_purchasely.IsDeeplinkHandled("https://purchasely.com");

Log($"Purchasely isAnonymous. {_purchasely.IsAnonymous()}");

_purchasely.SetAttribute(PLYAttribute.ADJUST_ID, "test_adjust_id");
_purchasely.SetAttribute(PLYAttribute.APPSFLYER_ID, "test_appsflyer_id");
}

private void OnPurchaselyEvent(Event @event)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.purchasely.unity",
"version": "4.1.3",
"version": "4.1.4",
"displayName": "Purchasely",
"description": "Subscription optimization made easy",
"unity": "2019.4",
Expand Down

0 comments on commit 3847d1c

Please sign in to comment.