Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(universal-confirm): support bytedance #74

Merged
merged 6 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/confirm/README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
confirm 确认框

## 支持
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px">

## 安装

Expand Down
2 changes: 1 addition & 1 deletion packages/confirm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Confirm component for feedback.

## Support
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px">

## Install

Expand Down
2 changes: 1 addition & 1 deletion packages/confirm/docs-template/README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
confirm 确认框

## 支持
__icon_web__ __icon_weex__ __icon_miniapp_mp__ __icon_miniapp_wx__
__icon_web__ __icon_weex__ __icon_miniapp_mp__ __icon_miniapp_wx__ __icon_microapp_tt__

## 安装

Expand Down
2 changes: 1 addition & 1 deletion packages/confirm/docs-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Confirm component for feedback.

## Support
__icon_web__ __icon_weex__ __icon_miniapp_mp__ __icon_miniapp_wx__
__icon_web__ __icon_weex__ __icon_miniapp_mp__ __icon_miniapp_wx__ __icon_microapp_tt__

## Install

Expand Down
2 changes: 1 addition & 1 deletion packages/confirm/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "universal-confirm",
"author": "rax",
"version": "1.0.2",
"version": "1.1.0",
"license": "BSD-3-Clause",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Options } from '../../types';
import { Options } from '../types';

declare const my: any;

Expand Down
23 changes: 23 additions & 0 deletions packages/confirm/src/bytedance-microapp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Options } from '../types';

declare const tt: any;

const confirm = (options: Options): Promise<boolean> => {
return new Promise((resolve, reject): void => {
const { title = '', content = '', confirmButtonText = '确定', cancelButtonText = '取消' } = options;
tt.showModal({
title,
content,
confirmText: confirmButtonText,
cancelText: cancelButtonText,
success: ({ confirm }): void => {
confirm ? resolve(true) : resolve(false);
},
fail: (): void => {
reject();
}
});
});
};

export default confirm;
10 changes: 7 additions & 3 deletions packages/confirm/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { isWeex, isMiniApp, isWeb, isWeChatMiniProgram } from 'universal-env';
import { isWeex, isMiniApp, isWeb, isWeChatMiniProgram, isByteDanceMicroApp } from 'universal-env';
import webModule from './web/index';
import weexModule from './weex/index';
import miniAppModule from './miniapp/ali/index';
import weChatModule from './miniapp/wechat/index';
import miniAppModule from './ali-miniapp/index';
import weChatModule from './wechat-miniprogram/index';
import byteDanceModule from './bytedance-microapp/index';

let confirm: any = () => {};

Expand All @@ -18,5 +19,8 @@ if (isMiniApp) {
if (isWeChatMiniProgram) {
confirm = weChatModule;
}
if (isByteDanceMicroApp) {
confirm = byteDanceModule;
}

export default confirm;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Options } from '../../types';
import { Options } from '../types';

declare const wx: any;

Expand Down