kamiliff 0.28.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/app/views/liff/_send_messages.liff.erb +16 -0
- data/app/views/liff/_share_target_picker.liff.erb +36 -0
- data/app/views/liff/entry.html.erb +9 -1
- data/config/initializers/mime_types.rb +1 -1
- data/lib/kamiliff/services/base64_decode_service.rb +2 -1
- data/lib/kamiliff/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36670cc34affa11b01f78976bd3630a7a5cae7061f420a83e4c5a4ae4e49c118
|
4
|
+
data.tar.gz: 439962ffdba9c96506dd942d876c28888d6c49054db21faa7e19454f598c3d9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad8417dbe7cdd11be8b7a147887812485ea313994795673479432997f0bd94d2f896c05bde1b30eedd74b7d1157ae92d8d9d7f97327cd45944e4b6472ff49e01
|
7
|
+
data.tar.gz: e89b3b1e26bb1f9ba1d76c388dff2029cd0e344f2187330c8930607401b697c0c093c6e008a84afb60cf96203f94788e01d4b847e2f8828b47dcae77f5cdf5bb
|
data/README.md
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
<%
|
2
|
+
messages = [messages] if messages.is_a? Hash
|
3
|
+
messages = messages.to_json if messages.is_a? Array
|
4
|
+
%>
|
5
|
+
|
6
|
+
<script>
|
7
|
+
(function(){
|
8
|
+
async function send_messages(){
|
9
|
+
const messages = <%= raw messages %>;
|
10
|
+
await liff.sendMessages(messages);
|
11
|
+
liff.closeWindow();
|
12
|
+
}
|
13
|
+
|
14
|
+
send_messages();
|
15
|
+
})();
|
16
|
+
</script>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%
|
2
|
+
messages = [messages] if messages.is_a? Hash
|
3
|
+
messages = messages.to_json if messages.is_a? Array
|
4
|
+
%>
|
5
|
+
|
6
|
+
<script>
|
7
|
+
(function(){
|
8
|
+
async function share_target_picker(messages){
|
9
|
+
/* JS 不支援的情況 */
|
10
|
+
if (!liff.isApiAvailable('shareTargetPicker')){
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
|
14
|
+
/* 分享訊息給好友 */
|
15
|
+
const response = await liff.shareTargetPicker(messages);
|
16
|
+
|
17
|
+
/* 分享訊息失敗 */
|
18
|
+
if(!response){
|
19
|
+
const [majorVer, minorVer] = (liff.getLineVersion() || "").split('.');
|
20
|
+
if (parseInt(majorVer) == 10 && parseInt(minorVer) < 11) {
|
21
|
+
alert("你的 LINE 版本太舊,無法使用分享訊息功能。");
|
22
|
+
} else {
|
23
|
+
alert("你已取消分享訊息。");
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
async function send_messages(){
|
29
|
+
const messages = <%= raw messages %>;
|
30
|
+
await share_target_picker(messages);
|
31
|
+
liff.closeWindow();
|
32
|
+
}
|
33
|
+
|
34
|
+
send_messages();
|
35
|
+
})();
|
36
|
+
</script>
|
@@ -38,8 +38,16 @@ let open_liff_page = (function(){
|
|
38
38
|
}
|
39
39
|
}
|
40
40
|
|
41
|
+
async function get_liff_profile(){
|
42
|
+
try{
|
43
|
+
return await liff.getProfile();
|
44
|
+
}catch(error){
|
45
|
+
return {};
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
41
49
|
async function get_liff_data(){
|
42
|
-
const profile = await
|
50
|
+
const profile = await get_liff_profile();
|
43
51
|
const context = liff.getContext();
|
44
52
|
return {
|
45
53
|
profile,
|
data/lib/kamiliff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kamiliff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- etrex kuo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -39,6 +39,8 @@ files:
|
|
39
39
|
- app/helpers/liff_helper.rb
|
40
40
|
- app/views/layouts/application.liff.erb
|
41
41
|
- app/views/layouts/liff.html.erb
|
42
|
+
- app/views/liff/_send_messages.liff.erb
|
43
|
+
- app/views/liff/_share_target_picker.liff.erb
|
42
44
|
- app/views/liff/entry.html.erb
|
43
45
|
- app/views/liff/route.html.erb
|
44
46
|
- config/initializers/assets.rb
|
@@ -71,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
73
|
- !ruby/object:Gem::Version
|
72
74
|
version: '0'
|
73
75
|
requirements: []
|
74
|
-
rubygems_version: 3.1.
|
76
|
+
rubygems_version: 3.1.4
|
75
77
|
signing_key:
|
76
78
|
specification_version: 4
|
77
79
|
summary: An easy way to use LINE Front-end Framework(LIFF) on rails.
|