status-react/resources/console.js

785 lines
31 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

I18n.translations = {
en: {
phone_title: 'Send Phone Number',
phone_description: 'Find friends using your number',
phone_placeholder: 'Phone number',
confirm_description: 'Confirmation code',
confirm_validation_title: 'Confirmation code',
confirm_validation_description: 'Wrong format',
password_description: 'Password',
password_placeholder: 'Type your password',
password_placeholder2: 'Please re-enter password to confirm',
password_error: 'Password should be not less then 6 symbols.',
password_error1: 'Password confirmation doesn\'t match password.',
password_validation_title: 'Password'
},
ru: {
phone_title: 'Отправить номер телефона',
phone_description: 'Найти друзей, используя ваш номер',
phone_placeholder: 'Номер телефона',
confirm_description: 'Код подтверждения',
confirm_validation_title: 'Код подтверждения',
confirm_validation_description: 'Неверный формат',
password_description: 'Пароль',
password_placeholder: 'Введите свой пароль',
password_placeholder2: 'Повторно введите пароль для подтверждения',
password_error: 'Пароль должен содержать не менее 6 символов',
password_error1: 'Подтверждение пароля не совпадает с паролем',
password_validation_title: 'Пароль'
},
af: {
phone_title: 'Stuur telefoonnommer',
phone_description: 'Vind vriende deur jou nommer te gebruik',
phone_placeholder: 'Telefoonnommer',
confirm_description: 'Bevestigingskode',
confirm_validation_title: 'Bevestigingskode',
confirm_validation_description: 'Verkeerde formaat',
password_description: 'Wagwoord',
password_placeholder: 'Tik jou wagwoord in',
password_placeholder2: 'Tik asseblief weer jou wagwoord in om te bevestig',
password_error: 'Wagwoord mag nie minder as 6 simbole wees nie.',
password_error1: 'Wagwoordbevestiging is nie dieselfde as wagwoord nie.',
password_validation_title: 'Wagwoord'
},
ar: {
phone_title: 'أرسل رقم الهاتف',
phone_description: 'ابحث عن الأصدقاء باستخدام رقمك',
phone_placeholder: 'رقم الهاتف',
confirm_description: 'رمز التأكيد',
confirm_validation_title: 'رمز التأكيد',
confirm_validation_description: 'صيغة خاطئة',
password_description: 'كلمة المرور',
password_placeholder: 'اكتب كلمة المرور الخاصة بك',
password_placeholder2: 'الرجاء إعادة إدخال كلمة المرور للتأكيد',
password_error: 'ينبغي أن لا تقل كلمة المرور عن 6 رموز.',
password_error1: 'لا يتوافق تأكيد كلمة المرور مع كلمة المرور.',
password_validation_title: 'كلمة المرور'
},
'zh-hant': {
phone_title: '發送手機號碼',
phone_description: '使用您的號碼發現好友',
phone_placeholder: '手機號碼',
confirm_description: '確認碼',
confirm_validation_title: '確認碼',
confirm_validation_description: '格式錯誤',
password_description: '密碼',
password_placeholder: '鍵入您的密碼',
password_placeholder2: '重新鍵入您的密碼',
password_error: '密碼不得短於6個字元。',
password_error1: '確認密碼與鍵入的密碼不一致。',
password_validation_title: '密碼'
},
'zh-hans': {
phone_title: '发送电话号码',
phone_description: '用你的号码来查找朋友',
phone_placeholder: '电话号码',
confirm_description: '确认码',
confirm_validation_title: '确认码',
confirm_validation_description: '格式错误',
password_description: '密码',
password_placeholder: '输入密码',
password_placeholder2: '请重新输入密码以确认',
password_error: '密码应不少于6个字符。',
password_error1: '密码确认信息与密码不匹配。',
password_validation_title: '密码'
},
'zh-yue': {
phone_title: '發送電話號碼',
phone_description: '使用本電話號碼查找好友',
phone_placeholder: '電話號碼',
confirm_description: '驗證碼',
confirm_validation_title: '驗證碼',
confirm_validation_description: '格式錯誤',
password_description: '密碼',
password_placeholder: '輸入密碼',
password_placeholder2: '請重新輸入密碼確認',
password_error: '密碼不能短於6個字符.',
password_error1: '確認密碼與輸入密碼不符.',
password_validation_title: '密碼'
},
'zh-wuu': {
phone_title: '发送电话号码',
phone_description: '用您的号码查找朋友',
phone_placeholder: '电话号码',
confirm_description: '确认码',
confirm_validation_title: '确认码',
confirm_validation_description: '错误格式',
password_description: '密码',
password_placeholder: '输入密码',
password_placeholder2: '请重新输入密码确认',
password_error: '密码应不小于6个字符。',
password_error1: '密码确认不匹配。',
password_validation_title: '密码'
},
nl: {
phone_title: 'Stuur telefoonnummer',
phone_description: 'Zoek vrienden met behulp van je nummer',
phone_placeholder: 'Telefoonnummer',
confirm_description: 'Bevestigingscode',
confirm_validation_title: 'Bevestigingscode',
confirm_validation_description: 'Verkeerd format',
password_description: 'Wachtwoord',
password_placeholder: 'Typ je wachtwoord',
password_placeholder2: 'Voer je wachtwoord opnieuw in om te bevestigen',
password_error: 'Wachtwoord moet minstens 6 tekens hebben.',
password_error1: 'Wachtwoordbevestiging komt niet overeen met wachtwoord.',
password_validation_title: 'Wachtwoord'
},
fr: {
phone_title: 'Envoyer le numéro de téléphone',
phone_description: 'Trouver des amis en utilisant votre numéro',
phone_placeholder: 'Numéro de téléphone',
confirm_description: 'Code de confirmation',
confirm_validation_title: 'Code de confirmation',
confirm_validation_description: 'Format incorrect',
password_description: 'Mot de passe',
password_placeholder: 'Tapez votre mot de passe',
password_placeholder2: 'Veuillez retapez votre mot de passe pour le confirmer',
password_error: 'Le mot de passe doit contenir 6 symboles au minimum.',
password_error1: 'Le mot de passe de confirmation ne correspond pas au mot de passe.',
password_validation_title: 'Mot de passe'
},
de: {
phone_title: 'Telefonnummer absenden',
phone_description: 'Freunde mit Ihrer Nummer finden',
phone_placeholder: 'Telefonnummer',
confirm_description: 'Bestätigungscode',
confirm_validation_title: 'Bestätigungscode',
confirm_validation_description: 'Falsches Format',
password_description: 'Passwort',
password_placeholder: 'Geben Sie Ihr Passwort ein',
password_placeholder2: 'Bitte geben Sie das Passwort zur Bestätigung erneut ein',
password_error: 'Das Passwort sollte nicht weniger als 6 Stellen beinhalten',
password_error1: 'Die Passwortbestätigung stimmt nicht mit dem Passwort überein',
password_validation_title: 'Passwort',
},
hi: {
phone_title: 'फ़ोन नंबर भेजें',
phone_description: 'अपने नंबर का उपयोग करके दोस्त ढूंढें',
phone_placeholder: 'फ़ोन नंबर',
confirm_description: 'पुष्टि कोड',
confirm_validation_title: 'पुष्टि कोड',
confirm_validation_description: 'गलत प्रारूप',
password_description: 'पासवर्ड',
password_placeholder: 'अपना पासवर्ड टाइप करें',
password_placeholder2: 'पुष्टि करने के लिए फिर से पासवर्ड दर्ज करें',
password_error: 'पासवर्ड 6 प्रतीकों से कम का नहीं होना चाहिए।',
password_error1: 'पासवर्ड पुष्टि पासवर्ड मेल नहीं खाता है।',
password_validation_title: 'पासवर्ड'
},
hu: {
phone_title: 'Telefonszám küldése',
phone_description: 'Ismerősök megkeresése telefonszám alapján',
phone_placeholder: 'Telefonszám',
confirm_description: 'Megerősítési kód',
confirm_validation_title: 'Megerősítési kód',
confirm_validation_description: 'Rossz formátum',
password_description: 'Jelszó',
password_placeholder: 'Add meg a jelszavad',
password_placeholder2: 'A megerősítéshez kérjük, add meg újra a jelszavad',
password_error: 'A jelszó nem lehet hosszabb 6 szimbólumnál.',
password_error1: 'A megerősített jelszó nem egyezik a jelszóval.',
password_validation_title: 'Jelszó'
},
it: {
phone_title: 'Invia numero di telefono',
phone_description: 'Trova gli amici che usano il tuo numero',
phone_placeholder: 'Numero di telefono',
confirm_description: 'Codice di conferma',
confirm_validation_title: 'Codice di conferma',
confirm_validation_description: 'Formato errato',
password_description: 'Password',
password_placeholder: 'Digita la tua password',
password_placeholder2: 'Reinserisci la password per confermare',
password_error: 'La password deve contenere almeno 6 caratteri.',
password_error1: 'Conferma password\ la password non corrisponde.',
password_validation_title: 'Password'
},
ja: {
phone_title: '電話番号を送信',
phone_description: 'あなたの番号を使用している友人を検索',
phone_placeholder: '携帯電話番号',
confirm_description: '確認コード',
confirm_validation_title: '確認コード',
confirm_validation_description: '間違った形式',
password_description: 'パスワード',
password_placeholder: 'パスワードを入力してください',
password_placeholder2: '確認のためにパスワードを再入力してください',
password_error: 'パスワードは6文字以下でなければなりません.',
password_error1: 'パスワードの確認がパスワードと一致しません。',
password_validation_title: 'パスワード'
},
ko: {
phone_title: '전화번호 보내기',
phone_description: '내 번호를 사용하여 친구 찾기',
phone_placeholder: '전화번호',
confirm_description: '확인 코드',
confirm_validation_title: '확인 코드',
confirm_validation_description: '잘못된 형식',
password_description: '비밀번호',
password_placeholder: '비밀번호를 입력하세요',
password_placeholder2: '확인을 위해 비밀번호를 다시 입력해 주세요',
password_error: '비밀번호는 6자 이상이어야 합니다.',
password_error1: '확인용 비밀번호가 원래 비밀번호와 일치하지 않습니다.',
password_validation_title: '비밀번호'
},
pl: {
phone_title: 'Wyślij numer telefonu',
phone_description: 'Znajdź znajomych, używając swojego numeru',
phone_placeholder: 'Numer telefonu',
confirm_description: 'Kod potwierdzający',
confirm_validation_title: 'Kod potwierdzający',
confirm_validation_description: 'Nieprawidłowy format',
password_description: 'Hasło',
password_placeholder: 'Wpisz swoje hasło',
password_placeholder2: 'Wprowadź ponownie hasło, aby potwierdzić',
password_error: 'Hasło powinno zawierać co najmniej 6 symboli.',
password_error1: 'Wprowadzone i potwierdzone hasła nie są takie same.',
password_validation_title: 'Hasło'
},
'pt-br': {
phone_title: 'Enviar número de telefone',
phone_description: 'Encontrar amigos por meio do seu número',
phone_placeholder: 'Número de telefone',
confirm_description: 'Código de confirmação',
confirm_validation_title: 'Código de confirmação',
confirm_validation_description: 'Formato incorreto',
password_description: 'Senha',
password_placeholder: 'Digite sua senha',
password_placeholder2: 'Por favor, digite a senha novamente para confirmar',
password_error: 'A senha deve ter no mínimo 6 símbolos.',
password_error1: 'A confirmação da senha é diferente da senha.',
password_validation_title: 'Senha'
},
'pt-pt': {
phone_title: 'Enviar o Número de Telefone',
phone_description: 'Encontrar amigos que utilizem o seu número',
phone_placeholder: 'Número de telefone',
confirm_description: 'Código de confirmação',
confirm_validation_title: 'Código de confirmação',
confirm_validation_description: 'Formato errado',
password_description: 'Palavra-passe',
password_placeholder: 'Digite a sua palavra-passe',
password_placeholder2: 'Por favor, volte a digitar a palavra-passe para confirmar',
password_error: 'A palavra-passe não deve ter menos de 6 símbolos.',
password_error1: 'A confirmação da palavra-passe não coincide com a palavra-passe.',
password_validation_title: 'Palavra-passe'
},
ro: {
phone_title: 'Trimite numărul de telefon',
phone_description: 'Găsește prieteni folosindu-ți numărul de telefon',
phone_placeholder: 'Număr de telefon',
confirm_description: 'Cod de confirmare',
confirm_validation_title: 'Cod de confirmare',
confirm_validation_description: 'Format greșit',
password_description: 'Parolă',
password_placeholder: 'Tastează parola',
password_placeholder2: 'Te rugăm să re-introduci parola pentru a confirma',
password_error: 'Parola trebuie să aibă cel puțin 6 simboluri.',
password_error1: 'Parola confirmată nu este aceeași cu parola introdusă.',
password_validation_title: 'Parolă'
},
sl: {
phone_title: 'Pošlji telefonsko številko',
phone_description: 'Iskanje prijateljev z uporabo tvoje telefonske številke',
phone_placeholder: 'Telefonska številka',
confirm_description: 'Potrditvena koda',
confirm_validation_title: 'Potrditvena koda',
confirm_validation_description: 'Neveljaven format',
password_description: 'Geslo',
password_placeholder: 'Vnesi svoje geslo',
password_placeholder2: 'Prosimo, ponovno vnesi geslo za potrditev',
password_error: 'Geslo mora vsebovati vsaj 6 simbolov.',
password_error1: 'Potrditev gesla se ne ujema z geslom.',
password_validation_title: 'Geslo'
},
es: {
phone_title: 'Enviar número de teléfono',
phone_description: 'Encontrar amigos que estén utilizando tu número',
phone_placeholder: 'Número de teléfono',
confirm_description: 'Código de confirmación',
confirm_validation_title: 'Código de confirmación',
confirm_validation_description: 'Formato erróneo',
password_description: 'Contraseña',
password_placeholder: 'Escribe tu contraseña',
password_placeholder2: 'Por favor, vuelve a escribir la contraseña para confirmar',
password_error: 'La contraseña no debe ser inferior a 6 símbolos.',
password_error1: 'La confirmación de contraseña no coincide con la contraseña.',
password_validation_title: 'Contraseña'
},
'es-ar': {
phone_title: 'Envia un número telefónico',
phone_description: 'Encuentra amigos utilizando tu número',
phone_placeholder: 'Número telefónico',
confirm_description: 'Código de confirmación',
confirm_validation_title: 'Código de confirmación',
confirm_validation_description: 'Formato incorrecto',
password_description: 'Contraseña',
password_placeholder: 'Ingresa tu contraseña',
password_placeholder2: 'Ingresa tu contraseña para confirmar',
password_error: 'Las contraseñas deben contener no menos de 6 símbolos.',
password_error1: 'La confirmación de la contraseña no coincide con la contraseña.',
password_validation_title: 'Contraseña'
},
sw: {
phone_title: 'Tuma Namba ya Simu',
phone_description: 'Pata marafiki kwa kutumia namba yako',
phone_placeholder: 'Namba ya simu',
confirm_description: 'Kificho cha uthibitisho',
confirm_validation_title: 'Kificho cha uthibitisho',
confirm_validation_description: 'Muundo hafifu',
password_description: 'Nenosiri',
password_placeholder: 'Andika nenosiri lako',
password_placeholder2: 'Tafadhali ingiza tena nenosiri kuthibitisha',
password_error: 'Nenosiri lisiwe chini ya alama 6.',
password_error1: 'Uthibitisho wa nenosiri haulingani na nenosiri.',
password_validation_title: 'Nenosiri'
},
sv: {
phone_title: 'Skicka telefonnummer',
phone_description: 'Hitta vänner som använder ditt nummer',
phone_placeholder: 'Telefonnummer',
confirm_description: 'Bekräftelsekod',
confirm_validation_title: 'Bekräftelsekod',
confirm_validation_description: 'Fel format',
password_description: 'Lösenord',
password_placeholder: 'Skriv ditt lösenord',
password_placeholder2: 'Var god ange ditt lösenord igen för att bekräfta',
password_error: 'Lösenordet bör inte vara mindre än 6 symboler.',
password_error1: 'Lösenordsbekräftelsen matcharinte lösenordet.',
password_validation_title: 'Lösenord'
},
'fr-ch': {
phone_title: 'Envoyer numéro de téléphone',
phone_description: 'Trouvez des amis en utilisant votre numéro',
phone_placeholder: 'Numéro de téléphone',
confirm_description: 'Code de confirmation',
confirm_validation_title: 'Code de confirmation',
confirm_validation_description: 'Mauvais format',
password_description: 'Mot de passe',
password_placeholder: 'Tapez votre mot de passe',
password_placeholder2: 'Veuillez saisir à nouveau le mot de passe pour confirmer',
password_error: 'Le mot de passe doit avoir au moins 6 caractères.',
password_error1: 'La confirmation du mot de passe ne correspond pas au premier mot de passe.',
password_validation_title: 'Mot de passe'
},
'de-ch': {
phone_title: 'Sende Telefonnummer',
phone_description: 'Finde Freunde mittels deiner Telefonnummer',
phone_placeholder: 'Telefonnummer',
confirm_description: 'Konfirmationscode',
confirm_validation_title: 'Konfirmationscode',
confirm_validation_description: 'Falsches Format',
password_description: 'Passwort',
password_placeholder: 'Gib dein Passwort ein',
password_placeholder2: 'Bitte gib das Passwort zur Bestätigung erneut ein',
password_error: 'Passwort sollte nicht kleiner als 6 Symbole sein.',
password_error1: 'Passwort Bestätigung stimmt mit Passwort nicht überein.',
password_validation_title: 'Passwort'
},
'it-ch': {
phone_title: 'Invia numero di telefono',
phone_description: 'Trova amici che utilizzano il tuo numero',
phone_placeholder: 'Numero di telefono',
confirm_description: 'Codice di conferma',
confirm_validation_title: 'Codice di conferma',
confirm_validation_description: 'Formato errato',
password_description: 'Password',
password_placeholder: 'Digita la tua password',
password_placeholder2: 'Inserisci nuovamente la password per confermare',
password_error: 'La password non può contenere meno di 6 caratteri.',
password_error1: 'La password di conferma non corrisponde alla password.',
password_validation_title: 'Password'
},
th: {
phone_title: 'ส่งหมายเลขโทรศัพท์',
phone_description: 'ค้นหาเพื่อนโดยใช้หมายเลขของคุณ ',
phone_placeholder: 'หมายเลขโทรศัพท์',
confirm_description: 'รหัสยืนยัน',
confirm_validation_title: 'รหัสยืนยัน',
confirm_validation_description: 'รูปแบบผิด',
password_description: 'รหัสผ่าน',
password_placeholder: 'พิมพ์รหัสผ่านของคุณ',
password_placeholder2: 'โปรดกรอกรหัสผ่านอีกครั้งเพื่อยืนยัน',
password_error: 'รหัสผ่านควรมีสัญลักษณ์ไม่น้อยกว่า 6 ตัว',
password_error1: 'การยืนยันรหัสผ่านไม่ตรงกับรหัสผ่าน',
password_validation_title: 'รหัสผ่าน'
},
tr: {
phone_title: 'Telefon Numarasını Gönder',
phone_description: 'Telefon numaranı kullanarak arkadaşlarınızı bulun',
phone_placeholder: 'Telefon numarası',
confirm_description: 'Onay kodu',
confirm_validation_title: 'Onay kodu',
confirm_validation_description: 'Hatalı format',
password_description: 'Şifre',
password_placeholder: 'Şifrenizi girin',
password_placeholder2: 'Onaylamak için lütfen parolanızı yeniden girin',
password_error: 'Şifre 6 simgeden daha kısa olmamalıdır.',
password_error1: 'Şifre onayı, şifre ile eşleşmiyor.',
password_validation_title: 'Şifre'
},
uk: {
phone_title: 'Надіслати номер телефону',
phone_description: 'Знайдіть друзів, використовуючи свій номер',
phone_placeholder: 'Номер телефону',
confirm_description: 'Код підтвердження',
confirm_validation_title: 'Код підтвердження',
confirm_validation_description: 'Неправильний формат',
password_description: 'Пароль',
password_placeholder: 'Введіть свій пароль',
password_placeholder2: 'Будь ласка, введіть пароль ще раз для підтвердження',
password_error: 'Пароль повинен бути не менше 6 символів.',
password_error1: 'Підтвердження паролю не співпадає з паролем.',
password_validation_title: 'Пароль'
},
ur: {
phone_title: 'فون نمبر بھیجیں',
phone_description: 'فون نمبر استعمال کرتے ہوئے دوستوں کو تلاش کریں',
phone_placeholder: 'فون نمبر',
confirm_description: 'تصدیقی کوڈ',
confirm_validation_title: 'تصدیقی کوڈ',
confirm_validation_description: 'غلط فارمیٹ',
password_description: 'پاسورڈ',
password_placeholder: 'اپنا پاسورڈ لکھیں',
password_placeholder2: 'برائے مہربانی تصدیق کے لیے اپنا پاسورڈ دوبارہ لکھیں',
password_error: 'پاسورڈ 6 اعداد سے چھوٹا نہیں ہونا چاہیے۔',
password_error1: 'تصدیقی پاسورڈ پاسورڈ سے مماثل نہیں',
password_validation_title: 'پاسورڈ'
},
vi: {
phone_title: 'Gửi số điện thoại',
phone_description: 'Tìm bạn bè bằng các sử dụng số điện thoại của bạn',
phone_placeholder: 'Số điện thoại',
confirm_description: 'Mã xác nhận',
confirm_validation_title: 'Mã xác nhận',
confirm_validation_description: 'Sai định dạng',
password_description: 'Mật khẩu',
password_placeholder: 'Gõ mật khẩu của bạn',
password_placeholder2: 'Vui lòng nhập lại mật khẩu để xác nhận',
password_error: 'Mật khẩu không được ít hơn 6 ký tự.',
password_error1: 'Xác nhận mật khẩu không khớp với mật khẩu.',
password_validation_title: 'Mật khẩu'
}
};
var phones = [ // TODO this is supposed to be regionalised
{
number: "89171111111",
description: "Number format 1"
},
{
number: "89371111111",
description: "Number format 1"
},
{
number: "+79171111111",
description: "Number format 2"
},
{
number: "9171111111",
description: "Number format 3"
}
];
function suggestionsContainerStyle(suggestionsCount) {
return {
marginVertical: 1,
marginHorizontal: 0,
height: Math.min(150, (56 * suggestionsCount)),
backgroundColor: "white",
borderRadius: 5,
flex: 1
};
}
var suggestionContainerStyle = {
paddingLeft: 16,
backgroundColor: "white"
};
var suggestionSubContainerStyle = {
height: 56,
borderBottomWidth: 1,
borderBottomColor: "#0000001f"
};
var valueStyle = {
marginTop: 9,
fontSize: 14,
fontFamily: "font",
color: "#000000de"
};
var descriptionStyle = {
marginTop: 1.5,
fontSize: 14,
fontFamily: "font",
color: "#838c93de"
};
function startsWith(str1, str2) {
// String.startsWith(...) doesn't work in otto
return str1.lastIndexOf(str2, 0) == 0 && str1 != str2;
}
function phoneSuggestions(params) {
var ph, suggestions;
if (!params.phone || params.phone == "") {
ph = phones;
} else {
ph = phones.filter(function (phone) {
return startsWith(phone.number, params.phone);
});
}
if (ph.length == 0) {
return;
}
suggestions = ph.map(function (phone) {
return status.components.touchable(
{onPress: [status.events.SET_VALUE, phone.number]},
status.components.view(suggestionContainerStyle,
[status.components.view(suggestionSubContainerStyle,
[
status.components.text(
{style: valueStyle},
phone.number
),
status.components.text(
{style: descriptionStyle},
phone.description
)
])])
);
});
/*var view = status.components.view(
{style: {flex: 1, flexDirection: "column"}},
[status.components.scrollView(
suggestionsContainerStyle(ph.length),
suggestions
)]
);*/
var view = status.components.scrollView(
suggestionsContainerStyle(ph.length),
suggestions
);
return {markup: view};
}
var phoneConfig = {
name: "phone",
icon: "phone_white",
title: I18n.t('phone_title'),
description: I18n.t('phone_description'),
color: "#5bb2a2",
params: [{
name: "phone",
type: status.types.PHONE,
suggestions: phoneSuggestions,
placeholder: I18n.t('phone_placeholder')
}]
};
status.response(phoneConfig);
status.command(phoneConfig);
// status.command({
// name: "help",
// title: "Help",
// description: "Request help from Console",
// color: "#7099e6",
// params: [{
// name: "query",
// type: status.types.TEXT
// }]
// });
status.response({
name: "confirmation-code",
color: "#7099e6",
description: I18n.t('confirm_description'),
params: [{
name: "code",
type: status.types.NUMBER
}],
validator: function (params) {
if (!/^[\d]{4}$/.test(params.code)) {
var error = status.components.validationMessage(
I18n.t('confirm_validation_title'),
I18n.t('confirm_validation_description')
);
return {errors: [error]}
}
}
});
status.response({
name: "password",
color: "#7099e6",
description: I18n.t('password_description'),
icon: "lock_white",
params: [{
name: "password",
type: status.types.PASSWORD,
placeholder: I18n.t('password_placeholder')
}, {
name: "password-confirmation",
type: status.types.PASSWORD,
placeholder: I18n.t('password_placeholder2')
}],
validator: function (params, context) {
var errorMessages = [];
var currentParameter = context["current-parameter"];
if (
currentParameter == "password" &&
params.password.length < 6
) {
errorMessages.push(I18n.t('password_error'));
}
if (currentParameter == "password-confirmation" &&
params.password != params["password-confirmation"]) {
errorMessages.push(I18n.t('password_error1'));
}
if (errorMessages.length) {
var errors = [];
for (var idx in errorMessages) {
errors.push(
status.components.validationMessage(
I18n.t('password_validation_title'),
errorMessages[idx]
)
);
}
return {errors: errors};
}
return {params: params, context: context};
},
preview: function (params, context) {
var style = {
marginTop: 5,
marginHorizontal: 0,
fontSize: 14,
color: "black"
};
if (context.platform == "ios") {
style.fontSize = 8;
style.marginTop = 10;
style.marginBottom = 2;
style.letterSpacing = 1;
}
return status.components.text({style: style}, "●●●●●●●●●●");
}
});