Skip to content

Commit

Permalink
5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
unity-thull committed Jan 27, 2022
1 parent 7992792 commit 6d3d7bd
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [Unreleased]

### Fixed
- When switching environments between Dev and Live, data will be cleaned so that events are not sent to the wrong environment during testing

## [5.0.0](https://github.com/deltaDNA/ios-sdk/releases/tag/5.0.0)
### New

Expand Down
4 changes: 2 additions & 2 deletions DeltaDNA.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Pod::Spec.new do |spec|

# Spec Metadata
spec.name = "DeltaDNA"
spec.version = "5.0.0"
spec.version = "5.0.1"
spec.summary = "A gaming analytics platform."

spec.homepage = "https://deltadna.com"
Expand All @@ -18,7 +18,7 @@ Pod::Spec.new do |spec|
spec.platform = :ios

# Source Location
spec.source = { :http => "https://github.com/deltaDNA/ios-sdk/releases/download/5.0.0/DeltaDNA-5.0.0.zip" }
spec.source = { :http => "https://github.com/deltaDNA/ios-sdk/releases/download/5.0.1/DeltaDNA-5.0.1.zip" }

# Source Code
spec.vendored_frameworks = 'build/Frameworks/DeltaDNA.xcframework'
Expand Down
21 changes: 21 additions & 0 deletions DeltaDNA/DDNASDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ - (void)startWithEnvironmentKey:(NSString *)environmentKey
self.impl = [[DDNATrackingSdk alloc] initWithSdk:self instanceFactory:DDNAInstanceFactory.sharedInstance];
}

[self handleEnvironmentChanges];

[self.impl startWithNewPlayer:self.userManager];
}
}
Expand Down Expand Up @@ -193,6 +195,25 @@ - (void) upload
}
}

/*
Detects if the environment has changed since the last app startup. We assume this method is called after the
environment key on self has been initialised in the start method. This method will clear out the event store and cache
if the environment changes - this is to ensure that events are not sent to the wrong environment during testing.
*/
- (void) handleEnvironmentChanges
{
static NSString *previousEnvironmentUserDefaultKey = @"DDNA_PREVIOUS_ENV";

@synchronized (self) {
NSString *previousEnv = [[NSUserDefaults standardUserDefaults] stringForKey:previousEnvironmentUserDefaultKey];
if (previousEnv != nil && previousEnv.length != 0 && previousEnv != self.environmentKey) {
DDNALogDebug(@"Detected an environment configuration change from %@ to %@, clearing out cached events from previous environment.", previousEnv, self.environmentKey);
[self.impl clearPersistentData];
}
[[NSUserDefaults standardUserDefaults] setValue:self.environmentKey forKey:previousEnvironmentUserDefaultKey];
}
}

- (void) clearPersistentData
{
@synchronized(self) {
Expand Down
2 changes: 1 addition & 1 deletion DeltaDNA/DDNASettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#import "DDNASettings.h"

NSString *const DDNA_SDK_VERSION = @"iOS SDK v5.0.0";
NSString *const DDNA_SDK_VERSION = @"iOS SDK v5.0.1";
NSString *const DDNA_ENGAGE_API_VERSION = @"4";

NSString *const DDNA_EVENT_STORAGE_PATH = @"{persistent_path}";
Expand Down
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target 'MyApp' do
# 如果你使用Swift或者想要使用动态框架,请取消此行注释
use_frameworks!

pod 'DeltaDNA', '~> 5.0.0'
pod 'DeltaDNA', '~> 5.0.1'

target 'MyAppTests' do
inherit! :search_paths
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ target 'MyApp' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
use_frameworks!

pod 'DeltaDNA', '~> 5.0.0'
pod 'DeltaDNA', '~> 5.0.1'

target 'MyAppTests' do
inherit! :search_paths
Expand Down Expand Up @@ -87,6 +87,9 @@ engageURL:@"YOUR_ENGAGE_URL"];

On the first run it will create a new user id and send a `newPlayer` event. On every call it will send a `gameStarted` and `clientDevice` event.

> Note: If the SDK detects that the environment has changed between runs (for example during testing) then the event store will be cleared, to avoid sending events
> to the wrong environment.
#### iOS 9 Support

Since iOS 9, all HTTP connections are forced to be HTTPS. To allow HTTP to be used you need to add the following key to your Info.plist file.
Expand Down
4 changes: 2 additions & 2 deletions buildFrameworks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ xcodebuild -create-xcframework -framework archives/ios_devices.xcarchive/Product

# Compress the archive ready for distribution to GitHub
rm build/*.zip
zip -r DeltaDNA-5.0.0.zip build
mv DeltaDNA-5.0.0.zip build/
zip -r DeltaDNA-5.0.1.zip build
mv DeltaDNA-5.0.1.zip build/

0 comments on commit 6d3d7bd

Please sign in to comment.