make file transfer initiate automatically
This commit is contained in:
@@ -116,12 +116,15 @@ export default class ChatViewModel {
|
||||
};
|
||||
|
||||
subscribeReadStatus = (): void => {
|
||||
React.createProxyState([this.selectedPage, this.chatListViewModel.selectedChat], () => {
|
||||
if (this.chatListViewModel.selectedChat.value != this) return;
|
||||
if (this.selectedPage.value != ChatPageType.Messages) return;
|
||||
this.setReadStatus(false);
|
||||
})
|
||||
}
|
||||
React.createProxyState(
|
||||
[this.selectedPage, this.chatListViewModel.selectedChat],
|
||||
() => {
|
||||
if (this.chatListViewModel.selectedChat.value != this) return;
|
||||
if (this.selectedPage.value != ChatPageType.Messages) return;
|
||||
this.setReadStatus(false);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
// init
|
||||
constructor(
|
||||
|
||||
@@ -52,6 +52,7 @@ export default class ConnectionViewModel {
|
||||
};
|
||||
|
||||
connectToAddress = (address: string): void => {
|
||||
console.log(address);
|
||||
this.connectionModel.connect(address);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ export default class CoreViewModel {
|
||||
|
||||
// SUGGESTIONS
|
||||
// boards & tasks
|
||||
boardSearchSuggestions: React.ListState<string> = new React.ListState();
|
||||
boardFilterStringSuggestions: React.ListState<string> =
|
||||
new React.ListState();
|
||||
|
||||
taskCategorySuggestions: React.ListState<string> = new React.ListState();
|
||||
taskStatusSuggestions: React.ListState<string> = new React.ListState();
|
||||
|
||||
@@ -128,6 +128,7 @@ export default class FileTransferViewModel {
|
||||
showTransferDataModal = (): void => {
|
||||
this.presentedModal.value = FileTransferModal.TransferDataDisplay;
|
||||
this.getTransferData();
|
||||
this.fileTransferModel.prepareToSend();
|
||||
};
|
||||
|
||||
initiateTransfer = (): void => {
|
||||
@@ -176,6 +177,10 @@ export default class FileTransferViewModel {
|
||||
this.fileTransferModel.fileHandlerManager.addHandler(
|
||||
this.handleReceivedFile,
|
||||
);
|
||||
|
||||
this.fileTransferModel.readyToSendHandlerManager.addHandler(() =>
|
||||
this.initiateTransfer(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ export default class NotificationViewModel {
|
||||
(chat) => chat.chatModel.info.primaryChannel == notification.chat,
|
||||
);
|
||||
chat.open();
|
||||
chat.selectedPage.value = ChatPageType.Messages;
|
||||
};
|
||||
|
||||
// loop
|
||||
|
||||
@@ -121,8 +121,12 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
searchTerm,
|
||||
];
|
||||
this.storageModel.write(suggestionPath, "");
|
||||
if (!this.coreViewModel.boardSearchSuggestions.value.has(searchTerm)) {
|
||||
this.coreViewModel.boardSearchSuggestions.add(searchTerm);
|
||||
if (
|
||||
!this.coreViewModel.boardFilterStringSuggestions.value.has(
|
||||
searchTerm,
|
||||
)
|
||||
) {
|
||||
this.coreViewModel.boardFilterStringSuggestions.add(searchTerm);
|
||||
}
|
||||
|
||||
const lastSearchPath: string[] = this.getLastSearchPath();
|
||||
@@ -221,7 +225,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
loadSearchSuggestions = (): void => {
|
||||
const dirPath: string[] = this.getPreviousSearchesPath();
|
||||
const searches: string[] = this.storageModel.list(dirPath);
|
||||
this.coreViewModel.boardSearchSuggestions.add(...searches);
|
||||
this.coreViewModel.boardFilterStringSuggestions.add(...searches);
|
||||
};
|
||||
|
||||
restoreSearch = (): void => {
|
||||
@@ -290,7 +294,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
this.taskViewModels,
|
||||
this.filteredTaskViewModels,
|
||||
TaskViewModel.getStringsForFilter,
|
||||
this.coreViewModel.boardSearchSuggestions,
|
||||
this.coreViewModel.boardFilterStringSuggestions,
|
||||
);
|
||||
this.searchViewModel.appliedQuery.subscribeSilent((newQuery) => {
|
||||
this.handleNewSearch(newQuery);
|
||||
|
||||
@@ -164,6 +164,8 @@ export default class TaskPageViewModel {
|
||||
|
||||
this.chatViewModel = chatViewModel;
|
||||
|
||||
this.loadData();
|
||||
|
||||
// handlers
|
||||
boardModel.boardHandlerManager.addHandler(
|
||||
(boardInfoFileContent: BoardInfoFileContent) => {
|
||||
|
||||
@@ -101,7 +101,8 @@ export default class TaskViewModel {
|
||||
this.loadTaskData();
|
||||
};
|
||||
|
||||
closeAndSave = (): void => {
|
||||
closeAndSave = (e: Event): void => {
|
||||
e.preventDefault();
|
||||
this.close();
|
||||
this.save();
|
||||
};
|
||||
@@ -234,7 +235,6 @@ export default class TaskViewModel {
|
||||
static getStringsForFilter = (taskViewModel: TaskViewModel): string[] => {
|
||||
return [
|
||||
taskViewModel.task.name,
|
||||
taskViewModel.task.description ?? "",
|
||||
taskViewModel.task.category ?? "",
|
||||
taskViewModel.task.status ?? "",
|
||||
taskViewModel.task.priority ?? "",
|
||||
|
||||
Reference in New Issue
Block a user