整理した
This commit is contained in:
18
src/client/app/mobile/api/choose-drive-file.ts
Normal file
18
src/client/app/mobile/api/choose-drive-file.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import Chooser from '../views/components/drive-file-chooser.vue';
|
||||
|
||||
export default function(opts) {
|
||||
return new Promise((res, rej) => {
|
||||
const o = opts || {};
|
||||
const w = new Chooser({
|
||||
propsData: {
|
||||
title: o.title,
|
||||
multiple: o.multiple,
|
||||
initFolder: o.currentFolder
|
||||
}
|
||||
}).$mount();
|
||||
w.$once('selected', file => {
|
||||
res(file);
|
||||
});
|
||||
document.body.appendChild(w.$el);
|
||||
});
|
||||
}
|
17
src/client/app/mobile/api/choose-drive-folder.ts
Normal file
17
src/client/app/mobile/api/choose-drive-folder.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import Chooser from '../views/components/drive-folder-chooser.vue';
|
||||
|
||||
export default function(opts) {
|
||||
return new Promise((res, rej) => {
|
||||
const o = opts || {};
|
||||
const w = new Chooser({
|
||||
propsData: {
|
||||
title: o.title,
|
||||
initFolder: o.currentFolder
|
||||
}
|
||||
}).$mount();
|
||||
w.$once('selected', folder => {
|
||||
res(folder);
|
||||
});
|
||||
document.body.appendChild(w.$el);
|
||||
});
|
||||
}
|
5
src/client/app/mobile/api/dialog.ts
Normal file
5
src/client/app/mobile/api/dialog.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export default function(opts) {
|
||||
return new Promise<string>((res, rej) => {
|
||||
alert('dialog not implemented yet');
|
||||
});
|
||||
}
|
8
src/client/app/mobile/api/input.ts
Normal file
8
src/client/app/mobile/api/input.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export default function(opts) {
|
||||
return new Promise<string>((res, rej) => {
|
||||
const x = window.prompt(opts.title);
|
||||
if (x) {
|
||||
res(x);
|
||||
}
|
||||
});
|
||||
}
|
3
src/client/app/mobile/api/notify.ts
Normal file
3
src/client/app/mobile/api/notify.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function(message) {
|
||||
alert(message);
|
||||
}
|
43
src/client/app/mobile/api/post.ts
Normal file
43
src/client/app/mobile/api/post.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import PostForm from '../views/components/post-form.vue';
|
||||
//import RepostForm from '../views/components/repost-form.vue';
|
||||
import getPostSummary from '../../../../common/get-post-summary';
|
||||
|
||||
export default (os) => (opts) => {
|
||||
const o = opts || {};
|
||||
|
||||
if (o.repost) {
|
||||
/*const vm = new RepostForm({
|
||||
propsData: {
|
||||
repost: o.repost
|
||||
}
|
||||
}).$mount();
|
||||
vm.$once('cancel', recover);
|
||||
vm.$once('post', recover);
|
||||
document.body.appendChild(vm.$el);*/
|
||||
|
||||
const text = window.prompt(`「${getPostSummary(o.repost)}」をRepost`);
|
||||
if (text == null) return;
|
||||
os.api('posts/create', {
|
||||
repostId: o.repost.id,
|
||||
text: text == '' ? undefined : text
|
||||
});
|
||||
} else {
|
||||
const app = document.getElementById('app');
|
||||
app.style.display = 'none';
|
||||
|
||||
function recover() {
|
||||
app.style.display = 'block';
|
||||
}
|
||||
|
||||
const vm = new PostForm({
|
||||
parent: os.app,
|
||||
propsData: {
|
||||
reply: o.reply
|
||||
}
|
||||
}).$mount();
|
||||
vm.$once('cancel', recover);
|
||||
vm.$once('post', recover);
|
||||
document.body.appendChild(vm.$el);
|
||||
(vm as any).focus();
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user