diff --git a/react/.buckconfig b/react/.buckconfig new file mode 100644 index 0000000000..934256cb29 --- /dev/null +++ b/react/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/react/.eslintrc.js b/react/.eslintrc.js new file mode 100644 index 0000000000..c91e66d6ce --- /dev/null +++ b/react/.eslintrc.js @@ -0,0 +1,401 @@ +module.exports = { + 'env': { + 'browser': true, + 'commonjs': true, + 'es6': true + }, + 'parserOptions': { + 'ecmaFeatures': { + 'experimentalObjectRestSpread': true, + 'jsx': true + }, + 'sourceType': 'module' + }, + 'plugins': [ + 'jsdoc', + 'react', + 'react-native' + ], + 'rules': { + // Possible Errors group + 'no-cond-assign': 2, + 'no-console': 0, + 'no-constant-condition': 2, + 'no-control-regex': 2, + 'no-debugger': 2, + 'no-dupe-args': 2, + 'no-dupe-keys': 2, + 'no-duplicate-case': 2, + 'no-empty': 2, + 'no-empty-character-class': 2, + 'no-ex-assign': 2, + 'no-extra-boolean-cast': 2, + 'no-extra-parens': [ + 'error', + 'all', + { 'nestedBinaryExpressions': false } + ], + 'no-extra-semi': 2, + 'no-func-assign': 2, + 'no-inner-declarations': 2, + 'no-invalid-regexp': 2, + 'no-irregular-whitespace': 2, + 'no-negated-in-lhs': 2, + 'no-obj-calls': 2, + 'no-prototype-builtins': 0, + 'no-regex-spaces': 2, + 'no-sparse-arrays': 2, + 'no-unexpected-multiline': 2, + 'no-unreachable': 2, + 'no-unsafe-finally': 2, + 'use-isnan': 2, + + // Currently, we are using both valid-jsdoc and 'jsdoc' plugin. In the + // future we might stick to one as soon as it has all the features. + 'valid-jsdoc': [ + 'error', + { + 'matchDescription': '.+', + 'prefer': { + 'arg': 'param', + 'argument': 'param', + 'return': 'returns' + }, + 'preferType': { + 'array': 'Array', + 'Boolean': 'boolean', + 'function': 'Function', + 'Number': 'number', + 'object': 'Object', + 'String': 'string' + }, + 'requireParamDescription': true, + 'requireReturn': true, + 'requireReturnDescription': false, + 'requireReturnType': true + } + ], + 'valid-typeof': 2, + + // Best Practices group + 'accessor-pairs': 0, + 'array-callback-return': 2, + 'block-scoped-var': 0, + 'complexity': 0, + 'consistent-return': 0, + 'curly': 2, + 'default-case': 0, + 'dot-location': [ 'error', 'property' ], + 'dot-notation': 2, + 'eqeqeq': 2, + 'guard-for-in': 2, + 'no-alert': 2, + 'no-caller': 2, + 'no-case-declarations': 2, + 'no-div-regex': 0, + 'no-else-return': 2, + 'no-empty-function': 2, + 'no-empty-pattern': 2, + 'no-eq-null': 2, + 'no-eval': 2, + 'no-extend-native': 2, + 'no-extra-bind': 2, + 'no-extra-label': 2, + 'no-fallthrough': 2, + 'no-floating-decimal': 2, + 'no-implicit-coercion': 2, + 'no-implicit-globals': 2, + 'no-implied-eval': 2, + 'no-invalid-this': 2, + 'no-iterator': 2, + 'no-labels': 2, + 'no-lone-blocks': 2, + 'no-loop-func': 2, + 'no-magic-numbers': 0, + 'no-multi-spaces': 2, + 'no-multi-str': 2, + 'no-native-reassign': 2, + 'no-new': 2, + 'no-new-func': 2, + 'no-new-wrappers': 2, + 'no-octal': 2, + 'no-octal-escape': 2, + 'no-param-reassign': 2, + 'no-proto': 2, + 'no-redeclare': 2, + 'no-return-assign': 2, + 'no-script-url': 2, + 'no-self-assign': 2, + 'no-self-compare': 2, + 'no-sequences': 2, + 'no-throw-literal': 2, + 'no-unmodified-loop-condition': 2, + 'no-unused-expressions': [ + 'error', + { + 'allowShortCircuit': true, + 'allowTernary': true + } + ], + 'no-unused-labels': 2, + 'no-useless-call': 2, + 'no-useless-concat': 2, + 'no-useless-escape': 2, + 'no-void': 2, + 'no-warning-comments': 0, + 'no-with': 2, + 'radix': 2, + 'vars-on-top': 2, + 'wrap-iife': [ 'error', 'inside' ], + 'yoda': 2, + + // Strict Mode group + 'strict': 2, + + // Variables group + 'init-declarations': 0, + 'no-catch-shadow': 2, + 'no-delete-var': 2, + 'no-label-var': 2, + 'no-restricted-globals': 0, + 'no-shadow': 2, + 'no-shadow-restricted-names': 2, + 'no-undef': 2, + 'no-undef-init': 2, + 'no-undefined': 0, + 'no-unused-vars': 2, + 'no-use-before-define': [ 'error', { 'functions': false } ], + + // Stylistic issues group + 'array-bracket-spacing': [ + 'error', + 'always', + { 'objectsInArrays': true } + ], + 'block-spacing': [ 'error', 'always' ], + 'brace-style': 2, + 'camelcase': 2, + 'comma-dangle': 2, + 'comma-spacing': 2, + 'comma-style': 2, + 'computed-property-spacing': 2, + 'consistent-this': [ 'error', 'self' ], + 'eol-last': 2, + 'func-names': 0, + 'func-style': 0, + 'id-blacklist': 0, + 'id-length': 0, + 'id-match': 0, + 'indent': [ 'error', 4, { 'SwitchCase': 0 } ], + 'jsx-quotes': [ 'error', 'prefer-single' ], + 'key-spacing': 2, + 'keyword-spacing': 2, + 'linebreak-style': [ 'error', 'unix' ], + 'lines-around-comment': [ + 'error', + { + 'allowBlockStart': true, + 'allowObjectStart': true, + 'beforeBlockComment': true, + 'beforeLineComment': true + } + ], + 'max-depth': 2, + 'max-len': [ 'error', 80 ], + 'max-lines': 0, + 'max-nested-callbacks': 2, + 'max-params': 2, + 'max-statements': 0, + 'max-statements-per-line': 2, + 'multiline-ternary': 0, + 'new-cap': 2, + 'new-parens': 2, + 'newline-after-var': 2, + 'newline-before-return': 2, + 'newline-per-chained-call': 2, + 'no-array-constructor': 2, + 'no-bitwise': 2, + 'no-continue': 2, + 'no-inline-comments': 0, + 'no-lonely-if': 2, + 'no-mixed-operators': 2, + 'no-mixed-spaces-and-tabs': 2, + 'no-multiple-empty-lines': 2, + 'no-negated-condition': 2, + 'no-nested-ternary': 0, + 'no-new-object': 2, + 'no-plusplus': 0, + 'no-restricted-syntax': 0, + 'no-spaced-func': 2, + 'no-tabs': 2, + 'no-ternary': 0, + 'no-trailing-spaces': 2, + 'no-underscore-dangle': 0, + 'no-unneeded-ternary': 2, + 'no-whitespace-before-property': 2, + 'object-curly-newline': 0, + 'object-curly-spacing': [ 'error', 'always' ], + 'object-property-newline': 2, + 'one-var': 0, + 'one-var-declaration-per-line': 0, + 'operator-assignment': 0, + 'operator-linebreak': [ 'error', 'before' ], + 'padded-blocks': 0, + 'quote-props': 0, + 'quotes': [ 'error', 'single' ], + 'require-jsdoc': [ + 'error', + { + 'require': { + 'ClassDeclaration': true, + 'FunctionDeclaration': true, + 'MethodDefinition': true + } + } + ], + 'semi': [ 'error', 'always' ], + 'semi-spacing': 2, + 'sort-vars': 2, + 'space-before-blocks': 2, + 'space-before-function-paren': [ 'error', 'never' ], + 'space-in-parens': [ 'error', 'never' ], + 'space-infix-ops': 2, + 'space-unary-ops': 2, + 'spaced-comment': 2, + 'unicode-bom': 0, + 'wrap-regex': 0, + + // ES6 group rules + 'arrow-body-style': [ + 'error', + 'as-needed', + { requireReturnForObjectLiteral: true } + ], + 'arrow-parens': [ 'error', 'as-needed' ], + 'arrow-spacing': 2, + 'constructor-super': 2, + 'generator-star-spacing': 2, + 'no-class-assign': 2, + 'no-confusing-arrow': 2, + 'no-const-assign': 2, + 'no-dupe-class-members': 2, + 'no-duplicate-imports': 2, + 'no-new-symbol': 2, + 'no-restricted-imports': 0, + 'no-this-before-super': 2, + 'no-useless-computed-key': 2, + 'no-useless-constructor': 2, + 'no-useless-rename': 2, + 'no-var': 2, + 'object-shorthand': [ + 'error', + 'always', + { 'avoidQuotes': true } + ], + 'prefer-arrow-callback': [ 'error', { 'allowNamedFunctions': true } ], + 'prefer-const': 2, + 'prefer-reflect': 0, + 'prefer-rest-params': 2, + 'prefer-spread': 2, + 'prefer-template': 2, + 'require-yield': 2, + 'rest-spread-spacing': 2, + 'sort-imports': 0, + 'template-curly-spacing': 2, + 'yield-star-spacing': 2, + + // JsDoc plugin rules group. The following rules are in addition to + // valid-jsdoc rule. + 'jsdoc/check-param-names': 0, + 'jsdoc/check-tag-names': 2, + 'jsdoc/check-types': 0, + 'jsdoc/newline-after-description': 2, + + // XXX Because the following plugin is not very smart about words which + // legitimately begin with uppercase characters mid-sentence, set it to + // warn only. + 'jsdoc/require-description-complete-sentence': 1, + 'jsdoc/require-hyphen-before-param-description': 2, + + // The following 5 rules are covered by valid-jsdoc, so disable them. + 'jsdoc/require-param': 0, + 'jsdoc/require-param-description': 0, + 'jsdoc/require-param-type': 0, + 'jsdoc/require-returns-description': 0, + 'jsdoc/require-returns-type': 0, + + // React plugin rules group + 'react/display-name': 0, + 'react/forbid-prop-types': 0, + 'react/no-danger': 2, + 'react/no-deprecated': 2, + 'react/no-did-mount-set-state': 2, + 'react/no-did-update-set-state': 2, + 'react/no-direct-mutation-state': 2, + 'react/no-find-dom-node': 2, + 'react/no-is-mounted': 2, + 'react/no-multi-comp': 2, + 'react/no-render-return-value': 2, + 'react/no-set-state': 0, + 'react/no-string-refs': 2, + 'react/no-unknown-property': 2, + 'react/prefer-es6-class': 2, + 'react/prefer-stateless-function': 0, + 'react/prop-types': 2, + 'react/react-in-jsx-scope': 2, + 'react/require-extension': 0, + 'react/require-optimization': 0, + 'react/require-render-return': 2, + 'react/self-closing-comp': 2, + 'react/sort-comp': 0, + 'react/sort-prop-types': 2, + + // React plugin JSX-specific rule group + 'react/jsx-boolean-value': [ 'error', 'always' ], + 'react/jsx-closing-bracket-location': [ + 'error', + 'after-props' + ], + 'react/jsx-curly-spacing': [ + 'error', + 'always', + { + 'spacing': { + 'objectLiterals': 'never' + } + } + ], + 'react/jsx-equals-spacing': [ 'error', 'always' ], + 'react/jsx-filename-extension': 0, + 'react/jsx-first-prop-new-line': [ 'error', 'multiline' ], + 'react/jsx-handler-names': [ + 'error', + { + 'eventHandlerPrefix': '_on', + 'eventHandlerPropPrefix': 'on' + } + ], + 'react/jsx-indent': 2, + 'react/jsx-indent-props': 2, + 'react/jsx-key': 2, + 'react/jsx-max-props-per-line': 2, + 'react/jsx-no-bind': 2, + 'react/jsx-no-comment-textnodes': 2, + 'react/jsx-no-duplicate-props': 2, + 'react/jsx-no-literals': 0, + 'react/jsx-no-target-blank': 2, + 'react/jsx-no-undef': 2, + 'react/jsx-pascal-case': 2, + 'react/jsx-sort-props': 2, + 'react/jsx-space-before-closing': 2, + 'react/jsx-uses-react': 2, + 'react/jsx-uses-vars': 2, + 'react/jsx-wrap-multilines': 2, + + // React-Mative plugin rules group + 'react-native/no-color-literals': 2, + 'react-native/no-inline-styles': 2, + 'react-native/no-unused-styles': 2, + 'react-native/split-platform-components': 2 + } +}; diff --git a/react/.flowconfig b/react/.flowconfig new file mode 100644 index 0000000000..4bea710c10 --- /dev/null +++ b/react/.flowconfig @@ -0,0 +1,58 @@ +[ignore] + +# We fork some components by platform. +.*/*[.]android.js + +# Ignore templates with `@flow` in header +.*/local-cli/generator.* + +# Ignore malformed json +.*/node_modules/y18n/test/.*\.json + +# Ignore the website subdir +/website/.* + +# Ignore BUCK generated dirs +/\.buckd/ + +# Ignore unexpected extra @providesModule +.*/node_modules/commoner/test/source/widget/share.js + +# Ignore duplicate module providers +# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root +.*/Libraries/react-native/React.js +.*/Libraries/react-native/ReactNative.js +.*/node_modules/jest-runtime/build/__tests__/.* + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow +flow/ + +[options] +module.system=haste + +esproposal.class_static_fields=enable +esproposal.class_instance_fields=enable + +experimental.strict_type_args=true + +munge_underscores=true + +module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FixMe + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy + +unsafe.enable_getters_and_setters=true + +[version] +^0.30.0 diff --git a/react/.gitignore b/react/.gitignore new file mode 100644 index 0000000000..5d67a700cb --- /dev/null +++ b/react/.gitignore @@ -0,0 +1,44 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IJ +# +*.iml +.idea +.gradle +local.properties + +# node.js +# +node_modules/ +npm-debug.log + +# BUCK +# +buck-out/ +\.buckd/ +android/app/libs +android/keystores/debug.keystore + +dist/ diff --git a/react/.watchmanconfig b/react/.watchmanconfig new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/react/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/react/LICENSE b/react/LICENSE new file mode 100644 index 0000000000..da614295ec --- /dev/null +++ b/react/LICENSE @@ -0,0 +1,219 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +Note: + +This project was originally contributed to the community under the MIT license and with the following notice: + +The MIT License (MIT) + +Copyright (c) 2013 ESTOS GmbH +Copyright (c) 2013 BlueJimp SARL + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/react/README.md b/react/README.md new file mode 100644 index 0000000000..d540db8821 --- /dev/null +++ b/react/README.md @@ -0,0 +1,7 @@ +# jitsi-meet-react + +## Launching the App + +- For Android: `npm run start:android` +- For iOS: `npm run start:ios` +- For Web: `npm run start:web` diff --git a/react/android/app/BUCK b/react/android/app/BUCK new file mode 100644 index 0000000000..e865cc73a3 --- /dev/null +++ b/react/android/app/BUCK @@ -0,0 +1,66 @@ +import re + +# To learn about Buck see [Docs](https://buckbuild.com/). +# To run your application with Buck: +# - install Buck +# - `npm start` - to start the packager +# - `cd android` +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` +# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck +# - `buck install -r android/app` - compile, install and run application +# + +lib_deps = [] +for jarfile in glob(['libs/*.jar']): + name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) + lib_deps.append(':' + name) + prebuilt_jar( + name = name, + binary_jar = jarfile, + ) + +for aarfile in glob(['libs/*.aar']): + name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) + lib_deps.append(':' + name) + android_prebuilt_aar( + name = name, + aar = aarfile, + ) + +android_library( + name = 'all-libs', + exported_deps = lib_deps +) + +android_library( + name = 'app-code', + srcs = glob([ + 'src/main/java/**/*.java', + ]), + deps = [ + ':all-libs', + ':build_config', + ':res', + ], +) + +android_build_config( + name = 'build_config', + package = 'org.jitsi.jitsi_meet_react', +) + +android_resource( + name = 'res', + res = 'src/main/res', + package = 'org.jitsi.jitsi_meet_react', +) + +android_binary( + name = 'app', + package_type = 'debug', + manifest = 'src/main/AndroidManifest.xml', + keystore = '//android/keystores:debug', + deps = [ + ':app-code', + ], +) diff --git a/react/android/app/build.gradle b/react/android/app/build.gradle new file mode 100644 index 0000000000..51e9423373 --- /dev/null +++ b/react/android/app/build.gradle @@ -0,0 +1,154 @@ +apply plugin: "com.android.application" + +import com.android.build.OutputFile + +/** + * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets + * and bundleReleaseJsAndAssets). + * These basically call `react-native bundle` with the correct arguments during the Android build + * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the + * bundle directly from the development server. Below you can see all the possible configurations + * and their defaults. If you decide to add a configuration block, make sure to add it before the + * `apply from: "../../node_modules/react-native/react.gradle"` line. + * + * project.ext.react = [ + * // the name of the generated asset file containing your JS bundle + * bundleAssetName: "index.android.bundle", + * + * // the entry file for bundle generation + * entryFile: "index.android.js", + * + * // whether to bundle JS and assets in debug mode + * bundleInDebug: false, + * + * // whether to bundle JS and assets in release mode + * bundleInRelease: true, + * + * // whether to bundle JS and assets in another build variant (if configured). + * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants + * // The configuration property can be in the following formats + * // 'bundleIn${productFlavor}${buildType}' + * // 'bundleIn${buildType}' + * // bundleInFreeDebug: true, + * // bundleInPaidRelease: true, + * // bundleInBeta: true, + * + * // the root of your project, i.e. where "package.json" lives + * root: "../../", + * + * // where to put the JS bundle asset in debug mode + * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", + * + * // where to put the JS bundle asset in release mode + * jsBundleDirRelease: "$buildDir/intermediates/assets/release", + * + * // where to put drawable resources / React Native assets, e.g. the ones you use via + * // require('./image.png')), in debug mode + * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", + * + * // where to put drawable resources / React Native assets, e.g. the ones you use via + * // require('./image.png')), in release mode + * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", + * + * // by default the gradle tasks are skipped if none of the JS files or assets change; this means + * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to + * // date; if you have any other folders that you want to ignore for performance reasons (gradle + * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ + * // for example, you might want to remove it from here. + * inputExcludes: ["android/**", "ios/**"], + * + * // override which node gets called and with what additional arguments + * nodeExecutableAndArgs: ["node"] + * + * // supply additional arguments to the packager + * extraPackagerArgs: [] + * ] + */ + +apply from: "../../node_modules/react-native/react.gradle" + +/** + * Set this to true to create two separate APKs instead of one: + * - An APK that only works on ARM devices + * - An APK that only works on x86 devices + * The advantage is the size of the APK is reduced by about 4MB. + * Upload all the APKs to the Play Store and people will download + * the correct one based on the CPU architecture of their device. + */ +def enableSeparateBuildPerCPUArchitecture = false + +/** + * Run Proguard to shrink the Java bytecode in release builds. + */ +def enableProguardInReleaseBuilds = false + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.1" + + defaultConfig { + applicationId "org.jitsi.jitsi_meet_react" + minSdkVersion 16 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + ndk { + abiFilters "armeabi-v7a", "x86" + } + packagingOptions { + // The project react-native does not provide 64-bit binaries at the + // time of this writing. Unfortunately, packaging any 64-bit + // binaries into the .apk will crash the app at runtime on 64-bit + // platforms. + exclude "lib/x86_64/libjingle_peerconnection_so.so" + exclude "lib/arm64-v8a/libjingle_peerconnection_so.so" + } + } + splits { + abi { + reset() + enable enableSeparateBuildPerCPUArchitecture + universalApk false // If true, also generate a universal APK + include "armeabi-v7a", "x86" + } + } + buildTypes { + release { + minifyEnabled enableProguardInReleaseBuilds + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + } + } + // applicationVariants are e.g. debug, release + applicationVariants.all { variant -> + variant.outputs.each { output -> + // For each separate APK per architecture, set a unique version code as described here: + // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits + def versionCodes = ["armeabi-v7a":1, "x86":2] + def abi = output.getFilter(OutputFile.ABI) + if (abi != null) { // null for the universal-debug, universal-release variants + output.versionCodeOverride = + versionCodes.get(abi) * 1048576 + defaultConfig.versionCode + } + } + } +} + +if (project.hasProperty("JITSI_SIGNING") + && new File(project.property("JITSI_SIGNING")).exists()) { + apply from: project.property("JITSI_SIGNING"); +} + +dependencies { + compile project(':react-native-vector-icons') + compile project(':react-native-webrtc') + compile fileTree(dir: "libs", include: ["*.jar"]) + compile "com.android.support:appcompat-v7:23.0.1" + compile "com.facebook.react:react-native:+" // From node_modules +} + +// Run this once to be able to run the application with BUCK +// puts all compile dependencies into folder libs for BUCK to use +task copyDownloadableDepsToLibs(type: Copy) { + from configurations.compile + into 'libs' +} diff --git a/react/android/app/proguard-rules.pro b/react/android/app/proguard-rules.pro new file mode 100644 index 0000000000..48361a9015 --- /dev/null +++ b/react/android/app/proguard-rules.pro @@ -0,0 +1,66 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Disabling obfuscation is useful if you collect stack traces from production crashes +# (unless you are using a system that supports de-obfuscate the stack traces). +-dontobfuscate + +# React Native + +# Keep our interfaces so they can be used by other ProGuard rules. +# See http://sourceforge.net/p/proguard/bugs/466/ +-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip +-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters +-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip + +# Do not strip any method/class that is annotated with @DoNotStrip +-keep @com.facebook.proguard.annotations.DoNotStrip class * +-keep @com.facebook.common.internal.DoNotStrip class * +-keepclassmembers class * { + @com.facebook.proguard.annotations.DoNotStrip *; + @com.facebook.common.internal.DoNotStrip *; +} + +-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { + void set*(***); + *** get*(); +} + +-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } +-keep class * extends com.facebook.react.bridge.NativeModule { *; } +-keepclassmembers,includedescriptorclasses class * { native ; } +-keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } + +-dontwarn com.facebook.react.** + +# okhttp + +-keepattributes Signature +-keepattributes *Annotation* +-keep class okhttp3.** { *; } +-keep interface okhttp3.** { *; } +-dontwarn okhttp3.** + +# okio + +-keep class sun.misc.Unsafe { *; } +-dontwarn java.nio.file.* +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement +-dontwarn okio.** diff --git a/react/android/app/src/main/AndroidManifest.xml b/react/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..fbb444f1e3 --- /dev/null +++ b/react/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/react/android/app/src/main/assets/fonts/FontAwesome.ttf b/react/android/app/src/main/assets/fonts/FontAwesome.ttf new file mode 100644 index 0000000000..f221e50a2e Binary files /dev/null and b/react/android/app/src/main/assets/fonts/FontAwesome.ttf differ diff --git a/react/android/app/src/main/java/org/jitsi/jitsi_meet_react/MainActivity.java b/react/android/app/src/main/java/org/jitsi/jitsi_meet_react/MainActivity.java new file mode 100644 index 0000000000..91320516c8 --- /dev/null +++ b/react/android/app/src/main/java/org/jitsi/jitsi_meet_react/MainActivity.java @@ -0,0 +1,46 @@ +package org.jitsi.jitsi_meet_react; + +import com.facebook.react.ReactActivity; +import com.facebook.react.ReactActivityDelegate; +import com.facebook.react.ReactRootView; + +public class MainActivity extends ReactActivity { + /** + * {@inheritDoc} + * + * Overrides {@link ReactActivity#createRootActivityDelegate()} to customize + * the {@link ReactRootView} with a background color that is in accord with + * the JavaScript and iOS parts of the application and causes less perceived + * visual flicker than the default background color. + */ + @Override + protected ReactActivityDelegate createReactActivityDelegate() { + return new ReactActivityDelegate(this, getMainComponentName()) { + /** + * {@inheritDoc} + * + * Overrides {@link ReactActivityDelegate#createRootView()} to + * customize the {@link ReactRootView} with a background color that + * is in accord with the JavaScript and iOS parts of the application + * and causes less perceived visual flicker than the default + * background color. + */ + @Override + protected ReactRootView createRootView() { + ReactRootView rootView = super.createRootView(); + + rootView.setBackgroundColor(0xFF111111); + return rootView; + } + }; + } + + /** + * Returns the name of the main component registered from JavaScript. + * This is used to schedule rendering of the component. + */ + @Override + protected String getMainComponentName() { + return "App"; + } +} diff --git a/react/android/app/src/main/java/org/jitsi/jitsi_meet_react/MainApplication.java b/react/android/app/src/main/java/org/jitsi/jitsi_meet_react/MainApplication.java new file mode 100644 index 0000000000..c7c53d1938 --- /dev/null +++ b/react/android/app/src/main/java/org/jitsi/jitsi_meet_react/MainApplication.java @@ -0,0 +1,39 @@ +package org.jitsi.jitsi_meet_react; + +import android.app.Application; +import android.util.Log; + +import com.facebook.react.ReactApplication; +import com.facebook.react.ReactInstanceManager; +import com.facebook.react.ReactNativeHost; +import com.facebook.react.ReactPackage; +import com.facebook.react.shell.MainReactPackage; +import com.oblador.vectoricons.VectorIconsPackage; +import com.oney.WebRTCModule.WebRTCModulePackage; + +import java.util.Arrays; +import java.util.List; + +public class MainApplication extends Application implements ReactApplication { + + private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { + @Override + protected boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + protected List getPackages() { + return Arrays.asList( + new MainReactPackage(), + new VectorIconsPackage(), + new WebRTCModulePackage() + ); + } + }; + + @Override + public ReactNativeHost getReactNativeHost() { + return mReactNativeHost; + } +} diff --git a/react/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/react/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..cde69bccce Binary files /dev/null and b/react/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/react/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/react/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..c133a0cbd3 Binary files /dev/null and b/react/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/react/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/react/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..bfa42f0e7b Binary files /dev/null and b/react/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/react/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/react/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..324e72cdd7 Binary files /dev/null and b/react/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/react/android/app/src/main/res/values/strings.xml b/react/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000..ebde5be0ca --- /dev/null +++ b/react/android/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Jitsi Meet + diff --git a/react/android/app/src/main/res/values/styles.xml b/react/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000..319eb0ca10 --- /dev/null +++ b/react/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/react/android/build.gradle b/react/android/build.gradle new file mode 100644 index 0000000000..fcba4c587f --- /dev/null +++ b/react/android/build.gradle @@ -0,0 +1,24 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.3.1' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + mavenLocal() + jcenter() + maven { + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm + url "$rootDir/../node_modules/react-native/android" + } + } +} diff --git a/react/android/gradle.properties b/react/android/gradle.properties new file mode 100644 index 0000000000..1fd964e90b --- /dev/null +++ b/react/android/gradle.properties @@ -0,0 +1,20 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true + +android.useDeprecatedNdk=true diff --git a/react/android/gradle/wrapper/gradle-wrapper.jar b/react/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..b5166dad4d Binary files /dev/null and b/react/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/react/android/gradle/wrapper/gradle-wrapper.properties b/react/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..b9fbfaba0e --- /dev/null +++ b/react/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip diff --git a/react/android/gradlew b/react/android/gradlew new file mode 100755 index 0000000000..91a7e269e1 --- /dev/null +++ b/react/android/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/react/android/gradlew.bat b/react/android/gradlew.bat new file mode 100644 index 0000000000..aec99730b4 --- /dev/null +++ b/react/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/react/android/keystores/BUCK b/react/android/keystores/BUCK new file mode 100644 index 0000000000..15da20e6b9 --- /dev/null +++ b/react/android/keystores/BUCK @@ -0,0 +1,8 @@ +keystore( + name = 'debug', + store = 'debug.keystore', + properties = 'debug.keystore.properties', + visibility = [ + 'PUBLIC', + ], +) diff --git a/react/android/keystores/debug.keystore.properties b/react/android/keystores/debug.keystore.properties new file mode 100644 index 0000000000..121bfb49f0 --- /dev/null +++ b/react/android/keystores/debug.keystore.properties @@ -0,0 +1,4 @@ +key.store=debug.keystore +key.alias=androiddebugkey +key.store.password=android +key.alias.password=android diff --git a/react/android/settings.gradle b/react/android/settings.gradle new file mode 100644 index 0000000000..8e74fe8141 --- /dev/null +++ b/react/android/settings.gradle @@ -0,0 +1,7 @@ +rootProject.name = 'jitsi-meet-react' + +include ':app' +include ':react-native-vector-icons' +project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') +include ':react-native-webrtc' +project(':react-native-webrtc').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webrtc/android') diff --git a/react/config.js b/react/config.js new file mode 100644 index 0000000000..2097ed6231 --- /dev/null +++ b/react/config.js @@ -0,0 +1,4 @@ +/* global config */ + +// For legacy reasons, use jitsi-meet's global variable config. +export default typeof config === 'object' ? config : undefined; diff --git a/react/debian/changelog b/react/debian/changelog new file mode 100644 index 0000000000..d8313f8b1b --- /dev/null +++ b/react/debian/changelog @@ -0,0 +1,5 @@ +jitsi-meet-react (1.0.1-1) unstable; urgency=low + + * Initial release. + + -- Damian Minkov Wed, 13 Jul 2016 15:32:41 +0000 diff --git a/react/debian/compat b/react/debian/compat new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/react/debian/compat @@ -0,0 +1 @@ +8 diff --git a/react/debian/config.js b/react/debian/config.js new file mode 100644 index 0000000000..5737c3dfc3 --- /dev/null +++ b/react/debian/config.js @@ -0,0 +1,73 @@ +/* jshint -W101 */ +var config = { +// configLocation: './config.json', // see ./modules/HttpConfigFetch.js + hosts: { + domain: 'jitsi-meet.example.com', + //anonymousdomain: 'guest.example.com', + //authdomain: 'jitsi-meet.example.com', // defaults to + muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030 + //jirecon: 'jirecon.jitsi-meet.example.com', + //call_control: 'callcontrol.jitsi-meet.example.com', + //focus: 'focus.jitsi-meet.example.com', // defaults to 'focus.jitsi-meet.example.com' + }, +// getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; }, +// useStunTurn: true, // use XEP-0215 to fetch STUN and TURN server +// useIPv6: true, // ipv6 support. use at your own risk + useNicks: false, + bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that + clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza + //focusUserJid: 'focus@auth.jitsi-meet.example.com', // The real JID of focus participant - can be overridden here + //defaultSipNumber: '', // Default SIP number + + // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable. + desktopSharingChromeMethod: 'ext', + // The ID of the jidesha extension for Chrome. + desktopSharingChromeExtId: 'diibjkoicjeejcmhdnailmkgecihlobk', + // The media sources to use when using screen sharing with the Chrome + // extension. + desktopSharingChromeSources: ['screen', 'window'], + // Required version of Chrome extension + desktopSharingChromeMinExtVersion: '0.1', + + // The ID of the jidesha extension for Firefox. If null, we assume that no + // extension is required. + desktopSharingFirefoxExtId: null, + // Whether desktop sharing should be disabled on Firefox. + desktopSharingFirefoxDisabled: true, + // The maximum version of Firefox which requires a jidesha extension. + // Example: if set to 41, we will require the extension for Firefox versions + // up to and including 41. On Firefox 42 and higher, we will run without the + // extension. + // If set to -1, an extension will be required for all versions of Firefox. + desktopSharingFirefoxMaxVersionExtRequired: -1, + // The URL to the Firefox extension for desktop sharing. + desktopSharingFirefoxExtensionURL: null, + + // Disables ICE/UDP by filtering out local and remote UDP candidates in signalling. + webrtcIceUdpDisable: false, + // Disables ICE/TCP by filtering out local and remote TCP candidates in signalling. + webrtcIceTcpDisable: false, + + openSctp: true, // Toggle to enable/disable SCTP channels + disableStats: false, + disableAudioLevels: false, + channelLastN: -1, // The default value of the channel attribute last-n. + adaptiveLastN: false, + //disableAdaptiveSimulcast: false, + enableRecording: false, + enableWelcomePage: true, + disableSimulcast: false, + logStats: false, // Enable logging of PeerConnection stats via the focus +// requireDisplayName: true, // Forces the participants that doesn't have display name to enter it when they enter the room. +// startAudioMuted: 10, // every participant after the Nth will start audio muted +// startVideoMuted: 10, // every participant after the Nth will start video muted +// defaultLanguage: "en", +// To enable sending statistics to callstats.io you should provide Applicaiton ID and Secret. +// callStatsID: "", // Application ID for callstats.io API +// callStatsSecret: "", // Secret for callstats.io API + /*noticeMessage: 'Service update is scheduled for 16th March 2015. ' + + 'During that time service will not be available. ' + + 'Apologise for inconvenience.',*/ + disableThirdPartyRequests: false, + minHDHeight: 540 +}; diff --git a/react/debian/control b/react/debian/control new file mode 100644 index 0000000000..5bdfbed8f0 --- /dev/null +++ b/react/debian/control @@ -0,0 +1,20 @@ +Source: jitsi-meet-react +Section: net +Priority: extra +Maintainer: Jitsi Team +Uploaders: Emil Ivov , Damian Minkov +Build-Depends: debhelper (>= 8.0.0) +Standards-Version: 3.9.6 +Homepage: https://jitsi.org/meet + +Package: jitsi-meet-react +Architecture: all +Depends: ${misc:Depends}, jitsi-videobridge, jitsi-meet-prosody, + openjdk-8-jre-headless | nginx +Description: WebRTC JavaScript video conferences + Jitsi Meet is a WebRTC JavaScript application that uses Jitsi + Videobridge to provide high quality, scalable video conferences. + . + It is a web interface to Jitsi Videobridge for audio and video + forwarding and relaying, configured to work with jetty instance + running embedded into Jitsi Videobridge diff --git a/react/debian/copyright b/react/debian/copyright new file mode 100644 index 0000000000..487ae98f41 --- /dev/null +++ b/react/debian/copyright @@ -0,0 +1,13 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: Jitsi Meet +Upstream-Contact: Emil Ivov +Source: https://github.com/jitsi/jitsi-meet-react + +Files: * +Copyright: 2015 Atlassian Pty Ltd +License: Apache-2.0 + +License: Apache-2.0 +On Debian systems, the full text of the Apache + License version 2 can be found in the file + '/usr/share/common-licenses/Apache-2.0'. diff --git a/react/debian/jitsi-meet-react.README b/react/debian/jitsi-meet-react.README new file mode 100644 index 0000000000..07d38a68ce --- /dev/null +++ b/react/debian/jitsi-meet-react.README @@ -0,0 +1,10 @@ +Jitsi Meet + +==== + +A WebRTC-powered multi-user videochat. + +Powered by the jitsi-videobridge[0] + + +[0] https://github.com/jitsi/jitsi-videobridge diff --git a/react/debian/jitsi-meet-react.README.Debian b/react/debian/jitsi-meet-react.README.Debian new file mode 100644 index 0000000000..e79c133d2e --- /dev/null +++ b/react/debian/jitsi-meet-react.README.Debian @@ -0,0 +1,8 @@ +Jitsi Meet for Debian +---------------------------- + +This is a WebRTC frontend of the video conferencing tool Jitsi Meet. It depends on the +jitsi-videobridge package, which is a SFU (Selective Forwarding Unit) and both packages +are designed to work together. + + -- Yasen Pramatarov Mon, 30 Jun 2014 23:05:18 +0100 diff --git a/react/debian/jitsi-meet-react.config b/react/debian/jitsi-meet-react.config new file mode 100644 index 0000000000..4b5aa24e89 --- /dev/null +++ b/react/debian/jitsi-meet-react.config @@ -0,0 +1,8 @@ +#!/bin/sh -e + +# Source debconf library. +. /usr/share/debconf/confmodule + +# certificate type choice +db_input critical jitsi-meet/cert-choice || true +db_go diff --git a/react/debian/jitsi-meet-react.dirs b/react/debian/jitsi-meet-react.dirs new file mode 100644 index 0000000000..0bb2ab3e5d --- /dev/null +++ b/react/debian/jitsi-meet-react.dirs @@ -0,0 +1 @@ +etc/jitsi/meet/ diff --git a/react/debian/jitsi-meet-react.docs b/react/debian/jitsi-meet-react.docs new file mode 100644 index 0000000000..f68b10fb55 --- /dev/null +++ b/react/debian/jitsi-meet-react.docs @@ -0,0 +1,4 @@ +README.md +debian/jitsi-meet.example +debian/jitsi-meet-react.README +debian/config.js diff --git a/react/debian/jitsi-meet-react.install b/react/debian/jitsi-meet-react.install new file mode 100644 index 0000000000..a11fb4ac68 --- /dev/null +++ b/react/debian/jitsi-meet-react.install @@ -0,0 +1 @@ +dist/* /usr/share/jitsi-meet-react diff --git a/react/debian/jitsi-meet-react.postinst b/react/debian/jitsi-meet-react.postinst new file mode 100644 index 0000000000..368a702b8a --- /dev/null +++ b/react/debian/jitsi-meet-react.postinst @@ -0,0 +1,200 @@ +#!/bin/bash +# postinst script for jitsi-meet +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +case "$1" in + configure) + + JVB_ETC_CONFIG="/etc/jitsi/videobridge/config" + + . $JVB_ETC_CONFIG + + # loading debconf + . /usr/share/debconf/confmodule + + # detect dpkg-reconfigure + RECONFIGURING="false" + db_get jitsi-meet/jvb-hostname + JVB_HOSTNAME_OLD=$RET + if [ -n "$RET" ] && [ ! "$JVB_HOSTNAME_OLD" = "$JVB_HOSTNAME" ] ; then + RECONFIGURING="true" + rm -f /etc/jitsi/meet/$JVB_HOSTNAME_OLD-config.js + fi + + JVB_SERVE="false" + db_get jitsi-meet/jvb-serve + if [ -n "$RET" ] && [ "$RET" = "true" ] ; then + JVB_SERVE="true" + fi + + # stores the hostname so we will reuse it later, like in purge + db_set jitsi-meet/jvb-hostname $JVB_HOSTNAME + + NGINX_INSTALL_CHECK="$(dpkg-query -f '${Status}' -W 'nginx' 2>/dev/null | awk '{print $3}' || true)" + if [ "$NGINX_INSTALL_CHECK" = "installed" ] || [ "$NGINX_INSTALL_CHECK" = "unpacked" ] ; then + FORCE_NGINX="true" + fi + + # SSL for nginx + db_get jitsi-meet/cert-choice + CERT_CHOICE="$RET" + UPLOADED_CERT_CHOICE="A certificate is available and the files are uploaded on the server" + + # jitsi meet + JITSI_MEET_CONFIG="/etc/jitsi/meet/$JVB_HOSTNAME-config.js" + if [ ! -f $JITSI_MEET_CONFIG ] ; then + cp /usr/share/doc/jitsi-meet-react/config.js $JITSI_MEET_CONFIG + sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" $JITSI_MEET_CONFIG + fi + + # this is new install let's configure jvb to serve meet + if [[ -z $FORCE_NGINX && ( -z $JVB_HOSTNAME_OLD || "$JVB_SERVE" = "true" ) ]] ; then + + JVB_CONFIG="/etc/jitsi/videobridge/sip-communicator.properties" + + # this is a reconfigure, lets just delete old links + if [ "$RECONFIGURING" = "true" ] ; then + rm -f $JVB_CONFIG + fi + + # we will write to the file if missing create it + if [ ! -f $JVB_CONFIG ] ; then + touch $JVB_CONFIG + fi + + # configure jvb + echo "AUTHBIND=yes" >> $JVB_ETC_CONFIG + sed -i "s/JVB_OPTS=.*/JVB_OPTS=--apis=rest,xmpp/g" $JVB_ETC_CONFIG + + echo "org.jitsi.videobridge.rest.jetty.host=::" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.port=443" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.ProxyServlet.hostHeader=$JVB_HOSTNAME" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.ProxyServlet.pathSpec=/http-bind" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.ProxyServlet.proxyTo=http://localhost:5280/http-bind" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.ResourceHandler.resourceBase=/usr/share/jitsi-meet-react" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.ResourceHandler.alias./config.js=/etc/jitsi/meet/$JVB_HOSTNAME-config.js" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.RewriteHandler.regex=^/([a-zA-Z0-9]+)$" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.RewriteHandler.replacement=/" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.SSIResourceHandler.paths=/" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.tls.port=443" >> $JVB_CONFIG + echo "org.jitsi.videobridge.TCP_HARVESTER_PORT=443" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.sslContextFactory.keyStorePath=/etc/jitsi/videobridge/$JVB_HOSTNAME.jks" >> $JVB_CONFIG + echo "org.jitsi.videobridge.rest.jetty.sslContextFactory.keyStorePassword=changeit" >> $JVB_CONFIG + + # configure authbind to allow jvb to bind to privileged ports + OWNER=$(stat -c '%U' /usr/share/jitsi-videobridge) + GROUP=$(stat -c '%G' /usr/share/jitsi-videobridge) + JVB_UID="`id -u $OWNER`" + if [ ! -f "/etc/authbind/byport/443" ] ; then + if [ ! -d "/etc/authbind/byport" ] ; then + mkdir -p /etc/authbind/byport + chmod 755 /etc/authbind + chmod 755 /etc/authbind/byport + fi + touch /etc/authbind/byport/443 + chown $OWNER /etc/authbind/byport/443 + chmod 755 /etc/authbind/byport/443 + fi + + if [ "$CERT_CHOICE" = "$UPLOADED_CERT_CHOICE" ] ; then + # create jks from uploaded certs + openssl pkcs12 -export \ + -in /etc/ssl/$JVB_HOSTNAME.crt \ + -inkey /etc/ssl/$JVB_HOSTNAME.key \ + -passout pass:changeit > /etc/jitsi/videobridge/$JVB_HOSTNAME.p12 + keytool -importkeystore \ + -srckeystore /etc/jitsi/videobridge/$JVB_HOSTNAME.p12 \ + -destkeystore /etc/jitsi/videobridge/$JVB_HOSTNAME.jks \ + -srcstoretype pkcs12 \ + -noprompt -storepass changeit -srcstorepass changeit + else + # create jks from self-signed certs + openssl pkcs12 -export \ + -in /var/lib/prosody/$JVB_HOSTNAME.crt \ + -inkey /var/lib/prosody/$JVB_HOSTNAME.key \ + -passout pass:changeit > /etc/jitsi/videobridge/$JVB_HOSTNAME.p12 + keytool -importkeystore \ + -srckeystore /etc/jitsi/videobridge/$JVB_HOSTNAME.p12 \ + -destkeystore /etc/jitsi/videobridge/$JVB_HOSTNAME.jks \ + -srcstoretype pkcs12 \ + -noprompt -storepass changeit -srcstorepass changeit + fi + + db_set jitsi-meet/jvb-serve "true" + + invoke-rc.d jitsi-videobridge restart + elif [[ "$FORCE_NGINX" = "true" || ( -n $JVB_HOSTNAME_OLD && "$JVB_SERVE" = "false" ) ]] ; then + # this is a reconfigure, lets just delete old links + if [ "$RECONFIGURING" = "true" ] ; then + rm -f /etc/nginx/sites-enabled/$JVB_HOSTNAME_OLD.conf + rm -f /etc/jitsi/meet/$JVB_HOSTNAME_OLD-config.js + fi + + # nginx conf + if [ ! -f /etc/nginx/sites-available/$JVB_HOSTNAME.conf ] ; then + cp /usr/share/doc/jitsi-meet-react/jitsi-meet.example /etc/nginx/sites-available/$JVB_HOSTNAME.conf + if [ ! -f /etc/nginx/sites-enabled/$JVB_HOSTNAME.conf ] ; then + ln -s /etc/nginx/sites-available/$JVB_HOSTNAME.conf /etc/nginx/sites-enabled/$JVB_HOSTNAME.conf + fi + sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" /etc/nginx/sites-available/$JVB_HOSTNAME.conf + fi + + if [ "$CERT_CHOICE" = "$UPLOADED_CERT_CHOICE" ] ; then + db_set jitsi-meet/cert-path-key "/etc/ssl/$JVB_HOSTNAME.key" + db_input critical jitsi-meet/cert-path-key || true + db_go + db_get jitsi-meet/cert-path-key + CERT_KEY="$RET" + db_set jitsi-meet/cert-path-crt "/etc/ssl/$JVB_HOSTNAME.crt" + db_input critical jitsi-meet/cert-path-crt || true + db_go + db_get jitsi-meet/cert-path-crt + CERT_CRT="$RET" + # replace self-signed certificate paths with user provided ones + CERT_KEY_ESC=$(echo $CERT_KEY | sed 's/\./\\\./g') + CERT_KEY_ESC=$(echo $CERT_KEY_ESC | sed 's/\//\\\//g') + sed -i "s/ssl_certificate_key\ \/var\/lib\/prosody\/.*key/ssl_certificate_key\ $CERT_KEY_ESC/g" \ + /etc/nginx/sites-available/$JVB_HOSTNAME.conf + CERT_CRT_ESC=$(echo $CERT_CRT | sed 's/\./\\\./g') + CERT_CRT_ESC=$(echo $CERT_CRT_ESC | sed 's/\//\\\//g') + sed -i "s/ssl_certificate\ \/var\/lib\/prosody\/.*crt/ssl_certificate\ $CERT_CRT_ESC/g" \ + /etc/nginx/sites-available/$JVB_HOSTNAME.conf + fi + + invoke-rc.d nginx reload + fi + + # and we're done with debconf + db_stop + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/react/debian/jitsi-meet-react.postrm b/react/debian/jitsi-meet-react.postrm new file mode 100644 index 0000000000..807dc38cbd --- /dev/null +++ b/react/debian/jitsi-meet-react.postrm @@ -0,0 +1,58 @@ +#!/bin/sh +# postrm script for jitsi-meet +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +# Load debconf +. /usr/share/debconf/confmodule + + +case "$1" in + remove) + if [ -x "/etc/init.d/nginx" ]; then + invoke-rc.d nginx reload + fi + ;; + purge) + db_get jitsi-meet/jvb-hostname + JVB_HOSTNAME=$RET + if [ -n "$RET" ]; then + rm -f /etc/jitsi/meet/$JVB_HOSTNAME-config.js + rm -f /etc/nginx/sites-available/$JVB_HOSTNAME.conf + rm -f /etc/nginx/sites-enabled/$JVB_HOSTNAME.conf + rm -f /etc/jitsi/videobridge/$JVB_HOSTNAME.jks + rm -f /etc/jitsi/videobridge/$JVB_HOSTNAME.p12 + fi + ;; + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +db_stop + +exit 0 diff --git a/react/debian/jitsi-meet-react.templates b/react/debian/jitsi-meet-react.templates new file mode 100644 index 0000000000..32050feef0 --- /dev/null +++ b/react/debian/jitsi-meet-react.templates @@ -0,0 +1,32 @@ +Template: jitsi-meet/cert-choice +Type: select +__Choices: Self-signed certificate will be generated, A certificate is available and the files are uploaded on the server +_Description: SSL certificate for the Jitsi Meet instance + Jitsi Meet is best to be set up with an SSL certificate. + Having no certificate, a self-signed one will be generated. + Having a certificate signed by a recognised CA, it can be uploaded on the server + and point its location. The default filenames will be /etc/ssl/--domain.name--.key + for the key and /etc/ssl/--domain.name--.crt for the certificate. + +Template: jitsi-meet/cert-path-key +Type: string +_Description: Full local server path to the SSL key file: + The full path to the SSL key file on the server. + If it has not been uploaded, now is a good time to do so. + +Template: jitsi-meet/cert-path-crt +Type: string +_Description: Full local server path to the SSL certificate file: + The full path to the SSL certificate file on the server. + If you haven't uploaded it, now is a good time to upload it in another console. + +Template: jitsi-meet/jvb-hostname +Type: string +_Description: The hostname of the current installation: + The value for the hostname that is set in Jitsi Videobridge installation. + +Template: jitsi-meet/jvb-serve +Type: boolean +Default: false +_Description: for internal use + for internal use. diff --git a/react/debian/jitsi-meet.example b/react/debian/jitsi-meet.example new file mode 100644 index 0000000000..4c35649d89 --- /dev/null +++ b/react/debian/jitsi-meet.example @@ -0,0 +1,42 @@ +server_names_hash_bucket_size 64; + +server { + listen 80; + server_name jitsi-meet.example.com; + return 301 https://$host$request_uri; +} +server { + listen 443 ssl; + server_name jitsi-meet.example.com; + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA256:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EDH+aRSA+AESGCM:EDH+aRSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!MEDIUM:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED"; + + add_header Strict-Transport-Security "max-age=31536000"; + + ssl_certificate /var/lib/prosody/jitsi-meet.example.com.crt; + ssl_certificate_key /var/lib/prosody/jitsi-meet.example.com.key; + + root /usr/share/jitsi-meet-react; + index index.html index.htm; + + location /config.js { + alias /etc/jitsi/meet/jitsi-meet.example.com-config.js; + } + + location ~ ^/([a-zA-Z0-9=\?]+)$ { + rewrite ^/(.*)$ / break; + } + + location / { + ssi on; + } + + # BOSH + location /http-bind { + proxy_pass http://localhost:5280/http-bind; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $http_host; + } +} diff --git a/react/debian/po/POTFILES.in b/react/debian/po/POTFILES.in new file mode 100644 index 0000000000..3458b92cfa --- /dev/null +++ b/react/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] jitsi-meet.templates diff --git a/react/debian/po/templates.pot b/react/debian/po/templates.pot new file mode 100644 index 0000000000..d3933e7302 --- /dev/null +++ b/react/debian/po/templates.pot @@ -0,0 +1,98 @@ +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: jitsi-meet\n" +"Report-Msgid-Bugs-To: jitsi-meet@packages.debian.org\n" +"POT-Creation-Date: 2014-09-03 17:26+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: select +#. Choices +#: ../jitsi-meet.templates:1001 +msgid "Self-signed certificate will be generated" +msgstr "" + +#. Type: select +#. Choices +#: ../jitsi-meet.templates:1001 +msgid "A certificate is available and the files are uploaded on the server" +msgstr "" + +#. Type: select +#. Description +#: ../jitsi-meet.templates:1002 +msgid "SSL certificate for the Jitsi Meet instance" +msgstr "" + +#. Type: select +#. Description +#: ../jitsi-meet.templates:1002 +msgid "" +"Jitsi Meet is best to be set up with an SSL certificate. Having no " +"certificate, a self-signed one will be generated. Having a certificate " +"signed by a recognised CA, it can be uploaded on the server and point its " +"location. The default filenames will be /etc/ssl/--domain.name--.key for the " +"key and /etc/ssl/--domain.name--.crt for the certificate." +msgstr "" + +#. Type: string +#. Description +#: ../jitsi-meet.templates:2001 +msgid "Full local server path to the SSL key file:" +msgstr "" + +#. Type: string +#. Description +#: ../jitsi-meet.templates:2001 +msgid "" +"The full path to the SSL key file on the server. If it has not been " +"uploaded, now is a good time to do so." +msgstr "" + +#. Type: string +#. Description +#: ../jitsi-meet.templates:3001 +msgid "Full local server path to the SSL certificate file:" +msgstr "" + +#. Type: string +#. Description +#: ../jitsi-meet.templates:3001 +msgid "" +"The full path to the SSL certificate file on the server. If you haven't " +"uploaded it, now is a good time to upload it in another console." +msgstr "" + +#. Type: string +#. Description +#: ../jitsi-meet.templates:4001 +msgid "The hostname of the current installation:" +msgstr "" + +#. Type: string +#. Description +#: ../jitsi-meet.templates:4001 +msgid "" +"The value for the hostname that is set in Jitsi Videobridge installation." +msgstr "" + + +#. Type: string +#. Description +#: ../jitsi-meet.templates:5001 +msgid "for internal use" +msgstr "" + +#. Type: string +#. Description +#: ../jitsi-meet.templates:5001 +msgid "" +"Jitsi Videobridge installation can use its internal jetty to serve static meet pages." +msgstr "" diff --git a/react/debian/rules b/react/debian/rules new file mode 100755 index 0000000000..d430dd2fa8 --- /dev/null +++ b/react/debian/rules @@ -0,0 +1,14 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ + +# we skip making Makefile exists for updating browserify modules when developing +override_dh_auto_build: + +override_dh_install: + dh_installdirs + dh_install -X/config.js -X/package.json diff --git a/react/debian/source/format b/react/debian/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/react/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/react/doc/coding-style.md b/react/doc/coding-style.md new file mode 100644 index 0000000000..161f84d237 --- /dev/null +++ b/react/doc/coding-style.md @@ -0,0 +1,84 @@ +# Comments + +* Comments documenting the source code are required. + + * Comments from which documentation is automatically generated are **not** + subject to case-by-case decisions. Such comments are used, for example, on + types and their members. Examples of tools which automatically generate + documentation from such comments include JSDoc, Javadoc, Doxygen. + + * Comments which are not automatically processed are strongly encouraged. They + are subject to case-by-case decisions. Such comments are often observed in + function bodies. + +* Comments should be formatted as proper English sentences. Such formatting pays + attention to, for example, capitalization and punctuation. + +# Duplication + +* Don't copy-paste source code. Reuse it. + +# Formatting + +* Line length is limited to 80 characters. + +* Sort by alphabetical order in order to make the addition of new entities as + easy as looking a word up in a dictionary. Otherwise, one risks duplicate + entries (with conflicting values in the cases of key-value pairs). For + example: + + * Within an `import` of multiple names from a module, sort the names in + alphabetical order. (Of course, the default name stays first as required by + the `import` syntax.) + + ````javascript + import { + DOMINANT_SPEAKER_CHANGED, + JITSI_CLIENT_CONNECTED, + JITSI_CLIENT_CREATED, + JITSI_CLIENT_DISCONNECTED, + JITSI_CLIENT_ERROR, + JITSI_CONFERENCE_JOINED, + MODERATOR_CHANGED, + PEER_JOINED, + PEER_LEFT, + RTC_ERROR + } from './actionTypes'; + ```` + + * Within a group of imports (e.g. groups of imports delimited by an empty line + may be: third-party modules, then project modules, and eventually the + private files of a module), sort the module names in alphabetical order. + + ````javascript + import React, { Component } from 'react'; + import { connect } from 'react-redux'; + ```` + +# Indentation + +* Align `switch` and `case`/`default`. Don't indent the `case`/`default` more + than its `switch`. + + ````javascript + switch (i) { + case 0: + ... + break; + default: + ... + } + ```` + +# Naming + +* An abstraction should have one name within the project and across multiple + projects. For example: + + * The instance of lib-jitsi-meet's `JitsiConnection` type should be named + `connection` or `jitsiConnection` in jitsi-meet-react, not `client`. + + * The class `ReducerRegistry` should be defined in ReducerRegistry.js and its + imports in other files should use the same name. Don't define the class + `Registry` in ReducerRegistry.js and then import it as `Reducers` in other + files. diff --git a/react/favicon.ico b/react/favicon.ico new file mode 100644 index 0000000000..bb34caf1ff Binary files /dev/null and b/react/favicon.ico differ diff --git a/react/features/app/actionTypes.js b/react/features/app/actionTypes.js new file mode 100644 index 0000000000..55567ef7f5 --- /dev/null +++ b/react/features/app/actionTypes.js @@ -0,0 +1,21 @@ +/** + * The type of the actions which signals that a specific App will mount (in the + * terms of React). + * + * { + * type: APP_WILL_MOUNT, + * app: App + * } + */ +export const APP_WILL_MOUNT = 'APP_WILL_MOUNT'; + +/** + * The type of the actions which signals that a specific App will unmount (in + * the terms of React). + * + * { + * type: APP_WILL_UNMOUNT, + * app: App + * } + */ +export const APP_WILL_UNMOUNT = 'APP_WILL_UNMOUNT'; diff --git a/react/features/app/actions.js b/react/features/app/actions.js new file mode 100644 index 0000000000..c0f030b9ce --- /dev/null +++ b/react/features/app/actions.js @@ -0,0 +1,135 @@ +import { setRoom } from '../base/conference'; +import { + getDomain, + setDomain +} from '../base/connection'; +import { + loadConfig, + setConfig +} from '../base/lib-jitsi-meet'; + +import { + APP_WILL_MOUNT, + APP_WILL_UNMOUNT +} from './actionTypes'; +import { + _getRoomAndDomainFromUrlString, + _getRouteToRender +} from './functions'; +import './reducer'; + +/** + * Triggers an in-app navigation to a different route. Allows navigation to be + * abstracted between the mobile and web versions. + * + * @param {(string|undefined)} urlOrRoom - The URL or room name to which to + * navigate. + * @returns {Function} + */ +export function appNavigate(urlOrRoom) { + return (dispatch, getState) => { + const oldDomain = getDomain(getState()); + + const { domain, room } = _getRoomAndDomainFromUrlString(urlOrRoom); + + // TODO Kostiantyn Tsaregradskyi: We should probably detect if user is + // currently in a conference and ask her if she wants to close the + // current conference and start a new one with the new room name or + // domain. + + if (typeof domain === 'undefined' || oldDomain === domain) { + // If both domain and room vars became undefined, that means we're + // actually dealing with just room name and not with URL. + dispatch( + _setRoomAndNavigate( + typeof room === 'undefined' && typeof domain === 'undefined' + ? urlOrRoom + : room)); + } else if (oldDomain !== domain) { + // Update domain without waiting for config to be loaded to prevent + // race conditions when we will start to load config multiple times. + dispatch(setDomain(domain)); + + // If domain has changed, that means we need to load new config + // for that new domain and set it, and only after that we can + // navigate to different route. + loadConfig(`https://${domain}`) + .then(config => { + // We set room name only here to prevent race conditions on + // app start to not make app re-render conference page for + // two times. + dispatch(setRoom(room)); + dispatch(setConfig(config)); + _navigate(getState()); + }); + } + }; +} + +/** + * Signals that a specific App will mount (in the terms of React). + * + * @param {App} app - The App which will mount. + * @returns {{ + * type: APP_WILL_MOUNT, + * app: App + * }} + */ +export function appWillMount(app) { + return { + type: APP_WILL_MOUNT, + app + }; +} + +/** + * Signals that a specific App will unmount (in the terms of React). + * + * @param {App} app - The App which will unmount. + * @returns {{ + * type: APP_WILL_UNMOUNT, + * app: App + * }} + */ +export function appWillUnmount(app) { + return { + type: APP_WILL_UNMOUNT, + app + }; +} + +/** + * Navigates to route corresponding to current room name. + * + * @param {Object} state - Redux state. + * @private + * @returns {void} + */ +function _navigate(state) { + const app = state['features/app'].app; + const routeToRender = _getRouteToRender(state); + + app._navigate(routeToRender); +} + +/** + * Sets room and navigates to new route if needed. + * + * @param {string} newRoom - New room name. + * @private + * @returns {Function} + */ +function _setRoomAndNavigate(newRoom) { + return (dispatch, getState) => { + const oldRoom = getState()['features/base/conference'].room; + + dispatch(setRoom(newRoom)); + + const state = getState(); + const room = state['features/base/conference'].room; + + if (room !== oldRoom) { + _navigate(state); + } + }; +} diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js new file mode 100644 index 0000000000..e9b75f1a11 --- /dev/null +++ b/react/features/app/components/AbstractApp.js @@ -0,0 +1,130 @@ +import React, { Component } from 'react'; + +import { + localParticipantJoined, + localParticipantLeft +} from '../../base/participants'; + +import { + appNavigate, + appWillMount, + appWillUnmount +} from '../actions'; + +/** + * Default config. + * + * @type {Object} + */ +const DEFAULT_CONFIG = { + configLocation: './config.js', + hosts: { + domain: 'meet.jit.si' + } +}; + +/** + * Base (abstract) class for main App component. + * + * @abstract + */ +export class AbstractApp extends Component { + /** + * Init lib-jitsi-meet and create local participant when component is going + * to be mounted. + * + * @inheritdoc + */ + componentWillMount() { + const dispatch = this.props.store.dispatch; + + dispatch(appWillMount(this)); + + dispatch(localParticipantJoined()); + + const config + = typeof this.props.config === 'object' + ? this.props.config + : DEFAULT_CONFIG; + + this._openURL(this.props.url || `https://${config.hosts.domain}`); + } + + /** + * Dispose lib-jitsi-meet and remove local participant when component is + * going to be unmounted. + * + * @inheritdoc + */ + componentWillUnmount() { + const dispatch = this.props.store.dispatch; + + dispatch(localParticipantLeft()); + + dispatch(appWillUnmount(this)); + } + + /** + * Create a ReactElement from the specified component, the specified props + * and the props of this AbstractApp which are suitable for propagation to + * the children of this Component. + * + * @param {Component} component - The component from which the ReactElement + * is to be created. + * @param {Object} props - The read-only React Component props with which + * the ReactElement is to be initialized. + * @returns {ReactElement} + * @protected + */ + _createElement(component, props) { + /* eslint-disable no-unused-vars, lines-around-comment */ + const { + // Don't propagate the config prop(erty) because the config is + // stored inside the Redux state and, thus, is visible to the + // children anyway. + config, + // Don't propagate the dispatch and store props because they usually + // come from react-redux and programmers don't really expect them to + // be inherited but rather explicitly connected. + dispatch, // eslint-disable-line react/prop-types + store, + // The url property was introduced to be consumed entirely by + // AbstractApp. + url, + // The remaining props, if any, are considered suitable for + // propagation to the children of this Component. + ...thisProps + } = this.props; + /* eslint-enable no-unused-vars, lines-around-comment */ + + // eslint-disable-next-line object-property-newline + return React.createElement(component, { ...thisProps, ...props }); + } + + /** + * Navigates this AbstractApp to (i.e. opens) a specific URL. + * + * @param {string} url - The URL to which to navigate this AbstractApp (i.e. + * the URL to open). + * @protected + * @returns {void} + */ + _openURL(url) { + this.props.store.dispatch(appNavigate(url)); + } +} + +/** + * AbstractApp component's property types. + * + * @static + */ +AbstractApp.propTypes = { + config: React.PropTypes.object, + store: React.PropTypes.object, + + /** + * The URL, if any, with which the app was launched. + */ + url: React.PropTypes.string +}; diff --git a/react/features/app/components/App.native.js b/react/features/app/components/App.native.js new file mode 100644 index 0000000000..d9b68b5422 --- /dev/null +++ b/react/features/app/components/App.native.js @@ -0,0 +1,135 @@ +import React from 'react'; +import { Linking, Navigator } from 'react-native'; +import { Provider } from 'react-redux'; + +import { _getRouteToRender } from '../functions'; +import { AbstractApp } from './AbstractApp'; + +/** + * Root application component. + * + * @extends AbstractApp + */ +export class App extends AbstractApp { + /** + * Initializes a new App instance. + * + * @param {Object} props - The read-only React Component props with which + * the new instance is to be initialized. + */ + constructor(props) { + super(props); + + // Bind event handlers so they are only bound once for every instance. + this._navigatorRenderScene = this._navigatorRenderScene.bind(this); + this._onLinkingURL = this._onLinkingURL.bind(this); + } + + /** + * Subscribe to notifications about activating URLs registered to be handled + * by this app. + * + * @inheritdoc + * @see https://facebook.github.io/react-native/docs/linking.html + * @returns {void} + */ + componentWillMount() { + super.componentWillMount(); + + Linking.addEventListener('url', this._onLinkingURL); + } + + /** + * Unsubscribe from notifications about activating URLs registered to be + * handled by this app. + * + * @inheritdoc + * @see https://facebook.github.io/react-native/docs/linking.html + * @returns {void} + */ + componentWillUnmount() { + Linking.removeEventListener('url', this._onLinkingURL); + + super.componentWillUnmount(); + } + + /** + * Implements React's {@link Component#render()}. + * + * @inheritdoc + * @returns {ReactElement} + */ + render() { + const store = this.props.store; + + /* eslint-disable brace-style, react/jsx-no-bind */ + + return ( + + { this.navigator = navigator; } } + renderScene = { this._navigatorRenderScene } /> + + ); + + /* eslint-enable brace-style, react/jsx-no-bind */ + } + + /** + * Navigates to a specific Route (via platform-specific means). + * + * @param {Route} route - The Route to which to navigate. + * @returns {void} + */ + _navigate(route) { + const navigator = this.navigator; + + // TODO Currently, the replace method doesn't support animation. Work + // towards adding it is done in + // https://github.com/facebook/react-native/issues/1981 + // XXX React Native's Navigator adds properties to the route it's + // provided with. Clone the specified route in order to prevent its + // modification. + navigator && navigator.replace({ ...route }); + } + + /** + * Renders the scene identified by a specific route in the Navigator of this + * instance. + * + * @param {Object} route - The route which identifies the scene to be + * rendered in the associated Navigator. In the fashion of NavigatorIOS, the + * specified route is expected to define a value for its component property + * which is the type of React component to be rendered. + * @private + * @returns {ReactElement} + */ + _navigatorRenderScene(route) { + // We started with NavigatorIOS and then switched to Navigator in order + // to support Android as well. In order to reduce the number of + // modifications, accept the same format of route definition. + return this._createElement(route.component, {}); + } + + /** + * Notified by React's Linking API that a specific URL registered to be + * handled by this App was activated. + * + * @param {Object} event - The details of the notification/event. + * @param {string} event.url - The URL registered to be handled by this App + * which was activated. + * @private + * @returns {void} + */ + _onLinkingURL(event) { + this._openURL(event.url); + } +} + +/** + * App component's property types. + * + * @static + */ +App.propTypes = AbstractApp.propTypes; diff --git a/react/features/app/components/App.web.js b/react/features/app/components/App.web.js new file mode 100644 index 0000000000..24319bf0a4 --- /dev/null +++ b/react/features/app/components/App.web.js @@ -0,0 +1,139 @@ +import React from 'react'; +import { Provider } from 'react-redux'; +import { + browserHistory, + Route, + Router +} from 'react-router'; +import { push, syncHistoryWithStore } from 'react-router-redux'; + +import { getDomain } from '../../base/connection'; +import { RouteRegistry } from '../../base/navigator'; + +import { AbstractApp } from './AbstractApp'; + +/** + * Root application component. + * + * @extends AbstractApp + */ +export class App extends AbstractApp { + /** + * Initializes a new App instance. + * + * @param {Object} props - The read-only React Component props with which + * the new instance is to be initialized. + */ + constructor(props) { + super(props); + + /** + * Create an enhanced history that syncs navigation events with the + * store. + * @link https://github.com/reactjs/react-router-redux#how-it-works + */ + this.history = syncHistoryWithStore(browserHistory, props.store); + + // Bind event handlers so they are only bound once for every instance. + this._onRouteEnter = this._onRouteEnter.bind(this); + this._routerCreateElement = this._routerCreateElement.bind(this); + } + + /** + * Implements React's {@link Component#render()}. + * + * @inheritdoc + * @returns {ReactElement} + */ + render() { + const routes = RouteRegistry.getRoutes(); + + /* eslint-disable no-extra-parens */ + return ( + + + { routes.map(r => ( + + )) } + + + ); + + /* eslint-enable no-extra-parens */ + } + + /** + * Navigates to a specific Route (via platform-specific means). + * + * @param {Route} route - The Route to which to navigate. + * @returns {void} + */ + _navigate(route) { + let path = route.path; + const store = this.props.store; + + // The syntax :room bellow is defined by react-router. It "matches a URL + // segment up to the next /, ?, or #. The matched string is called a + // param." + path + = path.replace( + /:room/g, + store.getState()['features/base/conference'].room); + + return store.dispatch(push(path)); + } + + /** + * Invoked by react-router to notify this App that a Route is about to be + * rendered. + * + * @private + * @returns {void} + */ + _onRouteEnter() { + // XXX The following is mandatory. Otherwise, moving back & forward + // through the browser's history could leave this App on the Conference + // page without a room name. + + // Our Router configuration (at the time of this writing) is such that + // each Route corresponds to a single URL. Hence, entering into a Route + // is like opening a URL. + + // XXX In order to unify work with URLs in web and native environments, + // we will construct URL here with correct domain from config. + const currentDomain = getDomain(this.props.store.getState); + const url + = new URL(window.location.pathname, `https://${currentDomain}`) + .toString(); + + this._openURL(url); + } + + /** + * Create a ReactElement from the specified component and props on behalf of + * the associated Router. + * + * @param {Component} component - The component from which the ReactElement + * is to be created. + * @param {Object} props - The read-only React Component props with which + * the ReactElement is to be initialized. + * @private + * @returns {ReactElement} + */ + _routerCreateElement(component, props) { + return this._createElement(component, props); + } +} + +/** + * App component's property types. + * + * @static + */ +App.propTypes = AbstractApp.propTypes; diff --git a/react/features/app/components/index.js b/react/features/app/components/index.js new file mode 100644 index 0000000000..ac7ba3b3a2 --- /dev/null +++ b/react/features/app/components/index.js @@ -0,0 +1 @@ +export * from './App'; diff --git a/react/features/app/functions.js b/react/features/app/functions.js new file mode 100644 index 0000000000..c66e14492f --- /dev/null +++ b/react/features/app/functions.js @@ -0,0 +1,117 @@ +import { isRoomValid } from '../base/conference'; +import { RouteRegistry } from '../base/navigator'; +import { Conference } from '../conference'; +import { WelcomePage } from '../welcome'; + +/** + * Gets room name and domain from URL object. + * + * @param {URL} url - URL object. + * @private + * @returns {{ + * domain: (string|undefined), + * room: (string|undefined) + * }} + */ +function _getRoomAndDomainFromUrlObject(url) { + let domain; + let room; + + if (url) { + domain = url.hostname; + room = url.pathname.substr(1).toLowerCase(); + + // Convert empty string to undefined to simplify checks. + if (room === '') { + room = undefined; + } + if (domain === '') { + domain = undefined; + } + } + + return { + domain, + room + }; +} + +/** + * Gets conference room name and connection domain from URL. + * + * @param {(string|undefined)} url - URL. + * @returns {{ + * domain: (string|undefined), + * room: (string|undefined) + * }} + */ +export function _getRoomAndDomainFromUrlString(url) { + // Rewrite the specified URL in order to handle special cases such as + // hipchat.com and enso.me which do not follow the common pattern of most + // Jitsi Meet deployments. + if (typeof url === 'string') { + // hipchat.com + let regex = /^(https?):\/\/hipchat.com\/video\/call\//gi; + let match = regex.exec(url); + + if (!match) { + // enso.me + regex = /^(https?):\/\/enso\.me\/(?:call|meeting)\//gi; + match = regex.exec(url); + } + if (match && match.length > 1) { + /* eslint-disable no-param-reassign, prefer-template */ + + url + = match[1] /* URL protocol */ + + '://enso.hipchat.me/' + + url.substring(regex.lastIndex); + + /* eslint-enable no-param-reassign, prefer-template */ + } + } + + return _getRoomAndDomainFromUrlObject(_urlStringToObject(url)); +} + +/** + * Determines which route is to be rendered in order to depict a specific Redux + * store. + * + * @param {(Object|Function)} stateOrGetState - Redux state or Regux getState() + * method. + * @returns {Route} + */ +export function _getRouteToRender(stateOrGetState) { + const state + = typeof stateOrGetState === 'function' + ? stateOrGetState() + : stateOrGetState; + const room = state['features/base/conference'].room; + const component = isRoomValid(room) ? Conference : WelcomePage; + + return RouteRegistry.getRouteByComponent(component); +} + +/** + * Parses a string into a URL (object). + * + * @param {(string|undefined)} url - The URL to parse. + * @private + * @returns {URL} + */ +function _urlStringToObject(url) { + let urlObj; + + if (url) { + try { + urlObj = new URL(url); + } catch (ex) { + // The return value will signal the failure & the logged + // exception will provide the details to the developers. + console.log(`${url} seems to be not a valid URL, but it's OK`, ex); + } + } + + return urlObj; +} diff --git a/react/features/app/index.js b/react/features/app/index.js new file mode 100644 index 0000000000..cc25e46aa0 --- /dev/null +++ b/react/features/app/index.js @@ -0,0 +1,3 @@ +export * from './actions'; +export * from './components'; +export * from './functions'; diff --git a/react/features/app/reducer.js b/react/features/app/reducer.js new file mode 100644 index 0000000000..706fd7dfc3 --- /dev/null +++ b/react/features/app/reducer.js @@ -0,0 +1,40 @@ +import { ReducerRegistry } from '../base/redux'; + +import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes'; + +/** + * The initial Redux state of features/app. + */ +const INITIAL_STATE = { + /** + * The one and only (i.e. singleton) App instance which is currently + * mounted. + * + * @type {App} + */ + app: undefined +}; + +ReducerRegistry.register('features/app', (state = INITIAL_STATE, action) => { + switch (action.type) { + case APP_WILL_MOUNT: + if (state.app !== action.app) { + return { + ...state, + app: action.app + }; + } + break; + + case APP_WILL_UNMOUNT: + if (state.app === action.app) { + return { + ...state, + app: INITIAL_STATE.app + }; + } + break; + } + + return state; +}); diff --git a/react/features/base/conference/actionTypes.js b/react/features/base/conference/actionTypes.js new file mode 100644 index 0000000000..3b054ca905 --- /dev/null +++ b/react/features/base/conference/actionTypes.js @@ -0,0 +1,46 @@ +/** + * Action type to signal that we are joining the conference. + * + * { + * type: CONFERENCE_JOINED, + * conference: { + * jitsiConference: JitsiConference + * } + * } + */ +export const CONFERENCE_JOINED = 'CONFERENCE_JOINED'; + +/** + * Action type to signal that we have left the conference. + * + * { + * type: CONFERENCE_LEFT, + * conference: { + * jitsiConference: JitsiConference + * } + * } + */ +export const CONFERENCE_LEFT = 'CONFERENCE_LEFT'; + +/** + * Action type to signal that we will leave the specified conference. + * + * { + * type: CONFERENCE_WILL_LEAVE, + * conference: { + * jitsiConference: JitsiConference + * } + * } + */ +export const CONFERENCE_WILL_LEAVE = 'CONFERENCE_WILL_LEAVE'; + +/** + * The type of the Redux action which sets the name of the room of the + * conference to be joined. + * + * { + * type: SET_ROOM, + * room: string + * } + */ +export const SET_ROOM = 'SET_ROOM'; diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js new file mode 100644 index 0000000000..75b2bd03e3 --- /dev/null +++ b/react/features/base/conference/actions.js @@ -0,0 +1,191 @@ +import JitsiMeetJS from '../lib-jitsi-meet'; +import { + changeParticipantEmail, + dominantSpeakerChanged, + participantJoined, + participantLeft, + participantRoleChanged +} from '../participants'; +import { + trackAdded, + trackRemoved +} from '../tracks'; + +import { + CONFERENCE_JOINED, + CONFERENCE_LEFT, + CONFERENCE_WILL_LEAVE, + SET_ROOM +} from './actionTypes'; +import { EMAIL_COMMAND } from './constants'; +import { _addLocalTracksToConference } from './functions'; +import './middleware'; +import './reducer'; + +const JitsiConferenceEvents = JitsiMeetJS.events.conference; + +/** + * Initializes a new conference. + * + * @returns {Function} + */ +export function createConference() { + return (dispatch, getState) => { + const state = getState(); + const connection = state['features/base/connection'].jitsiConnection; + const room = state['features/base/conference'].room; + + if (!connection) { + throw new Error('Cannot create conference without connection'); + } + if (typeof room === 'undefined' || room === '') { + throw new Error('Cannot join conference without room name'); + } + + // TODO Take options from config. + const conference + = connection.initJitsiConference(room, { openSctp: true }); + + dispatch(_setupConferenceListeners(conference)); + + conference.join(); + }; +} + +/** + * Attach any pre-existing local media to the conference once the conference has + * been joined. + * + * @param {JitsiConference} conference - The JitsiConference instance which was + * joined by the local participant. + * @returns {Function} + */ +export function conferenceJoined(conference) { + return (dispatch, getState) => { + const localTracks = getState()['features/base/tracks'] + .filter(t => t.local) + .map(t => t.jitsiTrack); + + if (localTracks.length) { + _addLocalTracksToConference(conference, localTracks); + } + + dispatch({ + type: CONFERENCE_JOINED, + conference: { + jitsiConference: conference + } + }); + }; +} + +/** + * Signal that we have left the conference. + * + * @param {JitsiConference} conference - The JitsiConference instance which was + * left by the local participant. + * @returns {{ + * type: CONFERENCE_LEFT, + * conference: { + * jitsiConference: JitsiConference + * } + * }} + */ +export function conferenceLeft(conference) { + return { + type: CONFERENCE_LEFT, + conference: { + jitsiConference: conference + } + }; +} + +/** + * Signal the intention of the application to have the local participant leave a + * specific conference. Similar in fashion to CONFERENCE_LEFT. Contrary to it + * though, it's not guaranteed because CONFERENCE_LEFT may be triggered by + * lib-jitsi-meet and not the application. + * + * @param {JitsiConference} conference - The JitsiConference instance which will + * be left by the local participant. + * @returns {{ + * type: CONFERENCE_LEFT, + * conference: { + * jitsiConference: JitsiConference + * } + * }} + */ +export function conferenceWillLeave(conference) { + return { + type: CONFERENCE_WILL_LEAVE, + conference: { + jitsiConference: conference + } + }; +} + +/** + * Sets (the name of) the room of the conference to be joined. + * + * @param {(string|undefined)} room - The name of the room of the conference to + * be joined. + * @returns {{ + * type: SET_ROOM, + * room: string + * }} + */ +export function setRoom(room) { + return { + type: SET_ROOM, + room + }; +} + +/** + * Setup various conference event handlers. + * + * @param {JitsiConference} conference - Conference instance. + * @private + * @returns {Function} + */ +function _setupConferenceListeners(conference) { + return dispatch => { + conference.on( + JitsiConferenceEvents.CONFERENCE_JOINED, + () => dispatch(conferenceJoined(conference))); + conference.on( + JitsiConferenceEvents.CONFERENCE_LEFT, + () => dispatch(conferenceLeft(conference))); + + conference.on( + JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, + id => dispatch(dominantSpeakerChanged(id))); + + conference.on( + JitsiConferenceEvents.TRACK_ADDED, + track => + track && !track.isLocal() && dispatch(trackAdded(track))); + conference.on( + JitsiConferenceEvents.TRACK_REMOVED, + track => + track && !track.isLocal() && dispatch(trackRemoved(track))); + + conference.on( + JitsiConferenceEvents.USER_JOINED, + (id, user) => dispatch(participantJoined({ + id, + name: user.getDisplayName(), + role: user.getRole() + }))); + conference.on( + JitsiConferenceEvents.USER_LEFT, + id => dispatch(participantLeft(id))); + conference.on( + JitsiConferenceEvents.USER_ROLE_CHANGED, + (id, role) => dispatch(participantRoleChanged(id, role))); + + conference.addCommandListener( + EMAIL_COMMAND, + (data, id) => dispatch(changeParticipantEmail(id, data.value))); + }; +} diff --git a/react/features/base/conference/constants.js b/react/features/base/conference/constants.js new file mode 100644 index 0000000000..dfb348322d --- /dev/null +++ b/react/features/base/conference/constants.js @@ -0,0 +1,6 @@ +/** + * The command type for updating a participant's email address. + * + * @type {string} + */ +export const EMAIL_COMMAND = 'email'; diff --git a/react/features/base/conference/functions.js b/react/features/base/conference/functions.js new file mode 100644 index 0000000000..dfdb66ea7d --- /dev/null +++ b/react/features/base/conference/functions.js @@ -0,0 +1,109 @@ +import JitsiMeetJS from '../lib-jitsi-meet'; + +const JitsiTrackErrors = JitsiMeetJS.errors.track; + +/** + * Attach a set of local tracks to a conference. + * + * NOTE The function is internal to this feature. + * + * @param {JitsiConference} conference - Conference instance. + * @param {JitsiLocalTrack[]} localTracks - List of local media tracks. + * @returns {Promise} + */ +export function _addLocalTracksToConference(conference, localTracks) { + const conferenceLocalTracks = conference.getLocalTracks(); + const promises = []; + + for (const track of localTracks) { + // XXX The library lib-jitsi-meet may be draconian, for example, when + // adding one and the same video track multiple times. + if (conferenceLocalTracks.indexOf(track) === -1) { + promises.push(conference.addTrack(track) + .catch(err => { + _reportError( + 'Failed to add local track to conference', + err); + })); + } + } + + return Promise.all(promises); +} + +/** + * Handle an error thrown by the backend (i.e. lib-jitsi-meet) while + * manipulating a conference participant (e.g. pin or select participant). + * + * NOTE The function is internal to this feature. + * + * @param {Error} err - The Error which was thrown by the backend while + * manipulating a conference participant and which is to be handled. + * @returns {void} + */ +export function _handleParticipantError(err) { + // XXX DataChannels are initialized at some later point when the conference + // has multiple participants, but code that pins or selects a participant + // might be executed before. So here we're swallowing a particular error. + // TODO Lib-jitsi-meet should be fixed to not throw such an exception in + // these scenarios. + if (err.message !== 'Data channels support is disabled!') { + throw err; + } +} + +/** + * Determines whether a specific string is a valid room name. + * + * @param {(string|undefined)} room - The name of the conference room to check + * for validity. + * @returns {boolean} If the specified room name is valid, then true; otherwise, + * false. + */ +export function isRoomValid(room) { + return typeof room === 'string' && room !== ''; +} + +/** + * Remove a set of local tracks from a conference. + * + * NOTE The function is internal to this feature. + * + * @param {JitsiConference} conference - Conference instance. + * @param {JitsiLocalTrack[]} localTracks - List of local media tracks. + * @returns {Promise} + */ +export function _removeLocalTracksFromConference(conference, localTracks) { + return Promise.all(localTracks.map(track => + conference.removeTrack(track) + .catch(err => { + // Local track might be already disposed by direct + // JitsiTrack#dispose() call. So we should ignore this error + // here. + if (err.name !== JitsiTrackErrors.TRACK_IS_DISPOSED) { + _reportError( + 'Failed to remove local track from conference', + err); + } + }) + )); +} + +/** + * Reports a specific Error with a specific error message. While the + * implementation merely logs the specified msg and err via the console at the + * time of this writing, the intention of the function is to abstract the + * reporting of errors and facilitate elaborating on it in the future. + * + * NOTE The function is internal to this feature. + * + * @param {string} msg - The error message to report. + * @param {Error} err - The Error to report. + * @private + * @returns {void} + */ +function _reportError(msg, err) { + // TODO This is a good point to call some global error handler when we have + // one. + console.error(msg, err); +} diff --git a/react/features/base/conference/index.js b/react/features/base/conference/index.js new file mode 100644 index 0000000000..08fe9014b1 --- /dev/null +++ b/react/features/base/conference/index.js @@ -0,0 +1,3 @@ +export * from './actions'; +export * from './actionTypes'; +export * from './functions'; diff --git a/react/features/base/conference/middleware.js b/react/features/base/conference/middleware.js new file mode 100644 index 0000000000..62539ca77c --- /dev/null +++ b/react/features/base/conference/middleware.js @@ -0,0 +1,112 @@ +import { + getLocalParticipant, + getParticipantById, + PIN_PARTICIPANT +} from '../participants'; +import { MiddlewareRegistry } from '../redux'; +import { + TRACK_ADDED, + TRACK_REMOVED +} from '../tracks'; + +import { + _addLocalTracksToConference, + _handleParticipantError, + _removeLocalTracksFromConference +} from './functions'; + +/** + * This middleware intercepts TRACK_ADDED and TRACK_REMOVED actions to sync + * conference's local tracks with local tracks in state. Also captures + * PIN_PARTICIPANT action to pin participant in conference. + * + * @param {Store} store - Redux store. + * @returns {Function} + */ +MiddlewareRegistry.register(store => next => action => { + switch (action.type) { + case PIN_PARTICIPANT: + pinParticipant(store, action.participant.id); + break; + + case TRACK_ADDED: + case TRACK_REMOVED: { + const track = action.track; + + if (track && track.local) { + return syncConferenceLocalTracksWithState(store, action) + .then(() => next(action)); + } + break; + } + } + + return next(action); +}); + +/** + * Pins remote participant in conference, ignores local participant. + * + * @param {Store} store - Redux store. + * @param {string|null} id - Participant id or null if no one is currently + * pinned. + * @returns {void} + */ +function pinParticipant(store, id) { + const state = store.getState(); + const participants = state['features/base/participants']; + const participantById = getParticipantById(participants, id); + let pin; + + // The following condition prevents signaling to pin local participant. The + // logic is: + // - If we have an ID, we check if the participant identified by that ID is + // local. + // - If we don't have an ID (i.e. no participant identified by an ID), we + // check for local participant. If she's currently pinned, then this + // action will unpin her and that's why we won't signal here too. + if (participantById) { + pin = !participantById.local; + } else { + const localParticipant = getLocalParticipant(participants); + + pin = !localParticipant || !localParticipant.pinned; + } + if (pin) { + const conference = state['features/base/conference'].jitsiConference; + + try { + conference.pinParticipant(id); + } catch (err) { + _handleParticipantError(err); + } + } +} + +/** + * Syncs local tracks from state with local tracks in JitsiConference instance. + * + * @param {Store} store - Redux store. + * @param {Object} action - Action object. + * @returns {Promise} + */ +function syncConferenceLocalTracksWithState(store, action) { + const conferenceState = store.getState()['features/base/conference']; + const conference = conferenceState.jitsiConference; + const leavingConference = conferenceState.leavingJitsiConference; + let promise; + + // XXX The conference in state might be already in 'leaving' state, that's + // why we should not add/remove local tracks to such conference. + if (conference && conference !== leavingConference) { + const track = action.track.jitsiTrack; + + if (action.type === TRACK_ADDED) { + promise = _addLocalTracksToConference(conference, [ track ]); + } else { + promise = _removeLocalTracksFromConference(conference, [ track ]); + } + } + + return promise || Promise.resolve(); +} diff --git a/react/features/base/conference/reducer.js b/react/features/base/conference/reducer.js new file mode 100644 index 0000000000..bfa70d83ab --- /dev/null +++ b/react/features/base/conference/reducer.js @@ -0,0 +1,80 @@ +import { ReducerRegistry } from '../redux'; + +import { + CONFERENCE_JOINED, + CONFERENCE_LEFT, + CONFERENCE_WILL_LEAVE, + SET_ROOM +} from './actionTypes'; +import { isRoomValid } from './functions'; + +const INITIAL_STATE = { + jitsiConference: null, + + /** + * Instance of JitsiConference that is currently in 'leaving' state. + */ + leavingJitsiConference: null, + + /** + * The name of the room of the conference (to be) joined (i.e. + * {@link #jitsiConference}). + * + * @type {string} + */ + room: null +}; + +/** + * Listen for actions that contain the conference object, so that it can be + * stored for use by other action creators. + */ +ReducerRegistry.register('features/base/conference', + (state = INITIAL_STATE, action) => { + switch (action.type) { + case CONFERENCE_JOINED: + return { + ...state, + jitsiConference: action.conference.jitsiConference + }; + + case CONFERENCE_LEFT: + if (state.jitsiConference === action.conference.jitsiConference) { + return { + ...state, + jitsiConference: null, + leavingJitsiConference: state.leavingJitsiConference + === action.conference.jitsiConference + ? null + : state.leavingJitsiConference + }; + } + break; + + case CONFERENCE_WILL_LEAVE: + return { + ...state, + leavingJitsiConference: action.conference.jitsiConference + }; + + case SET_ROOM: { + let room = action.room; + + // Technically, there're multiple values which don't represent + // valid room names. Practically, each of them is as bad as the rest + // of them because we can't use any of them to join a conference. + if (!isRoomValid(room)) { + room = INITIAL_STATE.room; + } + if (state.room !== room) { + return { + ...state, + room + }; + } + break; + } + } + + return state; + }); diff --git a/react/features/base/connection/actionTypes.js b/react/features/base/connection/actionTypes.js new file mode 100644 index 0000000000..a6c5660403 --- /dev/null +++ b/react/features/base/connection/actionTypes.js @@ -0,0 +1,30 @@ +/** + * Action type to signal that connection has disconnected. + * + * @type {string} + */ +export const CONNECTION_DISCONNECTED = 'CONNECTION_DISCONNECTED'; + +/** + * Action type to signal that have successfully established a connection. + * + * @type {string} + */ +export const CONNECTION_ESTABLISHED = 'CONNECTION_ESTABLISHED'; + +/** + * Action type to signal a connection failed. + * + * @type {string} + */ +export const CONNECTION_FAILED = 'CONNECTION_FAILED'; + +/** + * Action to signal to change connection domain. + * + * { + * type: SET_DOMAIN, + * domain: string + * } + */ +export const SET_DOMAIN = 'SET_DOMAIN'; diff --git a/react/features/base/connection/actions.js b/react/features/base/connection/actions.js new file mode 100644 index 0000000000..1282fe16d8 --- /dev/null +++ b/react/features/base/connection/actions.js @@ -0,0 +1,209 @@ +import { + conferenceWillLeave, + createConference +} from '../conference'; +import JitsiMeetJS from '../lib-jitsi-meet'; +import { + CONNECTION_DISCONNECTED, + CONNECTION_ESTABLISHED, + CONNECTION_FAILED, + SET_DOMAIN +} from './actionTypes'; +import './reducer'; + +const JitsiConnectionEvents = JitsiMeetJS.events.connection; + +/** + * Opens new connection. + * + * @returns {Promise} + */ +export function connect() { + return (dispatch, getState) => { + const state = getState(); + const connectionOpts + = state['features/base/connection'].connectionOptions; + const room = state['features/base/conference'].room; + const connection = new JitsiMeetJS.JitsiConnection( + connectionOpts.appId, + connectionOpts.token, + { + ...connectionOpts, + bosh: connectionOpts.bosh + ( + room ? `?room=${room}` : '' + ) + } + ); + + return new Promise((resolve, reject) => { + connection.addEventListener( + JitsiConnectionEvents.CONNECTION_DISCONNECTED, + handleConnectionDisconnected); + connection.addEventListener( + JitsiConnectionEvents.CONNECTION_ESTABLISHED, + handleConnectionEstablished); + connection.addEventListener( + JitsiConnectionEvents.CONNECTION_FAILED, + handleConnectionFailed); + + connection.connect(); + + /** + * Dispatches CONNECTION_DISCONNECTED action when connection is + * disconnected. + * + * @param {string} message - Disconnect reason. + * @returns {void} + */ + function handleConnectionDisconnected(message) { + connection.removeEventListener( + JitsiConnectionEvents.CONNECTION_DISCONNECTED, + handleConnectionDisconnected); + + dispatch(_connectionDisconnected(connection, message)); + } + + /** + * Resolves external promise when connection is established. + * + * @returns {void} + */ + function handleConnectionEstablished() { + unsubscribe(); + resolve(connection); + } + + /** + * Rejects external promise when connection fails. + * + * @param {JitsiConnectionErrors} err - Connection error. + * @returns {void} + */ + function handleConnectionFailed(err) { + unsubscribe(); + console.error('CONNECTION FAILED:', err); + reject(err); + } + + /** + * Unsubscribes connection instance from CONNECTION_ESTABLISHED + * and CONNECTION_FAILED events. + * + * @returns {void} + */ + function unsubscribe() { + connection.removeEventListener( + JitsiConnectionEvents.CONNECTION_ESTABLISHED, + handleConnectionEstablished + ); + connection.removeEventListener( + JitsiConnectionEvents.CONNECTION_FAILED, + handleConnectionFailed + ); + } + }) + .catch(err => dispatch(_connectionFailed(err))) + .then(con => dispatch(_connectionEstablished(con))) + .then(() => dispatch(createConference())); + }; +} + +/** + * Closes connection. + * + * @returns {Function} + */ +export function disconnect() { + return (dispatch, getState) => { + const state = getState(); + const conference = state['features/base/conference'].jitsiConference; + const connection = state['features/base/connection'].jitsiConnection; + + let promise; + + // Leave the conference. + if (conference) { + // In a fashion similar to JitsiConference's CONFERENCE_LEFT event + // (and the respective Redux action) which is fired after the + // conference has been left, notify the application about the + // intention to leave the conference. + dispatch(conferenceWillLeave(conference)); + + promise = conference.leave(); + } else { + promise = Promise.resolve(); + } + + // Disconnect the connection. + if (connection) { + promise = promise.then(() => connection.disconnect()); + } + + return promise; + }; +} + +/** + * Sets connection domain. + * + * @param {string} domain - Domain name. + * @returns {{ + * type: SET_DOMAIN, + * domain: string + * }} + */ +export function setDomain(domain) { + return { + type: SET_DOMAIN, + domain + }; +} + +/** + * Create an action for when the signaling connection has been lost. + * + * @param {JitsiConnection} connection - The JitsiConnection which was + * disconnected. + * @param {string} message - Error message. + * @private + * @returns {{ + * type: CONNECTION_DISCONNECTED, + * connection: JitsiConnection, + * message: string + * }} + */ +function _connectionDisconnected(connection, message) { + return { + type: CONNECTION_DISCONNECTED, + connection, + message + }; +} + +/** + * Create an action for when the signaling connection has been established. + * + * @param {JitsiConnection} connection - JitsiConnection instance. + * @private + * @returns {{type: CONNECTION_ESTABLISHED, connection: JitsiConnection}} + */ +function _connectionEstablished(connection) { + return { + type: CONNECTION_ESTABLISHED, + connection + }; +} + +/** + * Create an action for when the signaling connection could not be created. + * + * @param {string} error - Error message. + * @private + * @returns {{type: CONNECTION_FAILED, error: string}} + */ +function _connectionFailed(error) { + return { + type: CONNECTION_FAILED, + error + }; +} diff --git a/react/features/base/connection/functions.js b/react/features/base/connection/functions.js new file mode 100644 index 0000000000..292b848e7c --- /dev/null +++ b/react/features/base/connection/functions.js @@ -0,0 +1,26 @@ +/** + * Returns current domain. + * + * @param {(Function|Object)} stateOrGetState - Redux getState() method or Redux + * state. + * @returns {(string|undefined)} + */ +export function getDomain(stateOrGetState) { + const state + = typeof stateOrGetState === 'function' + ? stateOrGetState() + : stateOrGetState; + const connection = state['features/base/connection']; + let domain; + + try { + domain = connection.connectionOptions.hosts.domain; + } catch (e) { + // XXX The value of connectionOptions or any of the properties + // descending from it may be undefined at some point in the execution + // (e.g. on start). Instead of multiple checks for the undefined value, + // we just wrap it in a try-catch block. + } + + return domain; +} diff --git a/react/features/base/connection/index.js b/react/features/base/connection/index.js new file mode 100644 index 0000000000..08fe9014b1 --- /dev/null +++ b/react/features/base/connection/index.js @@ -0,0 +1,3 @@ +export * from './actions'; +export * from './actionTypes'; +export * from './functions'; diff --git a/react/features/base/connection/reducer.js b/react/features/base/connection/reducer.js new file mode 100644 index 0000000000..eb3ec3a0f1 --- /dev/null +++ b/react/features/base/connection/reducer.js @@ -0,0 +1,100 @@ +import { ReducerRegistry } from '../redux'; + +import { + CONNECTION_DISCONNECTED, + CONNECTION_ESTABLISHED, + SET_DOMAIN +} from './actionTypes'; + +/** + * Initial Redux state. + * + * @type {{ + * jitsiConnection: (JitsiConnection|null), + * connectionOptions: Object + * }} + */ +const INITIAL_STATE = { + jitsiConnection: null, + connectionOptions: null +}; + +/** + * Listen for actions that contain the connection object, so that + * it can be stored for use by other action creators. + */ +ReducerRegistry.register('features/base/connection', + (state = INITIAL_STATE, action) => { + switch (action.type) { + case CONNECTION_DISCONNECTED: + if (state.jitsiConnection === action.connection) { + return { + ...state, + jitsiConnection: null + }; + } + + return state; + + case CONNECTION_ESTABLISHED: + return { + ...state, + jitsiConnection: action.connection + }; + + case SET_DOMAIN: + return { + ...state, + connectionOptions: { + ...(state.connectionOptions || {}), + ...buildConnectionOptions(action.domain) + } + }; + + default: + return state; + } + }); + +/** + * Builds connection options based on domain. + * + * @param {string} domain - Domain name. + * @returns {Object} + */ +function buildConnectionOptions(domain) { + // FIXME The HTTPS scheme for the BOSH URL works with meet.jit.si on both + // mobile & Web. It also works with beta.meet.jit.si on Web. Unfortunately, + // it doesn't work with beta.meet.jit.si on mobile. Temporarily, use the + // HTTP scheme for the BOSH URL with beta.meet.jit.si on mobile. + let boshProtocol; + + if (domain === 'beta.meet.jit.si') { + if (typeof window === 'object') { + const windowLocation = window.location; + + if (windowLocation) { + // React Native doesn't have a window.location at the time of + // this writing, let alone a window.location.protocol. + boshProtocol = windowLocation.protocol; + } + } + if (!boshProtocol) { + boshProtocol = 'http:'; + } + } + + // Default to the HTTPS scheme for the BOSH URL. + if (!boshProtocol) { + boshProtocol = 'https:'; + } + + return { + bosh: `${boshProtocol}//${domain}/http-bind`, + hosts: { + domain, + focus: `focus.${domain}`, + muc: `conference.${domain}` + } + }; +} diff --git a/react/features/base/fontIcons/Icon.js b/react/features/base/fontIcons/Icon.js new file mode 100644 index 0000000000..f230db5da7 --- /dev/null +++ b/react/features/base/fontIcons/Icon.js @@ -0,0 +1,10 @@ +// FIXME The import of react-native-vector-icons makes the file native-specific +// but the file's name and/or location (within the directory structure) don't +// reflect that, it suggests the file is platform-independent. +import { createIconSetFromIcoMoon } from 'react-native-vector-icons'; +import icoMoonConfig from './fonts/selection.json'; + +/** + * Creates the Jitsi icon set from the ico moon project config file. + */ +export const Icon = createIconSetFromIcoMoon(icoMoonConfig); diff --git a/react/features/base/fontIcons/fonts/fontawesome-webfont.eot b/react/features/base/fontIcons/fonts/fontawesome-webfont.eot new file mode 100644 index 0000000000..a30335d748 Binary files /dev/null and b/react/features/base/fontIcons/fonts/fontawesome-webfont.eot differ diff --git a/react/features/base/fontIcons/fonts/fontawesome-webfont.svg b/react/features/base/fontIcons/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000000..6fd19abcb9 --- /dev/null +++ b/react/features/base/fontIcons/fonts/fontawesome-webfont.svg @@ -0,0 +1,640 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/react/features/base/fontIcons/fonts/fontawesome-webfont.ttf b/react/features/base/fontIcons/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000000..d7994e1308 Binary files /dev/null and b/react/features/base/fontIcons/fonts/fontawesome-webfont.ttf differ diff --git a/react/features/base/fontIcons/fonts/fontawesome-webfont.woff b/react/features/base/fontIcons/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000000..6fd4ede0f3 Binary files /dev/null and b/react/features/base/fontIcons/fonts/fontawesome-webfont.woff differ diff --git a/react/features/base/fontIcons/fonts/fontawesome-webfont.woff2 b/react/features/base/fontIcons/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000000..5560193ccc Binary files /dev/null and b/react/features/base/fontIcons/fonts/fontawesome-webfont.woff2 differ diff --git a/react/features/base/fontIcons/fonts/jitsi.eot b/react/features/base/fontIcons/fonts/jitsi.eot new file mode 100755 index 0000000000..264fbd1366 Binary files /dev/null and b/react/features/base/fontIcons/fonts/jitsi.eot differ diff --git a/react/features/base/fontIcons/fonts/jitsi.svg b/react/features/base/fontIcons/fonts/jitsi.svg new file mode 100755 index 0000000000..7b4ff3645d --- /dev/null +++ b/react/features/base/fontIcons/fonts/jitsi.svg @@ -0,0 +1,40 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/react/features/base/fontIcons/fonts/jitsi.ttf b/react/features/base/fontIcons/fonts/jitsi.ttf new file mode 100755 index 0000000000..e3f976b3f8 Binary files /dev/null and b/react/features/base/fontIcons/fonts/jitsi.ttf differ diff --git a/react/features/base/fontIcons/fonts/jitsi.woff b/react/features/base/fontIcons/fonts/jitsi.woff new file mode 100755 index 0000000000..86cea65c6a Binary files /dev/null and b/react/features/base/fontIcons/fonts/jitsi.woff differ diff --git a/react/features/base/fontIcons/fonts/selection.json b/react/features/base/fontIcons/fonts/selection.json new file mode 100755 index 0000000000..6c266e3c1f --- /dev/null +++ b/react/features/base/fontIcons/fonts/selection.json @@ -0,0 +1,949 @@ +{ + "IcoMoonType": "selection", + "icons": [ + { + "icon": { + "paths": [ + "M984.014 244.799c-26.67-26.665-58.84-40.001-96.532-40.001h-119.467l-27.195-72.529c-6.759-17.42-19.108-32.444-37.073-45.072-17.958-12.622-36.356-18.938-55.203-18.938h-273.074c-18.845 0-37.247 6.316-55.205 18.938-17.958 12.628-30.309 27.653-37.066 45.072l-27.199 72.529h-119.467c-37.695 0-69.867 13.336-96.537 40.001-26.665 26.666-39.997 58.842-39.997 96.533v477.872c0 37.694 13.332 69.873 39.997 96.532 26.67 26.67 58.844 40.006 96.537 40.006h750.936c37.692 0 69.859-13.336 96.532-40.006 26.663-26.659 39.999-58.838 39.999-96.532v-477.872c0.007-37.692-13.329-69.867-39.986-96.533zM680.804 749.075c-46.755 46.757-103.017 70.142-168.801 70.142s-122.042-23.384-168.801-70.142c-46.759-46.75-70.134-103.025-70.134-168.793 0-65.789 23.382-122.045 70.134-168.805 46.754-46.759 103.019-70.134 168.801-70.134s122.045 23.381 168.801 70.134c46.757 46.754 70.136 103.016 70.136 168.805 0 65.768-23.377 122.038-70.136 168.793z", + "M512.003 426.668c-42.313 0-78.492 15.023-108.537 45.072-30.046 30.046-45.069 66.219-45.069 108.541 0 42.306 15.023 78.484 45.069 108.53 30.046 30.040 66.222 45.063 108.537 45.063 42.308 0 78.49-15.023 108.536-45.063 30.046-30.046 45.070-66.222 45.070-108.53 0-42.321-15.025-78.494-45.070-108.541-30.044-30.048-66.228-45.072-108.536-45.072z" + ], + "attrs": [ + {}, + {} + ], + "isMulticolor": false, + "isMulticolor2": false, + "grid": 0, + "tags": [ + "photo-camera" + ] + }, + "attrs": [ + {}, + {} + ], + "properties": { + "order": 31, + "id": 0, + "name": "photo-camera", + "prevSize": 32, + "code": 59648 + }, + "setIdx": 0, + "setId": 2, + "iconIdx": 0 + }, + { + "icon": { + "paths": [ + "M74.418 78.701h239.304v228.491h-239.304v-228.491z", + "M393.455 78.701h239.304v228.491h-239.304v-228.491z", + "M712.494 78.701h239.263v228.491h-239.263v-228.491z", + "M74.418 397.735h239.304v228.555h-239.304v-228.555z", + "M393.455 397.735h239.304v228.555h-239.304v-228.555z", + "M712.494 397.735h239.263v228.555h-239.263v-228.555z", + "M74.418 716.834h239.304v228.465h-239.304v-228.465z", + "M393.455 716.834h239.304v228.465h-239.304v-228.465z", + "M712.494 716.834h239.263v228.465h-239.263v-228.465z" + ], + "attrs": [ + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {} + ], + "isMulticolor": false, + "width": 1026, + "grid": 0, + "tags": [ + "dailPad" + ] + }, + "attrs": [ + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {} + ], + "properties": { + "order": 29, + "id": 0, + "prevSize": 32, + "code": 58908, + "name": "dialPad" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 0 + }, + { + "icon": { + "paths": [ + "M526.071 725.251c-28.637 30.869-56.465 60.861-84.282 90.859-51.578 55.636-103.047 111.376-154.842 166.832-7.606 8.135-15.958 16.1-25.317 22.012-28.075 17.708-58.31 18.090-88.472 6.492-59.84-23.028-80.004-90.727-59.734-139.234 5.413-12.95 13.721-23.601 23.709-33.173 70.256-67.351 140.506-134.717 210.76-202.077 15.638-14.993 31.264-29.995 47.364-45.45-9.302-9.529-18.386-18.833-27.451-28.137-12.122-12.442-13.234-20.28-5.067-35.498 4.735-8.816 4.789-8.878-2.627-16.198-20.012-19.72-40.168-39.198-63.498-55.188-27.167-18.624-57.161-24.233-89.083-19.849-53.402 7.328-91.609 38.372-121.413 81.046-12.774 18.299-15.365 40.313-17.517 61.875-3.23 32.245-2.415 64.479 2.209 96.597 1.654 11.515-3.863 16.539-13.835 11.175-8.306-4.448-16.095-11.048-22.115-18.353-15.574-18.89-22.223-42.042-27.474-65.395-12.955-57.652-8.86-114.49 12.191-169.495 32.345-84.537 79.743-159.571 145.953-221.932 13.659-12.857 176.841-180.564 202.944-207.021 7.493-7.599 14.895-7.635 22.393-0.028 43.009 43.641 85.985 87.316 128.927 131.029 8.117 8.267 8.019 15.097-0.222 23.49-26.339 26.834-52.726 53.627-79.106 80.419-6.244 6.334-97.34 82.437-73.027 128.816 22.693 25.090 46.196 49.449 69.575 73.904 1.189 1.238 4.686 1.386 6.523 0.632 3.63-1.499 6.848-3.997 10.248-6.066 9.745-5.94 19.545-4.918 27.812 3.083 11.755 11.381 23.405 22.858 35.392 34.59 4.807-4.575 9.939-9.41 15.027-14.294 27.128-26.039 54.272-52.071 81.351-78.146 16.413-15.778 18.652-28.418 11.038-49.658-10.473-29.221-14.356-59.677-13.85-90.624 1.017-61.045 20.438-115.334 61.003-161.416 32.825-37.286 72.054-64.311 121.643-74.325 35.227-7.101 69.139-4.513 100.663 14.026 6.365 3.752 11.908 9.007 17.455 14.005 3.491 3.125 3.153 6.236-0.565 9.98-42.503 42.885-84.772 86.013-127.154 129.035-12.442 12.638-12.356 23.167 0.196 35.914 40.344 40.978 80.597 82.050 120.936 123.052 10.076 10.233 19.537 10.021 29.504-0.134 43.195-44.077 86.449-88.090 129.706-132.118 1.21-1.233 2.572-2.322 5.135-4.624 5.491 5.893 11.895 10.924 15.961 17.406 19.452 30.944 22.608 64.83 17.073 100.25-14.253 91.080-97.188 175.638-197.712 190.123-39.977 5.764-79.372 2.562-118.067-9.031-5.898-1.775-11.541-4.629-17.538-5.829-12.47-2.474-23.872 0.366-32.74 9.877-30.921 33.168-61.674 66.484-92.474 99.758-0.73 0.805-1.349 1.718-0.181 1.099 8.992 10.006 17.354 20.662 27.061 29.94 81.064 77.54 164.91 151.986 250.882 224.063 9.936 8.347 10.274 15.695 1.040 25.1-42.338 43.068-84.689 86.111-127.059 129.154-9.413 9.575-16.846 9.152-25.291-1.295-76.686-94.78-156.8-186.609-239.707-276.002-1.334-1.453-2.562-3.029-4.257-5.042z" + ], + "attrs": [ + { + "opacity": 1, + "visibility": false + } + ], + "width": 1105, + "grid": 0, + "tags": [ + "settings" + ] + }, + "attrs": [ + { + "opacity": 1, + "visibility": false + } + ], + "properties": { + "order": 1, + "id": 33, + "prevSize": 32, + "code": 58907, + "name": "settings" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 1 + }, + { + "icon": { + "paths": [ + "M1223.129 242.783l-180.128 175.796v-217.716c0-74.673-59.512-135.496-132.599-135.496h-634.716c-73.084 0-132.596 60.823-132.596 135.496v609.237c0 74.673 59.512 135.496 132.596 135.496h634.716c73.084 0 132.599-60.82 132.599-135.496v-172.679l193.45 153.712c48.784 35.558 96.695-5.178 96.695-40.424v-483.533c-0.003-35.248-55.897-71.306-110.017-24.393zM601.169 760.065c-141.111 0-255.524-114.411-255.524-255.521s114.411-255.521 255.524-255.521c141.108 0 255.519 114.411 255.519 255.521-0 141.113-114.408 255.521-255.519 255.521z", + "M599.045 359.751c-80.474 0-145.727 65.253-145.727 145.729 0 80.471 65.25 145.727 145.727 145.727s145.729-65.256 145.729-145.727c0-80.474-65.253-145.729-145.729-145.729z" + ], + "width": 1334, + "attrs": [ + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + } + ], + "tags": [ + "webCam" + ], + "grid": 0 + }, + "attrs": [ + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + } + ], + "properties": { + "order": 4, + "id": 32, + "prevSize": 32, + "code": 58888, + "name": "webCam", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 2 + }, + { + "icon": { + "paths": [ + "M3.881 813.165h220.26v210.835h-220.26v-210.835z", + "M308.817 609.857h220.27v414.143h-220.27v-414.143z", + "M613.764 406.588h220.268v617.412h-220.268v-617.412z", + "M918.685 203.285h220.265v820.715h-220.265v-820.715z", + "M1223.629 0h220.263v1024h-220.263v-1024z" + ], + "width": 1444, + "attrs": [ + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + } + ], + "tags": [ + "connection-2" + ], + "grid": 0 + }, + "attrs": [ + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + } + ], + "properties": { + "order": 27, + "id": 31, + "prevSize": 32, + "code": 58906, + "name": "connection", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 3 + }, + { + "icon": { + "paths": [ + "M46.993-1.7c461.234 0 553.793 0 1015.024 0 35.919 0 53.356 25.959 53.356 57.959-0.581 303.259-0.325 606.488-0.449 909.809 0 43.984-13.203 57.058-57.703 57.058-443.072 0.126-556.453 0.126-999.553 0-44.534 0-57.799-13.009-57.799-57.058-0.098-303.257 0.485-608.072-0.093-911.329-0.034-26.21 11.301-53.761 47.217-56.439zM311.405 509.702c0 119.045-0.072 172.168 0.057 291.249 0.036 50.043 11.208 61.050 62.12 61.050 233.352 0 137.075 0 370.522 0 47.075 0 59.249-11.982 59.249-58.095 0.126-239.111 0.126-346.338 0-585.389 0-48.138-10.687-58.991-57.768-58.991-235.323-0.101-140.844-0.101-376.157 0-47.044 0-57.93 11.043-57.966 58.89-0.129 119.109-0.057 172.209-0.057 291.287zM153.944 121.434c-74.929 0.062-66.687-5.958-66.845 66.685-0.201 63.95-7.054 63.534 62.528 63.372 72.999-0.194 67.201 3.764 67.302-67.554 0-67.722 4.087-62.595-62.985-62.502zM963.644 121.434c-71.159 0.034-65.56-6.185-65.751 65.364-0.129 67.302-4.508 64.693 64.528 64.693 73.089 0 65.299 2.031 65.299-66.238-0.003-68.646 6.956-63.911-64.076-63.818zM216.828 837.592c0.359-73.094 4.639-66.914-67.358-67.17-68.104-0.191-62.569-2.763-62.407 63.31 0.129 73.476-6.954 66.52 67.074 66.649 66.042 0.065 63.142 6.056 62.691-62.789zM1027.718 835.6c0.134-68.334 6.443-65.304-63.297-65.178-70.132 0.132-66.656-5.793-66.527 65.304 0.129 70.645-4.384 64.721 63.756 64.657 71.995-0.132 66.202 6.698 66.068-64.783zM1027.718 617.923c0-70.55 7.219-66.842-67.485-66.522-0.898 0-1.873 0-2.838 0-59.375 0-59.375 0-59.375 58.023 0 77.922-6.443 69.936 69.293 70.196 66.076 0.387 60.539 3.091 60.405-61.697zM151.307 470.127c68.295 0.163 65.815 5.568 65.624-62.982-0.194-71.128 4.895-64.917-66.014-65.010-69.905-0.101-63.813-4.704-63.885 63.978-0.062 67.431-5.7 64.463 64.275 64.014zM961.263 470.127c72.511 0.258 66.589 4.603 66.455-64.494 0-68.558 6.185-63.537-64.267-63.498-70.196 0.028-65.686-6.053-65.498 65.493 0.132 62.5 0.067 62.5 63.31 62.5zM150.399 679.62c71.004 0 66.659 6.567 66.466-64.528-0.163-63.694-0.036-63.501-65.013-63.756-70.805-0.258-64.822-2.673-64.822 63.756 0.036 69.167-5.919 64.788 63.369 64.528z" + ], + "width": 1115, + "attrs": [], + "tags": [ + "filmstrip" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 25, + "id": 29, + "prevSize": 32, + "code": 58905, + "name": "filmstrip", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 4 + }, + { + "icon": { + "paths": [ + "", + "M797.086 847.699c-0.059-0.163-0.119-0.328-0.16-0.485-71.399 45.638-151.782 69.931-234.023 69.931-0.013 0-0.021 0-0.028 0-122.52 0-237.501-52.772-315.469-144.741-99.778-117.698-134.252-329.954-73.022-427.789 4.004 1.662 7.875 3.233 11.68 4.773 13.585 5.511 26.413 10.716 42.305 19.096 6.063 3.202 12.338 4.812 18.673 4.812 11.714 0 22.6-5.648 29.848-15.486 7.815-10.617 10.313-24.778 6.538-36.951l-3.525-11.41c-10.687-34.59-21.723-70.354-34.211-105.078-9.983-27.765-22.399-62.327-59.226-62.327-12.057 0-26.037 3.656-46.73 12.204-44.294 18.319-71.058 29.961-114.534 49.81-15.102 6.887-25.234 22.698-25.203 39.343 0.028 15.842 8.992 29.337 23.975 36.115 18.208 8.257 30.536 13.716 43.468 19.447l10.687 4.753c-101.938 259.102 24.803 526.458 211.314 639.212 83.497 50.474 178.5 77.14 274.769 77.14h0.041c102.72 0 205.561-31.099 284.501-85.198-31.729-28.803-45.566-69.167-51.671-87.171z", + "M1098.203 749.91c-18.113-8.577-30.356-14.258-43.221-20.244l-10.496-4.892c106.448-257.268-15.569-526.801-200.067-642.788-85.36-53.663-183.123-82.032-282.716-82.032-104.848 0-206.41 30.593-285.967 86.165l-5.385 3.764c31.597 27.564 45.86 66.788 52.917 86.41 72.926-47.94 155.675-73.409 239.895-73.409 125.407 0 242.142 54.785 320.294 150.316 97.683 119.447 128.439 332.255 65.498 429.015-3.989-1.736-7.815-3.385-11.624-4.998-13.471-5.759-26.204-11.18-41.954-19.821-6.203-3.424-12.645-5.155-19.212-5.155-11.585 0-22.399 5.558-29.69 15.267-7.813 10.434-10.478 24.432-6.966 36.515l3.279 11.301c10.096 34.845 20.531 70.857 32.412 105.842 9.588 28.238 21.514 63.382 59.179 63.382 11.843 0 25.577-3.424 45.881-11.399 44.351-17.439 71.319-28.601 115.409-47.777 15.19-6.623 25.601-22.252 25.859-38.894 0.281-15.822-8.445-29.499-23.325-36.569z" + ], + "width": 1122, + "attrs": [], + "tags": [ + "reload" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 24, + "id": 28, + "prevSize": 32, + "code": 58904, + "name": "reload", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 5 + }, + { + "icon": { + "paths": [ + "M65.774 443.252c10.052-9.358 25.988-21.772 43.285-32.699 51.335-32.619 108.115-50.897 166.829-64.133 48.763-10.95 98.246-16.887 148.066-20.203 55.755-3.754 111.559-3.78 167.392-0.797 39.944 2.185 79.686 6.502 119.119 13.211 43.956 7.506 87.037 17.994 128.785 33.751 24.419 9.175 48.172 20.105 70.534 33.573 29.716 17.891 56.552 39.224 77.22 67.348 20.819 28.302 31.721 60.407 33.829 95.392 1.747 27.402 0.717 54.697-5.656 81.588-2.877 12.083-8.226 23.134-16.554 32.386-11.417 12.648-26.424 17.021-42.772 17.636-20.463 0.668-40.411-4.113-60.361-8.226-38.912-7.97-77.836-16.245-116.699-24.728-14.137-3.034-28.689-5.093-41.649-12.596-22.308-12.955-34.445-31.775-34.033-57.783 0.258-16.869 2.216-33.782 2.469-50.695 0.312-25.010-9.923-45.161-30.898-59.042-14.395-9.539-30.694-14.911-47.452-18.665-40.411-9.046-81.387-10.179-122.561-10.050-28.821 0.126-57.582 1.669-86.093 6.143-19.947 3.161-39.562 7.813-57.732 17.014-24.318 12.364-39.353 31.465-40.073 59.352-0.441 16.351 0.973 32.802 1.927 49.15 0.642 11.822-0.080 23.446-5.295 34.288-9.26 19.385-24.935 31.672-45.37 36.964-22.646 5.865-45.605 10.54-68.504 15.223-38.102 7.764-76.216 15.368-114.416 22.517-14.526 2.774-29.254 1.951-43.133-3.602-18.742-7.457-28.924-22.775-34.138-41.337-7.096-25.397-7.841-51.513-6.966-77.731 0.9-27.040 5.883-53.237 18.404-77.607 9.794-19.065 22.491-35.955 42.493-55.642z" + ], + "width": 1026, + "attrs": [], + "tags": [ + "hangup" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 23, + "id": 27, + "prevSize": 32, + "code": 58903, + "name": "hangup", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 6 + }, + { + "icon": { + "paths": [ + "M1016.824 954.234c-2.051-15.373-5.331-30.537-7.859-45.847-8.334-50.458-33.006-86.503-82.063-107.922-78.373-34.198-155.103-72.121-232.111-109.395-55.686-27.025-52.409-88.519-34.097-114.413 11.89-16.88 22.344-34.572 23.575-56.852 0.444-8.226 8.303-18.99 15.817-23.294 26.070-15.035 38.161-39.565 50.020-64.982 3.109-6.696 7.379-13.187 12.266-18.722 8.471-9.668 12.264-19.235 6.079-31.842-1.435-2.97 1.331-8.334 2.8-12.367 4.304-12.026 10.285-23.676 13.12-36.043 3.556-15.339 5.398-31.225 6.252-46.975 0.374-6.523-6.045-13.528-5.362-19.95 3.483-31.912-14.557-56.202-24.739-83.977-12.465-34.198-36.928-55.619-58.519-81.106-4.066-4.784-5.227-13.051-5.571-19.886-0.72-14.588-6.732-21.797-22.004-19.813-6.11 0.787-12.772 2.495-18.41 0.991-4.957-1.334-12.406-6.288-12.676-10.112-1.538-19.336-8.264-22.517-28.016-19.235-12.364 2.049-28.457-9.155-40.584-17.561-10.145-7.041-18.89-10.045-30.681-7.176-4.915 1.195-11.544 0.991-15.716-1.435-4.441-2.663-8.775-4.237-13.118-5.124v-0.748c-0.957 0.031-1.982 0.204-2.939 0.307-0.955-0.103-1.912-0.274-2.867-0.307v0.751c-4.371 0.888-8.749 2.462-13.156 5.124-4.133 2.425-10.762 2.632-15.68 1.435-11.822-2.867-20.569 0.137-30.684 7.176-12.158 8.404-28.217 19.609-40.584 17.561-19.746-3.282-26.509-0.103-28.047 19.235-0.307 3.824-7.686 8.778-12.676 10.112-5.669 1.504-12.297-0.204-18.446-0.991-15.236-1.984-21.25 5.225-21.97 19.813-0.338 6.832-1.502 15.102-5.568 19.886-21.588 25.485-46.051 46.908-58.555 81.106-10.117 27.773-28.189 52.063-24.669 83.975 0.686 6.422-5.744 13.427-5.4 19.95 0.89 15.749 2.735 31.636 6.254 46.975 2.836 12.367 8.814 24.019 13.151 36.043 1.437 4.033 4.242 9.397 2.769 12.367-6.182 12.607-2.358 22.174 6.115 31.842 4.853 5.535 9.121 12.026 12.23 18.722 11.859 25.417 23.947 49.947 50.014 64.982 7.519 4.304 15.378 15.068 15.858 23.294 1.192 22.28 11.65 39.972 23.57 56.852 18.281 25.895 21.147 86.738-34.162 114.413-76.456 38.264-153.741 75.2-232.042 109.395-49.129 21.418-73.726 57.463-82.063 107.922-2.526 15.311-5.878 30.475-7.859 45.847-3.009 22.928-7.823 69.766-7.823 69.766h1024.611c-0.003 0-4.781-46.838-7.787-69.766z" + ], + "width": 1025, + "attrs": [], + "tags": [ + "contactListIcon" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 21, + "id": 26, + "prevSize": 32, + "code": 58901, + "name": "contactList", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 7 + }, + { + "icon": { + "paths": [ + "M1026.175 510.933c0 283.345-229.709 513.051-513.108 513.051-283.348 0-513.069-229.703-513.069-513.051 0-283.384 229.721-513.106 513.069-513.106 283.4-0 513.108 229.721 513.108 513.106z", + "M513.069 1023.985c135.725 0 259.112-52.711 350.874-138.739-9.717-11.65-22.551-21.114-39.113-28.343-58.934-25.745-116.627-54.256-174.534-82.256-41.871-20.322-39.405-66.587-25.639-86.057 8.943-12.692 16.805-25.998 17.728-42.746 0.333-6.169 6.241-14.284 11.889-17.522 19.604-11.304 28.697-29.747 37.604-48.861 2.34-5.031 5.555-9.89 9.229-14.077 6.37-7.243 9.224-14.436 4.572-23.942-1.086-2.209 1.004-6.241 2.105-9.273 3.238-9.067 7.733-17.801 9.861-27.115 2.67-11.549 4.059-23.48 4.701-35.323 0.281-4.902-4.544-10.184-4.033-14.986 2.621-24.022-10.943-42.271-18.598-63.158-9.376-25.714-27.771-41.82-44.005-60.97-3.058-3.623-3.927-9.838-4.188-14.952-0.539-10.981-5.060-16.415-16.544-14.924-4.598 0.601-9.611 1.886-13.843 0.756-3.728-0.988-9.327-4.724-9.534-7.604-1.153-14.539-6.213-16.929-21.065-14.475-9.296 1.543-21.395-6.858-30.513-13.203-7.632-5.292-14.209-7.555-23.069-5.38-3.697 0.9-8.682 0.746-11.815-1.094-3.341-1.976-6.605-3.184-9.867-3.839v-0.552c-0.72 0.013-1.489 0.129-2.209 0.217-0.722-0.088-1.44-0.206-2.157-0.217v0.552c-3.29 0.653-6.574 1.863-9.89 3.839-3.112 1.837-8.091 1.992-11.797 1.094-8.886-2.173-15.448 0.088-23.064 5.38-9.157 6.345-21.222 14.746-30.518 13.203-14.862-2.451-19.94-0.062-21.093 14.475-0.219 2.879-5.793 6.616-9.516 7.604-4.278 1.13-9.247-0.155-13.887-0.756-11.456-1.491-15.987 3.943-16.516 14.924-0.261 5.111-1.13 11.33-4.19 14.952-16.222 19.15-34.616 35.258-44.018 60.97-7.627 20.887-21.204 39.136-18.57 63.158 0.511 4.802-4.304 10.083-4.046 14.986 0.655 11.846 2.041 23.776 4.701 35.323 2.131 9.312 6.626 18.048 9.89 27.115 1.094 3.032 3.174 7.062 2.082 9.273-4.649 9.508-1.788 16.702 4.582 23.942 3.674 4.188 6.874 9.046 9.224 14.077 8.899 19.111 17.992 37.557 37.596 48.861 5.653 3.238 11.559 11.353 11.905 17.522 0.913 16.748 8.773 30.054 17.739 42.746 13.745 19.47 15.902 65.245-25.673 86.057-57.52 28.772-115.6 56.511-174.503 82.256-16.57 7.23-29.409 16.694-39.123 28.338 91.759 86.031 215.138 138.744 350.843 138.744z" + ], + "width": 1026, + "attrs": [], + "tags": [ + "avatar" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 22, + "id": 25, + "prevSize": 32, + "code": 58902, + "name": "avatar", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 8 + }, + { + "icon": { + "paths": [ + "M839.334 573.513c0 79.199-64.257 143.461-143.486 143.461-79.174 0-143.431-64.262-143.431-143.461 0-79.227 64.257-143.431 143.431-143.431 79.23 0.003 143.486 64.204 143.486 143.431z", + "M1372.769 253.515c-6.595-39.459-29.496-64.168-70.606-69.276-23.788-2.918-38.256-15.637-44.726-39.040-9.706-35.519-33.678-58.993-67.811-70.76-24.807-8.595-50.3-16.462-76.186-20.491-69.655-10.911-140.51-15.924-209.526-29.943-69.53-14.178-139.053-23.342-208.893-24.073-69.845 0.731-139.371 9.895-208.893 24.073-69.022 14.016-139.876 19.029-209.526 29.94-25.884 4.028-51.385 11.896-76.189 20.491-34.13 11.767-58.105 35.24-67.814 70.76-6.469 23.403-20.934 36.122-44.723 39.040-41.105 5.108-64.006 29.82-70.601 69.278-6.788 40.41-11.737 81.202-16.811 121.885-2.728 22.109 6.405 32.576 30.386 32.448 120.839-0.697 241.692-0.697 362.595-0.095 24.045 0.128 33.115-9.388 33.433-33.338 0.762-57.369-4.631-111.895-47.136-156.618-7.041-7.39-10.849-25.281-6.726-33.846 4.062-8.5 40.856-16.716 45.992-16.716 43.328 0.19 43.138 0.223 49.418 43.423 1.205 8.28 2.539 18.46 7.803 23.853 30.319 30.863 21.252 66.706 7.234 97.634-30.389 67.139-61.537 134.827-100.867 196.869-73.458 115.831-104.41 160.744-198.679 260.844-58.675 62.293-68.573 101.687-68.573 137.466 0 70.989 41.038 96.744 137.148 96.744 181.614 0 260.908-0.315 442.528-0.315 181.614 0 260.905 0.315 442.528 0.315 96.102 0 137.142-25.752 137.142-96.744 0-35.779-9.898-75.173-68.573-137.466-94.264-100.1-125.222-145.012-198.679-260.844-39.333-62.042-70.475-129.73-100.861-196.869-14.019-30.927-23.091-66.77 7.234-97.634 5.264-5.393 6.595-15.575 7.803-23.853 6.28-43.202 6.090-43.233 49.412-43.423 5.139 0 41.933 8.216 45.992 16.716 4.126 8.565 0.318 26.453-6.723 33.846-42.502 44.723-47.898 99.249-47.136 156.618 0.315 23.947 9.388 33.466 33.43 33.338 120.909-0.603 241.753-0.603 362.601 0.095 23.975 0.126 33.109-10.342 30.383-32.448-5.075-40.686-10.018-81.475-16.806-121.885zM959.991 576.495c0 146.315-118.624 264.936-264.97 264.936s-264.973-118.621-264.973-264.936c0-146.318 118.624-264.936 264.973-264.936 146.343-0 264.97 118.621 264.97 264.936z" + ], + "width": 1390, + "attrs": [], + "tags": [ + "callRetro" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 17, + "id": 24, + "prevSize": 32, + "code": 58897, + "name": "callRetro", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 9 + }, + { + "icon": { + "paths": [ + "M310.262 929.57c0 52.13-42.207 94.43-94.399 94.43h-121.405c-52.195 0-94.458-42.3-94.458-94.43v-835.67c0-52.158 42.266-94.458 94.458-94.458h121.403c52.195 0 94.399 42.3 94.399 94.458v835.67z", + "M1077.118-0.56h-561.987c-72.919 0-132.33 60.673-132.33 135.253v754.115c0 74.518 59.411 135.191 132.33 135.191h561.987c72.98 0 132.394-60.673 132.394-135.191v-754.115c0-74.58-59.414-135.253-132.394-135.253zM529.83 133.094h532.653l0.062 143.298h-532.715v-143.298zM643.255 908.372h-113.551v-113.551h113.551v113.551zM643.255 703.252h-113.551v-113.554h113.551v113.554zM643.382 496.244h-113.551v-113.554h113.551v113.554zM852.9 908.372h-113.551v-113.551h113.551v113.551zM852.9 703.252h-113.551v-113.554h113.551v113.554zM853.027 496.244h-113.556v-113.554h113.556v113.554zM1062.548 908.372h-113.556v-113.551h113.556v113.551zM1062.548 703.252h-113.556v-113.554h113.556v113.554zM1062.669 496.244h-113.554v-113.554h113.554v113.554z" + ], + "width": 1210, + "attrs": [], + "tags": [ + "callModern" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 18, + "id": 23, + "prevSize": 32, + "code": 58898, + "name": "callModern", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 10 + }, + { + "icon": { + "paths": [ + "M1123.444 20.985c-23.593-26.481-64.131-28.989-90.74-5.395l-1008.269 893.436c-26.609 23.468-28.991 64.131-5.46 90.676 12.674 14.306 30.308 21.649 48.126 21.649 15.123 0 30.372-5.401 42.544-16.195l130.045-115.22c90.743 81.844 210.569 132.165 342.473 132.101 282.816-0.061 510.913-227.969 511.287-510.972 0.126-109.934-34.682-211.367-93.499-294.72l118.088-104.625c26.483-23.526 28.997-64.129 5.404-90.735zM944.422 510.182c0.128 200.922-161.896 363.201-362.509 362.952-87.56-0.123-167.573-31.151-230.061-82.569l331.277-293.509v73.176c1.071 60.993 32.696 92.18 94.944 93.692 61.997-1.512 93.686-32.763 95.131-93.756v-41.096h-72.227v47.499c0.251 4.642-0.564 10.607-2.511 17.949-1.25 3.261-3.448 6.020-6.525 8.093-3.197 2.572-7.845 3.828-13.868 3.828-10.543-0.31-17.132-4.268-19.827-11.921-1.068-3.512-1.947-6.905-2.508-10.163-0.254-2.887-0.377-5.532-0.377-7.786v-143.511l42.477-37.634c0.215 0.432 0.452 0.851 0.63 1.303 1.947 6.467 2.762 12.799 2.511 19.076v36.772h72.227v-30.121c-0.246-31.245-9.086-54.699-26.363-70.447l40.711-36.069c35.787 56.055 56.803 122.585 56.867 194.244z", + "M239.795 628.53c-12.613-37.023-19.827-76.557-19.827-117.913-0.19-200.236 161.584-362.009 361.945-362.135 56.853 0 110.313 13.302 158.133 36.398l117.846-104.421c-79.444-50.952-173.758-80.817-275.292-80.948-283.377-0.181-511.354 227.729-511.789 511.675-0.126 79.567 18.636 154.679 51.137 221.882l117.848-104.538z", + "M388.576 333.98h-97.514v249.057l72.23-64.070v-0.689h0.815l117.72-104.418c0-0.564 0.123-0.94 0.123-1.509 0.753-53.898-30.369-80.069-93.374-78.37zM405.959 398.483c1.942 2.767 3.074 6.469 3.323 11.112 0.312 4.452 0.438 9.6 0.438 15.246 0.251 10.916-0.689 19.83-2.949 26.985-2.952 7.594-10.983 11.357-24.159 11.357h-19.325v-74.043h15.31c7.842 0 13.865 0.683 18.072 2.19 4.397 1.573 7.468 3.953 9.29 7.153z" + ], + "width": 1140, + "attrs": [], + "tags": [ + "recDisable" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 19, + "id": 22, + "prevSize": 32, + "code": 58899, + "name": "recDisable", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 11 + }, + { + "icon": { + "paths": [ + "M581.278-1.708c284.857 0.19 514.807 230.517 514.427 514.997-0.378 285.047-230.073 514.553-514.869 514.615-284.541 0.062-515.311-230.517-514.933-514.422 0.439-285.936 230.009-515.439 515.375-515.19zM580.579 148.244c-201.764 0.123-364.666 163.032-364.478 364.663 0 202.018 162.524 364.735 364.478 364.984 202.018 0.316 365.174-163.030 365.048-365.423-0.252-201.767-163.156-364.35-365.048-364.224z", + "M287.698 335.093h98.196c63.442-1.767 94.785 24.518 94.027 78.863 0.254 19.081-2.211 34.882-7.456 47.521-6.005 12.508-18.706 21.988-38.167 28.181v0.819c28.373 6.259 43.031 23.573 43.981 51.946v57.689c0 11.247 0.254 22.813 0.758 34.756 0.819 12.005 3.033 20.979 6.696 27.043h-71.846c-3.727-6.064-6.128-15.038-7.14-27.043-1.012-11.943-1.454-23.509-1.138-34.756v-52.321c0-9.603-2.214-16.553-6.573-20.979-4.675-4.107-12.701-6.19-24.012-6.19h-14.599v141.291h-72.73v-326.82zM360.428 465.139h19.463c13.271 0 21.359-3.794 24.331-11.375 2.276-7.204 3.221-16.304 2.969-27.171 0-5.815-0.126-10.867-0.442-15.418-0.252-4.675-1.392-8.404-3.352-11.247-1.831-3.157-4.926-5.561-9.352-7.14-4.233-1.454-10.299-2.211-18.2-2.211h-15.418v74.564z", + "M498.372 335.093h162.082v62.687h-89.35v65.587h78.103v62.685h-78.103v73.11h92.822v62.749h-165.557v-326.818z", + "M682.507 424.001c0.316-31.782 9.416-55.542 27.425-71.407 17.44-15.29 40.185-22.936 68.181-22.936 28.247 0 51.119 7.646 68.623 23 17.82 15.798 26.92 39.623 27.171 71.407v30.333h-72.73v-37.031c0.254-6.192-0.57-12.639-2.527-19.209-1.264-3.157-3.475-5.938-6.573-8.214-3.221-1.515-7.898-2.404-13.964-2.404-10.615 0.316-17.249 3.855-19.967 10.618-2.211 6.573-3.223 13.017-2.907 19.209v161.956c0 2.273 0.126 4.865 0.38 7.772 0.568 3.411 1.454 6.824 2.527 10.233 2.717 7.775 9.352 11.756 19.967 12.007 6.067 0 10.744-1.261 13.964-3.791 3.098-2.15 5.309-4.867 6.573-8.216 1.96-7.33 2.782-13.33 2.527-18.007v-47.837h72.73v41.328c-1.451 61.547-33.364 93.015-95.794 94.469-62.685-1.454-94.53-32.922-95.607-94.343v-148.937z" + ], + "width": 1142, + "attrs": [], + "tags": [ + "recEnable" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 20, + "id": 21, + "prevSize": 32, + "code": 58900, + "name": "recEnable", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 12 + }, + { + "icon": { + "paths": [ + "M513.036 0c283.57 0.188 512.414 229.474 512.037 512.664-0.377 283.756-228.965 512.228-512.541 512.288-283.191 0.067-512.912-229.474-512.533-512.099 0.374-284.638 228.965-513.103 513.036-512.853zM512.285 149.271c-200.79 0.126-362.957 162.291-362.831 363.014 0 201.105 161.788 363.081 362.831 363.334 201.164 0.312 363.581-162.294 363.455-363.772-0.25-200.852-162.417-362.702-363.455-362.575z", + "M597.392 512.412h-0.503l-0.126-0.126h0.63l115.615-115.866c0 0-78.247-78.505-82.153-82.153l-117.754 116.183-119.014-118.196-82.024 82.279 88.815 88.818 26.674 29.061h0.503l0.253 0.253h-0.756l-115.489 115.806c0 0 78.249 78.564 82.024 82.212l117.76-116.245 119.008 118.26 82.153-82.406-88.815-88.82-26.8-29.061z" + ], + "width": 1025, + "attrs": [], + "tags": [ + "kickUser1" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 16, + "id": 20, + "prevSize": 32, + "code": 58895, + "name": "kick1", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 13 + }, + { + "icon": { + "paths": [ + "M66.491 1023.997h1027.94z", + "M1198.596 472.014c-135.702-135.893-271.415-271.66-407.367-407.241-6.244-6.089-13.868-11.714-21.867-14.653-31.236-11.399-63.48 12.808-63.728 47.674-0.253 67.663-0.126 135.331-0.126 202.965 0 4.281 0 8.62 0 13.964-6.123 0-10.87 0-15.62 0-106.247 0-212.334-0.062-318.485 0-35.178 0.031-54.86 19.71-54.86 54.922-0.059 92.778-0.059 185.5 0 278.345 0 35.8 19.682 55.479 55.611 55.479 105.775 0.062 211.423 0 317.11 0 4.877 0 9.622 0 16.245 0 0 5.375 0 9.374 0 13.309 0 66.793 0.25 133.703 0 200.496 0 23.057 9.247 40.241 30.242 49.547 21.116 9.371 39.361 2.81 55.231-12.937 135.955-136.079 272.031-272.034 407.989-408.175 23.49-23.431 23.24-50.112-0.374-73.695z", + "M532.596 915.271c-2.627-19.62-22.055-32.116-27.928-35.426-8.811-5.186-18.371-5.811-25.683-5.811l-6.37 0.126-227.926-0.188c-56.042-0.124-98.468-42.173-98.591-97.717-0.188-177.127-0.188-354.321 0.065-531.51 0.059-53.983 42.671-96.53 96.968-96.811l235.922-0.062c33.426-0.031 51.294-16.121 54.481-49.235 1.001-12.965 0.81-26.052 0.439-39.172-1.128-39.737-19.369-57.481-59.107-57.512l-217.866 0.121c-15.494 0-30.926 0.562-46.361 2.343-115.52 13.154-207.555 113.649-209.681 228.798-1.313 63.888-0.996 127.804-0.684 191.718l0.186 60.201h-0.377c0 0-0.121 227.954 0.065 289.811 0.248 135.702 101.528 240.796 235.545 244.48 33.176 0.875 66.419 1.189 99.654 1.189h0.065l148.012-0.753c29.368 0 47.483-17.37 49.73-47.545 1.755-22.058 1.628-40.173-0.557-57.045z" + ], + "width": 1216, + "attrs": [], + "tags": [ + "kickUser" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 15, + "id": 19, + "prevSize": 32, + "code": 58896, + "name": "kick", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 14 + }, + { + "icon": { + "paths": [ + "M955.816-0.317h-822.841c-73.303 0-132.975 60.931-132.975 135.844v542.186c0 74.851 59.672 135.785 132.975 135.785h822.841c73.239 0 132.916-60.934 132.916-135.785v-542.186c0-74.913-59.677-135.844-132.916-135.844zM949.51 671.216h-810.226v-529.223h810.164l0.062 529.223z", + "M945.219 959.66c0 35.738-28.261 64.66-63.207 64.66h-675.228c-34.949 0-63.209-28.921-63.209-64.66v-29.618c0-35.7 28.261-64.657 63.209-64.657h675.228c34.946 0 63.207 28.957 63.207 64.657v29.618z", + "M776.792 617.566l-302.669-302.605 112.411-112.316 302.545 302.602v112.318z" + ], + "width": 1089, + "attrs": [], + "tags": [ + "shareDesktop" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 14, + "id": 18, + "prevSize": 32, + "code": 58882, + "name": "share-desktop", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 15 + }, + { + "icon": { + "paths": [ + "M953.901-2.387h-819.775c-72.965 0-132.418 60.712-132.418 135.344v540.168c0 74.567 59.453 135.279 132.418 135.279h35.823v212.891l344.966-212.891h438.986c72.963 0 132.415-60.709 132.415-135.279v-540.168c0.003-74.632-59.45-135.344-132.415-135.344zM494.429 666.646l-195.769 124.001v-124.001h-158.184v-527.252h807.078l0.124 527.252h-453.249z" + ], + "width": 1089, + "attrs": [], + "tags": [ + "chatNoLines" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 13, + "id": 17, + "prevSize": 32, + "code": 58886, + "name": "chat-simple", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 16 + }, + { + "icon": { + "paths": [ + "M952.366-0.134h-820.477c-73.027 0-132.531 60.761-132.531 135.455v752.358c0 74.66 59.504 135.424 132.531 135.424h820.48c73.089 0 132.596-60.766 132.596-135.424v-752.358c-0.003-74.694-59.507-135.455-132.599-135.455zM946.135 881.199h-807.894v-739.462h807.834l0.059 739.462z", + "M569.742 448.125l91.772-96.865-77.305-77.308 316.393-85.040-84.981 316.391-75.357-75.293-91.834 96.865z", + "M514.763 575.437l-91.767 96.865 77.3 77.305-316.388 85.043 84.979-316.388 75.357 75.29 91.834-96.871z" + ], + "width": 1089, + "attrs": [], + "tags": [ + "fullScreen 1" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 12, + "id": 16, + "prevSize": 32, + "code": 58893, + "name": "full-screen", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 17 + }, + { + "icon": { + "paths": [ + "M953.225 0.82h-820.663c-73.045 0-132.562 60.776-132.562 135.488v752.525c0 74.647 59.517 135.421 132.562 135.421h820.66c73.107 0 132.624-60.776 132.624-135.421v-752.525c0.003-74.712-59.515-135.488-132.622-135.488zM946.994 882.353h-808.079v-739.596h808.017l0.062 739.596z", + "M915.539 253.3l-91.795 96.889 77.326 77.323-316.463 85.030 84.999-316.463 75.373 75.339 91.852-96.889z", + "M170.625 771.779l91.793-96.884-77.323-77.326 316.463-85.028-84.997 316.46-75.373-75.342-91.857 96.891z" + ], + "width": 1089, + "attrs": [], + "tags": [ + "exitFullScreen 1" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 11, + "id": 15, + "prevSize": 32, + "code": 58894, + "name": "exit-full-screen", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 18 + }, + { + "icon": { + "paths": [ + "M512.356-0c-282.456 0-512.356 229.838-512.356 512.478 0 282.389 229.9 512.227 512.356 512.227 282.515 0 512.414-229.838 512.414-512.227 0-282.64-229.9-512.478-512.414-512.478zM512.356 945.144c-238.545 0-432.671-194.126-432.671-432.666 0-238.796 194.126-432.858 432.671-432.858 238.601 0 432.856 194.062 432.856 432.858 0 238.54-194.255 432.666-432.856 432.666z", + "M512.545 105.038c-224.755 0-407.508 182.75-407.508 407.315 0 224.563 182.75 407.315 407.508 407.315 224.437 0 407.187-182.755 407.187-407.315-0.003-224.566-182.75-407.315-407.187-407.315zM512.545 832.677c-176.715 0-320.453-143.804-320.453-320.324 0-176.523 143.737-320.324 320.453-320.324 176.523 0 320.196 143.802 320.196 320.324 0 176.52-143.673 320.324-320.196 320.324z", + "M283.851 397.211l-0.954 1.398v234.413l0.954 1.398c15.757 23.060 36.473 44.542 61.699 63.797l8.961 6.801v-378.341l-8.961 6.735c-25.1 19.191-45.814 40.544-61.699 63.799z", + "M415.637 294.271l-3.621 1.334v440.36l3.621 1.398c18.683 7.055 38.887 11.94 61.766 14.931l6.224 0.762v-474.415l-6.163 0.762c-22.237 2.795-43.016 7.753-61.827 14.869z", + "M547.367 279.401l-6.165-0.762v474.415l6.165-0.762c22.301-2.793 43.077-7.811 61.763-14.864l3.685-1.4v-440.488l-3.685-1.334c-18.811-7.053-39.525-12.010-61.763-14.805z", + "M740.98 397.211c-15.692-23.002-36.473-44.48-61.699-63.797l-8.894-6.86v378.469l8.894-6.801c25.351-19.381 46.132-40.862 61.699-63.861l0.89-1.398v-234.352l-0.89-1.4z" + ], + "width": 1025, + "attrs": [], + "tags": [ + "prezisimple" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 10, + "id": 14, + "prevSize": 32, + "code": 58892, + "name": "prezi", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 19 + }, + { + "icon": { + "paths": [ + "M831.678 943.614h-144.885v-258.653c-45.729-29.159-41.794-84.953-24.574-109.307 11.939-16.905 22.43-34.662 23.663-57.004 0.423-8.241 8.303-19.031 15.847-23.364 26.122-15.037 38.223-39.632 50.12-65.116 3.143-6.714 7.392-13.187 12.3-18.753 8.471-9.686 12.295-19.264 6.115-31.922-1.466-2.972 1.318-8.326 2.779-12.362 4.335-12.106 10.326-23.745 13.169-36.148 3.522-15.399 5.398-31.305 6.244-47.086 0.379-6.543-6.074-13.574-5.351-19.986 3.486-32.030-14.612-56.346-24.785-84.189-12.509-34.28-37.036-55.732-58.681-81.26-4.074-4.843-5.225-13.125-5.563-19.942-0.722-14.63-6.752-21.875-22.048-19.898-6.161 0.805-12.808 2.526-18.474 1.019-4.969-1.316-12.408-6.288-12.702-10.13-1.553-19.393-8.285-22.577-28.098-19.305-12.406 2.062-28.527-9.134-40.677-17.587-10.15-7.049-18.941-10.065-30.751-7.175-4.928 1.187-11.598 0.973-15.716-1.466-4.461-2.634-8.837-4.226-13.169-5.119v-0.722c-0.975 0-1.976 0.17-2.934 0.276-0.975-0.106-1.951-0.276-2.908-0.276v0.722c-4.355 0.893-8.726 2.485-13.169 5.119-4.167 2.441-10.811 2.652-15.718 1.466-11.851-2.89-20.598 0.126-30.751 7.175-12.212 8.453-28.287 19.648-40.671 17.587-19.816-3.272-26.591-0.085-28.119 19.305-0.299 3.844-7.73 8.816-12.7 10.13-5.692 1.509-12.32-0.212-18.497-1.019-15.27-1.976-21.302 5.269-22.024 19.898-0.338 6.819-1.486 15.102-5.565 19.942-21.622 25.528-46.154 46.98-58.684 81.26-10.171 27.843-28.271 52.161-24.765 84.189 0.699 6.412-5.736 13.443-5.395 19.986 0.87 15.78 2.74 31.687 6.267 47.086 2.843 12.403 8.835 24.042 13.187 36.148 1.466 4.033 4.229 9.387 2.784 12.362-6.203 12.658-2.379 22.236 6.115 31.922 4.887 5.565 9.134 12.039 12.277 18.753 11.874 25.484 24.001 50.079 50.125 65.116 7.516 4.332 15.417 15.122 15.863 23.364 1.21 22.342 11.701 40.099 23.64 57.004 18.33 25.954 21.194 86.95-34.216 114.687-76.673 38.336-154.083 75.357-232.624 109.632-49.189 21.498-73.891 57.6-82.238 108.192-2.549 15.331-5.862 30.539-7.88 45.961-3.014 22.956-7.839 69.874-7.839 69.874h831.678v-80.386z", + "M1188.556 879.11h-144.89v144.89h-147.481v-144.89h-144.885v-147.481h144.885v-144.888h147.481v144.888h144.89v147.481z" + ], + "width": 1189, + "attrs": [ + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + } + ], + "tags": [ + "addNew-V5" + ], + "grid": 0 + }, + "attrs": [ + { + "opacity": 1, + "visibility": false + }, + { + "opacity": 1, + "visibility": false + } + ], + "properties": { + "order": 26, + "id": 30, + "prevSize": 32, + "code": 58880, + "name": "addNew-V5", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 20 + }, + { + "icon": { + "paths": [ + "M956.063-2.932h-819.824c-73.036 0-132.489 60.717-132.489 135.316v540.205c0 74.537 59.453 135.246 132.489 135.246h35.826v212.941l344.987-212.941h439.011c72.964 0 132.42-60.711 132.42-135.246v-540.202c0-74.602-59.456-135.318-132.42-135.318zM496.5 666.113l-195.714 123.997v-123.997h-158.261v-527.257h807.189l0.064 527.255h-453.278z", + "M239.062 244.446h605.126v110.62h-605.126v-110.62z", + "M239.062 437.524h605.126v110.615h-605.126v-110.615z" + ], + "width": 1088, + "attrs": [], + "tags": [ + "chat" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 1, + "id": 11, + "prevSize": 32, + "code": 58881, + "name": "chat", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 21 + }, + { + "icon": { + "paths": [ + "M952.495 4.935h-818.689c-72.81 0-132.183 60.63-132.183 135.162v750.719c0 74.473 59.372 135.101 132.183 135.101h818.686c72.936 0 132.314-60.625 132.314-135.101v-750.722c0.003-74.532-59.378-135.159-132.311-135.159zM946.346 884.349h-806.14v-737.822h806.015l0.126 737.822z", + "M685.753 285.456h216.911v566.758h-216.911v-566.758z", + "M428.672 413.998h216.911v438.216h-216.911v-438.216z", + "M172.339 542.54h216.161v309.677h-216.161v-309.677z" + ], + "width": 1088, + "attrs": [], + "tags": [ + "presentation" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 3, + "id": 9, + "prevSize": 32, + "code": 58883, + "name": "presentation", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 22 + }, + { + "icon": { + "paths": [ + "M878.259-5.513c-163.545 0-296.573 133.036-296.573 296.612v43.752h-448.909c-73.14 0-132.777 60.909-132.777 135.751v412.768c0 74.777 59.637 135.678 132.777 135.678h564.152c73.265 0 132.919-60.901 132.919-135.678v-412.768c0-70.054-52.267-127.895-119.040-135.009v-44.494c0-92.367 75.154-167.49 167.451-167.49 92.305 0 167.462 75.12 167.462 167.49v77.422c0 35.681 28.883 64.564 64.556 64.564 35.69 0 64.569-28.883 64.569-64.564v-77.422c-0.003-163.576-133.028-296.612-296.587-296.612z" + ], + "width": 1179, + "attrs": [], + "tags": [ + "security" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 5, + "id": 8, + "prevSize": 32, + "code": 58884, + "name": "security", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 23 + }, + { + "icon": { + "paths": [ + "M1.518 318.386h277.533v-319.798c0 0-78.033 8.102-176.18 111.633-98.139 103.529-101.353 208.165-101.353 208.165z", + "M683.281-1.412h-339.684v384.596l-342.080-0.251-1.515-3.468v510.502c0 73.845 61.4 133.979 136.847 133.979h546.434c75.514 0 136.911-60.137 136.911-133.979v-757.403c-0.003-73.843-61.397-133.976-136.914-133.976zM691.854 814.836h-572.848v-92.788h572.845v92.788zM691.854 621.198h-572.848v-92.783h572.845v92.783z" + ], + "width": 820, + "attrs": [], + "tags": [ + "shareDoc" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 6, + "id": 7, + "prevSize": 32, + "code": 58885, + "name": "share-doc", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 24 + }, + { + "icon": { + "paths": [ + "M709.515 339.906v-44.455c0-163.090-132.662-295.749-295.749-295.749-163.093 0-295.752 132.659-295.752 295.749v44.455c-66.226 7.393-118.013 64.915-118.013 134.607v411.623c0 74.629 59.481 135.365 132.472 135.365h562.583c73.059 0 132.534-60.736 132.534-135.365v-411.623c-0-69.697-51.792-127.219-118.074-134.607zM413.765 128.463c92.043 0 166.987 74.944 166.987 166.987v43.632h-333.978v-43.632c0-92.043 74.883-166.987 166.99-166.987z" + ], + "width": 828, + "attrs": [], + "tags": [ + "securityLock" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 2, + "id": 5, + "prevSize": 32, + "code": 58887, + "name": "security-locked", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 25 + }, + { + "icon": { + "paths": [ + "M1223.934 242.853l-180.299 175.956v-217.848c0-7.661-0.666-15.148-1.902-22.432l73.695-65.346c26.349-23.41 28.841-63.8 5.369-90.24-23.475-26.406-63.803-28.872-90.273-5.4l-1009.019 894.712c-26.408 23.41-28.841 63.806-5.398 90.209 12.607 14.237 30.183 21.539 47.85 21.539 15.076 0 30.214-5.305 42.39-16.1l95.841-84.979c20.995 14.627 46.26 23.232 73.592 23.232h635.191c73.099 0 132.66-60.807 132.66-135.537v-172.868l193.659 153.955c48.815 35.46 96.765-5.248 96.765-40.584v-483.829c0.003-35.305-55.933-71.386-110.123-24.44zM601.515 760.552c-58.81 0-112.566-20.216-155.526-53.797l82.93-73.533c20.863 11.665 44.849 18.386 70.47 18.386 80.533 0 145.832-65.299 145.832-145.835 0-19.421-3.896-37.857-10.857-54.713l86.847-77.001c22.848 38.259 36.012 82.969 36.012 130.782 0 141.214-114.493 255.71-255.707 255.71z", + "M345.797 504.84c0-141.216 114.496-255.715 255.717-255.715 21.501 0 42.075 3.434 61.986 8.429l216.757-192.191h-604.474c-73.138 0-132.697 60.838-132.697 135.597v518.074l205.894-182.543c-1.308-10.486-3.184-20.853-3.184-31.651z" + ], + "width": 1334, + "attrs": [], + "tags": [ + "disableWebCam" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 7, + "id": 3, + "prevSize": 32, + "code": 58889, + "name": "camera-disabled", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 26 + }, + { + "icon": { + "paths": [ + "M1121.124 21.134c-23.48-26.413-63.883-28.849-90.296-5.372l-1009.306 894.905c-26.413 23.418-28.852 63.816-5.434 90.232 12.612 14.243 30.224 21.547 47.893 21.547 15.050 0 30.224-5.307 42.403-16.108l257.072-227.934c33.225 22.863 69.988 39.678 108.611 49.713-70.191 35.653-118.771 107.715-118.771 191.894h431.872c0-85.737-50.329-159.115-122.765-194.079 54.95-14.49 105.842-39.965 147.497-77.496 51.888-46.712 113.712-131.515 113.712-270.329v-130.323c0-18.812-7.924-35.767-20.585-47.798l212.664-188.558c26.419-23.477 28.849-63.816 5.434-90.294zM791.535 478.109c0 157.985-117.649 229.923-226.99 229.923-35.214 0-68.659-7.217-98.285-20.786l55.735-49.416c14.733 4.59 30.356 7.132 46.609 7.132 89.357 0 161.984-72.687 161.984-161.979v-30.1l60.947-54.042v79.269z", + "M730.589 166.133c0-89.298-72.625-161.984-161.984-161.984-89.298 0-161.984 72.687-161.984 161.984v316.85c0 0.25 0 0.498 0 0.748l323.969-287.25v-30.348z", + "M350.795 533.31c-3.246-17.483-5.119-35.782-5.119-55.201v-130.323c0-36.406-29.6-66.004-66.006-66.004-36.466 0-66.004 29.597-66.004 66.004v130.323c0 57.198 11.115 107.026 29.099 150.931l108.030-95.73z" + ], + "width": 1137, + "attrs": [], + "tags": [ + "disableMic" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 8, + "id": 2, + "prevSize": 32, + "code": 58890, + "name": "mic-disabled", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 27 + }, + { + "icon": { + "paths": [ + "M858.414 280.056c-36.595 0-66.246 29.652-66.246 66.182v130.725c0 158.421-117.982 230.597-227.635 230.597-58.674 0-112.618-19.87-151.86-55.959-44.23-40.819-67.696-101.203-67.696-174.64v-130.725c0-36.53-29.654-66.182-66.182-66.182-36.53 0-66.182 29.652-66.182 66.182v130.725c0 195.834 119.494 314.763 259.177 351.040-70.408 35.71-119.176 108.014-119.176 192.431h433.118c0-85.993-50.409-159.621-123.029-194.572 55.079-14.64 106.121-40.127 147.886-77.79 52.050-46.877 114.008-131.925 114.008-271.106v-130.725c0-36.53-29.59-66.182-66.184-66.182z", + "M568.571 644.281c-89.589 0-162.459-72.932-162.459-162.521v-317.665c0-89.589 72.87-162.459 162.459-162.459 89.592 0 162.524 72.87 162.524 162.459v317.665c0.003 89.592-72.929 162.521-162.524 162.521z" + ], + "width": 1137, + "attrs": [], + "tags": [ + "mic" + ], + "grid": 0 + }, + "attrs": [], + "properties": { + "order": 9, + "id": 1, + "prevSize": 32, + "code": 58891, + "name": "microphone", + "ligatures": "" + }, + "setIdx": 1, + "setId": 1, + "iconIdx": 28 + } + ], + "height": 1024, + "metadata": { + "name": "jitsi" + }, + "preferences": { + "showGlyphs": true, + "showQuickUse": true, + "showQuickUse2": true, + "showSVGs": true, + "fontPref": { + "prefix": "icon-", + "metadata": { + "fontFamily": "jitsi", + "majorVersion": 1, + "minorVersion": 0 + }, + "metrics": { + "emSize": 1024, + "baseline": 6.25, + "whitespace": 50 + }, + "embed": false + }, + "imagePref": { + "prefix": "icon-", + "png": true, + "useClassSelector": true + }, + "historySize": 100, + "showCodes": true, + "search": "" + } +} \ No newline at end of file diff --git a/react/features/base/fontIcons/index.js b/react/features/base/fontIcons/index.js new file mode 100644 index 0000000000..e263cc0e6d --- /dev/null +++ b/react/features/base/fontIcons/index.js @@ -0,0 +1 @@ +export * from './Icon'; diff --git a/react/features/base/lib-jitsi-meet/_.native.js b/react/features/base/lib-jitsi-meet/_.native.js new file mode 100644 index 0000000000..738c4d2b8a --- /dev/null +++ b/react/features/base/lib-jitsi-meet/_.native.js @@ -0,0 +1 @@ +export * from './native'; diff --git a/react/features/base/lib-jitsi-meet/_.web.js b/react/features/base/lib-jitsi-meet/_.web.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/react/features/base/lib-jitsi-meet/actionTypes.js b/react/features/base/lib-jitsi-meet/actionTypes.js new file mode 100644 index 0000000000..8f1bd590d2 --- /dev/null +++ b/react/features/base/lib-jitsi-meet/actionTypes.js @@ -0,0 +1,37 @@ +/** + * Action to signal that lib-jitsi-meet library was disposed. + * + * { + * type: LIB_DISPOSED + * } + */ +export const LIB_DISPOSED = 'LIB_DISPOSED'; + +/** + * Action to signal that lib-jitsi-meet initialized failed with error. + * + * { + * type: LIB_INIT_ERROR, + * error: Error + * } + */ +export const LIB_INIT_ERROR = 'LIB_INIT_ERROR'; + +/** + * Action to signal that lib-jitsi-meet initialization succeeded. + * + * { + * type: LIB_INITIALIZED + * } + */ +export const LIB_INITIALIZED = 'LIB_INITIALIZED'; + +/** + * Action to signal that config was set. + * + * { + * type: SET_CONFIG, + * config: Object + * } + */ +export const SET_CONFIG = 'SET_CONFIG'; diff --git a/react/features/base/lib-jitsi-meet/actions.js b/react/features/base/lib-jitsi-meet/actions.js new file mode 100644 index 0000000000..734bb55f77 --- /dev/null +++ b/react/features/base/lib-jitsi-meet/actions.js @@ -0,0 +1,73 @@ +import JitsiMeetJS from './'; +import { + LIB_DISPOSED, + LIB_INIT_ERROR, + LIB_INITIALIZED, + SET_CONFIG +} from './actionTypes'; +import './middleware'; +import './reducer'; + +/** + * Disposes lib-jitsi-meet. + * + * @returns {Function} + */ +export function disposeLib() { + // XXX We're wrapping it with Promise, because: + // a) to be better aligned with initLib() method, which is async. + // b) as currently there is no implementation for it in lib-jitsi-meet, and + // there is a big chance it will be async. + // TODO Currently, lib-jitsi-meet doesn't have any functionality to + // dispose itself. + return dispatch => { + dispatch({ type: LIB_DISPOSED }); + + return Promise.resolve(); + }; +} + +/** + * Initializes lib-jitsi-meet with passed configuration. + * + * @returns {Function} + */ +export function initLib() { + return (dispatch, getState) => { + const config = getState()['features/base/lib'].config; + + if (!config) { + throw new Error('Cannot initialize lib-jitsi-meet without config'); + } + + return JitsiMeetJS.init(config) + .then(() => dispatch({ type: LIB_INITIALIZED })) + .catch(error => { + dispatch({ + type: LIB_INIT_ERROR, + lib: { error } + }); + + // TODO Handle LIB_INIT_ERROR error somewhere instead. + console.error('lib-jitsi-meet failed to init due to ', error); + throw error; + }); + }; +} + +/** + * Sets config. + * + * @param {Object} config - Config object accepted by JitsiMeetJS#init() + * method. + * @returns {{ + * type: SET_CONFIG, + * config: Object + * }} + */ +export function setConfig(config) { + return { + type: SET_CONFIG, + config + }; +} diff --git a/react/features/base/lib-jitsi-meet/functions.js b/react/features/base/lib-jitsi-meet/functions.js new file mode 100644 index 0000000000..dba6cf2707 --- /dev/null +++ b/react/features/base/lib-jitsi-meet/functions.js @@ -0,0 +1,29 @@ +import { loadScript } from '../../base/util'; + +/** + * Loads config.js file from remote server. + * + * @param {string} host - Host where config.js is hosted. + * @param {string} configLocation='/config.js' - Relative pah to config.js file. + * @returns {Promise} + */ +export function loadConfig(host, configLocation = '/config.js') { + return loadScript(new URL(configLocation, host).toString()) + .then(() => { + const config = window.config; + + // We don't want to pollute global scope. + window.config = undefined; + + if (typeof config !== 'object') { + throw new Error('window.config is not an object'); + } + + return config; + }) + .catch(error => { + console.error('Failed to load config.js from remote server', error); + + throw error; + }); +} diff --git a/react/features/base/lib-jitsi-meet/index.js b/react/features/base/lib-jitsi-meet/index.js new file mode 100644 index 0000000000..7725057efa --- /dev/null +++ b/react/features/base/lib-jitsi-meet/index.js @@ -0,0 +1,30 @@ +import './_'; + +// The library lib-jitsi-meet (externally) depends on the libraries jQuery and +// Strophe +(global => { + // jQuery + if (typeof global.$ === 'undefined') { + const jQuery = require('jquery'); + + jQuery(global); + global.$ = jQuery; + } + + // Strophe + if (typeof global.Strophe === 'undefined') { + require('strophe'); + require('strophejs-plugins/disco/strophe.disco'); + require('strophejs-plugins/caps/strophe.caps.jsonly'); + } +})(global || window || this); // eslint-disable-line no-invalid-this + +// Re-export JitsiMeetJS from the library lib-jitsi-meet to (the other features +// of) the project jitsi-meet-react. +import JitsiMeetJS from 'lib-jitsi-meet'; + +export { JitsiMeetJS as default }; + +export * from './actions'; +export * from './actionTypes'; +export * from './functions'; diff --git a/react/features/base/lib-jitsi-meet/middleware.js b/react/features/base/lib-jitsi-meet/middleware.js new file mode 100644 index 0000000000..cd8674d945 --- /dev/null +++ b/react/features/base/lib-jitsi-meet/middleware.js @@ -0,0 +1,48 @@ +import { PARTICIPANT_LEFT } from '../participants'; +import { MiddlewareRegistry } from '../redux'; + +import { + disposeLib, + initLib +} from './actions'; +import { SET_CONFIG } from './actionTypes'; + +/** + * Middleware that captures PARTICIPANT_LEFT action for a local participant + * (which signalizes that we finally left the app) and disposes lib-jitsi-meet. + * Also captures SET_CONFIG action and disposes previous instance (if any) of + * lib-jitsi-meet, and initializes a new one with new config. + * + * @param {Store} store - Redux store. + * @returns {Function} + */ +MiddlewareRegistry.register(store => next => action => { + switch (action.type) { + case PARTICIPANT_LEFT: + if (action.participant.local) { + store.dispatch(disposeLib()); + } + break; + + case SET_CONFIG: { + const { dispatch, getState } = store; + const libInitialized = getState()['features/base/lib'].initialized; + + // XXX If we already have config, that means new config is coming, which + // means that we should dispose instance of lib initialized with + // previous config first. + // TODO Currently 'disposeLib' actually does not dispose lib-jitsi-meet. + // This functionality should be implemented. + const promise = libInitialized + ? dispatch(disposeLib()) + : Promise.resolve(); + + promise + .then(dispatch(initLib())); + + break; + } + } + + return next(action); +}); diff --git a/react/features/base/lib-jitsi-meet/native/index.js b/react/features/base/lib-jitsi-meet/native/index.js new file mode 100644 index 0000000000..a689ae4abf --- /dev/null +++ b/react/features/base/lib-jitsi-meet/native/index.js @@ -0,0 +1,2 @@ +require('./polyfills-browser'); +require('./polyfills-browserify'); diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js new file mode 100644 index 0000000000..886d5772d5 --- /dev/null +++ b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js @@ -0,0 +1,320 @@ +/** + * Gets the first common prototype of two specified Objects (treating the + * objects themselves as prototypes as well). + * + * @param {Object} a - The first prototype chain to climb in search of a common + * prototype. + * @param {Object} b - The second prototype chain to climb in search of a common + * prototype. + * @returns {Object|undefined} - The first common prototype of a and b. + */ +function _getCommonPrototype(a, b) { + // Allow the arguments to be prototypes themselves. + if (a === b) { + return a; + } + + let p; + + if ((p = Object.getPrototypeOf(a)) && (p = _getCommonPrototype(b, p))) { + return p; + } + if ((p = Object.getPrototypeOf(b)) && (p = _getCommonPrototype(a, p))) { + return p; + } + + return undefined; +} + +/** + * Implements an absolute minimum of the common logic of Document.querySelector + * and Element.querySelector. Implements the most simple of selectors necessary + * to satisfy the call sites at the time of this writing i.e. select by tagName. + * + * @param {Node} node - The Node which is the root of the tree to query. + * @param {string} selectors - The group of CSS selectors to match on. + * @returns {Element} - The first Element which is a descendant of the specified + * node and matches the specified group of selectors. + */ +function _querySelector(node, selectors) { + let element = null; + + node && _visitNode(node, n => { + if (n.nodeType === 1 /* ELEMENT_NODE */ + && n.nodeName === selectors) { + element = n; + + return true; + } + + return false; + }); + + return element; +} + +/** + * Visits each Node in the tree of a specific root Node (using depth-first + * traversal) and invokes a specific callback until the callback returns true. + * + * @param {Node} node - The root Node which represents the tree of Nodes to + * visit. + * @param {Function} callback - The callback to invoke with each visited Node. + * @returns {boolean} - True if the specified callback returned true for a Node + * (at which point the visiting stopped); otherwise, false. + */ +function _visitNode(node, callback) { + if (callback(node)) { + return true; + } + + /* eslint-disable no-param-reassign, no-extra-parens */ + + if ((node = node.firstChild)) { + do { + if (_visitNode(node, callback)) { + return true; + } + } while ((node = node.nextSibling)); + } + + /* eslint-enable no-param-reassign, no-extra-parens */ + + return false; +} + +(global => { + + const DOMParser = require('xmldom').DOMParser; + + // addEventListener + // + // Required by: + // - jQuery + if (typeof global.addEventListener === 'undefined') { + // eslint-disable-next-line no-empty-function + global.addEventListener = () => {}; + } + + // document + // + // Required by: + // - jQuery + // - lib-jitsi-meet/modules/RTC/adapter.screenshare.js + // - Strophe + if (typeof global.document === 'undefined') { + const document + = new DOMParser().parseFromString( + /* source */ '', + /* mineType */ 'text/xml'); + + // document.addEventListener + // + // Required by: + // - jQuery + if (typeof document.addEventListener === 'undefined') { + // eslint-disable-next-line no-empty-function + document.addEventListener = () => {}; + } + + // Document.querySelector + // + // Required by: + // - strophejs-plugins/caps/strophe.caps.jsonly.js + const documentPrototype = Object.getPrototypeOf(document); + + if (documentPrototype) { + if (typeof documentPrototype.querySelector === 'undefined') { + documentPrototype.querySelector = function(selectors) { + return _querySelector(this.elementNode, selectors); + }; + } + } + + // Element.querySelector + // + // Required by: + // - strophejs-plugins/caps/strophe.caps.jsonly.js + const elementPrototype + = Object.getPrototypeOf(document.documentElement); + + if (elementPrototype + && typeof elementPrototype.querySelector === 'undefined') { + elementPrototype.querySelector = function(selectors) { + return _querySelector(this, selectors); + }; + } + + // FIXME There is a weird infinite loop related to console.log and + // Document and/or Element at the time of this writing. Work around it + // by patching Node and/or overriding console.log. + const nodePrototype + = _getCommonPrototype(documentPrototype, elementPrototype); + + if (nodePrototype + + // XXX The intention was to find Node from which Document and + // Element extend. If for whatever reason we've reached Object, + // then it doesn't sound like what expected. + && nodePrototype !== Object.getPrototypeOf({})) { + // Override console.log. + const console = global.console; + + if (console) { + const loggerLevels = require('jitsi-meet-logger').levels; + + Object.keys(loggerLevels).forEach(key => { + const level = loggerLevels[key]; + const consoleLog = console[level]; + + /* eslint-disable prefer-rest-params */ + + if (typeof consoleLog === 'function') { + console[level] = function(...args) { + const length = args.length; + + for (let i = 0; i < length; ++i) { + let arg = args[i]; + + if (arg + && typeof arg !== 'string' + + // Limit the console.log override to + // Node (instances). + && nodePrototype.isPrototypeOf(arg)) { + const toString = arg.toString; + + if (toString) { + arg = toString.call(arg); + } + } + args[i] = arg; + } + + consoleLog.apply(this, args); + }; + } + + /* eslint-enable prefer-rest-params */ + }); + } + } + + global.document = document; + } + + // location + if (typeof global.location === 'undefined') { + global.location = { + href: '' + }; + } + + // performance + if (typeof global.performance === 'undefined') { + global.performance = { + now() { + return 0; + } + }; + } + + // sessionStorage + // + // Required by: + // - Strophe + if (typeof global.sessionStorage === 'undefined') { + global.sessionStorage = { + /* eslint-disable no-empty-function */ + getItem() {}, + removeItem() {}, + setItem() {} + + /* eslint-enable no-empty-function */ + }; + } + + const navigator = global.navigator; + + if (navigator) { + // platform + // + // Required by: + // - lib-jitsi-meet/modules/RTC/adapter.screenshare.js + if (typeof navigator.platform === 'undefined') { + navigator.platform = ''; + } + + // plugins + // + // Required by: + // - lib-jitsi-meet/modules/RTC/adapter.screenshare.js + if (typeof navigator.plugins === 'undefined') { + navigator.plugins = []; + } + + // userAgent + // + // Required by: + // - lib-jitsi-meet/modules/RTC/adapter.screenshare.js + // - lib-jitsi-meet/modules/RTC/RTCBrowserType.js + (() => { + const reactNativePackageJSON = require('react-native/package.json'); + let userAgent = reactNativePackageJSON.name || 'react-native'; + + const version = reactNativePackageJSON.version; + + if (version) { + userAgent += `/${version}`; + } + + if (typeof navigator.userAgent !== 'undefined') { + const s = navigator.userAgent.toString(); + + if (s.length > 0 && s.indexOf(userAgent) === -1) { + userAgent = `${s} ${userAgent}`; + } + } + + // Required by: + // - lib-jitsi-meet/modules/RTC/adapter.screenshare.js + userAgent += ' Chrome/31.'; + + navigator.userAgent = userAgent; + })(); + } + + // WebRTC + require('./polyfills-webrtc'); + + // XMLHttpRequest + if (global.XMLHttpRequest) { + const prototype = global.XMLHttpRequest.prototype; + + // XMLHttpRequest.responseXML + // + // Required by: + // - Strophe + if (prototype && typeof prototype.responseXML === 'undefined') { + Object.defineProperty(prototype, 'responseXML', { + configurable: true, + enumerable: true, + get() { + const responseText = this.responseText; + let responseXML; + + if (responseText) { + responseXML = new DOMParser() + .parseFromString(responseText); + } + + return responseXML; + } + }); + } + } + + // Polyfill for URL constructor + require('url-polyfill'); + +})(global || window || this); // eslint-disable-line no-invalid-this diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browserify.js b/react/features/base/lib-jitsi-meet/native/polyfills-browserify.js new file mode 100644 index 0000000000..e644bebe6f --- /dev/null +++ b/react/features/base/lib-jitsi-meet/native/polyfills-browserify.js @@ -0,0 +1,8 @@ +(global => { + + // __filename + if (typeof global.__filename === 'undefined') { + global.__filename = '__filename'; + } + +})(global || window || this); // eslint-disable-line no-invalid-this diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js b/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js new file mode 100644 index 0000000000..c6d18279fc --- /dev/null +++ b/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js @@ -0,0 +1,155 @@ +(global => { + const { + MediaStream, + MediaStreamTrack, + RTCPeerConnection, + RTCSessionDescription, + getUserMedia + } = require('react-native-webrtc'); + + if (typeof global.webkitMediaStream === 'undefined') { + global.webkitMediaStream = MediaStream; + } + + if (typeof global.MediaStreamTrack === 'undefined') { + global.MediaStreamTrack = MediaStreamTrack; + } + + if (typeof global.webkitRTCPeerConnection === 'undefined') { + // XXX At the time of this writing extending RTCPeerConnection using ES6 + // 'class' and 'extends' causes a runtime error related to the attempt + // to define the onaddstream property setter. The error mentions that + // babelHelpers.set is undefined which appears to be a thing inside + // React Native's packager. As a workaround, extend using the pre-ES6 + // way. + + /* eslint-disable no-inner-declarations */ + + /** + * The RTCPeerConnection provided by react-native-webrtc fires + * onaddstream before it remembers remotedescription (and thus makes it + * available to API clients). Because that appears to be a problem for + * lib-jitsi-meet which has been successfully running + * on Chrome, Firefox, Temasys, etc. for a very long time, attempt to + * meets its expectations (by extending RTCPPeerConnection). + * + * @class + */ + function _RTCPeerConnection(...args) { + + /* eslint-disable no-invalid-this */ + + RTCPeerConnection.apply(this, args); + + this.onaddstream = (...args) => // eslint-disable-line no-shadow + (this._onaddstreamQueue + ? this._queueOnaddstream + : this._invokeOnaddstream) + .apply(this, args); + + // Shadow RTCPeerConnection's onaddstream but after + // _RTCPeerConnection has assigned to the property in question. + // Defining the property on _RTCPeerConnection's prototype may (or + // may not, I don't know) work but I don't want to try because the + // following approach appears to work and I understand it. + Object.defineProperty(this, 'onaddstream', { + configurable: true, + enumerable: true, + get() { + return this._onaddstream; + }, + set(value) { + this._onaddstream = value; + } + }); + + /* eslint-enable no-invalid-this */ + } + + /* eslint-enable no-inner-declarations */ + + _RTCPeerConnection.prototype + = Object.create(RTCPeerConnection.prototype); + _RTCPeerConnection.prototype.constructor = _RTCPeerConnection; + _RTCPeerConnection.prototype._invokeOnaddstream = function(...args) { + const onaddstream = this._onaddstream; + let r; + + if (onaddstream) { + r = onaddstream.apply(this, args); + } + + return r; + }; + _RTCPeerConnection.prototype._invokeQueuedOnaddstream = function(q) { + q && q.every(function(args) { + try { + this._invokeOnaddstream(...args); + } catch (e) { + // TODO Determine whether the combination of the standard + // setRemoteDescription and onaddstream results in a similar + // swallowing of errors. + console && console.error && console.error(e); + } + + return true; + }, this); + }; + _RTCPeerConnection.prototype._queueOnaddstream = function(...args) { + this._onaddstreamQueue.push(Array.from(args)); + }; + _RTCPeerConnection.prototype.setRemoteDescription + = function(sessionDescription, successCallback, errorCallback) { + // Ensure I'm not remembering onaddstream invocations from + // previous setRemoteDescription calls. I shouldn't be but... + // anyway. + this._onaddstreamQueue = []; + + return RTCPeerConnection.prototype.setRemoteDescription.call( + this, + sessionDescription, + (...args) => { + let r; + let q; + + try { + if (successCallback) { + r = successCallback(...args); + } + } finally { + q = this._onaddstreamQueue; + this._onaddstreamQueue = undefined; + } + + this._invokeQueuedOnaddstream(q); + + return r; + }, + (...args) => { + let r; + + this._onaddstreamQueue = undefined; + + if (errorCallback) { + r = errorCallback(...args); + } + + return r; + }); + }; + + global.webkitRTCPeerConnection = _RTCPeerConnection; + } + if (typeof global.RTCSessionDescription === 'undefined') { + global.RTCSessionDescription = RTCSessionDescription; + } + + const navigator = global.navigator; + + if (navigator) { + if (typeof navigator.webkitGetUserMedia === 'undefined') { + navigator.webkitGetUserMedia = getUserMedia; + } + } + +})(global || window || this); // eslint-disable-line no-invalid-this diff --git a/react/features/base/lib-jitsi-meet/reducer.js b/react/features/base/lib-jitsi-meet/reducer.js new file mode 100644 index 0000000000..995d6f65d4 --- /dev/null +++ b/react/features/base/lib-jitsi-meet/reducer.js @@ -0,0 +1,66 @@ +import { ReducerRegistry } from '../redux'; + +import { + LIB_DISPOSED, + LIB_INIT_ERROR, + LIB_INITIALIZED, + SET_CONFIG +} from './actionTypes'; + +/** + * Initial state of 'features/base/lib'. + * + * @type {{ + * initializationError: null, + * initialized: boolean + * }} + */ +const INITIAL_STATE = { + config: { + // FIXME Lib-jitsi-meet uses HTML script elements to asynchronously + // load certain pieces of JavaScript. Unfortunately, the technique + // doesn't work on React Native (because there are no HTML elements + // in the first place). Fortunately, these pieces of JavaScript + // currently involve third parties and we can temporarily disable + // them (until we implement an alternative to async script elements + // on React Native). + disableThirdPartyRequests: true + }, + initializationError: null, + initialized: false +}; + +ReducerRegistry.register( + 'features/base/lib', + (state = INITIAL_STATE, action) => { + switch (action.type) { + case LIB_DISPOSED: + return INITIAL_STATE; + + case LIB_INIT_ERROR: + return { + ...state, + initializationError: action.lib.error, + initialized: false + }; + + case LIB_INITIALIZED: + return { + ...state, + initializationError: null, + initialized: true + }; + + case SET_CONFIG: + return { + ...state, + config: { + ...action.config, + ...state.config + } + }; + + default: + return state; + } + }); diff --git a/react/features/base/media/actionTypes.js b/react/features/base/media/actionTypes.js new file mode 100644 index 0000000000..fee4579d50 --- /dev/null +++ b/react/features/base/media/actionTypes.js @@ -0,0 +1,29 @@ +/** + * Action to change muted state of the local audio. + * + * { + * type: AUDIO_MUTED_CHANGED, + * muted: boolean + * } + */ +export const AUDIO_MUTED_CHANGED = 'AUDIO_MUTED_CHANGED'; + +/** + * Action to signal a change of the facing mode of the local video camera. + * + * { + * type: CAMERA_FACING_MODE_CHANGED, + * cameraFacingMode: CAMERA_FACING_MODE + * } + */ +export const CAMERA_FACING_MODE_CHANGED = 'CAMERA_FACING_MODE_CHANGED'; + +/** + * Action to change muted state of the local video. + * + * { + * type: VIDEO_MUTED_CHANGED, + * muted: boolean + * } + */ +export const VIDEO_MUTED_CHANGED = 'VIDEO_MUTED_CHANGED'; diff --git a/react/features/base/media/actions.js b/react/features/base/media/actions.js new file mode 100644 index 0000000000..7af67b69aa --- /dev/null +++ b/react/features/base/media/actions.js @@ -0,0 +1,101 @@ +import { + AUDIO_MUTED_CHANGED, + CAMERA_FACING_MODE_CHANGED, + VIDEO_MUTED_CHANGED +} from './actionTypes'; +import { CAMERA_FACING_MODE } from './constants'; +import './middleware'; +import './reducer'; + +/** + * Action to signal the change in local audio muted state. + * + * @param {boolean} muted - If local audio is muted. + * @returns {{ + * type: AUDIO_MUTED_CHANGED, + * muted: boolean + * }} + */ +export function audioMutedChanged(muted) { + return { + type: AUDIO_MUTED_CHANGED, + muted + }; +} + +/** + * Action to signal the change in facing mode of local video camera. + * + * @param {CAMERA_FACING_MODE} cameraFacingMode - Camera facing mode. + * @returns {{ + * type: CAMERA_FACING_MODE_CHANGED, + * cameraFacingMode: CAMERA_FACING_MODE + * }} + */ +export function cameraFacingModeChanged(cameraFacingMode) { + return { + type: CAMERA_FACING_MODE_CHANGED, + cameraFacingMode + }; +} + +/** + * Toggles the mute state of the local audio track(s). + * + * @returns {Function} + */ +export function toggleAudioMuted() { + return (dispatch, getState) => { + const muted = getState()['features/base/media'].audio.muted; + + return dispatch(audioMutedChanged(!muted)); + }; +} + +/** + * Toggles the camera between front and rear (user and environment). + * + * @returns {Function} + */ +export function toggleCameraFacingMode() { + return (dispatch, getState) => { + let cameraFacingMode + = getState()['features/base/media'].video.facingMode; + + cameraFacingMode + = cameraFacingMode === CAMERA_FACING_MODE.USER + ? CAMERA_FACING_MODE.ENVIRONMENT + : CAMERA_FACING_MODE.USER; + + return dispatch(cameraFacingModeChanged(cameraFacingMode)); + }; +} + +/** + * Toggles the mute state of the local video track(s). + * + * @returns {Function} + */ +export function toggleVideoMuted() { + return (dispatch, getState) => { + const muted = getState()['features/base/media'].video.muted; + + return dispatch(videoMutedChanged(!muted)); + }; +} + +/** + * Action to signal the change in local video muted state. + * + * @param {boolean} muted - If local video is muted. + * @returns {{ + * type: VIDEO_MUTED_CHANGED, + * muted: boolean + * }} + */ +export function videoMutedChanged(muted) { + return { + type: VIDEO_MUTED_CHANGED, + muted + }; +} diff --git a/react/features/base/media/components/AbstractVideoTrack.js b/react/features/base/media/components/AbstractVideoTrack.js new file mode 100644 index 0000000000..adeac26981 --- /dev/null +++ b/react/features/base/media/components/AbstractVideoTrack.js @@ -0,0 +1,147 @@ +import React, { Component } from 'react'; + +import { trackVideoStarted } from '../../tracks'; + +import { shouldRenderVideoTrack } from '../functions'; +import { Video } from './_'; + +/** + * Component that renders video element for a specified video track. + * + * @abstract + */ +export class AbstractVideoTrack extends Component { + /** + * Initializes a new AbstractVideoTrack instance. + * + * @param {Object} props - The read-only properties with which the new + * instance is to be initialized. + */ + constructor(props) { + super(props); + + this.state = { + videoTrack: _falsy2null(props.videoTrack) + }; + + // Bind event handlers so they are only bound once for every instance. + this._onVideoPlaying = this._onVideoPlaying.bind(this); + } + + /** + * Implements React's {@link Component#componentWillReceiveProps()}. + * + * @inheritdoc + * @param {Object} nextProps - The read-only props which this Component will + * receive. + * @returns {void} + */ + componentWillReceiveProps(nextProps) { + const oldValue = this.state.videoTrack; + const newValue = _falsy2null(nextProps.videoTrack); + + if (oldValue !== newValue) { + this._setVideoTrack(newValue); + } + } + + /** + * Implements React's {@link Component#render()}. + * + * @inheritdoc + * @returns {ReactElement} + */ + render() { + const videoTrack = this.state.videoTrack; + let render; + + if (this.props.waitForVideoStarted) { + // That's the complex case: we have to wait for onPlaying before we + // render videoTrack. The complexity comes from the fact that + // onPlaying will come after we render videoTrack. + if (shouldRenderVideoTrack(videoTrack, true)) { + // It appears that onPlaying has come for videoTrack already. + // Most probably, another render has already passed through the + // else clause bellow already. + render = true; + } else if (shouldRenderVideoTrack(videoTrack, false) + && !videoTrack.videoStarted) { + // XXX Unfortunately, onPlaying has not come for videoTrack yet. + // We have to render in order to give onPlaying a chance to + // come. + render = true; + } + } else { + // That's the simple case: we don't have to wait for onPlaying + // before we render videoTrack + render = shouldRenderVideoTrack(videoTrack, false); + } + + const stream + = render ? videoTrack.jitsiTrack.getOriginalStream() : null; + + return ( +