Skip to content

Commit

Permalink
add comment api
Browse files Browse the repository at this point in the history
  • Loading branch information
bobdos committed May 29, 2018
1 parent d0d1630 commit 3a5801d
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 5 deletions.
48 changes: 48 additions & 0 deletions steem-corona.lua
Expand Up @@ -56,3 +56,51 @@ function get_accounts(account_array, callback)
callback,
params)
end

function comment(parent_author, parent_permlink, author, permlink, title, body, json_metadata)

native.showWebPopup(
0,
0,
display.contentWidth,
display.contentHeight,
"https://v2.steemconnect.com/sign/comment?"..
"parent_author="..parent_author..
"&parent_permlink="..parent_permlink..
"&author="..author..
"&permlink="..permlink..
"&title="..title..
"&body="..body..
"&json_metadata="..json_metadata,
{
urlRequest =
function(event)
local shouldLoad = true

local url = event.url

if url then
print( "You are visiting: " .. event.url )
end

if 1 == string.find( url, "corona:close" ) then
-- Close the web popup
shouldLoad = false
end

if string.find(url, "success") then
shouldLoad = false
end

if event.errorCode then
-- Error loading page
print( "Error: " .. tostring( event.errorMessage ) )
shouldLoad = false
end

return shouldLoad
end
}
)
end

30 changes: 25 additions & 5 deletions test.lua
Expand Up @@ -3,7 +3,8 @@ local json = require("json")

local account_array = {"steemsdk.test"}

--[[ test case: get_config ]]
--[[ test case: get_config --]]
---[[
steem.get_config(
function(event)
if event.isError then
Expand All @@ -13,8 +14,10 @@ steem.get_config(
end
end
)
--]]
--[[ test case: get_version ]]
--[[ test case: get_version --]]
---[[
steem.get_version(
function(event)
if event.isError then
Expand All @@ -24,8 +27,10 @@ steem.get_version(
end
end
)
--]]
--[[ test case: get_account_count ]]
--[[ test case: get_account_count --]]
---[[
steem.get_account_count(
function(event)
if event.isError then
Expand All @@ -35,8 +40,10 @@ steem.get_account_count(
end
end
)
--]]
--[[ test case: get_accounts ]]
--[[ test case: get_accounts --]]
---[[
steem.get_accounts(
account_array,
function(event)
Expand All @@ -46,8 +53,21 @@ steem.get_accounts(
print("response: "..json.prettify(event.response))
local decoded_response = json.decode(event.response)
print("id: "..decoded_response[1]["id"].."\n"..
"name: "..decoded_response[1]["name"])
"name: "..decoded_response[1]["name"])
end
end
)
--]]
--[[ test case: comment --]]
---[[
steem.comment(
"",
"test",
"steemsdk.test",
os.time(os.date('*t')).."-post",
"title-test-"..os.time(os.date('*t')),
"body-test-"..os.time(os.date('*t')),
""
)
--]]

0 comments on commit 3a5801d

Please sign in to comment.