commit 5692e6bf9727956eed9521a85a13454feee1fae1 Author: Adam Millerchip Date: Tue Jul 16 17:53:12 2019 +0900 Create demo app diff --git a/LINE_APP.png b/LINE_APP.png new file mode 100644 index 0000000..ec94f54 Binary files /dev/null and b/LINE_APP.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..6b2dc56 --- /dev/null +++ b/index.html @@ -0,0 +1,48 @@ + + + + + + + + + + Hello, world! + + + +
+
{{ error }}
+
+
+ +
+
+
{{ profile.displayName }}
+

{{ profile.statusMessage }}

+ + +
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/meetup-liff.js b/meetup-liff.js new file mode 100644 index 0000000..89e77d0 --- /dev/null +++ b/meetup-liff.js @@ -0,0 +1,49 @@ +var defaultProfile = { + displayName: "Adam", + pictureUrl: "https://profile.line-scdn.net/0hoczsWu6VMExHCh1UxVFPG3tPPiEwJDYEP20oeGVYZns_aHMceTh6KjVePSloPHESeGp-LWECbX9p", + statusMessage: "Presenting in #LINE_DM!" +} + +var app = new Vue({ + el: '#app', + data: { + error: null, + profile: defaultProfile + } +}) + +liff.init(undefined, err => app.error = err) + +function toggle() { + if (app.profile === defaultProfile) { + liff.getProfile() + .then(profile => app.profile = profile) + .catch(err => app.error = err) + } else { + app.profile = defaultProfile + } +} + +function share() { + liff.sendMessages([{ + "type": "template", + "altText": "Check out this profile", + "template": { + "type": "buttons", + "thumbnailImageUrl": app.profile.pictureUrl || "https://adamu.github.io/line_dm_liff/LINE_APP.png", + "imageAspectRatio": "rectangle", + "imageSize": "cover", + "imageBackgroundColor": "#FFFFFF", + "title": app.profile.displayName, + "text": app.profile.statusMessage || "(no status message)", + "actions": [ + { + "type": "uri", + "label": "Selfie 📸", + "uri": "line://nv/camera/" + } + ] + } + }]) + .then(() => liff.closeWindow(), err => app.error = err) +} \ No newline at end of file