Skip to content

integrateFacebookLogin

集成Facebook登录到Android项目,自动配置相关文件和依赖。

前置依赖

依赖参数

参数名类型说明
deps.existsSyncFileSystem['existsSync']检查文件是否存在
deps.readFileSyncFileSystem['readFileSync']读取文件内容
deps.writeFileSyncFileSystem['writeFileSync']写入文件内容
deps.copyFileSyncFileSystem['copyFileSync']复制文件
deps.joinPath['join']路径拼接
deps.xmlParserXMLParserConstructorXML 解析器构造函数
deps.xmlSerializerXMLSerializerConstructorXML 序列化器构造函数
deps.xpathXPathXPath 查询库

环境要求

  • @xmldom/xmldom: XML DOM 解析库
  • xpath: XPath 查询库
bash
npm install @xmldom/xmldom xpath

函数签名

typescript
function integrateFacebookLogin(
  projectPath: string,
  moduleDir: string,
  packageName: string,
  config: FacebookLoginConfig,
  deps: IntegrateThirdPartyModuleDeps
): Promise<{ success: boolean; message?: string; error?: string; logs: string[] }>

参数

参数名类型必填说明
projectPathstringAndroid项目路径
moduleDirstring模块目录(如 'app' 或 'HBuilder-uniPlugin')
packageNamestring应用包名
configFacebookLoginConfigFacebook登录配置
depsIntegrateThirdPartyModuleDeps依赖注入对象

返回值

类型说明
Promise<{ success: boolean; message?: string; error?: string; logs: string[] }>Promise,解析为集成结果对象

工作原理

基于 integrateThirdPartyModule 实现,自动处理库文件拷贝、Gradle依赖添加、清单文件修改等操作,确保Facebook登录功能正确集成。