add flutter
This commit is contained in:
Regular → Executable
+14
-2
@@ -24,13 +24,25 @@ class appnotification extends CI_Controller
|
||||
|
||||
public function send()
|
||||
{
|
||||
$this->load->helper('fcm_v1_helper');
|
||||
|
||||
// Validate Firebase token before kirim. If no token, relogin (retry) is done in helper.
|
||||
if (!fcm_v1_validate_token()) {
|
||||
$this->session->set_flashdata('error', 'Firebase token tidak valid. Pastikan file ngojol-trial-firebase-adminsdk JSON ada dan dapat dibaca. Silakan coba lagi.');
|
||||
redirect('appnotification/index');
|
||||
return;
|
||||
}
|
||||
|
||||
$topic = $this->input->post('topic');
|
||||
$title = $this->input->post('title');
|
||||
$message = $this->input->post('message');
|
||||
$this->notif->send_notif($title, $message, $topic);
|
||||
$this->session->set_flashdata('send', 'Notifikasi berhasil dikirim');
|
||||
|
||||
$ok = $this->notif->send_notif($title, $message, $topic);
|
||||
if ($ok) {
|
||||
$this->session->set_flashdata('send', 'Notifikasi berhasil dikirim');
|
||||
} else {
|
||||
$this->session->set_flashdata('error', 'Gagal mengirim notifikasi. Firebase token mungkin kedaluwarsa. Silakan coba lagi.');
|
||||
}
|
||||
redirect('appnotification/index');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user