Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- + (AOEventDescriptor *)describeItem:(CDHistoryItemEntity *)item supplicant:(AOEventDescriptorType)supplicant {
- AOEventDescriptor *descriptor = [AOEventDescriptor new];
- NSString *title;
- NSArray *titles;
- NSArray *values;
- NSArray *buttons;
- NSString *iconString;
- NSString *date = [descriptor dateStringFromTimeinterval:[item.itemTimeUTC integerValue] supplicant:supplicant];
- NSString *senderName = [[AOReceivedDataStore sharedDataStore] getRelationNameForRelationId:item.itemData.relationship_RelationId];
- NSString *itemRole = item.itemData.msgRoleInd;
- BOOL isHasAttachments = [item.itemData.fileInfoList count] > 0;
- switch (item.itemTypeEnum.integerValue) {
- case AOEventItemTypeCall: {
- CDHistoryCallItemEntity *callItem = (CDHistoryCallItemEntity *)item.itemData;
- NSInteger duration = callItem.callDuration.integerValue;
- NSInteger subType = item.itemSubTypeEnum.integerValue;
- if (subType == AOEventItemCallTypeUnknow) {
- values = @[AOLocalizedString(@"key.MISC.Unknown-call-type")];
- }
- else if (subType == AOEventItemCallTypeIncoming) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Incoming-call"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.from"), senderName],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
- iconString = @"Q";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Incoming-call");
- titles = @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeCall), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeIncomingWithMessage) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Incoming-call-with..."),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.from"), senderName],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
- iconString = @"Q";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Incoming-call");
- titles = @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeCall), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeMissed) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Missed-call"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.from"), senderName], AOLocalizedString(@"key.MISC.Unanswered")];
- iconString = @"V";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Missed-call");
- titles = @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeCall), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeMissedWithMessage) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Missed-call-with-message"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.from"), senderName], AOLocalizedString(@"key.MISC.Unanswered")];
- iconString = @"X";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- NSString *callType = [callItem.callRecordedInd isEqualToString:@"Y"] ? AOLocalizedString(@"key.LOGS.Recorded") : ([callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"));
- title = AOLocalizedString(@"key.MISC.Missed-call");
- titles = @[AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, callType, date];
- buttons = @[@(AOEventItemButtonTypeCall), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeIncomingMeeting) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Joined-Meeting"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
- iconString = @"T";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Incoming-meeting-call");
- titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[callItem.receivers, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeStartMeeting), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeIncomingMeetingWithMessage) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Joined-Meeting-with-message"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
- iconString = @"T";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Incoming-meeting-call");
- titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[callItem.receivers, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeStartMeeting), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeMissedMeeting) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- // values = @[AOLocalizedString(@"key.MISC.Missed-Meeting"), [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers]];
- values = @[AOLocalizedString(@"key.MISC.Missed-Meeting"), [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), senderName], AOLocalizedString(@"key.MISC.Unanswered")];
- iconString = @"W";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Missed-meeting-call");
- titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[callItem.receivers, [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeStartMeeting), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeMissedMeetingWithMessage) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Missed-Meeting-with-message"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers], AOLocalizedString(@"key.MISC.Unanswered")];
- iconString = @"W";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- NSString *callType = [callItem.callRecordedInd isEqualToString:@"Y"] ? AOLocalizedString(@"key.LOGS.Recorded") : ([callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"));
- title = AOLocalizedString(@"key.MISC.Missed-meeting-call");
- titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[callItem.receivers, callType, date];
- buttons = @[@(AOEventItemButtonTypeStartMeeting), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeOutAnswered) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Outgoing-call"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.to"), senderName],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
- iconString = @"S";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Outgoing-call");
- titles = @[AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeCall), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeOutAnsweredWithMessage) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Outgoing-call-with-message"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.to"), senderName],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
- iconString = @"S";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Outgoing-call");
- titles = @[AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeCall), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeOutUnanswered) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Outgoing-call"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.to"), senderName],
- AOLocalizedString(@"key.MISC.Unanswered")];
- iconString = @"R";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Outgoing-call-unanswered");
- titles = @[AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeCall), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeOutUnansweredWithMessage) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Outgoing-call-with-message"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.to"), senderName],
- AOLocalizedString(@"key.MISC.Unanswered")];
- iconString = @"R";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- NSString *callType = [callItem.callRecordedInd isEqualToString:@"Y"] ? AOLocalizedString(@"key.LOGS.Recorded") : ([callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"));
- title = AOLocalizedString(@"key.MISC.Outgoing-call-unanswered");
- titles = @[AOLocalizedString(@"key.MISC.To"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, callType, date];
- buttons = @[@(AOEventItemButtonTypeCall), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeOutMeeting) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Initialized-Meeting"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
- iconString = @"U";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Outgoing-meeting-call");
- titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[callItem.receivers, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeStartMeeting), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeOutMeetingWithMessage) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Initialized-Meeting-with-message"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.Duration"), [descriptor stringDurationFromInteger:duration]]];
- iconString = @"U";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Outgoing-meeting-call");
- titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[callItem.receivers, [descriptor stringDurationFromInteger:duration], [callItem.callType isEqualToString:@"V"] ? @"Video" : @"Audio", date];
- buttons = @[@(AOEventItemButtonTypeStartMeeting), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeOutMeetingUnanswered) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Initialized-Meeting"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
- AOLocalizedString(@"key.MISC.Unanswered")];
- iconString = @"U";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Outgoing-call-unanswered");
- titles = @[AOLocalizedString(@"key.LOGS.to"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, [callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"), date];
- buttons = @[@(AOEventItemButtonTypeStartMeeting), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemCallTypeOutMeetingUnansweredWithMessage) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Initialized-Meeting-with-message"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), callItem.receivers],
- AOLocalizedString(@"key.MISC.Unanswered")];
- iconString = @"U";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- NSString *callType = [callItem.callRecordedInd isEqualToString:@"Y"] ? AOLocalizedString(@"key.LOGS.Recorded") : ([callItem.callType isEqualToString:@"V"] ? AOLocalizedString(@"key.MISC.Video") : AOLocalizedString(@"key.MISC.Audio"));
- title = AOLocalizedString(@"key.MISC.Outgoing-meeting-call-unanswered");
- titles = @[AOLocalizedString(@"key.LOGS.with"), AOLocalizedString(@"key.LOGS.Call-Type"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[callItem.receivers, callType, date];
- buttons = @[@(AOEventItemButtonTypeStartMeeting), [descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- }
- break;
- case AOEventItemTypeMsgRecorded: {
- BOOL isSelfAction = [itemRole isEqualToString:@"S"];
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.Voice-message"), !isSelfAction ? AOLocalizedString(@"key.LOGS.Sent") : AOLocalizedString(@"key.LOGS.received")],
- [NSString stringWithFormat:@"%@ %@", !isSelfAction ? AOLocalizedString(@"key.LOGS.to") : AOLocalizedString(@"key.LOGS.from"), senderName]];
- iconString = @"Y";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- CDHistoryRecordItemEntity *recordItem = (CDHistoryRecordItemEntity *)item.itemData;
- title = !isSelfAction ? AOLocalizedString(@"key.MISC.Sent-recording") : AOLocalizedString(@"key.MISC.Received-recording");
- titles = @[!isSelfAction ? AOLocalizedString(@"key.MISC.To") : AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.Duration"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, [descriptor stringDurationFromInteger:recordItem.msgDuration.integerValue], date];
- buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypeListenRecording) : @(AOEventItemButtonTypeDownloadRec),*/ @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- break;
- case AOEventItemTypeMsg: {
- BOOL isSelfAction = [itemRole isEqualToString:@"S"];
- iconString = isSelfAction ? @"M" : @"N";
- NSInteger subType = item.itemSubTypeEnum.integerValue;
- if (subType == AOEventItemMsgTypeUnknow) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[@"Unknow Message type"];
- iconString = @"";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = @"Unknow Message type";
- }
- }
- else if (subType == AOEventItemMsgTypeSms) {
- BOOL isGroupMess = [[item.itemData.recipients allObjects] count] > 1;
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- BOOL isRead = [item.itemData.itemReadInd isEqualToString:@"Y"];
- NSString *firstLine = nil;
- // NSString *secondLine = item.itemData.msgBody.length > 0 ? [item.itemData.msgBody stringByReplacingOccurrencesOfString:@"\n" withString:@" "] : AOLocalizedString(@"key.MISC.no-content");
- NSString *secondLine = item.itemData.msgBodyPlaneText.length > 0 ? [item.itemData.msgBodyPlaneText stringByReplacingOccurrencesOfString:@"\n" withString:@" "] : AOLocalizedString(@"key.MISC.no-content");
- if (isRead) {
- 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];
- } else {
- 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];
- }
- values = @[firstLine, secondLine.length > 0 ? secondLine : @""];
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = isSelfAction ? [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.Sent")] : [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.SMS"), AOLocalizedString(@"key.LOGS.received")];
- 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")];
- values = isGroupMess ? @[item.itemData.sender_DisplayName , senderName, date] : @[isSelfAction ? senderName : item.itemData.sender_DisplayName, date];
- buttons = @[isSelfAction ? @(AOEventItemButtonTypeNewSms) : @(AOEventItemButtonTypeReplySms), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemMsgTypeEmail) {
- BOOL isGroupMess = [[item.itemData.recipients allObjects] count] > 1;
- BOOL isEsignReq = NO;
- for (CDHistoryFileInfoEntity *fileInfo in item.itemData.fileInfoList.allObjects) {
- if (fileInfo.reqESignFlag.boolValue) {
- isEsignReq = YES;
- break;
- }
- }
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- BOOL isRead = [item.itemData.itemReadInd isEqualToString:@"Y"];
- NSString *firstLine = nil;
- NSString *secondLine = item.itemData.msgSubject;
- NSString *thirdLine = item.itemData.msgBodyPlaneText;
- if (isRead) {
- 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];
- } else {
- 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];
- }
- values = @[firstLine,
- secondLine.length > 0 ? secondLine : thirdLine.length > 0 ? thirdLine : @"",
- secondLine.length == 0 ? @"" : thirdLine.length > 0 ? thirdLine : @""];
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = isSelfAction ? [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.Sent")] : [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.Email"), AOLocalizedString(@"key.LOGS.received")];
- if (isEsignReq) {
- 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")];
- 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];
- } else {
- 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")];
- values = isGroupMess ? @[item.itemData.sender_DisplayName , senderName, date, item.itemData.msgSubject] : @[isSelfAction ? senderName: item.itemData.sender_DisplayName, date, item.itemData.msgSubject];
- }
- buttons = isHasAttachments ? @[isSelfAction ? @(AOEventItemButtonTypeNewEmail) : @(AOEventItemButtonTypeReplyEmail), @(AOEventItemButtonTypeOpenRelationship), @(AOEventItemButtonTypeMoveToVault)]
- : @[isSelfAction ? @(AOEventItemButtonTypeNewEmail) : @(AOEventItemButtonTypeReplyEmail), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- }
- break;
- case AOEventItemTypeTextChat: {
- CDHistoryChatItemEntity *chatItem = (CDHistoryChatItemEntity *)item.itemData;
- CDChatMessageItemEntity *chatMessage = [chatItem.messages filteredSetUsingPredicate:[NSPredicate predicateWithFormat:@"msgId == %@", chatItem.msgId]].anyObject;
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- NSString *eventDescription = nil;
- if (chatItem.msgBody.length > 0) {
- eventDescription = chatItem.msgBody;
- }
- else if (chatMessage.attachments.count > 0) {
- eventDescription = [NSString stringWithFormat:@"1%@", /*chatMessage.attachments.count,*/ AOLocalizedString(@"key.LOGS.-file-received.")];
- }
- else {
- eventDescription = AOLocalizedString(@"key.MISC.no-content");
- }
- values = @[AOLocalizedString(@"key.MISC.TextChat"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.with"), senderName],
- eventDescription];
- iconString = @"G";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- NSString *readByValue = senderName;
- NSMutableArray *readReceivers = [NSMutableArray array];
- for (CDHistoryRecipientListEntity *recipient in chatMessage.recipients) {
- if ([recipient.itemReadInd isEqualToString:@"Y"]) {
- [readReceivers addObject:recipient.displayName];
- }
- }
- if (readReceivers.count > 0) {
- readByValue = [readReceivers componentsJoinedByString:@", "];
- }
- title = AOLocalizedString(@"key.MISC.TextChat");
- titles = @[AOLocalizedString(@"key.LOGS.Date,-Time"), AOLocalizedString(@"key.LOGS.Read-by"), AOLocalizedString(@"key.NATIVE.n_chatevent_sender_l"), AOLocalizedString(@"key.LOGS.Last-Message")];
- values = @[date, readByValue, item.itemData.sender_DisplayName, item.itemData.msgBody];
- buttons = isHasAttachments ? @[@(AOEventItemButtonTypeReply), @(AOEventItemButtonTypeOpenRelationship), @(AOEventItemButtonTypeMoveToVault)] : @[@(AOEventItemButtonTypeReply), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- break;
- case AOEventItemTypeVault: {
- CDHistoryFileAccessItem *fileAccessItem = (CDHistoryFileAccessItem *)item.itemData;
- itemRole = fileAccessItem.userRoleInd;
- BOOL isSelfAction = [itemRole isEqualToString:@"A"];
- BOOL isGroup = [[AOReceivedDataStore sharedDataStore] isTeamRelationship:fileAccessItem.relationship_RelationId];
- NSString *accessedByUser = [fileAccessItem.accessedBy rangeOfString:@":"].location == NSNotFound ? fileAccessItem.accessedBy : [[AOReceivedDataStore sharedDataStore] getPersonalNameForUserName:fileAccessItem.accessedBy];
- NSString *parentFolderName = [[AOReceivedDataStore sharedDataStore] getFolderNameForId:fileAccessItem.parentFoldId];
- BOOL isRootFolder = parentFolderName.length == 0;
- NSString *vaultPath = [NSString stringWithFormat:@"/%@", fileAccessItem.fullName];
- 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];
- 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")];
- 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")];
- NSArray *defaultValues = @[isSelfAction ? senderName : accessedByUser.length > 0 ? accessedByUser : @"", fileAccessItem.fileName.length > 0 ? fileAccessItem.fileName : @"", vaultPath, date.length > 0 ? date : @""];
- NSInteger subType = item.itemSubTypeEnum.integerValue;
- if (subType == AOEventItemVaultTypeUnknow) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Unknown-Vault-type")];
- iconString = @"";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Unknown-Vault-type");
- }
- }
- else if (subType == AOEventItemVaultTypeFileRead) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.LOGS.downloaded"), eventParticipants];
- iconString = @"B";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.File-viewed");
- titles = defaultTitlesForFileEvent;
- values = defaultValues;
- buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFolderRead) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.folder"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.viewed"), eventParticipants];
- iconString = @"B";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Folder-viewed");
- titles = defaultTitlesForFolderEvent;
- values = defaultValues;
- buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFileDeleted) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.LOGS.deleted"), eventParticipants];
- iconString = @"B";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.File"), AOLocalizedString(@"key.LOGS.deleted")];
- titles = defaultTitlesForFileEvent;
- values = defaultValues;
- buttons = @[@(AOEventItemButtonTypeVaultOpen), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFolderDeleted) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.fileName], AOLocalizedString(@"key.LOGS.deleted"), eventParticipants];
- iconString = @"B";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.MISC.Folder"), AOLocalizedString(@"key.LOGS.deleted")];
- titles = defaultTitlesForFolderEvent;
- values = defaultValues;
- buttons = @[@(AOEventItemButtonTypeVaultOpen), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFileMoved) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.moved"), eventParticipants];
- iconString = @"f";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.File-moved");
- titles = defaultTitlesForFileEvent;
- values = defaultValues;
- buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFolderMoved) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.moved"), eventParticipants];
- iconString = @"f";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Folder-moved");
- titles = defaultTitlesForFolderEvent;
- values = defaultValues;
- buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFileCreated) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.uploaded"), eventParticipants];
- iconString = @"Z";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.File"), [AOLocalizedString(@"key.MISC.uploaded") capitalizedString]];
- titles = defaultTitlesForFileEvent;
- values = defaultValues;
- buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFolderCreated) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.fileName], AOLocalizedString(@"key.MISC.created"), eventParticipants];
- iconString = @"a";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Folder-created");
- titles = defaultTitlesForFolderEvent;
- values = defaultValues;
- buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFolderCopied) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.fileName], AOLocalizedString(@"key.NATIVE.n_dashboard_event_copied_l").lowercaseString, eventParticipants];
- iconString = @"a";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.NATIVE.n_dashboard_event_foldercopied_l");
- titles = defaultTitlesForFolderEvent;
- values = defaultValues;
- buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFileCopied) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.NATIVE.n_dashboard_event_copied_l").lowercaseString, eventParticipants];
- iconString = @"Z";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.File"), AOLocalizedString(@"key.NATIVE.n_dashboard_event_copied_l")];
- titles = defaultTitlesForFileEvent;
- values = defaultValues;
- buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFolderNameChanged) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- //"key.MISC.Old-file-name"
- //"key.MISC.New-name:" = "New name:"
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Folder"), fileAccessItem.infoBeforeChange],
- [NSString stringWithFormat:@"%@ %@ \"%@\"", AOLocalizedString(@"key.MISC.renamed"), AOLocalizedString(@"key.LOGS.to"), fileAccessItem.fileName], eventParticipants];
- iconString = @"d";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Folder-renamed");
- titles = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for").capitalizedString :AOLocalizedString(@"key.MISC.By"),
- AOLocalizedString(@"key.MISC.Old-file-name"),
- AOLocalizedString(@"key.MISC.New-name:"),
- AOLocalizedString(@"key.MISC.Vault-path"),
- AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[isSelfAction ? senderName : accessedByUser,
- fileAccessItem.infoBeforeChange,
- fileAccessItem.fileName,
- vaultPath,
- date];
- buttons = @[@(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFileNameChanged) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.infoBeforeChange],
- [NSString stringWithFormat:@"%@ %@ \"%@\"", AOLocalizedString(@"key.MISC.renamed"), AOLocalizedString(@"key.LOGS.to"), fileAccessItem.fileName], eventParticipants];
- iconString = @"d";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.File-renamed");
- titles = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for").capitalizedString :AOLocalizedString(@"key.MISC.By"),
- AOLocalizedString(@"key.MISC.Old-file-name"),
- AOLocalizedString(@"key.MISC.New-name:"),
- AOLocalizedString(@"key.MISC.Vault-path"),
- AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[isSelfAction ? senderName : accessedByUser,
- fileAccessItem.infoBeforeChange,
- fileAccessItem.fileName.length > 0 ? fileAccessItem.fileName : @"",
- vaultPath,
- date];
- buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFileReplaced) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName],
- AOLocalizedString(@"key.MISC.replaced"),
- [NSString stringWithFormat:@"%@ %@", isSelfAction ? AOLocalizedString(@"key.LOGS.for") : AOLocalizedString(@"key.LOGS.by"), fileAccessItem.accessedBy]];
- iconString = @"f";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Replaced-file");
- if (!isRootFolder) {
- titles = @[AOLocalizedString(@"key.MISC.By"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.MISC.Vault-path"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, fileAccessItem.fileName, fileAccessItem.fullName, date];
- } else {
- titles = @[AOLocalizedString(@"key.MISC.By"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, fileAccessItem.fileName, date];
- }
- buttons = @[[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload), @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemVaultTypeFileESign) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName], AOLocalizedString(@"key.LOGS.e-signed"), eventParticipants];
- iconString = @"B";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.NATIVE.n_file_e_signed");
- 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")];
- 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")];
- buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeVaultOpenFolder)];
- }
- }
- else if (subType == AOEventItemVaultTypeFileTransfer) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.LOGS.File"), fileAccessItem.fileName],
- AOLocalizedString(@"key.MISC.moved"),
- [NSString stringWithFormat:@"%@ %@", isSelfAction ? AOLocalizedString(@"key.LOGS.for") : AOLocalizedString(@"key.LOGS.by"), isSelfAction ? senderName : fileAccessItem.accessedBy]];
- iconString = @"f";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.File-moved");
- if (!isRootFolder) {
- 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")];
- values = @[isSelfAction ? senderName : fileAccessItem.accessedBy, fileAccessItem.fileName, fileAccessItem.fullName, date];
- } else {
- titles = @[isSelfAction ? AOLocalizedString(@"key.LOGS.for") : AOLocalizedString(@"key.LOGS.by"), AOLocalizedString(@"key.MISC.File-name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[isSelfAction ? senderName : fileAccessItem.accessedBy, fileAccessItem.fileName, date];
- }
- buttons = @[[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload), @(AOEventItemButtonTypeVaultOpenFolder), @(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- }
- break;
- case AOEventItemTypeSendFile: {
- CDHistoryFileInfoEntity *fileInfo = (CDHistoryFileInfoEntity *)item.itemData.fileInfoList.anyObject;
- BOOL isSelfAction = [itemRole isEqualToString:@"S"];
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- 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")],
- [NSString stringWithFormat:@"%@ %@", isSelfAction ? AOLocalizedString(@"key.LOGS.to") : AOLocalizedString(@"key.LOGS.from"), senderName],
- item.itemData.msgBody];
- iconString = isSelfAction ? @"O" : @"P";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = isSelfAction ? AOLocalizedString(@"key.LOGS.Sent-File") : AOLocalizedString(@"key.MISC.Received-file");
- titles = @[isSelfAction ? AOLocalizedString(@"key.MISC.To") : AOLocalizedString(@"key.MISC.From"), AOLocalizedString(@"key.LOGS.File"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[senderName, fileInfo.name.length > 0 ? fileInfo.name : AOLocalizedString(@"key.MISC.empty"), date];
- if (isSelfAction) {
- buttons = @[@(AOEventItemButtonTypeSendFile), @(AOEventItemButtonTypeOpenRelationship)];
- }
- else {
- buttons = @[/*[descriptor isRecordedFileExistForItem:item] ? @(AOEventItemButtonTypePreview) : @(AOEventItemButtonTypeDownload),*/ @(AOEventItemButtonTypeSendFile), @(AOEventItemButtonTypeMoveToVault)];
- }
- }
- }
- break;
- case AOEventItemTypeMyOffice: {
- CDHistoryAccountManageEntity *accountItem = (CDHistoryAccountManageEntity *)item.itemData;
- NSString *managedUser = [accountItem.managedUser rangeOfString:@":"].location == NSNotFound ? accountItem.managedUser : [[accountItem.managedUser componentsSeparatedByString:@":"] firstObject];
- NSString *managedBy = [accountItem.managedBy rangeOfString:@":"].location == NSNotFound ? accountItem.managedBy : [[accountItem.managedBy componentsSeparatedByString:@":"] firstObject];
- NSInteger subType = item.itemSubTypeEnum.integerValue;
- if (subType == AOEventItemMyOfficeTypeUnknow) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Unknown-My-office-type")];
- iconString = @"";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Unknown-My-office-type");
- }
- }
- else if (subType == AOEventItemMyOfficeTypeUserCreated) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
- AOLocalizedString(@"key.MISC.was-created"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"n";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.User-created");
- titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[managedUser, date];
- buttons = @[@(AOEventItemButtonTypeOpenUser)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeUserEdited) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
- AOLocalizedString(@"key.MISC.was-edited"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"o";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.User-edited");
- titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[managedUser, date];
- buttons = @[@(AOEventItemButtonTypeOpenUser)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeUserPasswordEdited) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
- AOLocalizedString(@"key.MISC.password-was-changed"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"p";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.ACCMAN.Password-changed");
- titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[managedUser, date];
- buttons = @[@(AOEventItemButtonTypeOpenUser)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeCompanyUserNameEdited) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
- AOLocalizedString(@"key.MISC.company-user-name-was-changed"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"d";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.User-renamed");
- titles = @[AOLocalizedString(@"key.MISC.New-user-name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[managedUser, date];
- buttons = @[@(AOEventItemButtonTypeOpenUser)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeUserDeleted) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
- AOLocalizedString(@"key.MISC.was-deleted"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"q";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.User-deleted");
- titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[managedUser, date];
- buttons = @[@(AOEventItemButtonTypeRestoreUser)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeUserDeleteUndo) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
- AOLocalizedString(@"key.MISC.was-restored"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"q";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.User-restored");
- titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[managedUser, date];
- buttons = @[@(AOEventItemButtonTypeOpenUser)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeUserAssignedToRelationship) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
- [NSString stringWithFormat:@"%@ %@ \"%@\"", AOLocalizedString(@"key.MISC.was-assigned"), AOLocalizedString(@"key.LOGS.to"), accountItem.relationship_RelationName],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"t";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.User-added-to-relationship");
- titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[managedUser, accountItem.relationship_RelationName, date];
- buttons = @[@(AOEventItemButtonTypeOpenRelationship), @(AOEventItemButtonTypeOpenUser)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeUserRemovedFromRelationship) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.User"), managedUser],
- [NSString stringWithFormat:@"%@ %@ \"%@\"", AOLocalizedString(@"key.MISC.was-removed"), AOLocalizedString(@"key.LOGS.from"), accountItem.relationship_RelationName],
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"u";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.User-removed-from...");
- titles = @[AOLocalizedString(@"key.FIELD.User-Name"), AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[managedUser, accountItem.relationship_RelationName, date];
- buttons = @[@(AOEventItemButtonTypeOpenUser)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeRelationshipCreated) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
- AOLocalizedString(@"key.MISC.was-created"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"r";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Relationship-created");
- titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[accountItem.relationship_RelationName, date];
- buttons = @[@(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeRelationshipEdited) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
- AOLocalizedString(@"key.MISC.was-edited"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"r";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Relationship-edited");
- titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[accountItem.relationship_RelationName, date];
- buttons = @[@(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeRelationshipDeleted) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
- AOLocalizedString(@"key.MISC.was-deleted"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"s";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Relationship-deleted");
- titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[accountItem.relationship_RelationName, date];
- buttons = @[@(AOEventItemButtonTypeRestoreRelationship)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeRelationshipDeleteUndo) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
- AOLocalizedString(@"key.MISC.was-restored"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"s";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Relationship-restored");
- titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[accountItem.relationship_RelationName, date];
- buttons = @[@(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeRelationshipDeactivated) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
- AOLocalizedString(@"key.MISC.was-deactivated"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"r";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Relationship-deactivated");
- titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[accountItem.relationship_RelationName, date];
- buttons = @[@(AOEventItemButtonTypeActivateRelationship)];
- }
- }
- else if (subType == AOEventItemMyOfficeTypeRelationshipReactivated) {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[[NSString stringWithFormat:@"%@ \"%@\"", AOLocalizedString(@"key.MISC.Relationship"), accountItem.relationship_RelationName],
- AOLocalizedString(@"key.MISC.was-reactivated"),
- [NSString stringWithFormat:@"%@ %@", AOLocalizedString(@"key.LOGS.by"), managedBy]];
- iconString = @"r";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Relationship-reactivated");
- titles = @[AOLocalizedString(@"key.MISC.Relationship"), AOLocalizedString(@"key.LOGS.Date,-Time")];
- values = @[accountItem.relationship_RelationName, date];
- buttons = @[@(AOEventItemButtonTypeOpenRelationship)];
- }
- }
- }
- break;
- case AOEventItemTypeOfficeTools: {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Unknown"),
- AOLocalizedString(@"key.MISC.Office-tools-type")];
- iconString = @"";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Unknown-Office-tools-type");
- }
- break;
- }
- default: {
- if (supplicant == AOEventDescriptorTypeDashboardCell) {
- values = @[AOLocalizedString(@"key.MISC.Unknown-event-type")];
- iconString = @"";
- }
- else if (supplicant == AOEventDescriptorTypeEventDetails) {
- title = AOLocalizedString(@"key.MISC.Unknown-event-type");
- }
- break;
- }
- }
- // Fill descriptor
- NSUInteger linesCount = values.count;
- NSMutableArray *lineItems = [NSMutableArray arrayWithCapacity:linesCount];
- for (int idx = 0; idx < linesCount; idx++) {
- [lineItems addObject:[AOEventDescriptorLineItem lineItemWithTitle:titles[idx] value:values[idx]]];
- }
- descriptor.lineItems = lineItems;
- descriptor.iconString = iconString;
- descriptor.dateString = date;
- descriptor.title = title;
- // On Event details screen remove "open relationship" button for iPad version
- if (supplicant == AOEventDescriptorTypeEventDetails && IS_IPAD) {
- NSMutableArray *mutableButtons = [buttons mutableCopy];
- [mutableButtons removeObject:@(AOEventItemButtonTypeOpenRelationship)];
- buttons = [NSArray arrayWithArray:mutableButtons];
- }
- descriptor.buttonTypes = buttons;
- return descriptor;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement