push.test as rest api
This commit is contained in:
parent
f4d68457dd
commit
54e3fedca6
|
@ -18,4 +18,7 @@ export type PushEndpoints = {
|
|||
'push.info': {
|
||||
GET: () => TPushInfo;
|
||||
};
|
||||
'push.test': {
|
||||
POST: () => { tokensCount: number };
|
||||
};
|
||||
};
|
||||
|
|
|
@ -828,5 +828,6 @@
|
|||
"Message_roomname": "Message {{roomName}}",
|
||||
"Microphone_access_needed_to_record_audio": "Microphone access needed to record audio",
|
||||
"Go_to_your_device_settings_and_allow_microphone": "Go to your device settings and allow microphone access for Rocket.Chat",
|
||||
"Check_again": "Check again"
|
||||
"Check_again": "Check again",
|
||||
"error-no-tokens-for-this-user": "There are no tokens for this user"
|
||||
}
|
|
@ -820,5 +820,6 @@
|
|||
"Go_to_your_device_settings_and_allow_microphone": "Vá para as configurações do seu dispositivo e permita o acesso ao microfone pelo aplicativo Rocket.Chat",
|
||||
"In_app_message_notifications": "Notificações de mensagens in-app",
|
||||
"Vibrate": "Vibrar",
|
||||
"Check_again": "Verificar novamente"
|
||||
"Check_again": "Verificar novamente",
|
||||
"error-no-tokens-for-this-user": "Não existem tokens para este usuário"
|
||||
}
|
|
@ -905,7 +905,7 @@ export const removePushToken = (): Promise<boolean | void> => {
|
|||
return Promise.resolve();
|
||||
};
|
||||
|
||||
export const pushTest = (): Promise<{ message: string; params: number[] }> => sdk.methodCallWrapper('push_test');
|
||||
export const pushTest = () => sdk.post('push.test');
|
||||
|
||||
// RC 6.5.0
|
||||
export const pushInfo = () => sdk.get('push.info');
|
||||
|
|
|
@ -82,9 +82,11 @@ const PushTroubleshootView = ({ navigation }: IPushTroubleshootViewProps): JSX.E
|
|||
let message = '';
|
||||
try {
|
||||
const result = await Services.pushTest();
|
||||
message = I18n.t('Your_push_was_sent_to_s_devices', { s: result.params[0] });
|
||||
if (result.success) {
|
||||
message = I18n.t('Your_push_was_sent_to_s_devices', { s: result.tokensCount });
|
||||
}
|
||||
} catch (error: any) {
|
||||
message = I18n.isTranslated(error?.error) ? I18n.t(error?.error) : error?.message;
|
||||
message = I18n.isTranslated(error?.data?.errorType) ? I18n.t(error?.data?.errorType) : error?.data?.error;
|
||||
} finally {
|
||||
Alert.alert(I18n.t('Test_push_notification'), message);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue