getAccountInfoSync

# getAccountInfoSync

Get current account information

Return Value

Object object

Property Type Description
miniProgram Object Mini-Program account information
plugin Object Plugin account information (only included when called within a plugin)

Structure of object.miniProgram

Property Type Description
appId string Mini-Program appId
envVersion string Mini-Program version
version string Online Mini-Program version number

Structure of object.plugin

Property Type Description
appId string Plugin appId
version string Plugin version number

Sample Code

const accountInfo = ft.getAccountInfoSync();
console.log(accountInfo.miniProgram.appId) // Mini-Program appId

# authorize

Initiate an authorization request to the user in advance.

Parameters

Object object

Property Type Default Required Description
scope string yes The scope requiring permission, see scope list for details
success function no Callback function for successful API call
fail function no Callback function for failed API call
complete function no Callback function for API call completion (executed for both success and failure)

Sample Code

// Can be passed ft.getSetting Check to see if the user is authorized "scope.record" this scope
// You can use ft.getSetting to first check if the user has authorized the "scope.record" scope
ft.getSetting({
  success(res) {
    if (!res.authSetting['scope.record']) {
      ft.authorize({
        scope: 'scope.record',
        success () {
          // The user has agreed to the Mini-Program using the recording function, subsequent calls to ft.startRecord will not prompt for confirmation
          ft.startRecord()
        }
      })
    }
  }
})

# openSetting

Invoke the client Mini-Program settings interface, return the user's setting operation result

Parameters

Object object

Property Type Default Required Description
withSubscriptions Boolean false no Whether to simultaneously obtain the subscription status of user subscription messages, not obtained by default.
success function no Callback function for successful API call
fail function no Callback function for failed API call
complete function no Callback function for API call completion (executed for both success and failure)

object.success callback function

Parameters

Object res

Property Type Description
authSetting AuthSetting User authorization result
subscriptionsSetting SubscriptionsSetting User subscription message settings, returned only when the withSubscriptions parameter value is true

Sample Code

ft.openSetting({
  success (res) {
    console.log(res.authSetting)
    // res.authSetting = {
    //   "scope.userInfo": true,
    //   "scope.userLocation": true
    // }
  }
})

# getSetting

Get the user's current settings

Parameters

Object object

Property Type Default Required Description
withSubscriptions Boolean false no Whether to simultaneously obtain the subscription status of user subscription messages, not obtained by default.
success function no Callback function for successful API call
fail function no Callback function for failed API call
complete function no Callback function for API call completion (executed for both success and failure)

object.success callback function

Parameters

Object res

Property Type Description
authSetting AuthSetting User authorization result
subscriptionsSetting SubscriptionsSetting User subscription message settings, returned only when the withSubscriptions parameter value is true
miniprogramAuthSetting AuthSetting When called within a plugin, the user authorization result of the current host Mini-Program

Sample Code

ft.getSetting({
  success (res) {
    console.log(res.authSetting)
    // res.authSetting = {
    //   "scope.userInfo": true,
    //   "scope.userLocation": true
    // }
  }
})

# AuthSetting

User authorization setting information, refer to permissions for details

Properties

boolean scope.userInfo

Whether user information is authorized, corresponds to interface ft.getUserInfo

boolean scope.userLocation

Whether geographic location is authorized, corresponds to interfaces ft.getLocation, ft.chooseLocation

boolean scope.address

Whether communication address is authorized, this authorization item has been canceled, will return true by default

boolean scope.invoiceTitle

Whether invoice header is authorized, this authorization item has been canceled, will return true by default

boolean scope.invoice

Whether obtaining invoices is authorized, this authorization item has been canceled, will return true by default

boolean scope.werun

Whether step count is authorized, corresponds to interface ft.getWeRunData

boolean scope.record

Whether recording function is authorized, corresponds to interface ft.startRecord

boolean scope.writePhotosAlbum

Whether saving to album is authorized, corresponds to ft.saveImageToPhotosAlbum, ft.saveVideoToPhotosAlbum

boolean scope.camera

Whether camera is authorized, corresponds to camera component

boolean scope.bluetooth

Whether Bluetooth is authorized, corresponds to interfaces ft.openBluetoothAdapter, ft.createBLEPeripheralServer

boolean scope.addPhoneContact

Whether adding contact to address book is authorized, corresponds to interface ft.addPhoneContact

boolean scope.addPhoneCalendar

Whether system calendar is authorized, corresponds to interfaces ft.addPhoneRepeatCalendar, ft.addPhoneCalendar

© FinClip with ❤ , Since 2017