mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Merge branch 'develop' of github.com:hillelcoren/invoice-ninja into develop
This commit is contained in:
commit
9efaada9f5
@ -132,7 +132,7 @@ class AccountApiController extends BaseAPIController
|
||||
$devices[$x]['token'] = $request->token; //update
|
||||
$account->devices = json_encode($devices);
|
||||
$account->save();
|
||||
return $this->response($account);
|
||||
return $this->response($devices[$x]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ class AccountApiController extends BaseAPIController
|
||||
$account->devices = json_encode($devices);
|
||||
$account->save();
|
||||
|
||||
return $this->response($account);
|
||||
return $this->response($newDevice);
|
||||
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ class AccountApiController extends BaseAPIController
|
||||
$account->devices = json_encode($devices);
|
||||
$account->save();
|
||||
|
||||
return $this->response($account);
|
||||
return $this->response($newDevice);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ use App\Events\QuoteInvitationWasViewed;
|
||||
use App\Events\QuoteInvitationWasApproved;
|
||||
use App\Events\PaymentWasCreated;
|
||||
use App\Ninja\Notifications;
|
||||
use App\Services\PushService;
|
||||
|
||||
class NotificationListener
|
||||
{
|
||||
@ -17,7 +18,7 @@ class NotificationListener
|
||||
protected $contactMailer;
|
||||
protected $pushService;
|
||||
|
||||
public function __construct(UserMailer $userMailer, ContactMailer $contactMailer, Notifications\PushService $pushService)
|
||||
public function __construct(UserMailer $userMailer, ContactMailer $contactMailer, PushService $pushService)
|
||||
{
|
||||
$this->userMailer = $userMailer;
|
||||
$this->contactMailer = $contactMailer;
|
||||
|
@ -194,7 +194,6 @@ class AccountRepository
|
||||
$account = $this->getNinjaAccount();
|
||||
$lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first();
|
||||
$publicId = $lastInvoice ? ($lastInvoice->public_id + 1) : 1;
|
||||
|
||||
$invoice = new Invoice();
|
||||
$invoice->account_id = $account->id;
|
||||
$invoice->user_id = $account->users()->first()->id;
|
||||
|
@ -51,7 +51,7 @@ class PushService
|
||||
foreach($devices as $device)
|
||||
{
|
||||
if(($device["notify_{$type}"] == TRUE) && ($device['device'] == 'ios'))
|
||||
$this->pushMessage($invoice, $device['token'], $device["notify_{$type}"]);
|
||||
$this->pushMessage($invoice, $device['token'], $type);
|
||||
}
|
||||
|
||||
|
||||
@ -104,19 +104,19 @@ class PushService
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case 'notify_sent':
|
||||
case 'sent':
|
||||
return $this->entitySentMessage($invoice);
|
||||
break;
|
||||
|
||||
case 'notify_paid':
|
||||
case 'paid':
|
||||
return $this->invoicePaidMessage($invoice);
|
||||
break;
|
||||
|
||||
case 'notify_approved':
|
||||
case 'approved':
|
||||
return $this->quoteApprovedMessage($invoice);
|
||||
break;
|
||||
|
||||
case 'notify_viewed':
|
||||
case 'viewed':
|
||||
return $this->entityViewedMessage($invoice);
|
||||
break;
|
||||
}
|
||||
@ -129,9 +129,9 @@ class PushService
|
||||
private function entitySentMessage($invoice)
|
||||
{
|
||||
if($invoice->is_quote)
|
||||
return 'Quote #{$invoice->invoice_number} sent!';
|
||||
return "Quote #{$invoice->invoice_number} sent!";
|
||||
else
|
||||
return 'Invoice #{$invoice->invoice_number} sent!';
|
||||
return "Invoice #{$invoice->invoice_number} sent";
|
||||
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ class PushService
|
||||
*/
|
||||
private function invoicePaidMessage($invoice)
|
||||
{
|
||||
return 'Invoice #{$invoice->invoice_number} paid!';
|
||||
return "Invoice #{$invoice->invoice_number} paid!";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +150,7 @@ class PushService
|
||||
*/
|
||||
private function quoteApprovedMessage($invoice)
|
||||
{
|
||||
return 'Quote #{$invoice->invoice_number} approved!';
|
||||
return "Quote #{$invoice->invoice_number} approved!";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,9 +160,9 @@ class PushService
|
||||
private function entityViewedMessage($invoice)
|
||||
{
|
||||
if($invoice->is_quote)
|
||||
return 'Quote #{$invoice->invoice_number} viewed!';
|
||||
return "Quote #{$invoice->invoice_number} viewed!";
|
||||
else
|
||||
return 'Invoice #{$invoice->invoice_number} viewed!';
|
||||
return "Invoice #{$invoice->invoice_number} viewed!";
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user