From 6806d9de87ed4c7a120c7cc4a7a86c00a3e3b1bc Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 23 Nov 2023 03:22:18 +0530 Subject: [PATCH 1/3] naming convention resolved --- app/components/mobile-dialog.hbs | 8 ++++---- app/components/mobile-dialog.js | 14 +++++++------- app/controllers/application.js | 4 ++-- app/styles/components/mobile-dialog.css | 4 ++-- app/templates/application.hbs | 4 ++-- config/environment.js | 3 +++ 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/components/mobile-dialog.hbs b/app/components/mobile-dialog.hbs index 96ef3046..05da9983 100644 --- a/app/components/mobile-dialog.hbs +++ b/app/components/mobile-dialog.hbs @@ -1,8 +1,8 @@ -{{#if @dev}} - {{#if @deviceType}} - {{#if this.toShow}} +{{#if @isDevEnv}} + {{#if @isMobileDevice}} + {{#if this.isDialogVisible}} - Open RDS in app + Redirect to RDS App
diff --git a/app/components/mobile-dialog.js b/app/components/mobile-dialog.js index 87a44996..23f968c4 100644 --- a/app/components/mobile-dialog.js +++ b/app/components/mobile-dialog.js @@ -1,13 +1,14 @@ import Component from '@glimmer/component'; import { action } from '@ember/object'; +import ENV from 'website-my/config/environment'; import { tracked } from '@glimmer/tracking'; export default class MobileDialogComponent extends Component { - @tracked toShow = true; + @tracked isDialogVisible = true; @action closeDialog() { - this.toShow = false; + this.isDialogVisible = false; } @action @@ -17,9 +18,8 @@ export default class MobileDialogComponent extends Component { openApp() { let isAppInstalled = false; - const appScheme = 'app://realdevsquad.com'; - const fallbackURL = - 'https://play.google.com/store/apps/details?id=com.github.android'; + const appScheme = ENV.RDS_ANDROID_SCHEME; + const fallbackURL = ENV.ANDROID_GITHUB_URL; const userAgent = navigator.userAgent || navigator.vendor || window.opera; const MAXTIME = 1000; @@ -29,7 +29,7 @@ export default class MobileDialogComponent extends Component { iframe.style.display = 'none'; iframe.src = appScheme; document.body.appendChild(iframe); - this.toShow = false; + this.isDialogVisible = false; window.addEventListener('blur', function () { document.body.removeChild(iframe); @@ -45,7 +45,7 @@ export default class MobileDialogComponent extends Component { document.body.removeChild(iframe); window.location.href = fallbackURL; } - this.toShow = false; + this.isDialogVisible = false; }, 1000); } } diff --git a/app/controllers/application.js b/app/controllers/application.js index 93b6b412..a6d408b5 100644 --- a/app/controllers/application.js +++ b/app/controllers/application.js @@ -10,7 +10,7 @@ export default class ApplicationController extends Controller { @service router; @service featureFlag; @service toast; - @tracked toVisible = this.checkDeviceType(); + @tracked isMobileDevice = this.detectMobileDevice(); GITHUB_URL = GITHUB_URL; BASE_API_URL = ENV.BASE_API_URL; @@ -40,7 +40,7 @@ export default class ApplicationController extends Controller { } } - checkDeviceType() { + detectMobileDevice() { let regexp = /android|iphone|kindle|ipad/i; let details = navigator.userAgent; let isMobileDevice = regexp.test(details); diff --git a/app/styles/components/mobile-dialog.css b/app/styles/components/mobile-dialog.css index 3f5d3d3d..901d7483 100644 --- a/app/styles/components/mobile-dialog.css +++ b/app/styles/components/mobile-dialog.css @@ -1,6 +1,6 @@ .mobile-dialog { display: block; - border-radius: 3px; + border-radius: 4px; padding: 0.5rem 1rem; font-weight: 900; margin: 0 auto; @@ -14,7 +14,7 @@ margin: 1rem; font-size:medium; border: none; - border-radius: 3px; + border-radius: 4px; color: var(--body-bg-color); font-weight: 600; } diff --git a/app/templates/application.hbs b/app/templates/application.hbs index ff91e959..1d062460 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -1,8 +1,8 @@ {{page-title "My | Real Dev Squad"}} Date: Thu, 23 Nov 2023 03:46:04 +0530 Subject: [PATCH 2/3] naming convention changes --- tests/integration/components/mobile-dialog-test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/components/mobile-dialog-test.js b/tests/integration/components/mobile-dialog-test.js index a6d05943..c0bc2883 100644 --- a/tests/integration/components/mobile-dialog-test.js +++ b/tests/integration/components/mobile-dialog-test.js @@ -8,8 +8,8 @@ module('Integration | Component | mobile-dialog', function (hooks) { test('Mobile-Dialog does not renders', async function (assert) { this.setProperties({ - dev: false, - deviceType: false, + isDevEnv: false, + isMobileDevice: false, }); await render(hbs``); @@ -18,12 +18,12 @@ module('Integration | Component | mobile-dialog', function (hooks) { test('Mobile-Dialog should renders', async function (assert) { this.setProperties({ - dev: true, - deviceType: true, + isDevEnv: true, + isMobileDevice: true, }); await render( - hbs`` + hbs`` ); assert.dom('[data-test-mobile-dialog]').exists(); From d9328163c4e5e6b72c145eb883db7d4901cfc5ba Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 23 Nov 2023 03:57:49 +0530 Subject: [PATCH 3/3] naming resolved --- app/components/mobile-dialog.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/mobile-dialog.hbs b/app/components/mobile-dialog.hbs index 05da9983..e8145324 100644 --- a/app/components/mobile-dialog.hbs +++ b/app/components/mobile-dialog.hbs @@ -4,7 +4,7 @@ Redirect to RDS App
- +
{{/if}}