适用于Ionic / Cordova的Firebase Invite插件

时间:2016-09-05 08:59:53

标签: cordova ionic-framework firebase firebase-invites

在Ionic应用程序中是否可以使用任何Cordova插件来使用Firebase Invite?

为Firebase @ https://github.com/arnesson/cordova-plugin-firebase

找到此插件

但它尚未支持Invites

1 个答案:

答案 0 :(得分:2)

这个解决了问题https://plugins.telerik.com/cordova/plugin/firebase-invites 根据文件

发送邀请

 FirebaseInvites.sendInvitation(
  {
      title: "The title", // mandatory, see the screenshots for its purpose
      message: "The message", // mandatory, see the screenshots for its purpose
      deepLink: "myapp://deeplink",
      callToActionText: "My CTA",
      description: "My description",
      customImage: "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png",
      //emailSubject: "My Email subject",
      //emailHtmlContent: "Some <strong>HTML</strong> content",
      androidClientID: "123abc",
      // You can find your iOS app's client ID in the GoogleService-Info.plist file you downloaded from the Firebase console
      iosClientID: "abc123"
  },
  function (result) {
    console.log("Sent " + result.count + " invites");
    console.log("Invitation ID's: " + JSON.stringify(result.invitationIds));
  },
  function (msg) {
    alert("Error: " + msg);
  }
);

并接收

    FirebaseInvites.getInvitation(
  function (result) {
    console.log("invitation ID: " + result.invitationId);
    console.log("deeplink: " + result.deepLink);
    console.log("matchType: " + result.matchType); // iOS only, either "Weak" or "Strong" as described at https://firebase.google.com/docs/invites/ios
  },
  function (msg) {
    alert("Error: " + msg);
  }
);