diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000..acdfcccbfb Binary files /dev/null and b/.DS_Store differ diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..3ed0c60391 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,179 @@ +version: 2.1 +orbs: + k8s: circleci/kubernetes@0.7.0 +commands: + git_checkout_from_cache: + description: "Git checkout and save cache" + steps: + - restore_cache: + name: Git restore cache + keys: + - source-v1-{{ .Branch }}-{{ .Revision }} + - source-v1-{{ .Branch }}- + - source-v1- + - run: + name: Fetch git tags + command: | + mkdir -p ~/.ssh + echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ' >> ~/.ssh/known_hosts + # Fetch tags if git cache is present + if [ -e /home/circleci/project/.git ] + then + git fetch origin --tags + fi + - checkout + - run: + name: Compress git objects + command: git gc + - save_cache: + name: Git save cache + key: source-v1-{{ .Branch }}-{{ .Revision }} + paths: + - ".git" + npm_install: + description: "Install npm modules" + steps: + - restore_cache: + name: Restore npm cache + keys: + - npm-v1-{{ checksum "package.json" }} + - npm-v1- + - run: + name: Install npm modules + command: npm install && ./node_modules/.bin/bower install + - save_cache: + name: Save NPM cache + key: npm-v1-{{ checksum "package.json" }} + paths: + - "node_modules" + build: + description: "Build" + steps: + - run: + name: "gulp build" + command: npx gulp build + - run: + name: "upload apk to www folder" + command: cp -r download www/ + deploy: + description: "Deploy to static branches" + parameters: + target_branch: + type: string + steps: + - checkout + - attach_workspace: + at: www + - run: + name: Tag build + command: echo "<< parameters.target_branch >> $(date)" > www/version + - run: + name: Install and configure dependencies + command: | + sudo npm install -g gh-pages@2.0.1 + git config user.email "ci-build@binary.com" + git config user.name "ci-build" + - add_ssh_keys: + fingerprints: + - "01:67:4a:6d:26:9c:70:c4:1a:60:91:88:d9:dd:f0:83" + - run: + name: Deploy docs to gh-pages branch + command: gh-pages -d www --branch << parameters.target_branch >> --message '[skip ci]' + docker_build_push: + description: "Build and Push image to docker hub" + steps: + - setup_remote_docker + - run: + name: Building docker image for production + command: | + docker build -t ${DOCKHUB_ORGANISATION}/binary-static-ticktrade:${CIRCLE_TAG} -t ${DOCKHUB_ORGANISATION}/binary-static-ticktrade:latest . + - run: + name: Pushing Image to docker hub + command: | + echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin + docker push ${DOCKHUB_ORGANISATION}/binary-static-ticktrade + k8s_deploy: + description: "Deploy to k8s cluster" + parameters: + k8s_namespace: + type: string + default: "ticktrade-binary-com-production" + k8s_service: + type: string + default: "binary-static-ticktrade" + steps: + - k8s/install-kubectl + - run: + name: Deploying to k8s cluster for service ticktrade-binary-com + command: | + TAG=${CIRCLE_TAG:-$CIRCLE_SHA1} + export NAMESPACE=<< parameters.k8s_namespace >> + git clone https://github.com/binary-com/devops-ci-scripts + cd devops-ci-scripts/k8s-build_tools + echo $CA_CRT | base64 --decode > ca.crt + ./release.sh << parameters.k8s_service >> ${TAG} + +jobs: + test: + docker: + - image: circleci/node:8.10.0-stretch + steps: + - git_checkout_from_cache + - npm_install + - build + release_beta: + docker: + - image: circleci/node:8.10.0-stretch + steps: + - git_checkout_from_cache + - npm_install + - build + - deploy: + target_branch: "staging" + + release_production: + docker: + - image: circleci/node:8.10.0-stretch + steps: + - git_checkout_from_cache + - npm_install + - build + - deploy: + target_branch: "production" + + release_aws_production: + docker: + - image: circleci/node:8.10.0-stretch + steps: + - git_checkout_from_cache + - npm_install + - build + - docker_build_push + - k8s_deploy + +workflows: + test: + jobs: + - test: + filters: + branches: + ignore: /^master$/ + release: + jobs: + - release_beta: + filters: + branches: + only: /^master$/ + - release_production: + filters: + branches: + ignore: /.*/ + tags: + only: /^production.*/ + - release_aws_production: + filters: + branches: + ignore: /.*/ + tags: + only: /^production.*/ + context: binary-frontend-artifact-upload diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..331d38729f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..da71996263 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ + +FROM nginx:alpine +COPY ./www /usr/share/nginx/html +COPY ./default.conf /etc/nginx/conf.d/default.conf diff --git a/config.xml b/config.xml index 2db0395647..2b2c044f9c 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + Tick Trade Enjoy fast-paced binary options trading with the Binary.com Tick Trade App. Trade Forex and more in seconds with our mobile application. @@ -29,6 +29,7 @@ + diff --git a/default.conf b/default.conf new file mode 100644 index 0000000000..758978854f --- /dev/null +++ b/default.conf @@ -0,0 +1,22 @@ +server { + listen 80; + server_name localhost; + + add_header Cache-Control "public, max-age=7200, s-maxage=600, must-revalidate"; + charset UTF-8; + + error_page 404 /404.html; + + location @custom_error_503 { + return 503; + } + + location ~ /\.git { + return 404; + } + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } +} diff --git a/download/ticktrade-app.apk b/download/ticktrade-app.apk new file mode 100644 index 0000000000..6c7ca7fa5d Binary files /dev/null and b/download/ticktrade-app.apk differ diff --git a/gulpfile.js b/gulpfile.js index 6ac29f9ed9..1b7a3d9820 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -121,39 +121,38 @@ gulp.task('deploy-apk', (done) => { const remoteUrl = getRemoteUrl(remote); // remove last tmp directory if it exists - sh.rm('-rf', 'tmp'); + // sh.rm('-rf', 'tmp'); // make a tmp directory - sh.mkdir('tmp'); + // sh.mkdir('tmp'); if(sh.error()){ console.log(gutil.colors.red(`Error: ${ sh.error()}`)); process.exit(1); } - sh.cd('tmp'); - console.log('Fetching gh-pages ...'); - sh.config.silent = false; - sh.exec(`git clone ${ remoteUrl } -b gh-pages ./`); - sh.config.silent = true; + // sh.cd('tmp'); + // console.log('Fetching gh-pages ...'); + // sh.config.silent = false; + // sh.exec(`git clone ${ remoteUrl } -b gh-pages ./`); + // sh.config.silent = true; console.log('Copying latest verison of APK ...'); sh.rm('-rf', 'download'); sh.mkdir('download'); - sh.cp('../platforms/android/app/build/outputs/apk/release/ticktrade-app.apk','download/ticktrade-app.apk'); + sh.cp('./platforms/android/app/build/outputs/apk/release/ticktrade-app.apk','download/ticktrade-app.apk'); - console.log('Pushing changes to gh-pages ...'); + console.log('Pushing changes to origin ...'); sh.config.silent = false; sh.exec('git config user.name "Morteza Tavanarad"'); sh.exec('git config user.email "morteza@binary.com"'); sh.exec('git add .'); sh.exec(`git commit -m "Deployed new version of APK - ${new Date().toUTCString()}"`); - sh.exec('git push origin gh-pages:gh-pages'); + sh.exec('git push origin master:master'); sh.config.silent = true; console.log('Cleaning workspace ...'); // remove tmp directory to clean workspace - sh.cd('../'); - sh.rm('-rf', 'tmp'); + // sh.rm('-rf', 'tmp'); return done(); }); gulp.task('code-push', (done) => { @@ -188,13 +187,14 @@ gulp.task('code-push', (done) => { console.log(` ${ gutil.colors.blue('Preparing files ...')}`); sh.sed('-i', '.otherwise("/")', '.otherwise("/update")', 'www/js/configs/states.config.js'); + sh.exec('ionic cordova prepare'); console.log(` ${ gutil.colors.blue('Run code-push ...')}`); sh.exec(`code-push release-cordova ${ app } ${ platform } --deploymentName ${ deployment }${targetVersion } --mandatory`); console.log(` ${ gutil.colors.blue('Rolling back dump changes ...')}`); sh.sed('-i', '.otherwise("/update")', '.otherwise("/")', 'www/js/configs/states.config.js'); - sh.exec('ionic prepare'); + sh.exec('ionic cordova prepare'); done(); }); @@ -271,10 +271,10 @@ gulp.task('release-qa', () => { const gitResult = sh.exec('echo | git branch | grep "*"'); - if (gitResult && gitResult.output && gitResult.output.indexOf('qa_version') < 0) { - console.log("You're not in qa_version branch"); - process.exit(-1); - } + // if (gitResult && gitResult.output && gitResult.output.indexOf('qa_version') < 0) { + // console.log("You're not in qa_version branch"); + // process.exit(-1); + // } const qaMachine = getArgvBySwitchName('--qa_machine'); @@ -292,6 +292,38 @@ gulp.task('release-qa', () => { } +}); + +gulp.task('run-qa', () => { + + /** + * Usage gulp release-qa --qa_machine qaurl1,qaurl2,... + * + */ + + const gitResult = sh.exec('echo | git branch | grep "*"'); + + // if (gitResult && gitResult.output && gitResult.output.indexOf('qa_version') < 0) { + // console.log("You're not in qa_version branch"); + // process.exit(-1); + // } + + const qaMachine = getArgvBySwitchName('--qa_machine'); + + if (qaMachine) { + sh.exec(`ionic cordova run android -- --qa_machine=${ qaMachine}`); + } + + const qaMachineFile = getArgvBySwitchName('--qa_machine_file'); + + if (qaMachineFile) { + const qaMachineList = require(qaMachineFile); + if (qaMachineList && qaMachineList.length) { + sh.exec(`ionic cordova run android -- --qa_machine=${ qaMachineList.join(',')}`); + } + } + + }); diff --git a/package.json b/package.json index 6038c79db5..7182ba64a7 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "cordova-plugin-whitelist": "^1.3.3", "cordova-plugin-zip": "^3.1.0", "express": "^4.13.3", - "gulp": "^3.5.6", + "gulp": "^3.9.1", "gulp-concat": "^2.2.0", "gulp-minify-css": "^0.3.0", "gulp-rename": "^1.2.0", diff --git a/scripts/after_prepare/011_add_cert_fingerprint.js b/scripts/after_prepare/011_add_cert_fingerprint.js index d680ccf873..8d8149ddb0 100755 --- a/scripts/after_prepare/011_add_cert_fingerprint.js +++ b/scripts/after_prepare/011_add_cert_fingerprint.js @@ -8,6 +8,7 @@ module.exports = function (context) { const platformPath = path.join(rootDir, 'platforms'); const qaMachines = context.opts.options.qa_machine ? context.opts.options.qa_machine.split(',') : []; + console.log(qaMachines); run(); @@ -18,20 +19,20 @@ module.exports = function (context) { const currentBranch = shell.exec("echo | git branch | grep '*'"); - if(currentBranch && currentBranch.stdout && currentBranch.stdout.indexOf('qa_version') > -1) { - const qaFP = []; + // if(currentBranch && currentBranch.stdout && currentBranch.stdout.indexOf('qa_version') > -1) { + const qaFP = []; - qaMachines.forEach((m) => { - const cert = { - url: m, - fp : retriveFP(m), - }; + qaMachines.forEach((m) => { + const cert = { + url: m, + fp : retriveFP(m), + }; - cert.fp ? qaFP.push(cert) : null; - }); + cert.fp ? qaFP.push(cert) : null; + }); - writeFP(qaFP, 'qaMachinesCertFP'); - } + writeFP(qaFP, 'qaMachinesCertFP'); + // } } function retriveFP(url, variableName) { diff --git a/scss/shared/_general.scss b/scss/shared/_general.scss index 10298607a7..c297ba05c8 100644 --- a/scss/shared/_general.scss +++ b/scss/shared/_general.scss @@ -315,6 +315,10 @@ button { } } +.button-image { + background: transparent !important; +} + @media screen and (max-width: 480px) { .information-popup .popup-body .item { font-size: $FONT_SIZE_N; diff --git a/www/i18n/en.json b/www/i18n/en.json index a70f49749c..561f0f616f 100644 --- a/www/i18n/en.json +++ b/www/i18n/en.json @@ -9,6 +9,8 @@ "regulatory_information": "Regulatory Information" }, "alert": { + "blocked_country": "Due to regulations, we’re unable to offer digital options in {{country}}.\nYou may continue to enjoy trading CFDs and multipliers.", + "blocked_country_title": "Digital options aren’t available in {{country}}", "error": "Error!", "warning": "Warning", "not_valid": "Please enter a valid token.", @@ -16,11 +18,13 @@ "not_unique": "You've already added this account.", "contract_error": "Contract not available, please try again.", "no_tick": "Please select another underlying, The underlying you've selected doesn't support ticks.", + "ok": "OK", "remove_token_title": "Removing a Token", "remove_token_content": "Are you sure you want to remove this token?", "remove_all_tokens_title": "Exit", "remove_all_tokens_content": "Are you sure you want to exit the app?", - "ok": "OK", + "trade_on_dmt5": "Trade CFDs on DMT5", + "trade_on_dtrader": "Trade multipliers on DTrader", "yes": "Yes", "no": "No" }, diff --git a/www/i18n/fr.json b/www/i18n/fr.json index c88bd06642..de983eb1e1 100644 --- a/www/i18n/fr.json +++ b/www/i18n/fr.json @@ -507,8 +507,8 @@ "otc_stocks": "Actions OTC", "volidx": "Volidx", "volatility_indices": "Indices de volatilité", - "synthetic_indices": "Synthetic Indices", - "synthetic_index": "Synthetic Indices", + "synthetic_indices": "Indices Synthétiques", + "synthetic_index": "Indices Synthétiques", "subject_to_change": "Les limites indiquées peuvent être modifiées sans préavis.", "trading_limits": "Limites de trading", "withdrawal_limits": "Limites de retrait", diff --git a/www/i18n/it.json b/www/i18n/it.json index b72b409208..e2b0d7d1a2 100644 --- a/www/i18n/it.json +++ b/www/i18n/it.json @@ -507,8 +507,8 @@ "otc_stocks": "Azioni OTC", "volidx": "Volidx", "volatility_indices": "Indici di volatilità", - "synthetic_indices": "Synthetic Indices", - "synthetic_index": "Synthetic Indices", + "synthetic_indices": "Indici sintetici", + "synthetic_index": "Indici sintetici", "subject_to_change": "I limiti fissi sono soggetti a modifica senza alcun preavviso.", "trading_limits": "Limiti del trading", "withdrawal_limits": "Limiti per i prelievi", diff --git a/www/i18n/pt.json b/www/i18n/pt.json index f9a7440803..9571684fb5 100644 --- a/www/i18n/pt.json +++ b/www/i18n/pt.json @@ -507,8 +507,8 @@ "otc_stocks": "Ações OTC", "volidx": "Volidx", "volatility_indices": "Índices Volatility", - "synthetic_indices": "Synthetic Indices", - "synthetic_index": "Synthetic Indices", + "synthetic_indices": "Índices Sintéticos", + "synthetic_index": "Índices Sintéticos", "subject_to_change": "Os limites mencionados estão sujeitos a alterações sem aviso prévio.", "trading_limits": "Limites de negociação", "withdrawal_limits": "Limites de retirada", diff --git a/www/i18n/th.json b/www/i18n/th.json index c05e9db543..12ece9acb4 100644 --- a/www/i18n/th.json +++ b/www/i18n/th.json @@ -507,8 +507,8 @@ "otc_stocks": "หลักทรัพย์ OTC", "volidx": "Volidx", "volatility_indices": "ดัชนีความผันผวน", - "synthetic_indices": "Synthetic Indices", - "synthetic_index": "Synthetic Indices", + "synthetic_indices": "ดัชนีสังเคราะห์", + "synthetic_index": "ดัชนีสังเคราะห์", "subject_to_change": "วงเงินที่ได้รับที่ระบุไว้อาจจะมีการเปลี่ยนแปลงโดยไม่บอกกล่าวให้ทราบล่วงหน้า", "trading_limits": "วงเงินในการซื้อขาย", "withdrawal_limits": "วงเงินในการถอน", diff --git a/www/i18n/vi.json b/www/i18n/vi.json index 9e8970961c..b9ef81afe7 100644 --- a/www/i18n/vi.json +++ b/www/i18n/vi.json @@ -6,7 +6,7 @@ "get_token": "Làm thế nào để nhận mã Token?", "signin_with_binary_com": "Đăng nhập", "next": "Tiếp theo", - "regulatory_information": "Thông tin điều chỉnh" + "regulatory_information": "Thông Tin Quy Định" }, "alert": { "error": "Lỗi!", @@ -15,7 +15,7 @@ "not_auth": "Xin lỗi, chúng tôi không thể xác thực bạn.", "not_unique": "Bạn đã thêm tài khoản này.", "contract_error": "Hợp đồng không khả dụng, vui lòng thử lại.", - "no_tick": "Vui lòng lựa chọn một thị trường cơ bản khác, Thị trường cơ bản mà bạn chọn không hỗ trợ khoảng thời gian là giây.", + "no_tick": "Vui lòng lựa chọn một thị trường cơ bản khác, Thị trường cơ bản mà bạn chọn không hỗ trợ khoảng thời gian là tick.", "remove_token_title": "Xóa bỏ mã Token", "remove_token_content": "Bạn có chắc muốn xóa mã token này?", "remove_all_tokens_title": "Thoát", @@ -57,59 +57,59 @@ "select_underlying": "Chọn mục được gạch chân", "select_tradetype": "Chọn loại giao dịch", "select_tick": "Chọn Tick", - "select_digit": "Chọn Digit", + "select_digit": "Chọn Chữ số", "selected_tick": "Tick đã chọn", - "last_digit": "Số cuối" + "last_digit": "\bChữ số cuối" }, "trade": { - "payout": "Thanh toán", + "payout": "Mức chi trả", "stake": "Cổ phần", "buy": "Mua", "net_profit": "Lợi nhuận ròng", - "potential_payout": "Khả năng thanh toán", + "potential_payout": "Mức chi trả tiềm năng", "total_cost": "Tổng chi phí", "potential_profit": "Lợi Nhuận Tiềm Năng", - "back": "Quay lại thương mại", + "back": "Quay lại Giao dịch", "loss": "Thua lỗ", - "win": "Hợp đồng này đã thắng", - "lose": "Hợp đồng này đã thất bại", + "win": "Thắng", + "lose": "Thua thầu", "transaction_id": "Tham chiếu giao dịch", "buy_again": "Mua lại", "sell": "Bán", "barrier": "Rào cản bù đắp", - "return": "Quay trở lại", + "return": "Quay lại", "tick": "tick" }, "app": { "exit_title": "Thoát", "exit_confirmation": "Bạn có chắc chắn muốn thoát?", - "connection_error": "Không có không kết nối internet!", + "connection_error": "Không có kết nối internet!", "ssl_cert_failed": "Kết nối của bạn không phải là riêng tư!", "sign_out": "Đăng xuất" }, "reality-check": { - "title": "Kiểm lại thực tế", - "about": "Giao dịch các tùy chọn có thể trở thành một cơn nghiện thực sự, như bất kỳ hoạt động nào khác bị đẩy đến giới hạn của nó. Để tránh rủi ro của một cơn nghiện nhu vậy, chúng tôi cung cấp một phương thức kiểm duyệt thực tế cung cấp cho bạn một bản tổng quát những giao dịch và tài khoản của bạn một cách thường xuyên.", + "title": "Kiểm duyệt Thực tế", + "about": "Giao dịch các tùy chọn có thể trở thành một cơn nghiện thực sự, như bất kỳ hoạt động nào khác bị đẩy đến giới hạn của nó. Để tránh rủi ro của một cơn nghiện như vậy, chúng tôi đưa ra phương thức kiểm duyệt thực tế để cung cấp cho bạn một bản tổng quát những giao dịch và tài khoản của bạn một cách thường xuyên.", "login_time": "Thời gian đăng nhập:", "current_time": "Thời gian hiện tại:", - "session_duration": "Thời hạn phiên:", + "session_duration": "Thời lượng phiên:", "interval_question": "Xin vui lòng ghi rõ khoảng thời gian kiểm duyệt thực tế phù hợp với bạn trong vài phút:", "loginid": "ID Đăng nhập", - "currency": "Đơn vị tiền tệ", + "currency": "Tiền tệ", "buy_amount": "Doanh số", "profit_loss": "Lãi/Lỗ", - "buy_count": "Hợp đồng đã được mua", - "sell_count": "Hợp đồng đã được bán", - "open_contract_count": "Hợp đồng Mở", + "buy_count": "Gói thầu đã mua", + "sell_count": "Gói thầu đã bán", + "open_contract_count": "Gói thầu Mở", "potential_profit": "Lợi nhuận tiềm năng", - "interval": "Khoảng thời gian kiểm lại thực tế trong vài phút", - "continue": "Tiếp tục giao dịch", + "interval": "Khoảng Thời gian Kiểm duyệt Thực tế trong Vài Phút", + "continue": "Tiếp tục Giao dịch", "logout": "Đăng xuất", "days": "ngày", "hours": "giờ", "minutes": "phút", - "interval_error": "Vui lòng nhập một con số trong khoảng từ 10 đến 60.", - "view_statement": "Xem tuyên bố", + "interval_error": "Vui lòng nhập một số trong khoảng từ 10 đến 60.", + "view_statement": "Xem Sao Kê", "integer_error": "Khoản thời gian nên là số nguyên." }, "new-virtual-account": { @@ -166,13 +166,13 @@ "continue": "Tiếp tục", "cancel": "Hủy bỏ", "not_pep_verify": "Tôi thừa nhận rằng tôi không phải là một cá nhân có ảnh hưởng chính trị (PEP)", - "pep_info": "Một PEP là một cá nhân mà đã hoặc đang được ủy thác với một chức vụ nổi trội trước công chúng. Thân thế địa vị này bao gồm cả người thân trong gia đình và các đồng đảng liên quan của PEP.", + "pep_info": "Một PEP là một cá nhân mà đã hoặc đang được ủy thác với một chức vụ nổi trội trước công chúng. Thân thế địa vị này bao gồm cả người thân trong gia đình và các bên liên quan của PEP.", "forex_trading_experience": "Kinh nghiệm giao dịch ngoại hối", "forex_trading_frequency": "Tần suất giao dịch ngoại hối", "binary_options_trading_experience": "Kinh nghiệm giao dịch Quyền Chọn Nhị Phân", - "binary_options_trading_frequency": "Tần xuất giao dịch Quyền Chọn Nhị Phân", + "binary_options_trading_frequency": "Tần suất giao dịch Quyền Chọn Nhị Phân", "cfd_trading_experience": "Kinh nghiệm giao dịch CFD", - "cfd_trading_frequency": "Tần xuất giao dịch CFD", + "cfd_trading_frequency": "Tần suất giao dịch CFD", "other_instruments_trading_experience": "Kinh nghiệm giao dịch trong các công cụ tài chính khác", "other_instruments_trading_frequency": "Tần suất giao dịch trong các công cụ tài chính khác", "employment_industry": "Ngành nghề tuyển dụng", diff --git a/www/index.html b/www/index.html index cfcd3d9116..5cce9ce111 100644 --- a/www/index.html +++ b/www/index.html @@ -4,7 +4,8 @@ - + + @@ -355,6 +356,9 @@ + + + diff --git a/www/js/app.js b/www/js/app.js index 9bf82617c2..118d4d4354 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -44,6 +44,7 @@ angular.module("binary.share.services", []); angular.module("binary.pages", [ + "binary.pages.qa-settings", "binary.pages.home", "binary.pages.signin", "binary.pages.trade", diff --git a/www/js/config.json b/www/js/config.json index 8947c1edef..5508a597c6 100644 --- a/www/js/config.json +++ b/www/js/config.json @@ -1 +1 @@ -{"version":"2.5.0"} +{"version":"2.6.2"} diff --git a/www/js/configs/states.config.js b/www/js/configs/states.config.js index f80d19840b..ce72ae0906 100644 --- a/www/js/configs/states.config.js +++ b/www/js/configs/states.config.js @@ -237,6 +237,13 @@ angular.module("binary").config(($locationProvider, $stateProvider, $urlRouterPr templateUrl : "js/pages/account-categorisation/account-categorisation.template.html", controller : "AccountCategorisationController", controllerAs: "vm" + }) + .state("endpoint", { + url : "/endpoint", + cache : false, + templateUrl : "js/pages/qa-settings/qa-settings.template.html", + controller : "QASettingsController", + controllerAs: "vm" }); diff --git a/www/js/pages/home/home.controller.js b/www/js/pages/home/home.controller.js index bc33a66bbc..7f943926ca 100644 --- a/www/js/pages/home/home.controller.js +++ b/www/js/pages/home/home.controller.js @@ -9,9 +9,9 @@ (function() { angular.module("binary.pages.home.controllers").controller("HomeController", Home); - Home.$inject = ["$scope", "$state", "accountService", "analyticsService", "appStateService"]; + Home.$inject = ["$scope", "$state", "accountService", "alertService", "analyticsService", "appStateService"]; - function Home($scope, $state, accountService, analyticsService, appStateService) { + function Home($scope, $state, accountService, alertService, analyticsService, appStateService) { const vm = this; /** * wait untile authorization and decide @@ -19,6 +19,12 @@ */ $scope.$on("authorize", (e, response) => { if (response) { + + if (accountService.isBlockedUser(response)) { + alertService.accountError.blockedCountry('Australia'); + return; + } + setTimeout(() => { $state.go("trade"); }, 1000); diff --git a/www/js/pages/qa-settings/qa-settings.controller.js b/www/js/pages/qa-settings/qa-settings.controller.js new file mode 100644 index 0000000000..dc2ee8e6ad --- /dev/null +++ b/www/js/pages/qa-settings/qa-settings.controller.js @@ -0,0 +1,57 @@ +/** + * @name qa-settings controller + * @author Morteza Tavnarad + * @contributors [] + * @since 10/14/2016 + * @copyright Binary Ltd + * Application Header + */ + +(function(){ + + + angular + .module('binary.pages.qa-settings.controllers') + .controller('QASettingsController', QASettings); + + QASettings.$inject = ['$state', 'appStateService', + 'config', 'websocketService']; + + function QASettings($state, appStateService, + config, websocketService){ + const vm = this; + + vm.saveSettings = function(){ + const settings = {}; + config.wsUrl = vm.wsUrl; + settings.server_url = new URL(vm.wsUrl).hostname; + config.app_id = vm.appId.toString(); + settings.appId = vm.appId.toString(); + config.oauthUrl = vm.oauthUrl; + settings.oauthUrl = vm.oauthUrl; + + Object.keys(settings).forEach((key) => localStorage.setItem(`config.${key}`, settings[key])); + + delete settings.server_url; + settings.wsUrl = vm.wsUrl; + localStorage.qaSettings = JSON.stringify(settings); + + websocketService.closeConnection(); + $state.go('home'); + } + + function init(){ + let settings = {}; + if(!_.isEmpty(localStorage.qaSettings)){ + settings = JSON.parse(localStorage.qaSettings); + } + + vm.wsUrl = settings.wsUrl || config.wsUrl; + vm.oauthUrl = settings.oauthUrl || config.oauthUrl; + vm.appId = Number(settings.appId) || Number(config.app_id); + } + + init(); + } +})(); + diff --git a/www/js/pages/qa-settings/qa-settings.module.js b/www/js/pages/qa-settings/qa-settings.module.js new file mode 100644 index 0000000000..c56801aa45 --- /dev/null +++ b/www/js/pages/qa-settings/qa-settings.module.js @@ -0,0 +1,24 @@ +/** + * @name qa-settings module + * @author Morteza Tavnarad + * @contributors [] + * @since 10/14/2016 + * @copyright Binary Ltd + * Application Header + */ + +(function(){ + + + angular + .module('binary.pages.qa-settings', [ + 'binary.pages.qa-settings.controllers', + 'binary.pages.qa-settings.directives' + ]); + + angular + .module('binary.pages.qa-settings.controllers', []); + + angular + .module('binary.pages.qa-settings.directives', []); +})(); diff --git a/www/js/pages/qa-settings/qa-settings.template.html b/www/js/pages/qa-settings/qa-settings.template.html new file mode 100644 index 0000000000..4228bd1483 --- /dev/null +++ b/www/js/pages/qa-settings/qa-settings.template.html @@ -0,0 +1,37 @@ + +
+
+ + + +
+
+ +
+
+
diff --git a/www/js/pages/sign-in/components/oauth/oauth.controller.js b/www/js/pages/sign-in/components/oauth/oauth.controller.js index c17c6d9d96..401b9bb6b2 100644 --- a/www/js/pages/sign-in/components/oauth/oauth.controller.js +++ b/www/js/pages/sign-in/components/oauth/oauth.controller.js @@ -22,7 +22,7 @@ function Oauth($scope, $ionicLoading, config, websocketService, alertService, accountService, languageService) { const vm = this; - let accounts = []; + vm.accounts = []; const authenticate = _token => { // Validate the token @@ -35,9 +35,9 @@ }; const handleUrl = (url) => { - accounts = getAccountsFromUrl(url); - if (accounts.length > 0) { - authenticate(accounts[0].token); + vm.accounts = getAccountsFromUrl(url); + if (vm.accounts.length > 0) { + authenticate(vm.accounts[0].token); } } @@ -50,9 +50,9 @@ $scope.$on("authorize", (e, response) => { if (response) { const accountList = response.account_list; - accounts.forEach((value, index) => { + vm.accounts.forEach((value, index) => { if (index > 0) { - let account = accounts[index]; + let account = vm.accounts[index]; account.email = response.email; account.country = response.country; if (accountList) { @@ -99,11 +99,11 @@ return; } - accounts = getAccountsFromUrl(url); - if (accounts && accounts.length) { + vm.accounts = getAccountsFromUrl(url); + if (vm.accounts && vm.accounts.length) { authWindow.close(); - authenticate(accounts[0].token); + authenticate(vm.accounts[0].token); } }); }; diff --git a/www/js/pages/sign-in/sign-in.controller.js b/www/js/pages/sign-in/sign-in.controller.js index e1fd0cfb15..a43930376e 100644 --- a/www/js/pages/sign-in/sign-in.controller.js +++ b/www/js/pages/sign-in/sign-in.controller.js @@ -49,6 +49,7 @@ vm.clientCountryIsUK = false; vm.linkToRegulatory = `https://www.binary.com/${localStorage.getItem("language") || "en"}/regulation.html`; vm.gamStopLink = "https://www.gamstop.co.uk/"; + vm.endpointCounter = 0; /** * On load: @@ -77,6 +78,11 @@ $scope.$on("authorize", (e, response, message) => { $ionicLoading.hide(); if (response) { + if (accountService.isBlockedUser(response)) { + alertService.accountError.blockedCountry('Australia'); + return; + } + if (accountService.isUnique(response.loginid)) { let account = {}; const accountList = response.account_list; @@ -258,5 +264,16 @@ vm.goToGamStop = () => { window.open(vm.gamStopLink, "_blank"); } + + vm.navigateToEndpoint = () => { + if (vm.endpointCounter === 0) { + setTimeout(() => vm.endpointCounter = 0, 5000); + } + + if (++vm.endpointCounter >= 6) { + $state.go("endpoint"); + vm.endpointCounter = 0; + } + }; } })(); diff --git a/www/js/pages/sign-in/sign-in.template.html b/www/js/pages/sign-in/sign-in.template.html index 201d69184b..96c725f844 100644 --- a/www/js/pages/sign-in/sign-in.template.html +++ b/www/js/pages/sign-in/sign-in.template.html @@ -11,7 +11,9 @@

- Binary.com +
- \ No newline at end of file + diff --git a/www/js/share/services/account.service.js b/www/js/share/services/account.service.js index ccffd12c34..129d6ed5cf 100644 --- a/www/js/share/services/account.service.js +++ b/www/js/share/services/account.service.js @@ -222,4 +222,6 @@ angular.module("binary").service("accountService", function(websocketService, ap }); return allLoginids; } + + this.isBlockedUser = (authorize) => authorize.country === 'au'; }); diff --git a/www/js/share/services/alert.service.js b/www/js/share/services/alert.service.js index c80e98ac37..9ad9f504e9 100644 --- a/www/js/share/services/alert.service.js +++ b/www/js/share/services/alert.service.js @@ -102,7 +102,49 @@ angular.module("binary").service("alertService", function($translate, $ionicPopu $translate(["alert.error", "alert.not_unique"]).then(translation => { displayAlert(translation["alert.error"], translation["alert.not_unique"]); }); - } + }, + blockedCountry(country) { + $translate( + ["alert.blocked_country_title", "alert.blocked_country", "alert.trade_on_dtrader", "alert.trade_on_dmt5"], + {country}).then(translation => { + $ionicPopup.show({ + title : translation["alert.blocked_country_title"], + template: translation["alert.blocked_country"], + buttons : [ + { + text: translation["alert.trade_on_dtrader"], + type: "button-secondary", + onTap(e) { + e.preventDefault(); + const link = `https://app.deriv.com/?lang=${localStorage.getItem("language") || "en"}`; + let windowTarget = '_system'; + + if(window.navigator.standalone) { + windowTarget = '_self'; + } + + window.open(link, windowTarget); + } + }, + { + text: translation["alert.trade_on_dmt5"], + type: "button-secondary", + onTap(e) { + e.preventDefault(); + const link = `https://app.deriv.com/mt5?lang=${localStorage.getItem("language") || "en"}#real`; + let windowTarget = '_system'; + + if(window.navigator.standalone) { + windowTarget = '_self'; + } + + window.open(link, windowTarget); + }, + }, + ], + }); + }); + }, }; this.contractError = {