refactor: rely on component versions from checksums file (#1111)

This commit is contained in:
Mo
2022-06-16 11:56:32 -05:00
committed by GitHub
parent 6921c6abe1
commit dc10a5cb25
738 changed files with 389 additions and 381 deletions

View File

@@ -88,7 +88,7 @@ export class Compose extends React.Component<PropsWhenNavigating | PropsWhenRend
this.context = context
const noteUuid = 'noteUuid' in props ? props.noteUuid : props.route.params.noteUuid
const editor = this.context.editorGroup.noteControllers.find(c => c.note.uuid === noteUuid)
const editor = this.context.editorGroup.itemControllers.find(c => c.item.uuid === noteUuid) as NoteViewController
if (!editor) {
throw 'Unable to to find note controller'
}
@@ -96,8 +96,8 @@ export class Compose extends React.Component<PropsWhenNavigating | PropsWhenRend
this.editor = editor
this.state = {
title: this.editor.note.title,
text: this.editor.note.text,
title: this.editor.item.title,
text: this.editor.item.text,
componentViewer: undefined,
saveError: false,
webViewError: undefined,
@@ -260,7 +260,7 @@ export class Compose extends React.Component<PropsWhenNavigating | PropsWhenRend
}
get note() {
return this.editor.note
return this.editor.item
}
dismissKeyboard = () => {

View File

@@ -165,7 +165,7 @@ export const Notes = React.memo(
let mounted = true
const removeEditorObserver = application.editorGroup.addActiveControllerChangeObserver(activeEditor => {
if (mounted) {
setSelectedNoteId(activeEditor?.note?.uuid)
setSelectedNoteId(activeEditor?.item?.uuid)
}
})
@@ -361,7 +361,7 @@ export const Notes = React.memo(
application.getAppState().closeActiveEditor()
}
} else {
const activeNote = application.getAppState().getActiveNoteController()?.note
const activeNote = application.getAppState().getActiveNoteController()?.item
if (activeNote) {
const isTrashView =
@@ -389,7 +389,7 @@ export const Notes = React.memo(
const onNoteCreate = useCallback(async () => {
const title = application.getAppState().isTabletDevice ? `Note ${notes.length + 1}` : undefined
const noteView = await application.getAppState().createEditor(title)
openCompose(true, noteView.note.uuid)
openCompose(true, noteView.item.uuid)
reloadNotes(true)
}, [application, notes.length, openCompose, reloadNotes])

View File

@@ -51,7 +51,9 @@ export const Root = () => {
}
})
const removeNoteObserver = application?.editorGroup.addActiveControllerChangeObserver(activeController => {
setActiveNoteView(activeController)
if (activeController instanceof NoteViewController) {
setActiveNoteView(activeController)
}
})
return () => {
@@ -112,7 +114,7 @@ export const Root = () => {
</NotesContainer>
{activeNoteView && !activeNoteView.dealloced && isInTabletMode && (
<ComposeContainer>
<Compose noteUuid={activeNoteView.note.uuid} />
<Compose noteUuid={activeNoteView.item.uuid} />
<ExpandTouchable style={{ bottom: collapseIconBottomPosition }} onPress={toggleNoteList}>
<Icon name={collapseIconName} size={24} color={hexToRGBA(theme.stylekitInfoColor, 0.85)} />
</ExpandTouchable>

View File

@@ -156,8 +156,8 @@ export const NoteSideMenu = React.memo((props: Props) => {
useEffect(() => {
let mounted = true
if ((!editor || props.drawerOpen) && mounted) {
const initialEditor = application.editorGroup.activeNoteViewController
const tempNote = initialEditor?.note
const initialEditor = application.editorGroup.activeItemViewController as NoteViewController
const tempNote = initialEditor?.item
setEditor(initialEditor)
setNote(tempNote)
}
@@ -170,8 +170,8 @@ export const NoteSideMenu = React.memo((props: Props) => {
let mounted = true
const removeEditorObserver = application.editorGroup.addActiveControllerChangeObserver(() => {
if (mounted) {
const activeController = application.editorGroup.activeNoteViewController
setNote(activeController?.note)
const activeController = application.editorGroup.activeItemViewController as NoteViewController
setNote(activeController?.item)
setEditor(activeController)
}
})