Advertisement
Guest User

Untitled

a guest
Feb 7th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. + (AOEventDescriptor *)describeItem:(CDHistoryItemEntity *)item supplicant:(AOEventDescriptorType)supplicant {
  2.    
  3.     AOEventDescriptor *descriptor = [AOEventDescriptor new];
  4.    
  5.     NSString *title;
  6.     NSArray  *titles;
  7.     NSArray  *values;
  8.     NSArray  *buttons;
  9.     NSString *iconString;
  10.    
  11.     NSString *date = [descriptor dateStringFromTimeinterval:[item.itemTimeUTC integerValue] supplicant:supplicant];
  12.    
  13.     NSString *senderName = [[AOReceivedDataStore sharedDataStore] getRelationNameForRelationId:item.itemData.relationship_RelationId];
  14.     NSString *itemRole = item.itemData.msgRoleInd;
  15.    
  16.     BOOL isHasAttachments = [item.itemData.fileInfoList count] > 0;
  17.    
  18.     switch (item.itemTypeEnum.integerValue) {
  19.            
  20.         case AOEventItemTypeCall: {
  21.            
  22.             CDHistoryCallItemEntity *callItem = (CDHistoryCallItemEntity *)item.itemData;
  23.             NSInteger duration = callItem.callDuration.integerValue;
  24.  
  25.             NSInteger subType = item.itemSubTypeEnum.integerValue;
  26.            
  27.             if (subType == AOEventItemCallTypeUnknow) {
  28.                
  29.                 values = @[AOLocalizedString(@"key.MISC.Unknown-call-type")];
  30.             }
  31.             else if (subType == AOEventItemCallTypeIncoming) {
  32.                
  33.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  34.                    
  35.                     values = @[AOLocalizedString(@"key.MISC.Incoming-call"),
  36.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.from"), senderName],
  37.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
  38.                     iconString = @"Q";
  39.                 }
  40.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  41.                    
  42.                     title = AOLocalizedString(@"key.MISC.Incoming-call");
  43.                     titles = @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  44.                     values = @[senderName, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  45.                     buttons = @[@(AOEventItemButtonTypeCall), @(AOEventItemButtonTypeOpenRelationship)];
  46.                 }
  47.             }
  48.             else if (subType == AOEventItemCallTypeIncomingWithMessage) {
  49.                
  50.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  51.                    
  52.                     values = @[AOLocalizedString(@"key.MISC.Incoming-call-with..."),
  53.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.from"), senderName],
  54.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
  55.                     iconString = @"Q";
  56.                 }
  57.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  58.                    
  59.                     title = AOLocalizedString(@"key.MISC.Incoming-call");
  60.                     titles = @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  61.                     values = @[senderName, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  62.                     buttons = @[@(AOEventItemButtonTypeCall), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
  63.                 }
  64.             }
  65.             else if (subType == AOEventItemCallTypeMissed) {
  66.                
  67.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  68.                    
  69.                     values = @[AOLocalizedString(@"key.MISC.Missed-call"),
  70.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.from"), senderName],                                AOLocalizedString(@"key.MISC.Unanswered")];
  71.                     iconString = @"V";
  72.                 }
  73.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  74.                    
  75.                     title = AOLocalizedString(@"key.MISC.Missed-call");
  76.                     titles = @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  77.                     values = @[senderName, [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  78.                     buttons = @[@(AOEventItemButtonTypeCall), @(AOEventItemButtonTypeOpenRelationship)];
  79.                 }
  80.             }
  81.             else if (subType == AOEventItemCallTypeMissedWithMessage) {
  82.                
  83.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  84.                    
  85.                     values = @[AOLocalizedString(@"key.MISC.Missed-call-with-message"),
  86.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.from"), senderName],                                AOLocalizedString(@"key.MISC.Unanswered")];
  87.                     iconString = @"X";
  88.                 }
  89.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  90.                    
  91.                     NSString *callType = [callItem.callRecordedInd isEqualToString:@"Y"] ? AOLocalizedString(@"key.LOGS.Recorded") : ([callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"));
  92.                     title = AOLocalizedString(@"key.MISC.Missed-call");
  93.                     titles = @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  94.                     values = @[senderName, callType, date];
  95.                     buttons = @[@(AOEventItemButtonTypeCall), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
  96.                 }
  97.             }
  98.             else if (subType == AOEventItemCallTypeIncomingMeeting) {
  99.                
  100.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  101.                    
  102.                     values = @[AOLocalizedString(@"key.MISC.Joined-Meeting"),
  103.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
  104.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
  105.                     iconString = @"T";
  106.                 }
  107.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  108.                    
  109.                     title = AOLocalizedString(@"key.MISC.Incoming-meeting-call");
  110.                     titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  111.                     values = @[callItem.receivers, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  112.                     buttons = @[@(AOEventItemButtonTypeStartMeeting), @(AOEventItemButtonTypeOpenRelationship)];
  113.                 }
  114.             }
  115.             else if (subType == AOEventItemCallTypeIncomingMeetingWithMessage) {
  116.                
  117.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  118.                    
  119.                     values = @[AOLocalizedString(@"key.MISC.Joined-Meeting-with-message"),
  120.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
  121.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
  122.                     iconString = @"T";
  123.                 }
  124.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  125.                    
  126.                     title = AOLocalizedString(@"key.MISC.Incoming-meeting-call");
  127.                     titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  128.                     values = @[callItem.receivers, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  129.                     buttons = @[@(AOEventItemButtonTypeStartMeeting), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
  130.                 }
  131.             }
  132.             else if (subType == AOEventItemCallTypeMissedMeeting) {
  133.                
  134.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  135.                    
  136. //                    values = @[AOLocalizedString(@"key.MISC.Missed-Meeting"), [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers]];
  137.                     values = @[AOLocalizedString(@"key.MISC.Missed-Meeting"), [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), senderName], AOLocalizedString(@"key.MISC.Unanswered")];
  138.                     iconString = @"W";
  139.                 }
  140.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  141.                    
  142.                     title = AOLocalizedString(@"key.MISC.Missed-meeting-call");
  143.                     titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  144.                     values = @[callItem.receivers, [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  145.                     buttons = @[@(AOEventItemButtonTypeStartMeeting), @(AOEventItemButtonTypeOpenRelationship)];
  146.                 }
  147.             }
  148.             else if (subType == AOEventItemCallTypeMissedMeetingWithMessage) {
  149.                
  150.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  151.                    
  152.                     values = @[AOLocalizedString(@"key.MISC.Missed-Meeting-with-message"),
  153.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers], AOLocalizedString(@"key.MISC.Unanswered")];
  154.                     iconString = @"W";
  155.                 }
  156.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  157.                    
  158.                     NSString *callType = [callItem.callRecordedInd isEqualToString:@"Y"] ? AOLocalizedString(@"key.LOGS.Recorded") : ([callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"));
  159.                     title = AOLocalizedString(@"key.MISC.Missed-meeting-call");
  160.                     titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  161.                     values = @[callItem.receivers, callType, date];
  162.                     buttons = @[@(AOEventItemButtonTypeStartMeeting), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
  163.                 }
  164.             }
  165.             else if (subType == AOEventItemCallTypeOutAnswered) {
  166.                
  167.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  168.                    
  169.                     values = @[AOLocalizedString(@"key.MISC.Outgoing-call"),
  170.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.to"), senderName],
  171.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
  172.                     iconString = @"S";
  173.                 }
  174.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  175.                    
  176.                     title = AOLocalizedString(@"key.MISC.Outgoing-call");
  177.                     titles = @[AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  178.                     values = @[senderName, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  179.                     buttons = @[@(AOEventItemButtonTypeCall), @(AOEventItemButtonTypeOpenRelationship)];
  180.                 }
  181.             }
  182.             else if (subType == AOEventItemCallTypeOutAnsweredWithMessage) {
  183.                
  184.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  185.                    
  186.                     values = @[AOLocalizedString(@"key.MISC.Outgoing-call-with-message"),
  187.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.to"), senderName],
  188.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
  189.                     iconString = @"S";
  190.                 }
  191.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  192.                    
  193.                     title = AOLocalizedString(@"key.MISC.Outgoing-call");
  194.                     titles = @[AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  195.                     values = @[senderName, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  196.                     buttons = @[@(AOEventItemButtonTypeCall), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
  197.                 }
  198.             }
  199.             else if (subType == AOEventItemCallTypeOutUnanswered) {
  200.                
  201.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  202.                    
  203.                     values = @[AOLocalizedString(@"key.MISC.Outgoing-call"),
  204.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.to"), senderName],
  205.                                AOLocalizedString(@"key.MISC.Unanswered")];
  206.                     iconString = @"R";
  207.                 }
  208.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  209.                    
  210.                     title = AOLocalizedString(@"key.MISC.Outgoing-call-unanswered");
  211.                     titles = @[AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  212.                     values = @[senderName, [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  213.                     buttons = @[@(AOEventItemButtonTypeCall), @(AOEventItemButtonTypeOpenRelationship)];
  214.                 }
  215.             }
  216.             else if (subType == AOEventItemCallTypeOutUnansweredWithMessage) {
  217.                
  218.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  219.                    
  220.                     values = @[AOLocalizedString(@"key.MISC.Outgoing-call-with-message"),
  221.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.to"), senderName],
  222.                                AOLocalizedString(@"key.MISC.Unanswered")];
  223.                     iconString = @"R";
  224.                 }
  225.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  226.                    
  227.                     NSString *callType = [callItem.callRecordedInd isEqualToString:@"Y"] ? AOLocalizedString(@"key.LOGS.Recorded") : ([callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"));
  228.                     title = AOLocalizedString(@"key.MISC.Outgoing-call-unanswered");
  229.                     titles = @[AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  230.                     values = @[senderName, callType, date];
  231.                     buttons = @[@(AOEventItemButtonTypeCall), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
  232.                 }
  233.             }
  234.             else if (subType == AOEventItemCallTypeOutMeeting) {
  235.                
  236.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  237.                    
  238.                     values = @[AOLocalizedString(@"key.MISC.Initialized-Meeting"),
  239.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
  240.                                [NSString stringWithFormat:@"%@ %@",  AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
  241.                     iconString = @"U";
  242.                 }
  243.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  244.                    
  245.                     title = AOLocalizedString(@"key.MISC.Outgoing-meeting-call");
  246.                     titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  247.                     values = @[callItem.receivers, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  248.                     buttons = @[@(AOEventItemButtonTypeStartMeeting), @(AOEventItemButtonTypeOpenRelationship)];
  249.                 }
  250.             }
  251.             else if (subType == AOEventItemCallTypeOutMeetingWithMessage) {
  252.                
  253.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  254.                    
  255.                     values = @[AOLocalizedString(@"key.MISC.Initialized-Meeting-with-message"),
  256.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
  257.                                [NSString stringWithFormat:@"%@ %@",  AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
  258.                     iconString = @"U";
  259.                 }
  260.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  261.                    
  262.                     title = AOLocalizedString(@"key.MISC.Outgoing-meeting-call");
  263.                     titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  264.                     values = @[callItem.receivers, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? @"Video" : @"Audio", date];
  265.                     buttons = @[@(AOEventItemButtonTypeStartMeeting), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
  266.                 }
  267.             }
  268.             else if (subType == AOEventItemCallTypeOutMeetingUnanswered) {
  269.                
  270.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  271.                    
  272.                     values = @[AOLocalizedString(@"key.MISC.Initialized-Meeting"),
  273.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
  274.                                AOLocalizedString(@"key.MISC.Unanswered")];
  275.                     iconString = @"U";
  276.                 }
  277.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  278.                    
  279.                     title = AOLocalizedString(@"key.MISC.Outgoing-call-unanswered");
  280.                     titles = @[AOLocalizedString(@"key.LOGS.to"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  281.                     values = @[senderName, [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
  282.                     buttons = @[@(AOEventItemButtonTypeStartMeeting), @(AOEventItemButtonTypeOpenRelationship)];
  283.                 }
  284.             }
  285.             else if (subType == AOEventItemCallTypeOutMeetingUnansweredWithMessage) {
  286.                
  287.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  288.                    
  289.                     values = @[AOLocalizedString(@"key.MISC.Initialized-Meeting-with-message"),
  290.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
  291.                                AOLocalizedString(@"key.MISC.Unanswered")];
  292.                     iconString = @"U";
  293.                 }
  294.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  295.                    
  296.                     NSString *callType = [callItem.callRecordedInd isEqualToString:@"Y"] ? AOLocalizedString(@"key.LOGS.Recorded") : ([callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"));
  297.                     title = AOLocalizedString(@"key.MISC.Outgoing-meeting-call-unanswered");
  298.                     titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  299.                     values = @[callItem.receivers, callType, date];
  300.                     buttons = @[@(AOEventItemButtonTypeStartMeeting), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
  301.                 }
  302.             }
  303.         }
  304.             break;
  305.         case AOEventItemTypeMsgRecorded: {
  306.            
  307.            
  308.             BOOL isSelfAction = [itemRole isEqualToString:@"S"];
  309.  
  310.             if (supplicant == AOEventDescriptorTypeDashboardCell) {
  311.                
  312.                 values = @[[NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.Voice-message"), !isSelfAction ? AOLocalizedString(@"key.LOGS.Sent") : AOLocalizedString(@"key.LOGS.received")],
  313.                            [NSString stringWithFormat:@"%@ %@", !isSelfAction ? AOLocalizedString(@"key.LOGS.to") : AOLocalizedString(@"key.LOGS.from"), senderName]];
  314.                 iconString = @"Y";
  315.             }
  316.             else if (supplicant == AOEventDescriptorTypeEventDetails) {
  317.                
  318.                 CDHistoryRecordItemEntity *recordItem = (CDHistoryRecordItemEntity *)item.itemData;
  319.                 title = !isSelfAction ? AOLocalizedString(@"key.MISC.Sent-recording") : AOLocalizedString(@"key.MISC.Received-recording");
  320.                 titles = @[!isSelfAction ? AOLocalizedString(@"key.MISC.To") : AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  321.                 values = @[senderName, [descriptor stringDurationFromInteger:recordItem.msgDuration.integerValue], date];
  322.                 buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec),*/ @(AOEventItemButtonTypeOpenRelationship)];
  323.             }
  324.         }
  325.             break;
  326.            
  327.         case AOEventItemTypeMsg: {
  328.            
  329.             BOOL isSelfAction = [itemRole isEqualToString:@"S"];
  330.             iconString = isSelfAction ? @"M" : @"N";
  331.            
  332.             NSInteger subType = item.itemSubTypeEnum.integerValue;
  333.            
  334.             if (subType == AOEventItemMsgTypeUnknow) {
  335.                
  336.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  337.                    
  338.                     values = @[@"Unknow Message type"];
  339.                     iconString = @"";
  340.                 }
  341.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  342.                    
  343.                     title = @"Unknow Message type";
  344.                 }
  345.             }
  346.             else if (subType == AOEventItemMsgTypeSms) {
  347.                
  348.                 BOOL isGroupMess = [[item.itemData.recipients allObjects] count] > 1;
  349.  
  350.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  351.                    
  352.                     BOOL isRead = [item.itemData.itemReadInd isEqualToString:@"Y"];
  353.                    
  354.                     NSString *firstLine = nil;
  355. //                    NSString *secondLine = item.itemData.msgBody.length > 0 ? [item.itemData.msgBody stringByReplacingOccurrencesOfString:@"\n" withString:@" "] : AOLocalizedString(@"key.MISC.no-content");
  356.                     NSString *secondLine = item.itemData.msgBodyPlaneText.length > 0 ? [item.itemData.msgBodyPlaneText stringByReplacingOccurrencesOfString:@"\n" withString:@" "] : AOLocalizedString(@"key.MISC.no-content");
  357.                    
  358.                     if (isRead) {
  359.                        
  360.                         firstLine = isSelfAction ? [NSString stringWithFormat:@"%@ %@ %@ %@", AOLocalizedString(@"key.LOGS.Sent"), AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.to"), senderName] : isGroupMess ? [NSString stringWithFormat:@"%@ %@ %@ %@ %@", AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.from"), item.itemData.sender_DisplayName , AOLocalizedString(@"key.LOGS.to"), senderName] : [NSString stringWithFormat:@"%@ %@ %@", AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.from"), senderName];
  361.                     } else {
  362.                        
  363.                         firstLine = isGroupMess ? [NSString stringWithFormat:@"%@%@ %@ %@ %@ %@", AOLocalizedString(@"key.LOGS.New"), AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.from"), item.itemData.sender_DisplayName , AOLocalizedString(@"key.LOGS.to"), senderName] : [NSString stringWithFormat:@"%@%@ %@ %@", AOLocalizedString(@"key.LOGS.New"), AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.from"), senderName];
  364.                     }
  365.                    
  366.                     values = @[firstLine, secondLine.length > 0 ? secondLine : @""];
  367.                 }
  368.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  369.                    
  370.                     title = isSelfAction ? [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.Sent")] : [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.received")];
  371.                    
  372.                     titles = isGroupMess ? @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Date,-Time")] : @[isSelfAction ? AOLocalizedString(@"key.MISC.To") :  AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  373.        
  374.                     values = isGroupMess ? @[item.itemData.sender_DisplayName , senderName, date] : @[isSelfAction ? senderName : item.itemData.sender_DisplayName, date];
  375.                     buttons = @[isSelfAction ? @(AOEventItemButtonTypeNewSms) : @(AOEventItemButtonTypeReplySms), @(AOEventItemButtonTypeOpenRelationship)];
  376.                 }
  377.             }
  378.             else if (subType == AOEventItemMsgTypeEmail) {
  379.                
  380.                 BOOL isGroupMess = [[item.itemData.recipients allObjects] count] > 1;
  381.                 BOOL isEsignReq = NO;
  382.                
  383.                 for (CDHistoryFileInfoEntity *fileInfo in item.itemData.fileInfoList.allObjects) {
  384.                    
  385.                     if (fileInfo.reqESignFlag.boolValue) {
  386.                         isEsignReq = YES;
  387.                         break;
  388.                     }
  389.                 }
  390.                
  391.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  392.                    
  393.                     BOOL isRead = [item.itemData.itemReadInd isEqualToString:@"Y"];
  394.                    
  395.                     NSString *firstLine = nil;
  396.                    
  397.                     NSString *secondLine = item.itemData.msgSubject;
  398.                     NSString *thirdLine = item.itemData.msgBodyPlaneText;
  399.                    
  400.                     if (isRead) {
  401.                        
  402.                         firstLine = isSelfAction ? [NSString stringWithFormat:@"%@ %@ %@ %@", AOLocalizedString(@"key.LOGS.Sent"), AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.to"), senderName] : isGroupMess ? [NSString stringWithFormat:@"%@ %@ %@ %@ %@", AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.from"), item.itemData.sender_DisplayName , AOLocalizedString(@"key.LOGS.to"), senderName] : [NSString stringWithFormat:@"%@ %@ %@", AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.from"), senderName];
  403.                     } else {
  404.                        
  405.                         firstLine = isGroupMess ? [NSString stringWithFormat:@"%@%@ %@ %@ %@ %@", AOLocalizedString(@"key.LOGS.New"), AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.from"), item.itemData.sender_DisplayName , AOLocalizedString(@"key.LOGS.to"), senderName] : [NSString stringWithFormat:@"%@%@ %@ %@", AOLocalizedString(@"key.LOGS.New"), AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.from"), senderName];
  406.                     }
  407.                     values = @[firstLine,
  408.                                secondLine.length > 0 ? secondLine : thirdLine.length > 0 ? thirdLine : @"",
  409.                                secondLine.length == 0 ? @"" : thirdLine.length > 0 ? thirdLine : @""];
  410.                 }
  411.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  412.                    
  413.                     title = isSelfAction ? [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.Sent")] : [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.received")];
  414.                    
  415.                     if (isEsignReq) {
  416.                        
  417.                         titles = isGroupMess ? @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Date,-Time"), AOLocalizedString(@"key.NATIVE.nE-Sign_Warning"), AOLocalizedString(@"key.LOGS.Subject")] : @[ isSelfAction ? AOLocalizedString(@"key.MISC.To") : AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Date,-Time"), AOLocalizedString(@"key.NATIVE.nE-Sign_Warning"), AOLocalizedString(@"key.LOGS.Subject")];
  418.                         values = isGroupMess ? @[item.itemData.sender_DisplayName , senderName, date, AOLocalizedString(@"key.NATIVE.nE-Sign_Use_PC-Mac"), item.itemData.msgSubject] : @[isSelfAction ? senderName: item.itemData.sender_DisplayName, date, AOLocalizedString(@"key.NATIVE.nE-Sign_Use_PC-Mac"), item.itemData.msgSubject];
  419.                        
  420.                     } else {
  421.                        
  422.                         titles = isGroupMess ? @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Date,-Time"), AOLocalizedString(@"key.LOGS.Subject")] : @[ isSelfAction ? AOLocalizedString(@"key.MISC.To") : AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Date,-Time"), AOLocalizedString(@"key.LOGS.Subject")];
  423.                         values = isGroupMess ? @[item.itemData.sender_DisplayName , senderName, date, item.itemData.msgSubject] : @[isSelfAction ? senderName: item.itemData.sender_DisplayName, date, item.itemData.msgSubject];
  424.                     }
  425.                    
  426.  
  427.                    
  428.  
  429.                     buttons = isHasAttachments ? @[isSelfAction ? @(AOEventItemButtonTypeNewEmail) : @(AOEventItemButtonTypeReplyEmail), @(AOEventItemButtonTypeOpenRelationship), @(AOEventItemButtonTypeMoveToVault)]
  430.                     : @[isSelfAction ? @(AOEventItemButtonTypeNewEmail) : @(AOEventItemButtonTypeReplyEmail), @(AOEventItemButtonTypeOpenRelationship)];
  431.                 }
  432.             }
  433.         }
  434.             break;
  435.            
  436.         case AOEventItemTypeTextChat: {
  437.            
  438.             CDHistoryChatItemEntity *chatItem = (CDHistoryChatItemEntity *)item.itemData;
  439.             CDChatMessageItemEntity *chatMessage = [chatItem.messages filteredSetUsingPredicate:[NSPredicate predicateWithFormat:@"msgId == %@", chatItem.msgId]].anyObject;
  440.  
  441.             if (supplicant == AOEventDescriptorTypeDashboardCell) {
  442.                
  443.                 NSString *eventDescription = nil;
  444.                
  445.                 if (chatItem.msgBody.length > 0) {
  446.                     eventDescription = chatItem.msgBody;
  447.                 }
  448.                 else if (chatMessage.attachments.count > 0) {
  449.                     eventDescription = [NSString stringWithFormat:@"1%@", /*chatMessage.attachments.count,*/ AOLocalizedString(@"key.LOGS.-file-received.")];
  450.                 }
  451.                 else {
  452.                     eventDescription = AOLocalizedString(@"key.MISC.no-content");
  453.                 }
  454.                
  455.                 values = @[AOLocalizedString(@"key.MISC.TextChat"),
  456.                            [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), senderName],
  457.                            eventDescription];
  458.                 iconString = @"G";
  459.             }
  460.             else if (supplicant == AOEventDescriptorTypeEventDetails) {
  461.                
  462.                 NSString *readByValue = senderName;
  463.                 NSMutableArray *readReceivers = [NSMutableArray array];
  464.                
  465.                 for (CDHistoryRecipientListEntity *recipient in chatMessage.recipients) {
  466.                     if ([recipient.itemReadInd isEqualToString:@"Y"]) {
  467.                         [readReceivers addObject:recipient.displayName];
  468.                     }
  469.                 }
  470.                
  471.                 if (readReceivers.count > 0) {
  472.                     readByValue = [readReceivers componentsJoinedByString:@", "];
  473.                 }
  474.                
  475.                 title = AOLocalizedString(@"key.MISC.TextChat");
  476.                 titles = @[AOLocalizedString(@"key.LOGS.Date,-Time"), AOLocalizedString(@"key.LOGS.Read-by"), AOLocalizedString(@"key.NATIVE.n_chatevent_sender_l"), AOLocalizedString(@"key.LOGS.Last-Message")];
  477.                 values = @[date, readByValue, item.itemData.sender_DisplayName, item.itemData.msgBody];
  478.                 buttons = isHasAttachments ? @[@(AOEventItemButtonTypeReply), @(AOEventItemButtonTypeOpenRelationship), @(AOEventItemButtonTypeMoveToVault)] : @[@(AOEventItemButtonTypeReply), @(AOEventItemButtonTypeOpenRelationship)];
  479.             }
  480.         }
  481.             break;
  482.            
  483.         case AOEventItemTypeVault: {
  484.            
  485.             CDHistoryFileAccessItem *fileAccessItem = (CDHistoryFileAccessItem *)item.itemData;
  486.             itemRole = fileAccessItem.userRoleInd;
  487.             BOOL isSelfAction = [itemRole isEqualToString:@"A"];
  488.             BOOL isGroup = [[AOReceivedDataStore sharedDataStore] isTeamRelationship:fileAccessItem.relationship_RelationId];
  489.             NSString *accessedByUser = [fileAccessItem.accessedBy rangeOfString:@":"].location == NSNotFound ? fileAccessItem.accessedBy : [[AOReceivedDataStore sharedDataStore] getPersonalNameForUserName:fileAccessItem.accessedBy];
  490.            
  491.             NSString *parentFolderName = [[AOReceivedDataStore sharedDataStore] getFolderNameForId:fileAccessItem.parentFoldId];
  492.             BOOL isRootFolder = parentFolderName.length == 0;
  493.             NSString *vaultPath = [NSString stringWithFormat:@"/%@", fileAccessItem.fullName];
  494.            
  495.             NSString *eventParticipants = isSelfAction ? [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.for"), senderName] : isGroup ? [NSString stringWithFormat:@"%@ %@ %@ %@", AOLocalizedString(@"key.LOGS.by"), accessedByUser, AOLocalizedString(@"key.LOGS.for"), senderName] : [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), senderName];
  496.            
  497.             NSArray *defaultTitlesForFileEvent = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for").capitalizedString : AOLocalizedString(@"key.MISC.By"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.MISC.Vault-path"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  498.            
  499.             NSArray *defaultTitlesForFolderEvent = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for").capitalizedString : AOLocalizedString(@"key.MISC.By"), AOLocalizedString(@"key.MISC.Folder-name"), AOLocalizedString(@"key.MISC.Vault-path"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  500.            
  501.             NSArray *defaultValues = @[isSelfAction ? senderName : accessedByUser.length > 0 ? accessedByUser : @"", fileAccessItem.fileName.length > 0 ? fileAccessItem.fileName : @"", vaultPath, date.length > 0 ? date : @""];
  502.            
  503.             NSInteger subType = item.itemSubTypeEnum.integerValue;
  504.            
  505.             if (subType == AOEventItemVaultTypeUnknow) {
  506.                
  507.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  508.                    
  509.                     values = @[AOLocalizedString(@"key.MISC.Unknown-Vault-type")];
  510.                     iconString = @"";
  511.                 }
  512.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  513.                    
  514.                     title = AOLocalizedString(@"key.MISC.Unknown-Vault-type");
  515.                 }
  516.             }
  517.             else if (subType == AOEventItemVaultTypeFileRead) {
  518.                
  519.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  520.                    
  521.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.LOGS.downloaded"), eventParticipants];
  522.                     iconString = @"B";
  523.                 }
  524.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  525.                    
  526.                     title = AOLocalizedString(@"key.MISC.File-viewed");
  527.                     titles = defaultTitlesForFileEvent;
  528.                     values = defaultValues;
  529.                    
  530.                     buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  531.                 }
  532.             }
  533.             else if (subType == AOEventItemVaultTypeFolderRead) {
  534.                
  535.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  536.                    
  537.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.folder"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.viewed"), eventParticipants];
  538.                     iconString = @"B";
  539.                 }
  540.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  541.                    
  542.                     title = AOLocalizedString(@"key.MISC.Folder-viewed");
  543.                     titles = defaultTitlesForFolderEvent;
  544.                     values = defaultValues;
  545.                
  546.                     buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  547.                 }
  548.             }
  549.             else if (subType == AOEventItemVaultTypeFileDeleted) {
  550.                
  551.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  552.                    
  553.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.LOGS.deleted"), eventParticipants];
  554.                     iconString = @"B";
  555.                 }
  556.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  557.                    
  558.                     title = [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.File"), AOLocalizedString(@"key.LOGS.deleted")];
  559.                     titles = defaultTitlesForFileEvent;
  560.                     values = defaultValues;
  561.  
  562.                     buttons = @[@(AOEventItemButtonTypeVaultOpen), @(AOEventItemButtonTypeOpenRelationship)];
  563.                 }
  564.             }
  565.             else if (subType == AOEventItemVaultTypeFolderDeleted) {
  566.                
  567.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  568.                    
  569.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.fileName], AOLocalizedString(@"key.LOGS.deleted"), eventParticipants];
  570.                     iconString = @"B";
  571.                 }
  572.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  573.                    
  574.                     title = [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.Folder"), AOLocalizedString(@"key.LOGS.deleted")];
  575.                    
  576.                     titles = defaultTitlesForFolderEvent;
  577.                     values = defaultValues;
  578.                    
  579.                     buttons = @[@(AOEventItemButtonTypeVaultOpen), @(AOEventItemButtonTypeOpenRelationship)];
  580.                 }
  581.             }
  582.             else if (subType == AOEventItemVaultTypeFileMoved) {
  583.                
  584.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  585.                    
  586.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.moved"), eventParticipants];
  587.                     iconString = @"f";
  588.                 }
  589.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  590.                    
  591.                     title = AOLocalizedString(@"key.MISC.File-moved");
  592.                     titles = defaultTitlesForFileEvent;
  593.                     values = defaultValues;
  594.                    
  595.                     buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  596.                 }
  597.             }
  598.             else if (subType == AOEventItemVaultTypeFolderMoved) {
  599.                
  600.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  601.                    
  602.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.moved"), eventParticipants];
  603.                    
  604.                     iconString = @"f";
  605.                 }
  606.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  607.                    
  608.                     title = AOLocalizedString(@"key.MISC.Folder-moved");
  609.                     titles = defaultTitlesForFolderEvent;
  610.                     values = defaultValues;
  611.                    
  612.                     buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  613.                 }
  614.             }
  615.             else if (subType == AOEventItemVaultTypeFileCreated) {
  616.                
  617.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  618.                    
  619.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.uploaded"), eventParticipants];
  620.                    
  621.                     iconString = @"Z";
  622.                 }
  623.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  624.                    
  625.                     title = [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.File"), [AOLocalizedString(@"key.MISC.uploaded") capitalizedString]];
  626.                    
  627.                     titles = defaultTitlesForFileEvent;
  628.                     values = defaultValues;
  629.  
  630.                     buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  631.                 }
  632.             }
  633.             else if (subType == AOEventItemVaultTypeFolderCreated) {
  634.                
  635.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  636.                    
  637.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.created"), eventParticipants];
  638.                     iconString = @"a";
  639.                 }
  640.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  641.                    
  642.                     title = AOLocalizedString(@"key.MISC.Folder-created");
  643.                     titles = defaultTitlesForFolderEvent;
  644.                     values = defaultValues;
  645.                
  646.                     buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  647.                 }
  648.             }
  649.             else if (subType == AOEventItemVaultTypeFolderCopied) {
  650.                
  651.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  652.                    
  653.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.fileName], AOLocalizedString(@"key.NATIVE.n_dashboard_event_copied_l").lowercaseString, eventParticipants];
  654.                     iconString = @"a";
  655.                 }
  656.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  657.                    
  658.                     title = AOLocalizedString(@"key.NATIVE.n_dashboard_event_foldercopied_l");
  659.                     titles = defaultTitlesForFolderEvent;
  660.                     values = defaultValues;
  661.                    
  662.                     buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  663.                 }
  664.             }
  665.             else if (subType == AOEventItemVaultTypeFileCopied) {
  666.                
  667.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  668.                    
  669.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.NATIVE.n_dashboard_event_copied_l").lowercaseString, eventParticipants];
  670.                     iconString = @"Z";
  671.                 }
  672.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  673.                    
  674.                     title = [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.File"), AOLocalizedString(@"key.NATIVE.n_dashboard_event_copied_l")];
  675.                     titles = defaultTitlesForFileEvent;
  676.                     values = defaultValues;
  677.                    
  678.                     buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  679.                 }
  680.             }
  681.             else if (subType == AOEventItemVaultTypeFolderNameChanged) {
  682.                
  683.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  684.                    
  685.                     //"key.MISC.Old-file-name"
  686.                     //"key.MISC.New-name:" = "New name:"
  687.                    
  688.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.infoBeforeChange],
  689.                                [NSString stringWithFormat:@"%@ %@ \"%@\"", AOLocalizedString(@"key.MISC.renamed"), AOLocalizedString(@"key.LOGS.to"), fileAccessItem.fileName], eventParticipants];
  690.                     iconString = @"d";
  691.                 }
  692.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  693.                    
  694.                     title = AOLocalizedString(@"key.MISC.Folder-renamed");
  695.                    
  696.                     titles = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for").capitalizedString :AOLocalizedString(@"key.MISC.By"),
  697.                                AOLocalizedString(@"key.MISC.Old-file-name"),
  698.                                AOLocalizedString(@"key.MISC.New-name:"),
  699.                                AOLocalizedString(@"key.MISC.Vault-path"),
  700.                                AOLocalizedString(@"key.LOGS.Date,-Time")];
  701.                     values = @[isSelfAction ? senderName : accessedByUser,
  702.                                fileAccessItem.infoBeforeChange,
  703.                                fileAccessItem.fileName,
  704.                                vaultPath,
  705.                                date];
  706.                    
  707.                     buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  708.                 }
  709.             }
  710.             else if (subType == AOEventItemVaultTypeFileNameChanged) {
  711.                
  712.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  713.                    
  714.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.infoBeforeChange],
  715.                                [NSString stringWithFormat:@"%@ %@ \"%@\"", AOLocalizedString(@"key.MISC.renamed"), AOLocalizedString(@"key.LOGS.to"), fileAccessItem.fileName], eventParticipants];
  716.                     iconString = @"d";
  717.                 }
  718.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  719.                    
  720.                     title = AOLocalizedString(@"key.MISC.File-renamed");
  721.                    
  722.                     titles = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for").capitalizedString :AOLocalizedString(@"key.MISC.By"),
  723.                                AOLocalizedString(@"key.MISC.Old-file-name"),
  724.                                AOLocalizedString(@"key.MISC.New-name:"),
  725.                                AOLocalizedString(@"key.MISC.Vault-path"),
  726.                                AOLocalizedString(@"key.LOGS.Date,-Time")];
  727.                     values = @[isSelfAction ? senderName : accessedByUser,
  728.                                fileAccessItem.infoBeforeChange,
  729.                                fileAccessItem.fileName.length > 0 ? fileAccessItem.fileName : @"",
  730.                                vaultPath,
  731.                                date];
  732.                    
  733.                     buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  734.                 }
  735.             }
  736.             else if (subType == AOEventItemVaultTypeFileReplaced) {
  737.                
  738.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  739.                    
  740.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName],
  741.                                AOLocalizedString(@"key.MISC.replaced"),
  742.                                [NSString stringWithFormat:@"%@ %@", isSelfAction ? AOLocalizedString(@"key.LOGS.for") : AOLocalizedString(@"key.LOGS.by"), fileAccessItem.accessedBy]];
  743.                     iconString = @"f";
  744.                 }
  745.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  746.                    
  747.                     title = AOLocalizedString(@"key.MISC.Replaced-file");
  748.                    
  749.                     if (!isRootFolder) {
  750.                        
  751.                         titles = @[AOLocalizedString(@"key.MISC.By"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.MISC.Vault-path"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  752.                         values = @[senderName, fileAccessItem.fileName, fileAccessItem.fullName, date];
  753.                     } else {
  754.                        
  755.                         titles = @[AOLocalizedString(@"key.MISC.By"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  756.                         values = @[senderName, fileAccessItem.fileName, date];
  757.                     }
  758.                
  759.                     buttons = @[[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload), @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  760.                 }
  761.             }
  762.            
  763.             else if (subType == AOEventItemVaultTypeFileESign) {
  764.                
  765.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  766.                    
  767.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.LOGS.e-signed"), eventParticipants];
  768.                    
  769.                     iconString = @"B";
  770.                 }
  771.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  772.                    
  773.                     title = AOLocalizedString(@"key.NATIVE.n_file_e_signed");
  774.                     titles = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for").capitalizedString : AOLocalizedString(@"key.MISC.By"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.MISC.Vault-path"), AOLocalizedString(@"key.LOGS.Date,-Time"), AOLocalizedString(@"key.LOGS.Link-to-E-Sign-email")];
  775.                     values = @[isSelfAction ? senderName : accessedByUser.length > 0 ? accessedByUser : @"", fileAccessItem.fileName.length > 0 ? fileAccessItem.fileName : @"", vaultPath, date.length > 0 ? date : @"", AOLocalizedString(@"key.NATIVE.n_refer_to_web_version")];
  776.                    
  777.                     buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder)];
  778.                 }
  779.             }
  780.            
  781.             else if (subType == AOEventItemVaultTypeFileTransfer) {
  782.                
  783.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  784.                    
  785.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName],
  786.                                AOLocalizedString(@"key.MISC.moved"),
  787.                                [NSString stringWithFormat:@"%@ %@", isSelfAction ? AOLocalizedString(@"key.LOGS.for") : AOLocalizedString(@"key.LOGS.by"), isSelfAction ? senderName : fileAccessItem.accessedBy]];
  788.                    
  789.                     iconString = @"f";
  790.                 }
  791.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  792.                    
  793.                     title = AOLocalizedString(@"key.MISC.File-moved");
  794.                    
  795.                     if (!isRootFolder) {
  796.                        
  797.                         titles = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for") : AOLocalizedString(@"key.LOGS.by"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.MISC.Vault-path"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  798.                         values = @[isSelfAction ? senderName : fileAccessItem.accessedBy, fileAccessItem.fileName, fileAccessItem.fullName, date];
  799.                        
  800.                     } else {
  801.                        
  802.                         titles = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for") : AOLocalizedString(@"key.LOGS.by"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  803.                         values = @[isSelfAction ? senderName : fileAccessItem.accessedBy, fileAccessItem.fileName, date];
  804.                     }
  805.                
  806.                     buttons = @[[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload), @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
  807.                 }
  808.             }
  809.         }
  810.             break;
  811.            
  812.         case AOEventItemTypeSendFile: {
  813.            
  814.             CDHistoryFileInfoEntity *fileInfo = (CDHistoryFileInfoEntity *)item.itemData.fileInfoList.anyObject;
  815.             BOOL isSelfAction = [itemRole isEqualToString:@"S"];
  816.            
  817.             if (supplicant == AOEventDescriptorTypeDashboardCell) {
  818.                
  819.                 values = @[[NSString stringWithFormat:@"%@ \"%@\" %@", AOLocalizedString(@"key.LOGS.File"), fileInfo.name.length > 0 ? fileInfo.name : AOLocalizedString(@"key.MISC.empty"), isSelfAction ? AOLocalizedString(@"key.MISC.sent") : AOLocalizedString(@"key.LOGS.received")],
  820.                            [NSString stringWithFormat:@"%@ %@", isSelfAction ? AOLocalizedString(@"key.LOGS.to") : AOLocalizedString(@"key.LOGS.from"), senderName],
  821.                            item.itemData.msgBody];
  822.                 iconString = isSelfAction ? @"O" : @"P";
  823.             }
  824.             else if (supplicant == AOEventDescriptorTypeEventDetails) {
  825.                
  826.                 title = isSelfAction ? AOLocalizedString(@"key.LOGS.Sent-File") : AOLocalizedString(@"key.MISC.Received-file");
  827.                 titles = @[isSelfAction ? AOLocalizedString(@"key.MISC.To") : AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.File"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  828.                 values = @[senderName, fileInfo.name.length > 0 ? fileInfo.name : AOLocalizedString(@"key.MISC.empty"), date];
  829.                 if (isSelfAction) {
  830.                     buttons = @[@(AOEventItemButtonTypeSendFile), @(AOEventItemButtonTypeOpenRelationship)];
  831.                 }
  832.                 else {
  833.                     buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeSendFile), @(AOEventItemButtonTypeMoveToVault)];
  834.                 }
  835.             }
  836.         }
  837.             break;
  838.            
  839.         case AOEventItemTypeMyOffice: {
  840.            
  841.             CDHistoryAccountManageEntity *accountItem = (CDHistoryAccountManageEntity *)item.itemData;
  842.            
  843.             NSString *managedUser = [accountItem.managedUser rangeOfString:@":"].location == NSNotFound ? accountItem.managedUser : [[accountItem.managedUser componentsSeparatedByString:@":"] firstObject];
  844.             NSString *managedBy = [accountItem.managedBy rangeOfString:@":"].location == NSNotFound ? accountItem.managedBy : [[accountItem.managedBy componentsSeparatedByString:@":"] firstObject];
  845.            
  846.             NSInteger subType = item.itemSubTypeEnum.integerValue;
  847.            
  848.             if (subType == AOEventItemMyOfficeTypeUnknow) {
  849.                
  850.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  851.                    
  852.                     values = @[AOLocalizedString(@"key.MISC.Unknown-My-office-type")];
  853.                     iconString = @"";
  854.                 }
  855.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  856.                    
  857.                     title = AOLocalizedString(@"key.MISC.Unknown-My-office-type");
  858.                 }
  859.             }
  860.             else if (subType == AOEventItemMyOfficeTypeUserCreated) {
  861.                
  862.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  863.                    
  864.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
  865.                                AOLocalizedString(@"key.MISC.was-created"),
  866.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  867.                     iconString = @"n";
  868.                 }
  869.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  870.                    
  871.                     title = AOLocalizedString(@"key.MISC.User-created");
  872.                     titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  873.                     values = @[managedUser, date];
  874.                     buttons = @[@(AOEventItemButtonTypeOpenUser)];
  875.                 }
  876.             }
  877.             else if (subType == AOEventItemMyOfficeTypeUserEdited) {
  878.                
  879.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  880.                    
  881.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
  882.                                AOLocalizedString(@"key.MISC.was-edited"),
  883.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  884.                     iconString = @"o";
  885.                 }
  886.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  887.                    
  888.                     title = AOLocalizedString(@"key.MISC.User-edited");
  889.                     titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  890.                     values = @[managedUser, date];
  891.                     buttons = @[@(AOEventItemButtonTypeOpenUser)];
  892.                 }
  893.             }
  894.             else if (subType == AOEventItemMyOfficeTypeUserPasswordEdited) {
  895.                
  896.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  897.                    
  898.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
  899.                                AOLocalizedString(@"key.MISC.password-was-changed"),
  900.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  901.                     iconString = @"p";
  902.                 }
  903.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  904.                    
  905.                     title = AOLocalizedString(@"key.ACCMAN.Password-changed");
  906.                     titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  907.                     values = @[managedUser, date];
  908.                     buttons = @[@(AOEventItemButtonTypeOpenUser)];
  909.                 }
  910.             }
  911.             else if (subType == AOEventItemMyOfficeTypeCompanyUserNameEdited) {
  912.                
  913.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  914.                    
  915.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
  916.                                AOLocalizedString(@"key.MISC.company-user-name-was-changed"),
  917.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  918.                     iconString = @"d";
  919.                 }
  920.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  921.                    
  922.                     title = AOLocalizedString(@"key.MISC.User-renamed");
  923.                     titles = @[AOLocalizedString(@"key.MISC.New-user-name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  924.                     values = @[managedUser, date];
  925.                     buttons = @[@(AOEventItemButtonTypeOpenUser)];
  926.                 }
  927.             }
  928.             else if (subType == AOEventItemMyOfficeTypeUserDeleted) {
  929.                
  930.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  931.                    
  932.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
  933.                                AOLocalizedString(@"key.MISC.was-deleted"),
  934.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  935.                     iconString = @"q";
  936.                 }
  937.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  938.                    
  939.                     title = AOLocalizedString(@"key.MISC.User-deleted");
  940.                     titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  941.                     values = @[managedUser, date];
  942.                     buttons = @[@(AOEventItemButtonTypeRestoreUser)];
  943.                 }
  944.             }
  945.             else if (subType == AOEventItemMyOfficeTypeUserDeleteUndo) {
  946.                
  947.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  948.                    
  949.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
  950.                                AOLocalizedString(@"key.MISC.was-restored"),
  951.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  952.                     iconString = @"q";
  953.                 }
  954.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  955.                    
  956.                     title = AOLocalizedString(@"key.MISC.User-restored");
  957.                     titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  958.                     values = @[managedUser, date];
  959.                     buttons = @[@(AOEventItemButtonTypeOpenUser)];
  960.                 }
  961.             }
  962.             else if (subType == AOEventItemMyOfficeTypeUserAssignedToRelationship) {
  963.                
  964.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  965.                    
  966.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
  967.                                [NSString stringWithFormat:@"%@ %@ \"%@\"", AOLocalizedString(@"key.MISC.was-assigned"), AOLocalizedString(@"key.LOGS.to"), accountItem.relationship_RelationName],
  968.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  969.                     iconString = @"t";
  970.                 }
  971.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  972.                    
  973.                     title = AOLocalizedString(@"key.MISC.User-added-to-relationship");
  974.                     titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  975.                     values = @[managedUser, accountItem.relationship_RelationName, date];
  976.                     buttons = @[@(AOEventItemButtonTypeOpenRelationship), @(AOEventItemButtonTypeOpenUser)];
  977.                 }
  978.             }
  979.             else if (subType == AOEventItemMyOfficeTypeUserRemovedFromRelationship) {
  980.                
  981.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  982.                    
  983.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
  984.                                [NSString stringWithFormat:@"%@ %@ \"%@\"", AOLocalizedString(@"key.MISC.was-removed"), AOLocalizedString(@"key.LOGS.from"), accountItem.relationship_RelationName],
  985.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  986.                     iconString = @"u";
  987.                 }
  988.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  989.                    
  990.                     title = AOLocalizedString(@"key.MISC.User-removed-from...");
  991.                     titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  992.                     values = @[managedUser, accountItem.relationship_RelationName, date];
  993.                     buttons = @[@(AOEventItemButtonTypeOpenUser)];
  994.                 }
  995.             }
  996.             else if (subType == AOEventItemMyOfficeTypeRelationshipCreated) {
  997.                
  998.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  999.                    
  1000.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
  1001.                                AOLocalizedString(@"key.MISC.was-created"),
  1002.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  1003.                     iconString = @"r";
  1004.                 }
  1005.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  1006.                    
  1007.                     title = AOLocalizedString(@"key.MISC.Relationship-created");
  1008.                     titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  1009.                     values = @[accountItem.relationship_RelationName, date];
  1010.                     buttons = @[@(AOEventItemButtonTypeOpenRelationship)];
  1011.                 }
  1012.             }
  1013.             else if (subType == AOEventItemMyOfficeTypeRelationshipEdited) {
  1014.                
  1015.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  1016.                    
  1017.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
  1018.                                AOLocalizedString(@"key.MISC.was-edited"),
  1019.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  1020.                     iconString = @"r";
  1021.                 }
  1022.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  1023.                    
  1024.                     title = AOLocalizedString(@"key.MISC.Relationship-edited");
  1025.                     titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  1026.                     values = @[accountItem.relationship_RelationName, date];
  1027.                     buttons = @[@(AOEventItemButtonTypeOpenRelationship)];
  1028.                 }
  1029.             }
  1030.             else if (subType == AOEventItemMyOfficeTypeRelationshipDeleted) {
  1031.                
  1032.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  1033.                    
  1034.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
  1035.                                AOLocalizedString(@"key.MISC.was-deleted"),
  1036.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  1037.                     iconString = @"s";
  1038.                 }
  1039.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  1040.                    
  1041.                     title = AOLocalizedString(@"key.MISC.Relationship-deleted");
  1042.                     titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  1043.                     values = @[accountItem.relationship_RelationName, date];
  1044.                     buttons = @[@(AOEventItemButtonTypeRestoreRelationship)];
  1045.                 }
  1046.             }
  1047.             else if (subType == AOEventItemMyOfficeTypeRelationshipDeleteUndo) {
  1048.                
  1049.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  1050.                    
  1051.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
  1052.                                AOLocalizedString(@"key.MISC.was-restored"),
  1053.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  1054.                     iconString = @"s";
  1055.                 }
  1056.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  1057.                    
  1058.                     title = AOLocalizedString(@"key.MISC.Relationship-restored");
  1059.                     titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  1060.                     values = @[accountItem.relationship_RelationName, date];
  1061.                     buttons = @[@(AOEventItemButtonTypeOpenRelationship)];
  1062.  
  1063.                 }
  1064.             }
  1065.             else if (subType == AOEventItemMyOfficeTypeRelationshipDeactivated) {
  1066.                
  1067.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  1068.                    
  1069.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
  1070.                                AOLocalizedString(@"key.MISC.was-deactivated"),
  1071.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  1072.                     iconString = @"r";
  1073.                 }
  1074.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  1075.                    
  1076.                     title = AOLocalizedString(@"key.MISC.Relationship-deactivated");
  1077.                     titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  1078.                     values = @[accountItem.relationship_RelationName, date];
  1079.                     buttons = @[@(AOEventItemButtonTypeActivateRelationship)];
  1080.                 }
  1081.             }
  1082.             else if (subType == AOEventItemMyOfficeTypeRelationshipReactivated) {
  1083.                
  1084.                 if (supplicant == AOEventDescriptorTypeDashboardCell) {
  1085.                    
  1086.                     values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
  1087.                                AOLocalizedString(@"key.MISC.was-reactivated"),
  1088.                                [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
  1089.                     iconString = @"r";
  1090.                 }
  1091.                 else if (supplicant == AOEventDescriptorTypeEventDetails) {
  1092.                    
  1093.                     title = AOLocalizedString(@"key.MISC.Relationship-reactivated");
  1094.                     titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
  1095.                     values = @[accountItem.relationship_RelationName, date];
  1096.                     buttons = @[@(AOEventItemButtonTypeOpenRelationship)];
  1097.                 }
  1098.             }
  1099.         }
  1100.             break;
  1101.            
  1102.         case AOEventItemTypeOfficeTools: {
  1103.            
  1104.             if (supplicant == AOEventDescriptorTypeDashboardCell) {
  1105.                
  1106.                 values = @[AOLocalizedString(@"key.MISC.Unknown"),
  1107.                            AOLocalizedString(@"key.MISC.Office-tools-type")];
  1108.                 iconString = @"";
  1109.             }
  1110.             else if (supplicant == AOEventDescriptorTypeEventDetails) {
  1111.                 title = AOLocalizedString(@"key.MISC.Unknown-Office-tools-type");
  1112.             }
  1113.             break;
  1114.         }
  1115.            
  1116.         default: {
  1117.            
  1118.             if (supplicant == AOEventDescriptorTypeDashboardCell) {
  1119.                
  1120.                 values = @[AOLocalizedString(@"key.MISC.Unknown-event-type")];
  1121.                 iconString = @"";
  1122.             }
  1123.             else if (supplicant == AOEventDescriptorTypeEventDetails) {
  1124.                 title = AOLocalizedString(@"key.MISC.Unknown-event-type");
  1125.             }
  1126.             break;
  1127.         }
  1128.     }
  1129.     // Fill descriptor
  1130.     NSUInteger linesCount = values.count;
  1131.     NSMutableArray *lineItems = [NSMutableArray arrayWithCapacity:linesCount];
  1132.    
  1133.     for (int idx = 0; idx < linesCount; idx++) {
  1134.         [lineItems addObject:[AOEventDescriptorLineItem lineItemWithTitle:titles[idx] value:values[idx]]];
  1135.     }
  1136.     descriptor.lineItems   = lineItems;
  1137.     descriptor.iconString  = iconString;
  1138.     descriptor.dateString  = date;
  1139.     descriptor.title       = title;
  1140.     // On Event details screen remove "open relationship" button for iPad version
  1141.     if (supplicant == AOEventDescriptorTypeEventDetails && IS_IPAD) {
  1142.        
  1143.         NSMutableArray *mutableButtons = [buttons mutableCopy];
  1144.         [mutableButtons removeObject:@(AOEventItemButtonTypeOpenRelationship)];
  1145.         buttons = [NSArray arrayWithArray:mutableButtons];
  1146.     }
  1147.     descriptor.buttonTypes = buttons;
  1148.  
  1149.     return descriptor;
  1150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement