Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Fixes #9175: Beta editor/sync: Fix image timestamps not updated after editing #9176

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions packages/app-mobile/components/screens/Note.tsx
Expand Up @@ -51,6 +51,7 @@ import VoiceTypingDialog from '../voiceTyping/VoiceTypingDialog';
import { voskEnabled } from '../../services/voiceTyping/vosk';
import { isSupportedLanguage } from '../../services/voiceTyping/vosk.android';
import { ChangeEvent as EditorChangeEvent, UndoRedoDepthChangeEvent } from '@joplin/editor/events';
import { join } from 'path';
const urlUtils = require('@joplin/lib/urlUtils');

// import Vosk from 'react-native-vosk';
Expand Down Expand Up @@ -829,13 +830,17 @@ class NoteScreenComponent extends BaseScreenComponent {
throw new Error('No resource is loaded in the editor');
}

const resourcePath = Resource.fullPath(resource);
logger.info('Saving drawing to resource', resource.id);

const filePath = resourcePath;
await shim.fsDriver().writeFile(filePath, svgData, 'utf8');
logger.info('Saved drawing to', filePath);
const tempFilePath = join(Setting.value('tempDir'), uuid.createNano());
await shim.fsDriver().writeFile(tempFilePath, svgData, 'utf8');

resource = await Resource.updateResourceBlobContent(
resource.id,
tempFilePath,
);
await shim.fsDriver().remove(tempFilePath);

resource = await Resource.save(resource, { isNew: false });
await this.refreshResource(resource);
}

Expand Down