Fix #1933 add option to send push notification using the "data" field, leaving out the "notification" field

This commit is contained in:
Kijin Sung 2023-08-03 23:00:57 +09:00
parent 00159407f4
commit 918418ebf3
5 changed files with 34 additions and 2 deletions

View file

@ -122,6 +122,17 @@ $lang->ncenterlite_mid_use = 'Module specific settings';
$lang->ncenterlite_to_unsubscribe = 'Disable notification'; $lang->ncenterlite_to_unsubscribe = 'Disable notification';
$lang->ncenterlite_subscribe = 'Activate notification'; $lang->ncenterlite_subscribe = 'Activate notification';
$lang->ncenterlite_cmd_unsubscribe_settings = 'Notification settings'; $lang->ncenterlite_cmd_unsubscribe_settings = 'Notification settings';
$lang->ncenterlite_notify_count = 'Notification count';
$lang->ncenterlite_notify_count_about = 'Set the number of notifications per page.';
$lang->this_message_unsubscribe = 'Unsubscribe from this post';
$lang->about_this_message_unsubscribe = 'Stop receiving notifications abou this post.';
$lang->unsubscribe_list = 'Unsubscribe List';
$lang->unsubscribe = 'Unsubscribe individually';
$lang->about_unsubscribe = 'Allow users to unsubscribe from individual posts.';
$lang->fcm_push_format = 'Push notification format';
$lang->fcm_push_format_notification = 'Use notification';
$lang->fcm_push_format_data = 'Use data';
$lang->about_fcm_push_format = 'Select where to place the notification data when sending push notifications with Google FCM.<br>This setting should match the requirements of your client application or frontend code.';
$lang->ncenterlite_all_delete = 'Delete all'; $lang->ncenterlite_all_delete = 'Delete all';
$lang->ncenterlite_month_before_delete = 'Delete older than 1 month'; $lang->ncenterlite_month_before_delete = 'Delete older than 1 month';
$lang->dont_check_notify_delete = 'Unread notifications will be deleted, too.'; $lang->dont_check_notify_delete = 'Unread notifications will be deleted, too.';

View file

@ -141,6 +141,10 @@ $lang->about_this_message_unsubscribe = '이 게시글/댓글의 알림을 수
$lang->unsubscribe_list = '수신 거부 리스트'; $lang->unsubscribe_list = '수신 거부 리스트';
$lang->unsubscribe = '개별 문서/댓글 알림 수신 거부'; $lang->unsubscribe = '개별 문서/댓글 알림 수신 거부';
$lang->about_unsubscribe = '개별 문서/댓글 알림 수신을 거부하는 기능을 사용합니다.'; $lang->about_unsubscribe = '개별 문서/댓글 알림 수신을 거부하는 기능을 사용합니다.';
$lang->fcm_push_format = '푸시 알림 포맷';
$lang->fcm_push_format_notification = 'notification 사용';
$lang->fcm_push_format_data = 'data 사용';
$lang->about_fcm_push_format = 'Google FCM 푸시 알림 발송시 알림 데이터를 어느 항목에 담을지 선택합니다.<br>알림을 받아 처리하는 모바일 어플리케이션이나 프론트엔드 코드의 요구사항에 맞추어야 합니다.';
$lang->member_menu_view = '회원 메뉴 표시'; $lang->member_menu_view = '회원 메뉴 표시';
$lang->member_menu_on = '표시'; $lang->member_menu_on = '표시';
$lang->member_menu_off = '표시하지 않음'; $lang->member_menu_off = '표시하지 않음';

View file

@ -38,6 +38,7 @@ class ncenterliteAdminController extends ncenterlite
'comment_all_notify_module_srls', 'comment_all_notify_module_srls',
'unsubscribe', 'unsubscribe',
'notify_count', 'notify_count',
'fcm_push_format',
); );
if($obj->disp_act == 'dispNcenterliteAdminSkinsetting') if($obj->disp_act == 'dispNcenterliteAdminSkinsetting')

View file

@ -1588,11 +1588,15 @@ class ncenterliteController extends ncenterlite
} }
$oPush = new \Rhymix\Framework\Push(); $oPush = new \Rhymix\Framework\Push();
$oPush->setSubject($content); if (!isset($config->fcm_push_format) || $config->fcm_push_format === 'notification')
$oPush->setContent(strval($args->extra_content)); {
$oPush->setSubject($content);
$oPush->setContent(strval($args->extra_content));
}
$oPush->setData($args->extra_data); $oPush->setData($args->extra_data);
$oPush->setURL(strval($target_url)); $oPush->setURL(strval($target_url));
$oPush->addTo(intval($args->member_srl)); $oPush->addTo(intval($args->member_srl));
var_dump($oPush);exit;
$output = $oPush->send(); $output = $oPush->send();
return $output; return $output;

View file

@ -107,6 +107,18 @@
<p class="x_help-block">{$lang->about_unsubscribe}</p> <p class="x_help-block">{$lang->about_unsubscribe}</p>
</div> </div>
</div> </div>
<div class="x_control-group">
<label class="x_control-label">{$lang->fcm_push_format}</label>
<div class="x_controls">
<label class="x_inline">
<input type="radio" name="fcm_push_format" value="notification" checked="checked"|cond="$config->fcm_push_format !== 'data'" /> {$lang->fcm_push_format_notification}
</label>
<label class="x_inline">
<input type="radio" name="fcm_push_format" value="data" checked="checked"|cond="$config->fcm_push_format === 'data'" /> {$lang->fcm_push_format_data}
</label>
<p class="x_help-block">{$lang->about_fcm_push_format}</p>
</div>
</div>
</section> </section>
<div class="x_clearfix btnArea"> <div class="x_clearfix btnArea">
<div class="x_pull-right"> <div class="x_pull-right">