nativeScript-launchkit
将原生 launchkit iOS 小部件集成到 NativeScript 中
npm i --save nativescript-launchkit

Nativescript LaunchKitSDK 包装器

#设置 LaunchKit 账户#

在线演示

Preview

设置

在您的 app.js 中添加以下代码

if (application.ios) {
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};

var appDelegate = (function (_super) {
__extends(appDelegate, _super);
function appDelegate() {
_super.apply(this, arguments);
}

appDelegate.prototype.applicationDidFinishLaunchingWithOptions = function (app, launchOptions) {
launchkit.initalize({
token: "OjMwhQZ5WgFFNZAQVBOYtWtAcXv1Kw2inxkzPEx_j6sK"
});
};

appDelegate.ObjCProtocols = [UIApplicationDelegate];
return appDelegate;
})(UIResponder);
application.ios.delegate = appDelegate;
}

API

var launchkit = require("nativescript-launchkit");
launchkit.initalize({
token: "", //From https://launchkit.io/sdk/install/,
debug: false //tells all methods that have debug flags to use them
});

isSuperUser: 返回布尔值

launchkit.isSuperUser();

setUser

launchkit.setUser({
id: "someid",
name: "steve",
email: "[email protected]"
});

showOnboarding: 返回 Promise (args: args)

launchkit.showOnboarding();

Onboarding 需要从视图调用,在 app.js 中调用将失败,因为没有 UIWindow

showReleaseNotes: 返回 Promise (args: didPresent)

launchkit.showAppReviewCard({
page: page //args.object from your onNavigatingTo, or onPageLoaded events
});

showAppReviewCard: 返回 Promise (args: didPresent, flowResult)

launchkit.showAppReviewCard({
page: page //args.object from your onNavigatingTo, or onPageLoaded events
});

注意:非官方插件,仅包装官方 iOS SDK