Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions app/containers/LoginServices/LoginServices.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ServicesSeparator from './ServicesSeparator';
import ButtonService from './ButtonService';
import { type IServices } from '../../selectors/login';
import { type TIconsName } from '../CustomIcon';
import ServiceListTest from './ServiceList';

const styles = StyleSheet.create({
serviceName: {
Expand Down Expand Up @@ -94,3 +95,31 @@ export const ServiceList = () => (
})}
</>
);

export const ServciceListCollapsed = () => {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
return (
<ServiceListTest
services={services}
CAS_enabled={false}
CAS_login_url=''
Gitlab_URL=''
server='https://demo.rocket.chat'
collapsed={true}
showLoginOnWebButton={true}
/>
);
};

export const ServciceListUncollapsed = () => {
return (
<ServiceListTest
services={services}
CAS_enabled={false}
CAS_login_url=''
Gitlab_URL=''
server='https://demo.rocket.chat'
collapsed={false}
showLoginOnWebButton={true}
/>
);
};
47 changes: 47 additions & 0 deletions app/containers/LoginServices/ServiceList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Linking } from 'react-native';

import Service from './Service';
import Button from '../Button';
import { type IServiceList, type IItemService } from './interfaces';
import I18n from '../../i18n';

const ServiceList = ({
services,
CAS_enabled,
CAS_login_url,
Gitlab_URL,
server,
collapsed,
showLoginOnWebButton
}: IServiceList & { showLoginOnWebButton: boolean }) => {
const enableLoginOnWebButton = showLoginOnWebButton && (!collapsed || Object.keys(services).length <= 2);
Comment thread
yash-rajpal marked this conversation as resolved.
Outdated

return (
<>
{Object.values(services).map((service: IItemService, index: number) => {
if (index > 2 && collapsed) return null;

return (
<Service
key={service._id}
CAS_enabled={CAS_enabled}
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
service={service}
/>
);
})}
{enableLoginOnWebButton && (
Comment thread
yash-rajpal marked this conversation as resolved.
Outdated
<Button
title={I18n.t('Login_on_web')}
onPress={() => {
Linking.openURL(`${server}/home?loginClient=mobile`);
}}
/>
)}
</>
);
};

export default ServiceList;
55 changes: 27 additions & 28 deletions app/containers/LoginServices/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,10 @@

import { type IServices } from '../../selectors/login';
import { useAppSelector } from '../../lib/hooks/useAppSelector';
import { type IItemService, type IServiceList } from './interfaces';
import { type IItemService } from './interfaces';

Check failure on line 7 in app/containers/LoginServices/index.tsx

View workflow job for this annotation

GitHub Actions / format

'IItemService' is defined but never used

Check failure on line 7 in app/containers/LoginServices/index.tsx

View workflow job for this annotation

GitHub Actions / ESLint and Test / run-eslint-and-test

'IItemService' is defined but never used
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
import { SERVICES_COLLAPSED_HEIGHT, SERVICE_HEIGHT } from './styles';
import ServicesSeparator from './ServicesSeparator';
import Service from './Service';

const ServiceList = ({ services, CAS_enabled, CAS_login_url, Gitlab_URL, server, collapsed }: IServiceList) => (
<>
{Object.values(services).map((service: IItemService, index: number) => {
if (index > 2 && collapsed) return null;
return (
<Service
key={service._id}
CAS_enabled={CAS_enabled}
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
service={service}
/>
);
})}
</>
);
import ServiceList from './ServiceList';

const LoginServices = ({ separator }: { separator: boolean }): React.ReactElement => {
const [collapsed, setCollapsed] = useState(true);
Expand All @@ -39,9 +21,14 @@
shallowEqual
);
const server = useAppSelector(state => state.server.server);
const services = useAppSelector(state => state.login.services as IServices, shallowEqual);
const { length } = Object.values(services);

const allServices = useAppSelector(state => state.login.services as IServices, shallowEqual);
const filteredServices = Object.fromEntries(
Object.entries(allServices).filter(([, service]) => !service.hideButtonOnMobile)
) as IServices;
const { length } = Object.values(filteredServices);
const enableLoginOnWebButton = Object.values(allServices).length > length;
console.log('filteredServices', filteredServices, 'enableLoginOnWebButton', enableLoginOnWebButton);
console.log('allServices', allServices);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
const heightButtons = useSharedValue(SERVICES_COLLAPSED_HEIGHT);

const animatedStyle = useAnimatedStyle(() => ({
Expand All @@ -50,7 +37,7 @@
}));

const onPressButtonSeparator = () => {
heightButtons.value = collapsed ? SERVICE_HEIGHT * length : SERVICES_COLLAPSED_HEIGHT;
heightButtons.value = collapsed ? SERVICE_HEIGHT * (length + (enableLoginOnWebButton ? 1 : 0)) : SERVICES_COLLAPSED_HEIGHT;
setCollapsed(prevState => !prevState);
};

Expand All @@ -59,29 +46,41 @@
<>
<Animated.View style={animatedStyle}>
<ServiceList
services={services}
services={filteredServices}
CAS_enabled={CAS_enabled}
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
collapsed={collapsed}
showLoginOnWebButton={enableLoginOnWebButton}
/>
</Animated.View>
<ServicesSeparator services={services} separator={separator} collapsed={collapsed} onPress={onPressButtonSeparator} />
<ServicesSeparator
services={filteredServices}
separator={separator}
collapsed={collapsed}
onPress={onPressButtonSeparator}
/>
</>
);
}
return (
<>
<ServiceList
services={services}
services={filteredServices}
CAS_enabled={CAS_enabled}
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
collapsed={collapsed}
showLoginOnWebButton={enableLoginOnWebButton}
/>
<ServicesSeparator
services={filteredServices}
separator={separator}
collapsed={collapsed}
onPress={onPressButtonSeparator}
/>
<ServicesSeparator services={services} separator={separator} collapsed={collapsed} onPress={onPressButtonSeparator} />
</>
);
};
Expand Down
1 change: 1 addition & 0 deletions app/containers/LoginServices/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface IItemService {
authorizePath: string;
clientId: string;
scope: string;
hideButtonOnMobile?: boolean;
}

export interface IServiceLogin {
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
"Logging_out": "تسجيل الخروج",
"Login": "تسجيل الدخول",
"Login_error": "تم رفض تسجيل الدخول الرجاء المحاولة مرة أخرى",
"Login_on_web": "تسجيل الدخول على الويب",
"Logout": "تسجيل الخروج",
"Logout_failed": "فشل تسجيل الخروج!",
"Logout_from_other_logged_in_locations": "تسجيل الخروج من الأماكن الأخرى",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/bn-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
"Logging_out": "লগআউট হচ্ছে।",
"Login": "লগইন",
"Login_error": "আপনার ক্রেডেনশিয়ালগুলি প্রত্যাখ্যান হয়েছে! অনুগ্রহ করে আবার চেষ্টা করুন।",
"Login_on_web": "ওয়েবে লগইন করুন",
"Logout": "লগ আউট",
"Logout_failed": "লগ আউট ব্যর্থ!",
"Logout_from_other_logged_in_locations": "অন্যান্য লগইন অবস্থান থেকে লগ আউট করুন",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@
"Login_error": "Vaše přihlašovací údaje byly odmítnuty! Zkuste to prosím znovu.",
"Login_has_been_temporarily_blocked_for_this_IP": "Přihlášení bylo dočasně zablokováno pro tuto IP",
"Login_has_been_temporarily_blocked_for_this_User": "Přihlášení bylo pro tohoto uživatele dočasně zablokováno",
"Login_on_web": "Přihlásit se na webu",
"Logout": "Odhlásit se",
"Logout_failed": "Odhlášení se nezdařilo!",
"Logout_from_other_logged_in_locations": "Odhlásit se z jiných přihlášených míst",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@
"Logging_out": "Abmelden.",
"Login": "Anmeldung",
"Login_error": "Ihre Zugangsdaten wurden abgelehnt! Bitte versuchen Sie es erneut.",
"Login_on_web": "Im Web anmelden",
"Logout": "Abmelden",
"Logout_failed": "Abmeldung fehlgeschlagen!",
"Logout_from_other_logged_in_locations": "Auf anderen angemeldeten Geräte abmelden",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@
"Login_error": "Your credentials were rejected! Please try again.",
"Login_has_been_temporarily_blocked_for_this_IP": "Login has been temporarily blocked for this IP",
"Login_has_been_temporarily_blocked_for_this_User": "Login has been temporarily blocked for this user",
"Login_on_web": "Login on web",
Comment thread
yash-rajpal marked this conversation as resolved.
"Logout": "Logout",
"Logout_failed": "Logout failed!",
"Logout_from_other_logged_in_locations": "Logout from other logged in locations",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"Loading": "Cargando",
"Login": "Inicio de sesión",
"Login_error": "¡Sus credenciales fueron rechazadas! Por favor, inténtelo de nuevo.",
"Login_on_web": "Iniciar sesión en la web",
"Logout": "Cerrar sesión",
"Mark_read": "Mark leyó",
"Mark_unread": "Marcar como no leído",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@
"Logging_out": "Kirjaudutaan ulos.",
"Login": "Kirjaudu",
"Login_error": "Tunnistetietojasi ei hyväksytty! Yritä uudelleen.",
"Login_on_web": "Kirjaudu sisään verkossa",
"Logout": "Kirjaudu ulos",
"Logout_failed": "Uloskirjaus epäonnistui!",
"Logout_from_other_logged_in_locations": "Kirjaa ulos muista sijainneista",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@
"Logging_out": "Déconnexion.",
"Login": "Connexion",
"Login_error": "Vos identifiants ont été rejetés ! Veuillez réessayer.",
"Login_on_web": "Se connecter sur le web",
"Logout": "Se déconnecter",
"Logout_failed": "Echec de la déconnexion !",
"Logout_from_other_logged_in_locations": "Déconnexion des autres emplacements connectés",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/hi-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
"Logging_out": "लॉग आउट हो रहा है।",
"Login": "लॉगिन",
"Login_error": "आपका क्रेडेंशियल्स अस्वीकृत हुए थे! कृपया पुनः प्रयास करें।",
"Login_on_web": "वेब पर लॉगिन करें",
"Logout": "लॉग आउट",
"Logout_failed": "लॉगआउट में विफल!",
"Logout_from_other_logged_in_locations": "अन्य लॉगइन स्थानों से लॉगआउट करें",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@
"Logging_out": "Kijelentkezett.",
"Login": "Bejelentkezés",
"Login_error": "A hitelesítő adatait elutasítottuk! Kérjük, próbálja meg újra.",
"Login_on_web": "Bejelentkezés weben",
"Logout": "Kijelentkezés",
"Logout_failed": "A kijelentkezés sikertelen!",
"Logout_from_other_logged_in_locations": "Kijelentkezés más bejelentkezett helyekről",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
"Logging_out": "Disconnettendo.",
"Login": "Accedi",
"Login_error": "Le tue credenziali sono state rifiutate! Prova di nuovo.",
"Login_on_web": "Accedi sul web",
"Logout": "Disconnetti",
"Logout_failed": "Disconnessione fallita!",
"Logout_from_other_logged_in_locations": "Disconnetti da altre postazioni",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
"Logging_out": "ログアウトしています。",
"Login": "ログイン",
"Login_error": "証明書が承認されませんでした。再度お試しください。",
"Login_on_web": "ウェブでログイン",
"Logout": "ログアウト",
"Mark_read": "マークを既読にする",
"Mark_unread": "未読にする",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@
"Logging_out": "Uitloggen.",
"Login": "Inloggen",
"Login_error": "Je inloggegevens zijn geweigerd! Probeer het opnieuw.",
"Login_on_web": "Inloggen op internet",
"Logout": "Uitloggen",
"Logout_failed": "Uitloggen mislukt!",
"Logout_from_other_logged_in_locations": "Afmelden bij andere ingelogde locaties",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/nn.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
"Logged_out_of_other_clients_successfully": "Logget ut av andre klienter",
"Login": "Logg inn",
"Login_has_been_temporarily_blocked_for_this_IP": "Innlogging er midlertidig blokkert for denne IP-adressen",
"Login_on_web": "Logg inn på nettet",
"Logout": "Logg ut",
"Mark_as_unread": "Vis teller",
"Mark_as_unread_Info": "Vis antall uleste meldinger",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@
"Login_error": "Legitimasjonen din ble avvist! Prøv på nytt.",
"Login_has_been_temporarily_blocked_for_this_IP": "Innlogging er midlertidig blokkert for denne IP-en",
"Login_has_been_temporarily_blocked_for_this_User": "Innlogging er midlertidig blokkert for denne brukeren",
"Login_on_web": "Logg inn på nettet",
"Logout": "Logg ut",
"Logout_failed": "Avlogging mislyktes!",
"Logout_from_other_logged_in_locations": "Logg ut fra andre påloggede steder",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@
"Login_error": "Suas credenciais foram rejeitadas. Tente novamente por favor!",
"Login_has_been_temporarily_blocked_for_this_IP": "Login foi temporariamente bloqueado para este IP",
"Login_has_been_temporarily_blocked_for_this_User": "Login foi temporariamente bloqueado para este usuário",
"Login_on_web": "Entrar na web",
"Logout": "Sair",
"Logout_failed": "Falha ao desconectar!",
"Logout_from_other_logged_in_locations": "Sair de outros locais logados",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
"Logging_out": "A terminar a sessão.",
"Login": "Entrar",
"Login_error": "As suas credenciais foram rejeitadas! Por favor, tente novamente.",
"Login_on_web": "Iniciar sessão na web",
"Logout": "Sair",
"Mark_read": "Marcar como lido",
"Mark_unread": "Marcar como não lido",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@
"Logging_out": "Осуществляется выход.",
"Login": "Вход",
"Login_error": "Ваши учетные данные были отклонены! Пожалуйста, попробуйте еще раз.",
"Login_on_web": "Войти через веб",
"Logout": "Выйти",
"Logout_failed": "Выход не успешен!",
"Logout_from_other_logged_in_locations": "Выйти из всех других подключенных расположений",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/sl-SI.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@
"Logging_out": "Odjava.",
"Login": "Prijava",
"Login_error": "Vaše poverilnice so bile zavrnjene! Prosim poskusite ponovno.",
"Login_on_web": "Prijava na spletu",
"Logout": "Odjava",
"Logout_failed": "Odjava ni uspela!",
"Logout_from_other_logged_in_locations": "Odjava z drugih prijavljenih lokacij",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@
"Logging_out": "Loggar ut.",
"Login": "Logga in",
"Login_error": "Dina inloggningsuppgifter avvisades. Försök igen.",
"Login_on_web": "Logga in på webben",
"Logout": "Logga ut",
"Logout_failed": "Det gick inte att logga ut.",
"Logout_from_other_logged_in_locations": "Logga ut från andra platser där du är inloggad",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/ta-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
"Logging_out": "வெளியேறுகின்றது.",
"Login": "உள்நுழைய",
"Login_error": "உங்கள் சான்றுகள் ஏற்றுக்கொண்டது! மீண்டும் முயற்சிக்கவும்.",
"Login_on_web": "இணையத்தில் உள்நுழைக",
"Logout": "வெளியேறு",
"Logout_failed": "வெளியேறுதல் தோல்வியுற்றது!",
"Logout_from_other_logged_in_locations": "மற்ற உள்நுழைவு இடங்களிலிருந்து வெளியேறு",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/te-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
"Logging_out": "లాగౌట్ అవుతోంది.",
"Login": "లాగిన్",
"Login_error": "మీ రుచియవి తిరిగి చూడబడలేదు! దయచేసి మళ్ళీ ప్రయత్నించండి.",
"Login_on_web": "వెబ్‌లో లాగిన్ అవ్వండి",
"Logout": "లాగౌట్",
"Logout_failed": "లాగౌట్ అయిపోయింది!",
"Logout_from_other_logged_in_locations": "ఇతర సెట్ అంగాల నుండి లాగౌట్ చేయండి",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
"Logging_out": "Çıkış Yapılıyor",
"Login": "Oturum aç",
"Login_error": "Kimlik bilgileriniz reddedildi! Lütfen tekrar deneyin.",
"Login_on_web": "Web'de oturum aç",
"Logout": "Çıkış Yap",
"Logout_failed": "Oturum kapatma başarısız oldu!",
"Logout_from_other_logged_in_locations": "Giriş yapılan diğer konumlardan çıkış yap",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
"Logging_out": "正在登出",
"Login": "登陆",
"Login_error": "认证失败!请再试一次",
"Login_on_web": "在网页上登录",
"Logout": "注销",
"Logout_failed": "注销失败",
"Logout_from_other_logged_in_locations": "注销其他已登陆的设备",
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@
"Logging_out": "正在登出",
"Login": "登入",
"Login_error": "認證失敗!請再試一次",
"Login_on_web": "在網頁上登入",
"Logout": "登出",
"Logout_failed": "登出失敗",
"Logout_from_other_logged_in_locations": "登出其他已登入的設備",
Expand Down
Loading