ApiLoadedState constructor
ApiLoadedState(
- dynamic data
Implementation
ApiLoadedState(this.data) {
for (Map<String, dynamic> item in data) {
String type = item['type'];
bool isVisible = item['Component']['visible'] ?? true;
ViewType viewType = getViewType(getWidgetType(type));
if (ViewType.pip == viewType && isVisible) {
if (!(ViewPref.getInstance().isClickThresholdCrossed(item) ||
ViewPref.getInstance().isViewFrequencyCrossed(item))) {
hasPip = true;
pipJson = item;
}
}
if (ViewType.inApp == viewType && isVisible) {
Map<String, dynamic> trigger = item['trigger'];
String key = trigger['trigger_name'] + '_' + trigger['trigger_value'];
inAppTriggerMap[key] = item;
}
if (ViewType.feedback == viewType && isVisible) {
Map<String, dynamic> trigger = item['trigger'];
String key = trigger['trigger_name'] + '_' + trigger['trigger_value'];
feedbackTriggerMap[key] = item;
}
if (ViewType.alert == viewType && isVisible) {
Map<String, dynamic> trigger = item['trigger'];
String key = trigger['trigger_name'] + '_' + trigger['trigger_value'];
alertTriggerMap[key] = item;
}
idJsonMap[item['id']] = item;
}
InAppJson.set(inAppTriggerMap);
FeedbackJson.set(feedbackTriggerMap);
AlertJson.set(alertTriggerMap);
}