import { ErrorBag } from '@ulangi/ulangi-common/interfaces' ; import { ObservableSetFormState } from '@ulangi/ulangi-observable' ; import { boundClass } from 'autobind-decorator' ; import { RemoteLogger } from '../../RemoteLogger' ; import { DialogDelegate } from '../dialog/DialogDelegate' ; import { NavigatorDelegate } from '../navigator/NavigatorDelegate' ; import { AddEditSetScreenDelegate } from './AddEditSetScreenDelegate' ; import { AddSetDelegate } from './AddSetDelegate' ; import { PickerDelegate } from './PickerDelegate' ; import { SetFormDelegate } from './SetFormDelegate' ; @ boundClass export class AddSetScreenDelegate extends AddEditSetScreenDelegate { private setFormState : ObservableSetFormState ; private addSetDelegate : AddSetDelegate ; public constructor ( setFormState , setFormDelegate , pickerDelegate , addSetDelegate , dialogDelegate , navigatorDelegate ) { super ( setFormDelegate , pickerDelegate , dialogDelegate , navigatorDelegate ) ; this . setFormState = setFormState ; this . addSetDelegate = addSetDelegate ; } public saveAdd ( callback ) { RemoteLogger . logEvent ( 'add_set' ) ; if ( this . setFormState . learningLanguageCode === null ) { this . showLanguageNotSelectedDialog ( 'learningLanguage' ) ; } else if ( this . setFormState . translatedToLanguageCode === null ) { this . showLanguageNotSelectedDialog ( 'translatedToLanguage' ) ; } else { this . addSetDelegate . saveAdd ( callback ) ; } } }