take out validateParameters from Links class
This commit is contained in:
parent
a085733e03
commit
08d467ff4d
@ -5,6 +5,38 @@ const EVENT_TYPE = {
|
||||
Link: 'dynamic_link_received',
|
||||
};
|
||||
|
||||
function validateParameters(parameters: Object): boolean {
|
||||
const suportedParametersObject = {
|
||||
dynamicLinkInfo: {
|
||||
dynamicLinkDomain: 'string',
|
||||
link: 'string',
|
||||
androidInfo: {
|
||||
androidPackageName: 'string',
|
||||
androidFallbackLink: 'string',
|
||||
androidMinPackageVersionCode: 'string',
|
||||
androidLink: 'string',
|
||||
},
|
||||
iosInfo: {
|
||||
iosBundleId: 'string',
|
||||
iosFallbackLink: 'string',
|
||||
iosCustomScheme: 'string',
|
||||
iosIpadFallbackLink: 'string',
|
||||
iosIpadBundleId: 'string',
|
||||
iosAppStoreId: 'string',
|
||||
},
|
||||
socialMetaTagInfo: {
|
||||
socialTitle: 'string',
|
||||
socialDescription: 'string',
|
||||
socialImageLink: 'string',
|
||||
},
|
||||
},
|
||||
suffix: {
|
||||
option: 'string',
|
||||
},
|
||||
};
|
||||
return areObjectKeysContainedInOther(parameters, suportedParametersObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @class Links
|
||||
*/
|
||||
@ -44,7 +76,7 @@ export default class Links extends ModuleBase {
|
||||
* @returns {Promise.<String>}
|
||||
*/
|
||||
createDynamicLink(parameters: Object = {}): Promise<String> {
|
||||
if (!this._validateParameters(parameters)) {
|
||||
if (!validateParameters(parameters)) {
|
||||
return Promise.reject(new Error('Invalid Parameters.'));
|
||||
}
|
||||
return this._native.createDynamicLink(parameters);
|
||||
@ -56,43 +88,11 @@ export default class Links extends ModuleBase {
|
||||
* @returns {Promise.<String>}
|
||||
*/
|
||||
createShortDynamicLink(parameters: Object = {}): Promise<String> {
|
||||
if (!this._validateParameters(parameters)) {
|
||||
if (!validateParameters(parameters)) {
|
||||
return Promise.reject(new Error('Invalid Parameters.'));
|
||||
}
|
||||
return this._native.createShortDynamicLink(parameters);
|
||||
}
|
||||
|
||||
_validateParameters(parameters: Object): boolean {
|
||||
const suportedParametersObject = {
|
||||
dynamicLinkInfo: {
|
||||
dynamicLinkDomain: 'string',
|
||||
link: 'string',
|
||||
androidInfo: {
|
||||
androidPackageName: 'string',
|
||||
androidFallbackLink: 'string',
|
||||
androidMinPackageVersionCode: 'string',
|
||||
androidLink: 'string',
|
||||
},
|
||||
iosInfo: {
|
||||
iosBundleId: 'string',
|
||||
iosFallbackLink: 'string',
|
||||
iosCustomScheme: 'string',
|
||||
iosIpadFallbackLink: 'string',
|
||||
iosIpadBundleId: 'string',
|
||||
iosAppStoreId: 'string',
|
||||
},
|
||||
socialMetaTagInfo: {
|
||||
socialTitle: 'string',
|
||||
socialDescription: 'string',
|
||||
socialImageLink: 'string',
|
||||
},
|
||||
},
|
||||
suffix: {
|
||||
option: 'string',
|
||||
},
|
||||
};
|
||||
return areObjectKeysContainedInOther(parameters, suportedParametersObject);
|
||||
}
|
||||
}
|
||||
|
||||
export const statics = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user