mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update translations
This commit is contained in:
parent
4e86a39f8c
commit
28f378f8db
19 changed files with 284 additions and 64 deletions
|
@ -202,6 +202,10 @@ h1 a:hover {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body:not(.enableBackButton) .headerBackButton {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: I have omitted any vendor-prefixes for clarity.
|
* Note: I have omitted any vendor-prefixes for clarity.
|
||||||
* Adding them is left as an exercise for the reader.
|
* Adding them is left as an exercise for the reader.
|
||||||
|
|
|
@ -350,7 +350,7 @@
|
||||||
getEndpointInfo().done(function (endpoint) {
|
getEndpointInfo().done(function (endpoint) {
|
||||||
|
|
||||||
if (endpoint.IsLocal || endpoint.IsInNetwork) {
|
if (endpoint.IsLocal || endpoint.IsInNetwork) {
|
||||||
ApiClient.getSystemInfo().done(function (info) {
|
ApiClient.getPublicSystemInfo().done(function (info) {
|
||||||
|
|
||||||
message.serverAddress = info.LocalAddress;
|
message.serverAddress = info.LocalAddress;
|
||||||
player.sendMessageInternal(message);
|
player.sendMessageInternal(message);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function ($, document) {
|
(function ($, document) {
|
||||||
|
|
||||||
var view = LibraryBrowser.getDefaultItemsView('Poster', 'PosterCard');
|
var view = LibraryBrowser.getDefaultItemsView('Poster', 'Poster');
|
||||||
|
|
||||||
// The base query options
|
// The base query options
|
||||||
var query = {
|
var query = {
|
||||||
|
|
|
@ -249,10 +249,12 @@
|
||||||
|
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
|
// Need a timeout because we can't show a popup at the same time as the previous one is closing
|
||||||
|
// Bumping it up to 1000 because the post play menu is hiding for some reason on android
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
|
||||||
showPostPlayMenu(currentItem);
|
showPostPlayMenu(currentItem);
|
||||||
}, 500);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlaybackProgress(positionTicks) {
|
function onPlaybackProgress(positionTicks) {
|
||||||
|
@ -478,7 +480,6 @@
|
||||||
|
|
||||||
showMenu: showPlayMenu,
|
showMenu: showPlayMenu,
|
||||||
onPlaybackStart: onPlaybackStart,
|
onPlaybackStart: onPlaybackStart,
|
||||||
onPlaybackStopped: onPlaybackStopped,
|
|
||||||
getExternalPlayers: getExternalPlayers,
|
getExternalPlayers: getExternalPlayers,
|
||||||
showPlayerSelectionMenu: showPlayerSelectionMenu
|
showPlayerSelectionMenu: showPlayerSelectionMenu
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
|
|
||||||
var html = '<div class="viewMenuBar ui-bar-b">';
|
var html = '<div class="viewMenuBar ui-bar-b">';
|
||||||
|
|
||||||
if (AppInfo.enableBackButton) {
|
|
||||||
html += '<button type="button" data-role="none" onclick="history.back();" class="headerButton headerButtonLeft headerBackButton"><div class="fa fa-arrow-left"></div></button>';
|
html += '<button type="button" data-role="none" onclick="history.back();" class="headerButton headerButtonLeft headerBackButton"><div class="fa fa-arrow-left"></div></button>';
|
||||||
}
|
|
||||||
|
|
||||||
html += '<button type="button" data-role="none" title="Menu" class="headerButton dashboardMenuButton barsMenuButton headerButtonLeft">';
|
html += '<button type="button" data-role="none" title="Menu" class="headerButton dashboardMenuButton barsMenuButton headerButtonLeft">';
|
||||||
html += '<div class="barMenuInner fa fa-bars">';
|
html += '<div class="barMenuInner fa fa-bars">';
|
||||||
|
|
|
@ -1287,15 +1287,19 @@
|
||||||
|
|
||||||
}).on("click.mediaplayerevent", function (e) {
|
}).on("click.mediaplayerevent", function (e) {
|
||||||
|
|
||||||
|
if (!$.browser.mobile) {
|
||||||
if (this.paused) {
|
if (this.paused) {
|
||||||
self.unpause();
|
self.unpause();
|
||||||
} else {
|
} else {
|
||||||
self.pause();
|
self.pause();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}).on("dblclick.mediaplayerevent", function () {
|
}).on("dblclick.mediaplayerevent", function () {
|
||||||
|
|
||||||
|
if (!$.browser.mobile) {
|
||||||
self.toggleFullscreen();
|
self.toggleFullscreen();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bindEventsForPlayback();
|
bindEventsForPlayback();
|
||||||
|
|
|
@ -108,11 +108,13 @@
|
||||||
return options;
|
return options;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getDeviceProfile = function () {
|
self.getDeviceProfile = function (maxWidth) {
|
||||||
|
|
||||||
var qualityOption = self.getVideoQualityOptions().filter(function (q) {
|
if (!maxWidth) {
|
||||||
|
maxWidth = self.getVideoQualityOptions().filter(function (q) {
|
||||||
return q.selected;
|
return q.selected;
|
||||||
})[0];
|
})[0].maxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
var bitrateSetting = AppSettings.maxStreamingBitrate();
|
var bitrateSetting = AppSettings.maxStreamingBitrate();
|
||||||
|
|
||||||
|
@ -316,7 +318,7 @@
|
||||||
{
|
{
|
||||||
Condition: 'LessThanEqual',
|
Condition: 'LessThanEqual',
|
||||||
Property: 'Width',
|
Property: 'Width',
|
||||||
Value: qualityOption.maxWidth
|
Value: maxWidth
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -333,7 +335,7 @@
|
||||||
{
|
{
|
||||||
Condition: 'LessThanEqual',
|
Condition: 'LessThanEqual',
|
||||||
Property: 'Width',
|
Property: 'Width',
|
||||||
Value: qualityOption.maxWidth
|
Value: maxWidth
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function ($, document) {
|
(function ($, document) {
|
||||||
|
|
||||||
var view = LibraryBrowser.getDefaultItemsView('Poster', 'PosterCard');
|
var view = LibraryBrowser.getDefaultItemsView('Poster', 'Poster');
|
||||||
|
|
||||||
// The base query options
|
// The base query options
|
||||||
var query = {
|
var query = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function ($, document) {
|
(function ($, document) {
|
||||||
|
|
||||||
var view = LibraryBrowser.getDefaultItemsView('Poster', 'PosterCard');
|
var view = LibraryBrowser.getDefaultItemsView('Poster', 'Poster');
|
||||||
|
|
||||||
// The base query options
|
// The base query options
|
||||||
var query = {
|
var query = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function ($, document) {
|
(function ($, document) {
|
||||||
|
|
||||||
var view = LibraryBrowser.getDefaultItemsView('Poster', 'PosterCard');
|
var view = LibraryBrowser.getDefaultItemsView('Poster', 'Poster');
|
||||||
|
|
||||||
// The base query options
|
// The base query options
|
||||||
var query = {
|
var query = {
|
||||||
|
|
|
@ -1359,7 +1359,8 @@ var Dashboard = {
|
||||||
},
|
},
|
||||||
|
|
||||||
capabilities: function () {
|
capabilities: function () {
|
||||||
return {
|
|
||||||
|
var caps = {
|
||||||
PlayableMediaTypes: "Audio,Video",
|
PlayableMediaTypes: "Audio,Video",
|
||||||
|
|
||||||
SupportedCommands: Dashboard.getSupportedRemoteCommands().join(','),
|
SupportedCommands: Dashboard.getSupportedRemoteCommands().join(','),
|
||||||
|
@ -1367,6 +1368,8 @@ var Dashboard = {
|
||||||
SupportsMediaControl: true,
|
SupportsMediaControl: true,
|
||||||
SupportedLiveMediaTypes: ['Audio', 'Video']
|
SupportedLiveMediaTypes: ['Audio', 'Video']
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return caps;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultImageQuality: function (imageType) {
|
getDefaultImageQuality: function (imageType) {
|
||||||
|
@ -1600,12 +1603,10 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
//localStorage.clear();
|
//localStorage.clear();
|
||||||
function createConnectionManager(appInfo) {
|
function createConnectionManager(appInfo, capabilities) {
|
||||||
|
|
||||||
var credentialProvider = new MediaBrowser.CredentialProvider();
|
var credentialProvider = new MediaBrowser.CredentialProvider();
|
||||||
|
|
||||||
var capabilities = Dashboard.capabilities();
|
|
||||||
|
|
||||||
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities);
|
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities);
|
||||||
|
|
||||||
$(ConnectionManager).on('apiclientcreated', function (e, newApiClient) {
|
$(ConnectionManager).on('apiclientcreated', function (e, newApiClient) {
|
||||||
|
@ -1713,6 +1714,10 @@ var AppInfo = {};
|
||||||
$(document).addClass('nativeApp');
|
$(document).addClass('nativeApp');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AppInfo.enableBackButton) {
|
||||||
|
$(document.body).addClass('enableBackButton');
|
||||||
|
}
|
||||||
|
|
||||||
var videoPlayerHtml = '<div id="mediaPlayer" data-theme="b" class="ui-bar-b" style="display: none;">';
|
var videoPlayerHtml = '<div id="mediaPlayer" data-theme="b" class="ui-bar-b" style="display: none;">';
|
||||||
|
|
||||||
videoPlayerHtml += '<div class="videoBackdrop">';
|
videoPlayerHtml += '<div class="videoBackdrop">';
|
||||||
|
@ -1823,6 +1828,10 @@ var AppInfo = {};
|
||||||
|
|
||||||
if (Dashboard.isRunningInCordova()) {
|
if (Dashboard.isRunningInCordova()) {
|
||||||
requirejs(['thirdparty/cordova/connectsdk', 'thirdparty/cordova/remotecontrols']);
|
requirejs(['thirdparty/cordova/connectsdk', 'thirdparty/cordova/remotecontrols']);
|
||||||
|
|
||||||
|
if ($.browser.android) {
|
||||||
|
requirejs(['thirdparty/cordova/android/immersive']);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($.browser.chrome) {
|
if ($.browser.chrome) {
|
||||||
requirejs(['scripts/chromecast']);
|
requirejs(['scripts/chromecast']);
|
||||||
|
@ -1830,7 +1839,7 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(deferred, appName, deviceId, deviceName, resolveOnReady) {
|
function init(deferred, capabilities, appName, deviceId, deviceName, resolveOnReady) {
|
||||||
|
|
||||||
requirejs.config({
|
requirejs.config({
|
||||||
map: {
|
map: {
|
||||||
|
@ -1850,12 +1859,14 @@ var AppInfo = {};
|
||||||
|
|
||||||
var appInfo = Dashboard.getAppInfo(appName, deviceId, deviceName);
|
var appInfo = Dashboard.getAppInfo(appName, deviceId, deviceName);
|
||||||
|
|
||||||
createConnectionManager(appInfo);
|
createConnectionManager(appInfo, capabilities);
|
||||||
|
|
||||||
if (!resolveOnReady) {
|
if (!resolveOnReady) {
|
||||||
|
|
||||||
Dashboard.initPromiseDone = true;
|
Dashboard.initPromiseDone = true;
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
onDocumentReady();
|
onDocumentReady();
|
||||||
if (resolveOnReady) {
|
if (resolveOnReady) {
|
||||||
|
@ -1867,9 +1878,19 @@ var AppInfo = {};
|
||||||
|
|
||||||
function initCordovaWithDeviceId(deferred, deviceId) {
|
function initCordovaWithDeviceId(deferred, deviceId) {
|
||||||
|
|
||||||
|
var screenWidth = Math.max(screen.height, screen.width);
|
||||||
|
initCordovaWithDeviceProfile(deferred, deviceId, MediaPlayer.getDeviceProfile(screenWidth));
|
||||||
|
}
|
||||||
|
|
||||||
|
function initCordovaWithDeviceProfile(deferred, deviceId, deviceProfile) {
|
||||||
|
|
||||||
requirejs(['thirdparty/cordova/imagestore.js']);
|
requirejs(['thirdparty/cordova/imagestore.js']);
|
||||||
|
|
||||||
init(deferred, "Emby Mobile", deviceId, device.model, true);
|
var capablities = Dashboard.capabilities();
|
||||||
|
|
||||||
|
capablities.DeviceProfile = deviceProfile;
|
||||||
|
|
||||||
|
init(deferred, capablities, "Emby Mobile", deviceId, device.model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initCordova(deferred) {
|
function initCordova(deferred) {
|
||||||
|
@ -1894,7 +1915,7 @@ var AppInfo = {};
|
||||||
if (Dashboard.isRunningInCordova()) {
|
if (Dashboard.isRunningInCordova()) {
|
||||||
initCordova(initDeferred);
|
initCordova(initDeferred);
|
||||||
} else {
|
} else {
|
||||||
init(initDeferred);
|
init(initDeferred, Dashboard.capabilities());
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function ($, document) {
|
(function ($, document) {
|
||||||
|
|
||||||
var view = LibraryBrowser.getDefaultItemsView('Poster', 'PosterCard');
|
var view = LibraryBrowser.getDefaultItemsView('Poster', 'Poster');
|
||||||
|
|
||||||
// The base query options
|
// The base query options
|
||||||
var query = {
|
var query = {
|
||||||
|
|
11
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
11
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
|
@ -1082,6 +1082,17 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.getRegistrationInfo = function (feature) {
|
||||||
|
|
||||||
|
var url = self.getUrl("Registrations/" + feature);
|
||||||
|
|
||||||
|
return self.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: "json"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current server status
|
* Gets the current server status
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1221,6 +1221,12 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.getRegistrationInfo = function (feature, apiClient) {
|
||||||
|
|
||||||
|
return apiClient.getRegistrationInfo(feature);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
34
dashboard-ui/thirdparty/cordova/android/immersive.js
vendored
Normal file
34
dashboard-ui/thirdparty/cordova/android/immersive.js
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
function onSuccess() {
|
||||||
|
console.log('Immersive mode succeeded');
|
||||||
|
}
|
||||||
|
|
||||||
|
function onError() {
|
||||||
|
console.log('Immersive mode failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
//// Is this plugin supported?
|
||||||
|
//AndroidFullScreen.isSupported();
|
||||||
|
|
||||||
|
//// Is immersive mode supported?
|
||||||
|
//AndroidFullScreen.isImmersiveModeSupported(successFunction, errorFunction);
|
||||||
|
|
||||||
|
//// The width of the screen in immersive mode
|
||||||
|
//AndroidFullScreen.immersiveWidth(trace, errorFunction);
|
||||||
|
|
||||||
|
//// The height of the screen in immersive mode
|
||||||
|
//AndroidFullScreen.immersiveHeight(trace, errorFunction);
|
||||||
|
|
||||||
|
//// Hide system UI until user interacts
|
||||||
|
//AndroidFullScreen.leanMode(successFunction, errorFunction);
|
||||||
|
|
||||||
|
//// Show system UI
|
||||||
|
//AndroidFullScreen.showSystemUI(successFunction, errorFunction);
|
||||||
|
|
||||||
|
//// Extend your app underneath the system UI (Android 4.4+ only)
|
||||||
|
//AndroidFullScreen.showUnderSystemUI(successFunction, errorFunction);
|
||||||
|
|
||||||
|
//// Hide system UI and keep it hidden (Android 4.4+ only)
|
||||||
|
//AndroidFullScreen.immersiveMode(successFunction, errorFunction);
|
||||||
|
})();
|
|
@ -92,7 +92,7 @@
|
||||||
getEndpointInfo().done(function (endpoint) {
|
getEndpointInfo().done(function (endpoint) {
|
||||||
|
|
||||||
if (endpoint.IsLocal || endpoint.IsInNetwork) {
|
if (endpoint.IsLocal || endpoint.IsInNetwork) {
|
||||||
ApiClient.getSystemInfo().done(function (info) {
|
ApiClient.getPublicSystemInfo().done(function (info) {
|
||||||
|
|
||||||
message.serverAddress = info.LocalAddress;
|
message.serverAddress = info.LocalAddress;
|
||||||
sendMessageInternal(message);
|
sendMessageInternal(message);
|
||||||
|
|
|
@ -18,33 +18,6 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExternalPlayers(url, mimeType) {
|
|
||||||
|
|
||||||
var deferred = $.Deferred();
|
|
||||||
|
|
||||||
window.plugins.launcher.canLaunch({
|
|
||||||
uri: url,
|
|
||||||
dataType: mimeType,
|
|
||||||
getAppList: true
|
|
||||||
}, function (data) {
|
|
||||||
|
|
||||||
console.log('plugin canLaunch succcess');
|
|
||||||
var players = data.appList.map(function (p) {
|
|
||||||
|
|
||||||
});
|
|
||||||
deferred.resolveWith(null, [players]);
|
|
||||||
|
|
||||||
}, function () {
|
|
||||||
console.log('plugin canLaunch error');
|
|
||||||
deferred.reject();
|
|
||||||
});
|
|
||||||
|
|
||||||
deferred.resolveWith(null, [players]);
|
|
||||||
|
|
||||||
return deferred.promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
window.ExternalPlayer.getExternalPlayers = getExternalPlayers;
|
|
||||||
window.ExternalPlayer.showPlayerSelectionMenu = showPlayerSelectionMenu;
|
window.ExternalPlayer.showPlayerSelectionMenu = showPlayerSelectionMenu;
|
||||||
|
|
||||||
})();
|
})();
|
|
@ -1,28 +1,105 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
function validatePlayback(deferred) {
|
var updatedProducts = [];
|
||||||
|
|
||||||
|
function updateProductInfo(p) {
|
||||||
|
|
||||||
|
updatedProducts = updatedProducts.filter(function (r) {
|
||||||
|
return r.alias != p.alias;
|
||||||
|
});
|
||||||
|
|
||||||
|
updatedProducts.push(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAndroid() {
|
||||||
|
|
||||||
var platform = (device.platform || '').toLowerCase();
|
var platform = (device.platform || '').toLowerCase();
|
||||||
|
|
||||||
|
return platform.indexOf('android') != -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function validatePlayback(deferred) {
|
||||||
|
|
||||||
// Don't require validation on android
|
// Don't require validation on android
|
||||||
if (platform.indexOf('android') != -1) {
|
if (isAndroid()) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deferred.resolve();
|
validateFeature({
|
||||||
|
|
||||||
|
id: 'appunlock',
|
||||||
|
alias: "premium features"
|
||||||
|
|
||||||
|
}, deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateLiveTV(deferred) {
|
function validateLiveTV(deferred) {
|
||||||
|
|
||||||
var platform = (device.platform || '').toLowerCase();
|
|
||||||
|
|
||||||
// Don't require validation if not android
|
// Don't require validation if not android
|
||||||
if (platform.indexOf('android') == -1) {
|
if (!isAndroid()) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validateFeature({
|
||||||
|
|
||||||
|
id: 'premiumunlock',
|
||||||
|
alias: "premium features"
|
||||||
|
|
||||||
|
}, deferred);
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateSmb(deferred) {
|
||||||
|
|
||||||
|
// Don't require validation if not android
|
||||||
|
if (!isAndroid()) {
|
||||||
|
deferred.resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
validateFeature({
|
||||||
|
|
||||||
|
id: 'premiumunlock',
|
||||||
|
alias: "premium features"
|
||||||
|
|
||||||
|
}, deferred);
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateFeature(info, deferred) {
|
||||||
|
|
||||||
|
var products = updatedProducts.filter(function (r) {
|
||||||
|
return r.alias == info.alias;
|
||||||
|
});
|
||||||
|
|
||||||
|
var product = products.length ? products[0] : null;
|
||||||
|
|
||||||
|
if (product && product.owned) {
|
||||||
|
deferred.resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get supporter status
|
||||||
|
ConnectionManager.getRegistrationInfo('appunlock', ApiClient).done(function (registrationInfo) {
|
||||||
|
|
||||||
|
if (registrationInfo.IsRegistered) {
|
||||||
|
deferred.resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showInAppPurchaseInfo(info, product, registrationInfo, deferred);
|
||||||
|
|
||||||
|
}).fail(function () {
|
||||||
|
deferred.reject();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showInAppPurchaseInfo(info, product, serverRegistrationInfo, deferred) {
|
||||||
|
|
||||||
|
var requiresLocalValidation = serverRegistrationInfo.IsLocalValidationRequired;
|
||||||
|
var canPurchase = product != null && product.canPurchase;
|
||||||
|
|
||||||
|
// Can only purchase if product != null
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,4 +134,82 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function validateProduct(product, callback) {
|
||||||
|
|
||||||
|
// product attributes:
|
||||||
|
// https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md#validation-error-codes
|
||||||
|
|
||||||
|
callback(true, {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//callback(true, { ... transaction details ... }); // success!
|
||||||
|
|
||||||
|
//// OR
|
||||||
|
//callback(false, {
|
||||||
|
// error: {
|
||||||
|
// code: store.PURCHASE_EXPIRED,
|
||||||
|
// message: "XYZ"
|
||||||
|
// }
|
||||||
|
//});
|
||||||
|
|
||||||
|
//// OR
|
||||||
|
//callback(false, "Impossible to proceed with validation");
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeStore() {
|
||||||
|
|
||||||
|
// Let's set a pretty high verbosity level, so that we see a lot of stuff
|
||||||
|
// in the console (reassuring us that something is happening).
|
||||||
|
store.verbosity = store.INFO;
|
||||||
|
|
||||||
|
store.validator = validateProduct;
|
||||||
|
|
||||||
|
if (isAndroid) {
|
||||||
|
store.register({
|
||||||
|
id: "premiumunlock",
|
||||||
|
alias: "premium features",
|
||||||
|
type: store.NON_CONSUMABLE
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// iOS
|
||||||
|
store.register({
|
||||||
|
id: "appunlock",
|
||||||
|
alias: "premium features",
|
||||||
|
type: store.NON_CONSUMABLE
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// When purchase of the full version is approved,
|
||||||
|
// show some logs and finish the transaction.
|
||||||
|
store.when("premium feautres").approved(function (order) {
|
||||||
|
log('You just unlocked the FULL VERSION!');
|
||||||
|
order.finish();
|
||||||
|
});
|
||||||
|
|
||||||
|
// The play button can only be accessed when the user
|
||||||
|
// owns the full version.
|
||||||
|
store.when("premium feautres").updated(function (product) {
|
||||||
|
|
||||||
|
updateProductInfo(product);
|
||||||
|
});
|
||||||
|
|
||||||
|
// When every goes as expected, it's time to celebrate!
|
||||||
|
// The "ready" event should be welcomed with music and fireworks,
|
||||||
|
// go ask your boss about it! (just in case)
|
||||||
|
store.ready(function () {
|
||||||
|
|
||||||
|
console.log("Store ready");
|
||||||
|
|
||||||
|
// After we've done our setup, we tell the store to do
|
||||||
|
// it's first refresh. Nothing will happen if we do not call store.refresh()
|
||||||
|
store.refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// We must wait for the "deviceready" event to fire
|
||||||
|
// before we can use the store object.
|
||||||
|
initializeStore();
|
||||||
|
|
||||||
})();
|
})();
|
|
@ -90,6 +90,17 @@
|
||||||
console.log('chrome.sockets.udp.create');
|
console.log('chrome.sockets.udp.create');
|
||||||
chrome.sockets.udp.create(function (createInfo) {
|
chrome.sockets.udp.create(function (createInfo) {
|
||||||
|
|
||||||
|
if (!createInfo) {
|
||||||
|
console.log('create fail');
|
||||||
|
deferred.resolveWith(null, [servers]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!createInfo.socketId) {
|
||||||
|
console.log('create fail');
|
||||||
|
deferred.resolveWith(null, [servers]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
socketId = createInfo.socketId;
|
socketId = createInfo.socketId;
|
||||||
|
|
||||||
console.log('chrome.sockets.udp.bind');
|
console.log('chrome.sockets.udp.bind');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue