From e313a32c6a89292e2bc3540c554018926411d28a Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 29 Dec 2016 21:49:55 +0200 Subject: [PATCH] Show app link when logging in on iOS device --- app/Http/routes.php | 1 + app/Listeners/HandleUserLoggedIn.php | 4 ++++ resources/lang/en/texts.php | 2 ++ 3 files changed, 7 insertions(+) diff --git a/app/Http/routes.php b/app/Http/routes.php index ca89733f3d..3093cac6c6 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -660,6 +660,7 @@ if (!defined('CONTACT_EMAIL')) { define('NINJA_FORUM_URL', env('NINJA_FORUM_URL', 'https://www.invoiceninja.com/forums/forum/support/')); define('NINJA_CONTACT_URL', env('NINJA_CONTACT_URL', 'https://www.invoiceninja.com/contact/')); define('NINJA_FROM_EMAIL', env('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com')); + define('NINJA_IOS_APP_URL', 'https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=1072566815'); define('RELEASES_URL', env('RELEASES_URL', 'https://trello.com/b/63BbiVVe/invoice-ninja')); define('ZAPIER_URL', env('ZAPIER_URL', 'https://zapier.com/zapbook/invoice-ninja')); define('OUTDATE_BROWSER_URL', env('OUTDATE_BROWSER_URL', 'http://browsehappy.com/')); diff --git a/app/Listeners/HandleUserLoggedIn.php b/app/Listeners/HandleUserLoggedIn.php index b8a9e3f1ad..f8b3bb8cfb 100644 --- a/app/Listeners/HandleUserLoggedIn.php +++ b/app/Listeners/HandleUserLoggedIn.php @@ -52,6 +52,10 @@ class HandleUserLoggedIn { $account->loadLocalizationSettings(); + if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')) { + Session::flash('warning', trans('texts.iphone_app_message', ['link' => link_to(NINJA_IOS_APP_URL, trans('texts.iphone_app'))])); + } + // if they're using Stripe make sure they're using Stripe.js $accountGateway = $account->getGatewayConfig(GATEWAY_STRIPE); if ($accountGateway && ! $accountGateway->getPublishableStripeKey()) { diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 8e9d991095..ce250d8077 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2288,6 +2288,8 @@ $LANG = array( 'security_confirmation' => 'Your email address has been confirmed.', 'white_label_expired' => 'Your white label license has expired, please consider renewing it to help support our project.', 'renew_license' => 'Renew License', + 'iphone_app_message' => 'Consider downloading our :link', + 'iphone_app' => 'iPhone app', );