import {AnkiDroid} from 'react-native-ankidroid/dist/ankidroid';
export const createAnkiLanModel = model => async dispatch => {
try {
const modelFields = [
'Word or sentence',
'Part of speech 1',
'Translate 1',
'Definition 1',
'Part of speech 2',
'Translate 2',
'Definition 2',
'Example',
'Transcription',
'Sound',
];
const css = ``;
const answerFormat = `
{{FrontSide}}
-
{{Translate 1}}
{{Definition 1}}
-
{{Translate 2}}
{{Definition 2}}
{Example}}
\`;
{{Sound}}
`;
const questionFormat = `
{{Word or sentence}}
{{Transcription}}
-
{{Part of speech 1}}
-
{{Part of speech 2}}
{{Sound}}`;
const modelProperties = {
name: model.name,
reference: 'com.ankilan.models',
fields: modelFields,
tags: [],
cardNames: ['Rus->En', 'En->Rus'],
questionFormat,
answerFormat,
css,
};
const settings = {
modelId: model.id,
modelProperties,
deckId: '1582019808117',
};
const currentDeck = new AnkiDroid(settings);
currentDeck.addNote(
[
'Word or sentence',
'Part of speech 1',
'Translate 1',
'Definition 1',
'Part of speech 2',
'Translate 2',
'Definition 2',
'Example',
'Transcription',
'Sound',
],
modelFields,
);
} catch (err) {
console.log(err);
}
};