Skip to content
New issue

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

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

Already on GitHub? # to your account

Mobile landing #1213

Closed
wants to merge 4 commits into from
Closed

Conversation

idainatovych
Copy link
Contributor

@idainatovych idainatovych commented Dec 27, 2016

This PR is based on #1204 (because moving app initialization is in that PR).

So, this PR provides logic for "mobile landing". It means that if user opens jitsi-meet via mobile device we'll try to detect her platform and if it's a mobile device we'll show corresponding landing page with link to iOS or Android app correspondingly.

Landing for Welcome page:
screen shot 2016-12-27 at 6 09 57 pm

Landing for Conference:
screen shot 2016-12-27 at 6 10 19 pm

If user clicks on"Download App" button app redirects to the store (Google Play in my case). Clicking on the second button proceeds previous action (opening welcome or conference page).

@lyubomir lyubomir self-assigned this Jan 9, 2017
/**
* Flag that shows that mobile landing shown shown.
*
* @type {App}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type of the property landingIsShown is definitely not App, it is boolean.

...state,

/**
* Flag that shows that mobile landing shown shown.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shown shown should be is shown.

}
}

const mapStateToProps = state => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A const with an arrow function as its value is not necessary here, a simple function definition is preferable.

this.props.dispatch(landingIsShown());
}

static propTypes = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static members go before instance members. Another way to look at it is, comply with the existing source code.

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import { landingIsShown } from '../actions';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imports must be grouped by type.

import { Link } from 'react-router';
import { landingIsShown } from '../actions';

const links = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constants have names with upper-case letters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do require documentation (comments) on everything.


const links = {
'android': 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
'ios': ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The iOS link is still missing.

@@ -1,2 +1,3 @@
export * from './loadScript';
export * from './roomnameGenerator';
export * from './detectDevices';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coding style requires sorting by alphabetical order.

}

return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's too complicated. It can be improved by:

  1. Returning the condition itself.

  2. Matching against a single regular expression.

@@ -50,6 +50,7 @@ export class App extends AbstractApp {
componentWillMount(...args) {
super.componentWillMount(...args);

this.props.store.dispatch(detectPlatform());
Copy link
Contributor

@lyubomir lyubomir Jan 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many actions will we dispatch in App's componentWillMount. The super dispatches APP_WILL_MOUNT. In a previous PR you added appInit. And now we have detectPlatform. That's more than I'd like to have dispatched right here.

* @returns {{type, platform: string}}
* @private
*/
export function _setPlatform(platform) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is both private and exported? Is it feature internal?

* been already detected.
*
* @param {string} platform - Mobile user agent platform.
* @returns {{type, platform: string}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type what? It's type: APP_SET_PLATFORM.

* platform: String
* }
*/
export const APP_SET_PLATFORM = Symbol('APP_SET_PLATFORM');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort by alphabetical order.

dispatch(_setPlatform('ios'));
}
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does that relate to React Native's Platform class? You basically want us to use two separate abstractions called platform.

/**
* Landing
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already commented on a previous PR of yours about the above formatting of documentation comments but here it goes again: that's not the convention in the file and in the project.

*
* @returns {boolean}
*/
export function detectIOS() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe using bowser could help here?

// If landing was shown there is no need to show it again.
if (platform && !landingIsShown) {
component = detectAndroid() || detectIOS() ? Landing : component;
}
Copy link
Contributor

@lyubomir lyubomir Jan 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the above if more complex than necessary:

  1. There's an assignment of component to component.

  2. There're 2 separate conditions that may be merged into 1 condition.

  3. The path that chooses the Landing component doesn't need the initialization of the component variable.

@lyubomir lyubomir force-pushed the mobile-landing branch 2 times, most recently from 2322283 to 56fedd6 Compare January 15, 2017 17:44
@lyubomir
Copy link
Contributor

A showstopper for me in this PR is the fact that the location /mobile-app is treated as a room at the client. While at that location, a refresh will force the browser to query the server for /mobile-app and the server will respond with a 404.

@lyubomir
Copy link
Contributor

I've rebased this PR on the latest master (at the time of this writing), I've refactored it to comply with the coding style, to simplify the source code, and to correct the direction in which I'd like to take it in https://github.com/jitsi/jitsi-meet/tree/BeatC-mobile-landing so this PR is no longer necessary (to me).

@lyubomir lyubomir closed this Jan 16, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants