@adapty/capacitor
Version:
Official Adapty SDK for Capacitor
41 lines • 1.46 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import { Coder } from './coder';
import { JSONCoder } from './json';
export class AdaptyRemoteConfigCoder extends Coder {
constructor() {
super(...arguments);
this.properties = {
data: {
key: 'data',
required: true,
type: 'string',
converter: new JSONCoder(),
},
lang: {
key: 'lang',
required: true,
type: 'string',
},
};
}
decode(data) {
const codablePart = super.decode(data);
const dataString = JSON.stringify(codablePart.data);
return Object.assign(Object.assign({}, codablePart), { dataString: dataString.length < 4 ? '' : dataString });
}
encode(data) {
const { dataString } = data, codablePart = __rest(data, ["dataString"]);
return super.encode(codablePart);
}
}
//# sourceMappingURL=adapty-remote-config.js.map