Skip to content

Commit 27f8388

Browse files
committed
Adds conf flag to allow default properties in customer update
1 parent 87a61c9 commit 27f8388

File tree

14 files changed

+43
-16
lines changed

14 files changed

+43
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ exponea: x.y.z
1414
* `$ cd ios`
1515
* `$ pod install`
1616

17-
Minimal supported iOS version for Exponea SDK is 10.3, you may need to change iOS version on the first line of your `ios/Podfile` to `platform :ios, '10.3'`, or higher.
17+
Minimal supported iOS version for Exponea SDK is 11.0, you may need to change iOS version on the first line of your `ios/Podfile` to `platform :ios, '11.0'`, or higher.
1818

1919
### Android setup
2020
You'll most likely need to enable multidex. Edit `android/app/build.gradle` and add `multiDexEnabled true` to android defaultConfig.

android/src/main/kotlin/com/exponea/data/ExponeaConfigurationParser.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class ExponeaConfigurationParser {
3232
map.getOptional<Boolean>("automaticSessionTracking")?.let {
3333
automaticSessionTracking = it
3434
}
35+
map.getOptional<Boolean>("allowDefaultCustomerProperties")?.let {
36+
allowDefaultCustomerProperties = it
37+
}
3538
map.getOptional<String>("pushTokenTrackingFrequency")?.let {
3639
try {
3740
tokenTrackFrequency = ExponeaConfiguration.TokenFrequency.valueOf(it)

example/android/app/src/test/kotlin/com/exponea/example/ConfigurationTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@ class ConfigurationTest {
7272
assertEquals(config.sessionTimeout.toInt(), 20);
7373
assertEquals(config.automaticSessionTracking, true);
7474
assertEquals(config.tokenTrackFrequency, TokenFrequency.DAILY);
75+
assertEquals(config.allowDefaultCustomerProperties, true);
7576
}
7677
}

example/ios/ExponeaTests/ExponeaConfigurationSpec.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class ExponeaConfigurationParserSpec: QuickSpec {
5454
expect(notifTracking.appGroup).to(equal(""))
5555
expect(notifTracking.requirePushAuthorization).to(equal(true))
5656
expect(notifTracking.isEnabled).to(equal(true))
57+
58+
expect(config.allowDefaultCustomerProperties).to(beNil())
5759
}
5860

5961
it("full") {
@@ -96,6 +98,8 @@ class ExponeaConfigurationParserSpec: QuickSpec {
9698
expect(notifTracking.appGroup).to(equal("mock-app-group"))
9799
expect(notifTracking.requirePushAuthorization).to(equal(false))
98100
expect(notifTracking.delegate).to(beNil())
101+
102+
expect(config.allowDefaultCustomerProperties).to(equal(true))
99103
}
100104
}
101105
}

example/ios/Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ PODS:
22
- AnyCodable-FlightSchool (0.6.3)
33
- exponea (0.0.1):
44
- AnyCodable-FlightSchool (= 0.6.3)
5-
- ExponeaSDK (= 2.12.1)
5+
- ExponeaSDK (= 2.13.1)
66
- Flutter
7-
- ExponeaSDK (2.12.1):
7+
- ExponeaSDK (2.13.1):
88
- SwiftSoup (= 2.4.3)
9-
- ExponeaSDK-Notifications (2.12.1)
9+
- ExponeaSDK-Notifications (2.13.1)
1010
- Flutter (1.0.0)
1111
- Nimble (9.2.1)
1212
- Quick (4.0.0)
@@ -46,9 +46,9 @@ EXTERNAL SOURCES:
4646

4747
SPEC CHECKSUMS:
4848
AnyCodable-FlightSchool: 1c9890be5884140c60da5fde1b66380dec4c244a
49-
exponea: 51eabd1894473ae5b26c48fd45e1d8deeb927346
50-
ExponeaSDK: a5cfdb245311656eb9d77251e665a32058dd2bf1
51-
ExponeaSDK-Notifications: 51afe956fe5697dfa7625cbb0cbc5128fda581da
49+
exponea: 4eb412fccf4a68cf8509566b158d6e72be578f26
50+
ExponeaSDK: 4e2567f56fda8a1cb20560ceb33cd03836fbb9f3
51+
ExponeaSDK-Notifications: 8c776f24b10de56ba09dc50d2542d49888b6e894
5252
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
5353
Nimble: e7e615c0335ee4bf5b0d786685451e62746117d5
5454
Quick: 6473349e43b9271a8d43839d9ba1c442ed1b7ac4

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@
761761
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
762762
GCC_WARN_UNUSED_FUNCTION = YES;
763763
GCC_WARN_UNUSED_VARIABLE = YES;
764-
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
764+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
765765
MTL_ENABLE_DEBUG_INFO = NO;
766766
SDKROOT = iphoneos;
767767
SUPPORTED_PLATFORMS = iphoneos;
@@ -788,7 +788,7 @@
788788
ENABLE_BITCODE = YES;
789789
GCC_C_LANGUAGE_STANDARD = gnu11;
790790
INFOPLIST_FILE = Runner/Info.plist;
791-
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
791+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
792792
LD_RUNPATH_SEARCH_PATHS = (
793793
"$(inherited)",
794794
"@executable_path/Frameworks",
@@ -1129,7 +1129,7 @@
11291129
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
11301130
GCC_WARN_UNUSED_FUNCTION = YES;
11311131
GCC_WARN_UNUSED_VARIABLE = YES;
1132-
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
1132+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
11331133
MTL_ENABLE_DEBUG_INFO = YES;
11341134
ONLY_ACTIVE_ARCH = YES;
11351135
SDKROOT = iphoneos;
@@ -1178,7 +1178,7 @@
11781178
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
11791179
GCC_WARN_UNUSED_FUNCTION = YES;
11801180
GCC_WARN_UNUSED_VARIABLE = YES;
1181-
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
1181+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
11821182
MTL_ENABLE_DEBUG_INFO = NO;
11831183
SDKROOT = iphoneos;
11841184
SUPPORTED_PLATFORMS = iphoneos;
@@ -1207,7 +1207,7 @@
12071207
ENABLE_BITCODE = YES;
12081208
GCC_C_LANGUAGE_STANDARD = gnu11;
12091209
INFOPLIST_FILE = Runner/Info.plist;
1210-
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
1210+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
12111211
LD_RUNPATH_SEARCH_PATHS = (
12121212
"$(inherited)",
12131213
"@executable_path/Frameworks",
@@ -1241,7 +1241,7 @@
12411241
ENABLE_BITCODE = YES;
12421242
GCC_C_LANGUAGE_STANDARD = gnu11;
12431243
INFOPLIST_FILE = Runner/Info.plist;
1244-
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
1244+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
12451245
LD_RUNPATH_SEARCH_PATHS = (
12461246
"$(inherited)",
12471247
"@executable_path/Frameworks",

example/lib/page/config.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class _ConfigPageState extends State<ConfigPage> {
134134
'int': 10,
135135
'bool': true,
136136
},
137+
allowDefaultCustomerProperties: false,
137138
// projectMapping: {
138139
// EventType.banner: [
139140
// ExponeaProject(projectToken: '1', authorizationToken: '11'),
@@ -165,6 +166,7 @@ class _ConfigPageState extends State<ConfigPage> {
165166
);
166167
ScaffoldMessenger.of(context).showSnackBar(snackBar);
167168
}
169+
_plugin.setLogLevel(LogLevel.verbose);
168170
widget.doneCallback.call(config);
169171
} on PlatformException catch (err) {
170172
final snackBar = SnackBar(

ios/Classes/Data/ExponeaConfiguration.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ class ExponeaConfiguration {
1414
let automaticSessionTracking: ExponeaSDK.Exponea.AutomaticSessionTracking
1515
let flushingSetup: ExponeaSDK.Exponea.FlushingSetup
1616
let defaultProperties: [String: JSONConvertible]?
17+
let allowDefaultCustomerProperties: Bool?
1718

1819
init(_ data: [String:Any?], parser: ConfigurationParser) throws {
1920
self.projectSettings = try parser.parseProjectSettings(data)
2021
self.pushNotificationTracking = try parser.parsePushNotificationTracking(data)
2122
self.automaticSessionTracking = try parser.parseSessionTracking(data)
2223
self.flushingSetup = try parser.parseFlushingSetup(data)
2324
self.defaultProperties = try parser.parseDefaultProperties(data)
25+
if let allowDefaultCustomerProperties = data["allowDefaultCustomerProperties"] as? Bool {
26+
self.allowDefaultCustomerProperties = allowDefaultCustomerProperties
27+
} else {
28+
self.allowDefaultCustomerProperties = nil
29+
}
2430
}
2531
}

ios/Classes/SwiftExponeaPlugin.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ public class SwiftExponeaPlugin: NSObject, FlutterPlugin {
130130
pushNotificationTracking: config.pushNotificationTracking,
131131
automaticSessionTracking: config.automaticSessionTracking,
132132
defaultProperties: config.defaultProperties,
133-
flushingSetup: config.flushingSetup
133+
flushingSetup: config.flushingSetup,
134+
allowDefaultCustomerProperties: config.allowDefaultCustomerProperties
134135
)
135136
exponeaInstance.pushNotificationsDelegate = self
136137
result(true)

ios/exponea.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A new flutter plugin project.
1717
s.dependency 'Flutter'
1818
s.dependency 'ExponeaSDK', '2.13.1'
1919
s.dependency 'AnyCodable-FlightSchool', '0.6.3'
20-
s.platform = :ios, '10.3'
20+
s.platform = :ios, '11.0'
2121

2222
# Flutter.framework does not contain a i386 slice.
2323
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }

lib/src/data/encoder/configuration.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ abstract class ExponeaConfigurationEncoder {
2323
pushTokenTrackingFrequency: data
2424
.getOptional<String>('pushTokenTrackingFrequency')
2525
?.let(TokenFrequencyEncoder.decode),
26+
allowDefaultCustomerProperties: data.getOptional('allowDefaultCustomerProperties'),
2627
android: data
2728
.getOptional<Map<String, dynamic>>('android')
2829
?.let(AndroidExponeaConfigurationEncoder.decode),
@@ -43,6 +44,7 @@ abstract class ExponeaConfigurationEncoder {
4344
'flushMaxRetries': config.flushMaxRetries?.toDouble(),
4445
'sessionTimeout': config.sessionTimeout,
4546
'automaticSessionTracking': config.automaticSessionTracking,
47+
'allowDefaultCustomerProperties': config.allowDefaultCustomerProperties,
4648
'pushTokenTrackingFrequency':
4749
config.pushTokenTrackingFrequency?.let(TokenFrequencyEncoder.encode),
4850
'android': config.android?.let(AndroidExponeaConfigurationEncoder.encode),

lib/src/data/model/configuration.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:ffi';
2+
13
import 'package:meta/meta.dart';
24

35
import 'event_type.dart';
@@ -35,6 +37,9 @@ class ExponeaConfiguration {
3537
/// Defines how often should the SDK track push notification token to Exponea
3638
final TokenFrequency? pushTokenTrackingFrequency;
3739

40+
/// If true, default properties are applied also for 'identifyCustomer' event.
41+
final bool? allowDefaultCustomerProperties;
42+
3843
/// Platform specific settings for Android
3944
final AndroidExponeaConfiguration? android;
4045

@@ -51,6 +56,7 @@ class ExponeaConfiguration {
5156
this.sessionTimeout,
5257
this.automaticSessionTracking,
5358
this.pushTokenTrackingFrequency,
59+
this.allowDefaultCustomerProperties,
5460
this.android,
5561
this.ios,
5662
});

test/unit/data/configuration_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void main() {
4646
"array": ["value1", "value2"],
4747
"object": {"key": "value"},
4848
},
49+
allowDefaultCustomerProperties: true,
4950
flushMaxRetries: 10,
5051
sessionTimeout: 20,
5152
automaticSessionTracking: true,
@@ -115,6 +116,7 @@ void main() {
115116
expect(decoded.flushMaxRetries, 10);
116117
expect(decoded.sessionTimeout, 20.0);
117118
expect(decoded.automaticSessionTracking, true);
119+
expect(decoded.allowDefaultCustomerProperties, true);
118120
expect(decoded.pushTokenTrackingFrequency, TokenFrequency.daily);
119121
expect(decoded.android != null, true);
120122
final android = decoded.android!;

test/values/configuration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
22
{},
33
{"projectToken":"mock-project-token","authorizationToken":"mock-auth-token"},
4-
{"projectToken":"mock-project-token","authorizationToken":"mock-auth-token","baseUrl":"http://mock.base.url.com","projectMapping":{"BANNER":[{"projectToken":"other-project-token","authorizationToken":"other-auth-token"}]},"defaultProperties":{"string":"value","boolean":false,"number":3.14159,"array":["value1","value2"],"object":{"key":"value"}},"flushMaxRetries":10,"sessionTimeout":20.0,"automaticSessionTracking":true,"pushTokenTrackingFrequency":"DAILY","android":{"automaticPushNotifications":true,"pushIcon":12345,"pushAccentColor":123,"pushChannelName":"mock-push-channel-name","pushChannelDescription":"mock-push-channel-description","pushChannelId":"mock-push-channel-id","pushNotificationImportance":"HIGH","httpLoggingLevel":"BODY"},"ios":{"requirePushAuthorization":false,"appGroup":"mock-app-group"}}
4+
{"projectToken":"mock-project-token","authorizationToken":"mock-auth-token","baseUrl":"http://mock.base.url.com","projectMapping":{"BANNER":[{"projectToken":"other-project-token","authorizationToken":"other-auth-token"}]},"defaultProperties":{"string":"value","boolean":false,"number":3.14159,"array":["value1","value2"],"object":{"key":"value"}},"flushMaxRetries":10,"sessionTimeout":20.0,"automaticSessionTracking":true,"pushTokenTrackingFrequency":"DAILY","allowDefaultCustomerProperties":true,"android":{"automaticPushNotifications":true,"pushIcon":12345,"pushAccentColor":123,"pushChannelName":"mock-push-channel-name","pushChannelDescription":"mock-push-channel-description","pushChannelId":"mock-push-channel-id","pushNotificationImportance":"HIGH","httpLoggingLevel":"BODY"},"ios":{"requirePushAuthorization":false,"appGroup":"mock-app-group"}}
55
]

0 commit comments

Comments
 (0)