Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #36 from cm-dyoshikawa/id-ready
Browse files Browse the repository at this point in the history
id and ready
  • Loading branch information
dyoshikawa authored Jan 18, 2022
2 parents 4fb3ce4 + ecaf49a commit d57b4eb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ niseliff

### Features

- [ ] [Ready](https://developers.line.biz/ja/reference/liff/#ready)
- [ ] [Id](https://developers.line.biz/ja/reference/liff/#id)
- [x] [Ready](https://developers.line.biz/ja/reference/liff/#ready)
- [x] [Id](https://developers.line.biz/ja/reference/liff/#id)
- [x] [Initialize liff app](https://developers.line.biz/ja/reference/liff/#initialize-liff-app)
- [x] [Get os](https://developers.line.biz/ja/reference/liff/#get-os)
- [x] [Get language](https://developers.line.biz/ja/reference/liff/#get-language)
Expand Down
8 changes: 6 additions & 2 deletions packages/niseliff-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { buildGetLineVersion } from './method/get-line-version'
import { buildGetOs } from './method/get-os'
import { buildGetProfile } from './method/get-profile'
import { buildGetVersion } from './method/get-version'
import { buildId } from './method/id'
import { buildInit } from './method/init'
import { buildInitPlugins } from './method/init-plugins'
import { buildIsApiAvailable } from './method/is-api-available'
Expand All @@ -25,6 +26,7 @@ import { buildPermanentCreateUrlBy } from './method/permanent-link-create-url-by
import { buildPermanentLinkSetExtraQueryParam } from './method/permanent-link-set-extra-query-param'
import { buildPermissionQuery } from './method/permission-query'
import { buildPermissionRequestAll } from './method/permission-request-all'
import { buildReady } from './method/ready'
import { buildScanCode } from './method/scan-code'
import { buildScanCodeV2 } from './method/scan-code-v2'
import { buildSendMessages } from './method/send-messages'
Expand All @@ -34,6 +36,7 @@ import { ConsoleLogger, Logger } from './util/logger'
export const buildNiseLiff = (params?: {
clientEndpoint?: string
authEndpoint?: string
liffId?: string
os?: 'ios' | 'android' | 'web' | undefined
language?: string
version?: string
Expand All @@ -47,8 +50,6 @@ export const buildNiseLiff = (params?: {
| 'subWindow'
| 'isSubWindow'
| 'use'
| 'ready'
| 'id'
| '_dispatchEvent'
| '_call'
| '_addListener'
Expand All @@ -58,13 +59,16 @@ export const buildNiseLiff = (params?: {
const logger: Logger = new ConsoleLogger()
const clientEndpoint = params?.clientEndpoint ?? window.location.origin
const authEndpoint = params?.authEndpoint ?? 'http://localhost:3000'
const liffId = params?.liffId ?? 'DEFAULT_LIFF_ID'
const os = params?.os ?? 'web'
const language = params?.language ?? 'ja'
const version = params?.version ?? '2.16.1'
const lineVersion = params?.lineVersion ?? '1.0.0'
const isInClient = params?.isInClient ?? false

return {
id: buildId(liffId),
ready: buildReady(),
init: buildInit({ logger, clientEndpoint, authEndpoint }),
getOS: buildGetOs(os),
getLanguage: buildGetLanguage(language),
Expand Down
3 changes: 3 additions & 0 deletions packages/niseliff-sdk/src/method/id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import liff from '@line/liff'

export const buildId = (liffId: string): typeof liff.id => liffId
6 changes: 6 additions & 0 deletions packages/niseliff-sdk/src/method/ready.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import liff from '@line/liff'

export const buildReady = (): typeof liff.ready =>
new Promise((resolve) => {
resolve()
})

0 comments on commit d57b4eb

Please sign in to comment.