Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

naming convention resolved #528

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/components/mobile-dialog.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{#if @dev}}
{{#if @deviceType}}
{{#if this.toShow}}
{{#if @isDevEnv}}
{{#if @isMobileDevice}}
{{#if this.isDialogVisible}}
<dialog data-test-mobile-dialog class="mobile-dialog">
Open RDS in app
Redirect to RDS App
<br/>
<button id="mobile-dialog__close-button" type="button" {{on 'click' (fn this.closeDialog)}} >Cancle</button>
<button id="mobile-dialog__open-button" type="button" {{on 'click' (fn this.openRDSApp)}}>Okay</button>
shubhamsinghbundela marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
14 changes: 7 additions & 7 deletions app/components/mobile-dialog.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;

Expand All @@ -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);
Expand All @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions app/styles/components/mobile-dialog.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.mobile-dialog {
display: block;
border-radius: 3px;
border-radius: 4px;
padding: 0.5rem 1rem;
font-weight: 900;
margin: 0 auto;
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{page-title "My | Real Dev Squad"}}

<MobileDialog
@dev ={{this.isDevMode}}
@deviceType = {{this.toVisible}}
@isDevEnv = {{this.isDevMode}}
shubhamsinghbundela marked this conversation as resolved.
Show resolved Hide resolved
@isMobileDevice = {{this.isMobileDevice}}
/>
<Navbar
@firstName={{@model.firstName}}
Expand Down
3 changes: 3 additions & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ module.exports = function (environment) {

ENV.BASE_API_URL = 'https://api.realdevsquad.com';
ENV.MIXPANEL_TOKEN = process.env.MIXPANEL_TOKEN || 'DUMMY_TOKEN';
ENV.ANDROID_GITHUB_URL =
'https://play.google.com/store/apps/details?id=com.github.android';
ENV.RDS_ANDROID_SCHEME = 'app://realdevsquad.com';

if (environment === 'development') {
ENV.BASE_API_URL = 'http://localhost:3000';
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/components/mobile-dialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`<MobileDialog @dev={{this.dev}}/>`);

Expand All @@ -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`<MobileDialog @dev={{this.dev}} @deviceType={{this.deviceType}} />`
hbs`<MobileDialog @isDevEnv={{this.isDevEnv}} @isMobileDevice={{this.isMobileDevice}} />`
);

assert.dom('[data-test-mobile-dialog]').exists();
Expand Down
Loading