Skip to content

Commit 0b0754e

Browse files
committed
6.0.3
1 parent 8c6e7a8 commit 0b0754e

File tree

7 files changed

+62
-26
lines changed

7 files changed

+62
-26
lines changed

Assets/DeltaDNA/Editor/iOS/CreateRichPushNotificationTargetPostProcessBuild.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static void CreateRichPushNotificationTarget(BuildTarget buildTarget, str
4444

4545
string guidOfInitialTarget = GetTargetGuid(project);
4646

47-
string pathToInfoPlist = Path.Combine(buildOutputPath, PATH_TO_INFO_PLIST_INSIDE_TARGET);
47+
string pathToInfoPlist = buildOutputPath + "/" + PATH_TO_INFO_PLIST_INSIDE_TARGET;
4848
PlistDocument mainProjectInfoPlist = new PlistDocument();
4949
mainProjectInfoPlist.ReadFromFile(pathToInfoPlist);
5050
PlistElementArray array = mainProjectInfoPlist.root.CreateArray("UIBackgroundModes");
@@ -55,29 +55,30 @@ public static void CreateRichPushNotificationTarget(BuildTarget buildTarget, str
5555
int indexOfLastIdentifierSection = bundleIdentifierForNotificationService.LastIndexOf('.') + 1;
5656
string displayName = bundleIdentifierForNotificationService.Substring(indexOfLastIdentifierSection);
5757

58-
string pathToNotificationServiceImplementation = Path.Combine(buildOutputPath, displayName);
58+
string pathToNotificationServiceImplementation = buildOutputPath + "/" + displayName;
5959

6060
if (!Directory.Exists(pathToNotificationServiceImplementation))
6161
{
6262
Directory.CreateDirectory(pathToNotificationServiceImplementation);
6363
}
6464

6565
PlistDocument notificationServicePlist = new PlistDocument();
66-
string plistTemplatePath = Path.Combine(GetPathToSourceDirectory(), "Info.plist");
66+
string plistTemplatePath = GetPathToSourceDirectory() + "/" + "Info.plist";
6767
notificationServicePlist.ReadFromFile(plistTemplatePath);
6868
notificationServicePlist.root.SetString("CFBundleDisplayName", displayName);
6969
notificationServicePlist.root.SetString("CFBundleIdentifier", bundleIdentifierForNotificationService);
7070
notificationServicePlist.root.SetString("CFBundleShortVersionString", PlayerSettings.bundleVersion);
7171
notificationServicePlist.root.SetString("CFBundleVersion", PlayerSettings.iOS.buildNumber);
7272

73-
string pathToNotificationServicePlist = Path.Combine(pathToNotificationServiceImplementation, PATH_TO_INFO_PLIST_INSIDE_TARGET);
73+
string pathToNotificationServicePlist = pathToNotificationServiceImplementation + "/" + PATH_TO_INFO_PLIST_INSIDE_TARGET;
7474
notificationServicePlist.WriteToFile(pathToNotificationServicePlist);
7575

7676
string guidOfExtension = PBXProjectExtensions.AddAppExtension(
77-
project, guidOfInitialTarget,
77+
project,
78+
guidOfInitialTarget,
7879
displayName,
7980
bundleIdentifierForNotificationService,
80-
pathToNotificationServicePlist
81+
displayName + "/" + PATH_TO_INFO_PLIST_INSIDE_TARGET
8182
);
8283
string buildPhaseId = project.AddSourcesBuildPhase(guidOfExtension);
8384

@@ -99,7 +100,6 @@ public static void CreateRichPushNotificationTarget(BuildTarget buildTarget, str
99100
);
100101
AddFileToProject(
101102
project,
102-
pathToNotificationServicePlist,
103103
"Info.plist",
104104
displayName,
105105
guidOfExtension,
@@ -150,26 +150,26 @@ private static void AddSourceFileToProject(
150150
string pathToImplementation
151151
)
152152
{
153-
string sourceFilepath = Path.Combine(GetPathToSourceDirectory(), filename);
154-
string destinationFilepath = Path.Combine(pathToImplementation, filename);
153+
string sourceFilepath = GetPathToSourceDirectory() + "/" + filename;
154+
string destinationFilepath = pathToImplementation + "/" + filename;
155155
if (File.Exists(destinationFilepath))
156156
{
157157
File.Delete(destinationFilepath);
158158
}
159159
File.Copy(sourceFilepath, destinationFilepath);
160-
string fileGUID = AddFileToProject(project, destinationFilepath, filename, extensionDisplayName, extensionGuid, buildPhase);
160+
string fileGUID = AddFileToProject(project, filename, extensionDisplayName, extensionGuid, buildPhase);
161161
project.AddFileToBuildSection(extensionGuid, buildPhase, fileGUID);
162162
}
163163

164164
private static string GetPathToSourceDirectory()
165165
{
166-
return Path.Combine("Assets", "DeltaDNA", "Editor", "iOS", "NotificationService");
166+
return string.Join("/", "Assets", "DeltaDNA", "Editor", "iOS", "NotificationService");
167167
}
168168

169-
private static string AddFileToProject(PBXProject project, string filepath, string filename, string extensionDisplayName, string extensionGuid, string buildPhase)
169+
private static string AddFileToProject(PBXProject project, string filename, string extensionDisplayName, string extensionGuid, string buildPhase)
170170
{
171171
string xcodePath = extensionDisplayName + "/" + filename;
172-
return project.AddFile(filepath, xcodePath);
172+
return project.AddFile(xcodePath, xcodePath);
173173
}
174174
}
175175
#endif

Assets/DeltaDNA/Runtime/Helpers/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace DeltaDNA
1818
{
1919
public class Settings
2020
{
21-
public static readonly string SDK_VERSION = "Unity SDK v6.0.2";
21+
public static readonly string SDK_VERSION = "Unity SDK v6.0.3";
2222

2323
internal static readonly string ENGAGE_API_VERSION = "4";
2424

Assets/DeltaDNA/Runtime/Helpers/SimpleDataStore.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public abstract class SimpleDataStore<K, V>{
1010

1111
private static object LOCK = new object();
1212

13-
private readonly string location = Application.temporaryCachePath + "/deltadna/";
13+
private readonly string location;
1414
private readonly string storename;
1515

1616
private Dictionary<K, V> data;
@@ -20,13 +20,16 @@ internal SimpleDataStore(string directory, string storename, char paramSeparator
2020

2121
directory = !directory.EndsWith("/") ? directory + "/" : directory;
2222

23-
this.location = Application.temporaryCachePath + "/deltadna/" + directory;
23+
this.location = Application.persistentDataPath + "/deltadna/" + directory;
24+
2425
this.paramSeparator = paramSeparator;
2526
this.storename = storename;
2627

2728
lock (LOCK) {
2829
CreateDirectory();
2930

31+
MigrateFromOldCacheFile(directory);
32+
3033
if (File.Exists(location + storename)) {
3134
data = File
3235
.ReadAllLines(location + storename)
@@ -92,6 +95,16 @@ protected char getKeyValueSeparator(){
9295
return this.paramSeparator;
9396
}
9497

98+
private void MigrateFromOldCacheFile(string directory)
99+
{
100+
string oldPath = Application.temporaryCachePath + "/deltadna/" + directory + storename;
101+
string newPath = location + storename;
102+
103+
if (File.Exists(oldPath) && !File.Exists(newPath))
104+
{
105+
File.Move(oldPath, newPath);
106+
}
107+
}
95108
}
96109

97110
}

Assets/DeltaDNA/Runtime/Messaging/ImageMessage.cs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,10 @@ public bool IsReady(){
223223

224224
public void Show(){
225225
if (IsReady()){
226-
try{
227-
if (spriteMap.Texture == null){
226+
try
227+
{
228+
if (spriteMap.Texture == null)
229+
{
228230
/*
229231
* This is a workaround for when we're showing for an
230232
* event trigger, as the instance didn't go through the
@@ -239,15 +241,17 @@ public void Show(){
239241
messageCanvas.sortingOrder = 32767;
240242
gameObject.AddComponent<GraphicRaycaster>();
241243

242-
if (this.configuration.ContainsKey("shim")){
244+
if (this.configuration.ContainsKey("shim"))
245+
{
243246
ShimLayer shimLayer = gameObject.AddComponent<ShimLayer>();
244247
shimLayer.Build(ddna, gameObject, this, this.configuration["shim"] as JSONObject, this.depth);
245248
}
246249

247250
JSONObject layout = configuration["layout"] as JSONObject;
248251
object orientation;
249252
if (!layout.TryGetValue("landscape", out orientation) &&
250-
!layout.TryGetValue("portrait", out orientation)){
253+
!layout.TryGetValue("portrait", out orientation))
254+
{
251255
throw new KeyNotFoundException("Layout missing orientation key.");
252256
}
253257

@@ -261,11 +265,15 @@ public void Show(){
261265

262266
showing = true;
263267
}
264-
catch (KeyNotFoundException exception){
268+
catch (KeyNotFoundException exception)
269+
{
265270
Logger.LogWarning("Failed to show image message, invalid format: " + exception.Message);
271+
HideImageMessageObject();
266272
}
267-
catch (Exception exception){
273+
catch (Exception exception)
274+
{
268275
Logger.LogWarning("Failed to show image message: " + exception.Message);
276+
HideImageMessageObject();
269277
}
270278
}
271279
}
@@ -276,9 +284,18 @@ public bool IsShowing(){
276284

277285
public void Close(){
278286
if (showing){
279-
UnityEngine.Object.Destroy(gameObject);
280-
showing = false;
287+
HideImageMessageObject();
288+
}
289+
}
290+
291+
private void HideImageMessageObject()
292+
{
293+
if (gameObject != null)
294+
{
295+
Object.Destroy(gameObject);
281296
}
297+
298+
showing = false;
282299
}
283300

284301
public JSONObject Parameters{ get; private set; }

Assets/DeltaDNA/Runtime/Plugins/Android/mainTemplate20194.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
33

44
dependencies {
55
implementation fileTree(dir: 'libs', include: ['*.jar'])
6-
implementation 'com.deltadna.android:deltadna-sdk-notifications:5.0.1'
6+
implementation 'com.deltadna.android:deltadna-sdk-notifications:5.0.2'
77
**DEPS**}
88

99
android {

Assets/DeltaDNA/Runtime/Plugins/Android/mainTemplate20202.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
33

44
dependencies {
55
implementation fileTree(dir: 'libs', include: ['*.jar'])
6-
implementation 'com.deltadna.android:deltadna-sdk-notifications:5.0.1'
6+
implementation 'com.deltadna.android:deltadna-sdk-notifications:5.0.2'
77
**DEPS**}
88

99
android {

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [6.0.3]
4+
5+
### Fixed
6+
- Event trigger counts will now be correctly persisted across sessions
7+
- iOS Rich Push Notifications will build correctly when project is moved between different systems between Unity and Xcode builds
8+
39
## [6.0.2]
410

511
### Fixed

0 commit comments

Comments
 (0)