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

LIFF <> GraphQL server communication #178

Merged
merged 17 commits into from May 13, 2020
Merged

LIFF <> GraphQL server communication #178

merged 17 commits into from May 13, 2020

Conversation

MrOrz
Copy link
Member

@MrOrz MrOrz commented Apr 26, 2020

This PR:

  • Adds src/liff/pages/{Source|Reason|PositiveFeedback|NegativeFeedback}.svelte page stubs
  • Implements loading state in src/liff/index.html and src/liff/App.svelte
  • Implements gql in LIFF that sends authorization header, and graphql server that verifies the authorization header
  • If session ID is not valid, tell user that the button is expired and aborts LIFF
  • Initializes LIFF and handle the weird redirection mechanism of LIFF v2
  • Add LINE user id in LIFF JWT tokens
  • Removes old context JSON API; replace issuedAt with data.sessionId in GraphQL context API.

Screenshot

LIFF button opened previously

If LIFF button is pressed before, pressing it again could be pretty fast:
https://drive.google.com/file/d/1hpv2Z1vjWItUBSmUmV2SXryjbKj5-MVQ/view?usp=sharing

The screencast shows:

  • App.svelte routing mechanism works
  • gql in LIFF works with GraphQL context & @auth mechanism
  • Production Cache-control: max-age works

Fresh LIFF button

For a new LIFF button, LIFF HTML is fetched from server, which makes the LIFF redirection obvious
https://drive.google.com/file/d/1i0pl1iqHaMVNTJR6cm8_mpf6SHK5A7qw/view?usp=sharing

The screencast shows:

  • 'loading' state works
  • LIFF redirection handling works (Green loading bar appears twice)

Abort LIFF for buttons in previous search sessions

When user inputs a new rumor, it is considered as "creating a new search session". LIFF opened with previous sessions are aborted.

https://drive.google.com/file/d/1iUmdNL4os9yyTPHOqyLUjWOl2Ewb7HMR/view?usp=sharing

@MrOrz MrOrz self-assigned this Apr 26, 2020
@MrOrz MrOrz added this to In progress in [Cofacts Next] 告知 Chatbot 使用者新回應 via automation Apr 26, 2020
@coveralls
Copy link

coveralls commented Apr 26, 2020

Pull Request Test Coverage Report for Build 738

  • 10 of 10 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 98.636%

Totals Coverage Status
Change from base Build 714: 0.03%
Covered Lines: 302
Relevant Lines: 303

💛 - Coveralls

@MrOrz MrOrz marked this pull request as ready for review April 26, 2020 15:46
@MrOrz MrOrz moved this from In progress to Review in progress in [Cofacts Next] 告知 Chatbot 使用者新回應 May 11, 2020
@MrOrz MrOrz changed the base branch from has-reply-flow to dev May 13, 2020 12:01
@MrOrz MrOrz merged commit 3eb6061 into dev May 13, 2020
[Cofacts Next] 告知 Chatbot 使用者新回應 automation moved this from Review in progress to Done May 13, 2020
@MrOrz MrOrz deleted the liff-comm branch June 16, 2020 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants