Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions interface.html
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ <h3><small>App version and bundle ID</small></h3>
<div class="col-sm-8">
<input type="text" name="fl-store-versionNumber" class="form-control" id="fl-store-versionNumber" data-error="Please enter an app version number" maxlength="64" required />
<div class="help-block with-errors"></div>
<p class="help-block"><small>The recommended format for version number is <code>1.0.0</code>. With a maximum value of <code>99</code> per number.</small></p>
<p class="help-block"><small>The required format for version number is <code>1.0.0</code>. With a maximum value of <code>99</code> per number.</small></p>
</div>
</div>
<div class="form-group clearfix">
Expand Down Expand Up @@ -1418,7 +1418,7 @@ <h3><small>App version and bundle ID</small></h3>
<div class="col-sm-8">
<input type="text" name="fl-ent-versionNumber" class="form-control" id="fl-ent-versionNumber" data-error="Please enter an app version number" required />
<div class="help-block with-errors"></div>
<p class="help-block"><small>The recommended format for version number is <code>1.0.0</code>. With a maximum value of <code>99</code> per number.</small></p>
<p class="help-block"><small>The required format for version number is <code>1.0.0</code>. With a maximum value of <code>99</code> per number.</small></p>
</div>
</div>
<div class="form-group clearfix">
Expand Down Expand Up @@ -1533,7 +1533,7 @@ <h4 class="panel-title collapsed" role="button" data-toggle="collapse" data-pare
<div class="col-sm-8">
<input type="text" name="fl-uns-versionNumber" class="form-control" id="fl-uns-versionNumber" data-error="Please enter an app version number" required />
<div class="help-block with-errors"></div>
<p class="help-block"><small>The recommended format for version number is <code>1.0.0</code>. With a maximum value of <code>99</code> per number.</small></p>
<p class="help-block"><small>The required format for version number is <code>1.0.0</code>. With a maximum value of <code>99</code> per number.</small></p>
</div>
</div>
<div class="form-group clearfix">
Expand Down
33 changes: 32 additions & 1 deletion js/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ var socket = Fliplet.Socket({
});
var socketClientId;

/* ERROR MESSAGES */

var ERRORS = {
INVALID_VERSION: 'The version number is incorrect. Please use a 3-part version number such as 1.0.0 where each part is no larger than 99.'
};

/* FUNCTIONS */
String.prototype.toCamelCase = function () {
return this.replace(/^([A-Z])|[^A-Za-z]+(\w)/g, function (match, p1, p2, offset) {
Expand Down Expand Up @@ -106,7 +112,7 @@ function createBundleID(orgName, appName) {
}

function incrementVersionNumber(versionNumber) {
var splitNumber = versionNumber.split('.');
var splitNumber = _.compact(versionNumber.split('.'));
var arrLength = splitNumber.length;

while (arrLength--) {
Expand Down Expand Up @@ -1566,6 +1572,10 @@ function checkGroupErrors() {
});
}

function isValidVersion(version) {
return /^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$/.test(version);
}

function validateScreenshots() {
var imageErrors = [];
var supportedFormats = _.uniqBy(_.concat.apply(null, _.map(screenshotRequirements, 'sizes')),
Expand Down Expand Up @@ -2424,6 +2434,13 @@ $('#appStoreConfiguration').validator().on('submit', function (event) {

event.preventDefault();

if (!isValidVersion($('[name="fl-store-versionNumber"]').val())) {
Fliplet.Modal.alert({
message: ERRORS.INVALID_VERSION
});
return;
}

if ($('[name="fl-store-screenshots"]:checked').val() === 'new' && !hasAllScreenshots) {
Fliplet.Modal.alert({
message: 'You need to add screenshots before submitting'
Expand Down Expand Up @@ -2518,6 +2535,13 @@ $('#enterpriseConfiguration').validator().on('submit', function (event) {

event.preventDefault();

if (!isValidVersion($('[name="fl-ent-versionNumber"]').val())) {
Fliplet.Modal.alert({
message: ERRORS.INVALID_VERSION
});
return;
}

if (!enterpriseManual && !enterpriseLoggedIn) {
Fliplet.Modal.alert({
message: 'Please log in with the Apple Developer Account or choose to enter the data manually.'
Expand Down Expand Up @@ -2592,6 +2616,13 @@ $('#unsignedConfiguration').validator().on('submit', function (event) {

event.preventDefault();

if (!isValidVersion($('[name="fl-uns-versionNumber"]').val())) {
Fliplet.Modal.alert({
message: ERRORS.INVALID_VERSION
});
return;
}

if (appInfo && appInfo.productionAppId) {
if (allAppData.indexOf('unsigned') > -1) {
var message = 'Are you sure you wish to update your published app?';
Expand Down