-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: update config for data pipelines support #157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import '../customer_io_enums.dart'; | ||
import '../customer_io_plugin_version.dart' as plugin_info show version; | ||
import 'in_app_config.dart'; | ||
import 'push_config.dart'; | ||
|
||
class CustomerIOConfig { | ||
final String source = 'Flutter'; | ||
final String version = plugin_info.version; | ||
|
||
final String cdpApiKey; | ||
final String? migrationSiteId; | ||
final Region? region; | ||
final CioLogLevel? logLevel; | ||
final bool? autoTrackDeviceAttributes; | ||
final String? apiHost; | ||
final String? cdnHost; | ||
final int? flushAt; | ||
final int? flushInterval; | ||
final InAppConfig? inAppConfig; | ||
final PushConfig pushConfig; | ||
|
||
CustomerIOConfig({ | ||
required this.cdpApiKey, | ||
this.migrationSiteId, | ||
this.region, | ||
this.logLevel, | ||
this.autoTrackDeviceAttributes, | ||
this.apiHost, | ||
this.cdnHost, | ||
this.flushAt, | ||
this.flushInterval, | ||
this.inAppConfig, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thinking our load, if a user has provided There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I initially thought the same, but doing it that way would mean losing flexibility in two scenarios:
Keeping them separate gives us better control in these cases. |
||
PushConfig? pushConfig, | ||
}) : pushConfig = pushConfig ?? PushConfig(); | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
'cdpApiKey': cdpApiKey, | ||
'migrationSiteId': migrationSiteId, | ||
'region': region?.name, | ||
'logLevel': logLevel?.name, | ||
'autoTrackDeviceAttributes': autoTrackDeviceAttributes, | ||
'apiHost': apiHost, | ||
'cdnHost': cdnHost, | ||
'flushAt': flushAt, | ||
'flushInterval': flushInterval, | ||
'inAppConfig': inAppConfig?.toMap(), | ||
'pushConfig': pushConfig.toMap(), | ||
'version': version, | ||
'source': source | ||
}; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class InAppConfig { | ||
final String siteId; | ||
|
||
InAppConfig({required this.siteId}); | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
'siteId': siteId, | ||
}; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:customer_io/customer_io_enums.dart'; | ||
|
||
class PushConfig { | ||
PushConfigAndroid pushConfigAndroid; | ||
|
||
PushConfig({PushConfigAndroid? android}) | ||
: pushConfigAndroid = android ?? PushConfigAndroid(); | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
'android': pushConfigAndroid.toMap(), | ||
}; | ||
} | ||
} | ||
|
||
class PushConfigAndroid { | ||
PushClickBehaviorAndroid pushClickBehavior; | ||
|
||
PushConfigAndroid( | ||
{this.pushClickBehavior = | ||
PushClickBehaviorAndroid.activityPreventRestart}); | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
'pushClickBehavior': pushClickBehavior.rawValue, | ||
}; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,3 @@ | ||
import 'customer_io_enums.dart'; | ||
|
||
/// Configure plugin using CustomerIOConfig | ||
class CustomerIOConfig { | ||
final String siteId; | ||
final String apiKey; | ||
Region region; | ||
String organizationId; | ||
CioLogLevel logLevel; | ||
bool autoTrackDeviceAttributes; | ||
String trackingApiUrl; | ||
bool autoTrackPushEvents; | ||
int backgroundQueueMinNumberOfTasks; | ||
double backgroundQueueSecondsDelay; | ||
PushClickBehaviorAndroid pushClickBehaviorAndroid; | ||
|
||
bool enableInApp; | ||
|
||
String version; | ||
|
||
CustomerIOConfig( | ||
{required this.siteId, | ||
required this.apiKey, | ||
this.region = Region.us, | ||
@Deprecated("organizationId is deprecated and isn't required anymore, use enableInApp instead. This field will be removed in the next release.") | ||
this.organizationId = "", | ||
this.logLevel = CioLogLevel.debug, | ||
this.autoTrackDeviceAttributes = true, | ||
this.trackingApiUrl = "", | ||
this.autoTrackPushEvents = true, | ||
this.backgroundQueueMinNumberOfTasks = 10, | ||
this.backgroundQueueSecondsDelay = 30.0, | ||
this.pushClickBehaviorAndroid = PushClickBehaviorAndroid.activityPreventRestart, | ||
this.enableInApp = false, | ||
this.version = ""}); | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
'siteId': siteId, | ||
'apiKey': apiKey, | ||
'region': region.name, | ||
'organizationId': organizationId, | ||
'logLevel': logLevel.name, | ||
'autoTrackDeviceAttributes': autoTrackDeviceAttributes, | ||
'trackingApiUrl': trackingApiUrl, | ||
'autoTrackPushEvents': autoTrackPushEvents, | ||
'backgroundQueueMinNumberOfTasks': backgroundQueueMinNumberOfTasks, | ||
'backgroundQueueSecondsDelay': backgroundQueueSecondsDelay, | ||
'pushClickBehaviorAndroid': pushClickBehaviorAndroid.rawValue, | ||
'enableInApp': enableInApp, | ||
'version': version, | ||
'source': "Flutter" | ||
}; | ||
} | ||
} | ||
export 'config/customer_io_config.dart'; | ||
export 'config/in_app_config.dart'; | ||
export 'config/push_config.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think
trackApplicationLifecycleEvents
is not here as its part of another ticket, correct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I focused mainly on Dart file changes here. native SDK implementation and testing will be handled in the other ticket you mentioned.