This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23766 from azasypkin/bug-1050416-build-script
Bug 1050416 - [Messages][Build] Add build script to ignore the desktop-only folder for production build. r=julien
- Loading branch information
Showing
14 changed files
with
182 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* global require, exports */ | ||
|
||
'use strict'; | ||
|
||
var utils = require('utils'); | ||
|
||
function removeDesktopOnlyFolder(appStageDir) { | ||
var desktopOnlyDir = utils.getFile(appStageDir, 'js', 'desktop-only'); | ||
|
||
if (desktopOnlyDir.exists()) { | ||
desktopOnlyDir.remove(true); | ||
} | ||
} | ||
|
||
function removeDesktopOnlyScripts(appStageDir) { | ||
var indexFile = utils.getFile(appStageDir, 'index.html'); | ||
var desktopOnlyScriptsRegex = /<script.+desktop\-only.+<\/script>/g; | ||
|
||
utils.writeContent( | ||
indexFile, | ||
utils.getFileContent(indexFile).replace(desktopOnlyScriptsRegex, '') | ||
); | ||
} | ||
|
||
exports.execute = function(options) { | ||
utils.copyToStage(options); | ||
|
||
removeDesktopOnlyFolder(options.STAGE_APP_DIR); | ||
removeDesktopOnlyScripts(options.STAGE_APP_DIR); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
(function(exports) { | ||
'use strict'; | ||
|
||
// Fake drafts stored in local store | ||
const timestamp = Date.now(), | ||
store = new Map(); | ||
|
||
const draftIndex = [ | ||
[11, [{ | ||
recipients: ['555', '666'], | ||
subject: '', | ||
content: ['This is a draft message'], | ||
timestamp: timestamp - (3600000 * 24), | ||
threadId: 11, | ||
type: 'sms' | ||
}]], | ||
[null, [{ | ||
recipients: [], | ||
subject: '', | ||
content: ['This is a draft SMS, with no recipient'], | ||
timestamp: timestamp, | ||
threadId: null, | ||
type: 'sms' | ||
}, { | ||
recipients: ['555-666-1234'], | ||
subject: '', | ||
content: ['This is a draft SMS, with a recipient, but no thread'], | ||
timestamp: timestamp - 3600000, | ||
threadId: null, | ||
type: 'sms' | ||
}]], | ||
[8, [{ | ||
recipients: ['123456'], | ||
subject: '', | ||
content: [ | ||
'This is a draft MMS...', | ||
{ | ||
blob: { | ||
type: 'audio/ogg', | ||
size: 12345 | ||
}, | ||
name: 'audio.oga' | ||
}, | ||
'...with a recipient and a thread' | ||
], | ||
timestamp: timestamp - (3600000 * 2), | ||
threadId: 8, | ||
type: 'mms' | ||
}]] | ||
]; | ||
|
||
store.set('draft index', draftIndex); | ||
|
||
function callCallback(value, callback) { | ||
if (typeof callback === 'function') { | ||
setTimeout(callback.bind(null, value), 0); | ||
} | ||
} | ||
|
||
Object.defineProperty(exports, 'asyncStorage', { | ||
// Marking as non-configurable to not be overridden by real asyncStorage | ||
configurable: false, | ||
value: { | ||
getItem: function asm_getItem(key, callback) { | ||
callCallback(store.get(key) || null, callback); | ||
}, | ||
setItem: function asm_setItem(key, value, callback) { | ||
callCallback(store.set(key, value), callback); | ||
}, | ||
removeItem: function asm_removeItem(key, callback) { | ||
callCallback(store.delete(key), callback); | ||
}, | ||
clear: function asm_clear(callback) { | ||
callCallback(store.clear(), callback); | ||
}, | ||
length: function(callback) { | ||
callCallback(store.size, callback); | ||
}, | ||
key: function() { | ||
throw new Error('Not Implemented'); | ||
} | ||
} | ||
}); | ||
})(window); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
if (navigator.mozIccManager) { | ||
return; | ||
} | ||
|
||
navigator.mozIccManager = { | ||
iccIds: [] | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
if (navigator.mozSettings) { | ||
return; | ||
} | ||
|
||
const KNOWN_SETTINGS = new Map(); | ||
|
||
KNOWN_SETTINGS.set('locale.hour12', true); | ||
|
||
navigator.mozSettings = { | ||
createLock: function() { | ||
return { | ||
get: function(key) { | ||
var request = { | ||
addEventListener: function(eventName, callback) { | ||
request[eventName] = callback; | ||
} | ||
}; | ||
|
||
window.setTimeout(function() { | ||
if (typeof request.onsuccess === 'function') { | ||
request.result = {}; | ||
request.result[key] = KNOWN_SETTINGS.get(key); | ||
request.onsuccess.call(request); | ||
} | ||
}, 0); | ||
|
||
return request; | ||
} | ||
}; | ||
}, | ||
|
||
addObserver: function() {} | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.