Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

996 B
Raw Blame
import { requireNativeModule } from 'expo-modules-core';

export interface WechatAuthOptions {
  appId: string;
  universalLink?: string;
  scope?: string;
  state: string;
}

export interface WechatAuthCodeResult {
  code: string;
}

interface XdtWechatLoginModule {
  isWechatInstalled(): Promise<boolean>;
  requestWechatAuthCode(
    options: WechatAuthOptions,
  ): Promise<WechatAuthCodeResult>;
  cancelWechatAuthRequest(): Promise<void>;
}

const nativeModule =
  requireNativeModule<XdtWechatLoginModule>('XdtWechatLogin');

export function isWechatInstalled(): Promise<boolean> {
  return nativeModule.isWechatInstalled();
}

export function requestWechatAuthCode(
  options: WechatAuthOptions,
): Promise<WechatAuthCodeResult> {
  return nativeModule.requestWechatAuthCode(options);
}

/** Releases a native request whose JavaScript-side foreground timeout already fired. */
export function cancelWechatAuthRequest(): Promise<void> {
  return nativeModule.cancelWechatAuthRequest();
}