Skip to content

Commit

Permalink
Merge pull request #41 from wireapp/kj/wir-18-reloading-wire-conversa…
Browse files Browse the repository at this point in the history
…tion-details-in-a-meeting-where-it-mobile-fix

fix: fixed notfication error, added recreating of conversation in spe…
  • Loading branch information
LennardZieglerCONPORT authored Jul 24, 2024
2 parents 6a5645d + d7c735c commit 2fe144d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 24 deletions.
29 changes: 25 additions & 4 deletions src/calendarIntegration/addMeetingLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,40 @@ async function handleExistingMeeting(): Promise<void> {
async function addMeetingLink(event: Office.AddinCommands.Event): Promise<void> {
try {
const isEnabled = await isFeatureEnabled();
if (!isEnabled) return;
if (!isEnabled) {
return;
}

await fetchCustomProperties();

if (!createdMeeting) {
await createNewMeeting();
if (isMobileDevice()) {
const currentLocation = await getLocation(mailboxItem);
const currentBody = await getBody(mailboxItem);

//Needs to be changed if the wire invitation string changes in future
const wireInvitationString = "/conversation-join/?key=";

//In some cases the wire invitation link is still present in location after deactiving the addin on mobile, so we can check for it and reuse it.
if (currentLocation.toString().includes(wireInvitationString) && !currentBody.includes(wireInvitationString)) {
const organizer = await getPlatformSpecificOrganizer();
const meetingSummary = createMeetingSummary(currentLocation, organizer);
await appendToBody(mailboxItem, meetingSummary);
} else if (currentLocation.toString().includes(wireInvitationString)) {
return;
} else {
await createNewMeeting();
}
} else {
await createNewMeeting();
}
} else {
await handleExistingMeeting();
}
} catch (error) {
console.error("Error during adding Wire meeting link", error);
handleAddMeetingLinkError(error);
} finally {
event.completed( { allowEvent: true } );
event.completed({ allowEvent: true });
}
}

Expand Down
46 changes: 26 additions & 20 deletions src/utils/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
/* global Office, console */

import { isMobileDevice } from "./mailbox";

export function showNotification(key, message, type, icon = null, persistent = null) {
const notificationMessage = {
type,
icon,
message,
persistent,
};
if(!isMobileDevice()){
const notificationMessage = {
type,
icon,
message,
persistent,
};

Office.context.mailbox.item.notificationMessages.addAsync(key, notificationMessage, (result) => {
if (result.status === Office.AsyncResultStatus.Succeeded) {
console.log(`Notification with key "${key}" added successfully.`);
} else {
console.error("Failed to add notification message:", result.error);
}
});
Office.context.mailbox.item.notificationMessages.addAsync(key, notificationMessage, (result) => {
if (result.status === Office.AsyncResultStatus.Succeeded) {
console.log(`Notification with key "${key}" added successfully.`);
} else {
console.error("Failed to add notification message:", result.error);
}
});
}
}

export function removeNotification(key) {
Office.context.mailbox.item.notificationMessages.removeAsync(key, (result) => {
if (result.status === Office.AsyncResultStatus.Succeeded) {
console.log(`Notification with key "${key}" removed successfully.`);
} else {
console.error("Failed to remove notification:", result.error);
}
});
if(!isMobileDevice()){
Office.context.mailbox.item.notificationMessages.removeAsync(key, (result) => {
if (result.status === Office.AsyncResultStatus.Succeeded) {
console.log(`Notification with key "${key}" removed successfully.`);
} else {
console.error("Failed to remove notification:", result.error);
}
});
}
}

0 comments on commit 2fe144d

Please sign in to comment.