From 4d3bf004a3d954b060d13bbafe71f5c486076660 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Thu, 20 Nov 2014 11:33:50 +0000 Subject: [PATCH] iOS version of https://github.com/readium/SDKLauncher-OSX/pull/32 (version info in navigator.epubReadingSystem, XCode build phase shell script to generate Git hashes, etc.) --- Resources/epubReadingSystem.epub | Bin 0 -> 2522 bytes Resources/epubReadingSystem.js | 11 ++ Resources/epubReadingSystem.sh | 117 ++++++++++++++++++++++ Resources/host_app_feedback.js | 61 ++++++++++- Resources/reader.html | 2 + SDKLauncher-iOS.xcodeproj/project.pbxproj | 27 +++++ 6 files changed, 213 insertions(+), 5 deletions(-) create mode 100644 Resources/epubReadingSystem.epub create mode 100644 Resources/epubReadingSystem.js create mode 100755 Resources/epubReadingSystem.sh diff --git a/Resources/epubReadingSystem.epub b/Resources/epubReadingSystem.epub new file mode 100644 index 0000000000000000000000000000000000000000..538e5ec71155f79ec1629aa6a0c83a799d46d96e GIT binary patch literal 2522 zcmZ`*2T&8t5)Msz=*6HEl@g>QQk5QrKmh5TP()gY5Sr4fqJTt{7NtrD=^Yh<1dvd~ zU!+JC2nYlPsRA!N$9d|!|8Dl~=4QX0yPe%{J|idvB^}^oDCIh7`@qY@*h%LTqam5M zySFPU80iW}BE8(5;V5?>grqCd-|6CQccc*s$qpbV`JEvDsU;9gNeFT>0DzOU8)%!V zi|fK5lFmK|6xMIfC?PZn(1$Ig?XpL^Mr!*FeuNu7{w9;RBa`$}_h^u3bmWIPJ zX=@RG=`a+y2!Vd<6hBi&!R;g*y;KrwhWkb-1pXGGo^I_J`SK!2xSWu|`RD*6(^AEu zf7Plx18wFe$jUVLA;WTwr`Cq?NWRr+RP3D6z8W~*M`j+RaoSi?TnlA^DMl+qWw>ux zuAE;q;db5t${l#*`spuFe_FCCcG%w6nSMW!Tp2|E=kI#Hh#*BN0f1U20DzwKJ9mVO zYmh|HO_aA+g~hbtyaIEWP;+vxA!DPTj#crjc7cl+)|IO{%)eFUotMr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@ + +ReadiumSDK.READIUM_iOS_sha = ''; +ReadiumSDK.READIUM_iOS_tag = ''; +ReadiumSDK.READIUM_iOS_clean = ''; +ReadiumSDK.READIUM_SDK_sha = ''; +ReadiumSDK.READIUM_SDK_tag = ''; +ReadiumSDK.READIUM_SDK_clean = ''; +ReadiumSDK.READIUM_SHARED_JS_sha = ''; +ReadiumSDK.READIUM_SHARED_JS_tag = ''; +ReadiumSDK.READIUM_SHARED_JS_clean = ''; +ReadiumSDK.READIUM_dateTimeString = ''; diff --git a/Resources/epubReadingSystem.sh b/Resources/epubReadingSystem.sh new file mode 100755 index 0000000..7553431 --- /dev/null +++ b/Resources/epubReadingSystem.sh @@ -0,0 +1,117 @@ +#!/bin/sh + +echo "###########################################" +echo "###########################################" + +pwd=`pwd` +echo "Path:" +echo "${pwd}" +echo "------" + +JS_FILE="${pwd}/Resources/epubReadingSystem_.js" +test -z "${CONTENTS_FOLDER_PATH}" || JS_FILE="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/epubReadingSystem.js" +echo "Javascript output:" +echo "${JS_FILE}" +test -z "${CONTENTS_FOLDER_PATH}" && echo "WARNING: file 'epubReadingSystem.js' will NOT be updated in XCode build folder! (running script from raw command line?)" +echo "------" + +FIRST="" + +GitDo() { +ROOT_DIR=$1 +INTERMEDIATE_DIR=$2 +GIT_SUBMODULE=$3 +SUB_DIR="${ROOT_DIR}${INTERMEDIATE_DIR}${GIT_SUBMODULE}" +TARGET_PREFIX=$4 + +cd "${SUB_DIR}" + +echo "=========================" +echo "Git target prefix:" +echo "${TARGET_PREFIX}" +echo "------" + +GIT_DIR="${ROOT_DIR}/.git" +echo "Git directory:" +echo "${GIT_DIR}" +echo "------" + +echo "Git submodule directory:" +echo "${SUB_DIR}" +echo "------" + +# We use "cd" instead! (more reliable, due to vendor submodules not necessarily setup the way we do it internally for Readium) +GIT_DIR_CWD="" +# GIT_DIR_CWD="--git-dir=${GIT_DIR} --work-tree=${SUB_DIR}" +# echo "Git path spec:" +# echo "${GIT_DIR_CWD}" +# echo "------" + +GIT_HEAD_PATH="${GIT_DIR}/HEAD" +test -f "${SUB_DIR}/HEAD" && GIT_HEAD_PATH="${SUB_DIR}/HEAD" +test -f "${GIT_DIR}/modules/${GIT_SUBMODULE}/HEAD" && GIT_HEAD_PATH="${GIT_DIR}/modules/${GIT_SUBMODULE}/HEAD" +echo "Git HEAD path:" +echo "${GIT_HEAD_PATH}"; +echo "------" + +GIT_HEAD=`cat "${GIT_HEAD_PATH}"` +echo "Git HEAD:" +echo "${GIT_HEAD}"; +echo "------" + +test "${GIT_HEAD#'ref: '}" != "${GIT_HEAD}" && echo "(attached head)" && GIT_SHA=`git ${GIT_DIR_CWD} rev-parse --verify HEAD` +test "${GIT_HEAD#'ref: '}" == "${GIT_HEAD}" && echo "(detached head)" && GIT_SHA="${GIT_HEAD}" + +echo "Git SHA:" +echo "${GIT_SHA}" +echo "------" + +GIT_TAG=`git ${GIT_DIR_CWD} describe --tags --long ${GIT_SHA}` +echo "Git TAG:" +echo "${GIT_TAG}" +echo "------" + +GIT_STATUS=`git ${GIT_DIR_CWD} status --porcelain` +echo "Git STATUS:" +echo "${GIT_STATUS}" +echo "------" + +GIT_CLEAN=false +test -z "${GIT_STATUS}" && GIT_CLEAN=true +echo "Git CLEAN:" +echo "${GIT_CLEAN}" +echo "------" + +echo "FIRST:" +echo "${FIRST}" +echo "------" + +test -z "${FIRST}" && echo $"" > "${JS_FILE}" +FIRST="false" + +echo "ReadiumSDK.READIUM_${TARGET_PREFIX}_sha = '${GIT_SHA}';" >> "${JS_FILE}" +echo "ReadiumSDK.READIUM_${TARGET_PREFIX}_tag = '${GIT_TAG}';" >> "${JS_FILE}" +echo "ReadiumSDK.READIUM_${TARGET_PREFIX}_clean = '${GIT_CLEAN}';" >> "${JS_FILE}" + +} + + + +GitDo "${pwd}" "" "" "iOS" + +GitDo "${pwd}" "/" "readium-sdk" "SDK" + +GitDo "${pwd}" "/Resources/" "readium-shared-js" "SHARED_JS" + + + +READIUM_dateTimeString=`date` +echo "ReadiumSDK.READIUM_dateTimeString = '${READIUM_dateTimeString}';" >> "${JS_FILE}" + + +cat ${JS_FILE} + +cd "${pwd}" + +echo "###########################################" +echo "###########################################" \ No newline at end of file diff --git a/Resources/host_app_feedback.js b/Resources/host_app_feedback.js index f0b20c7..729342a 100644 --- a/Resources/host_app_feedback.js +++ b/Resources/host_app_feedback.js @@ -1,4 +1,4 @@ -// LauncherOSX +// LauncheriOS // // Created by Boris Schneiderman. // Copyright (c) 2014 Readium Foundation and/or its licensees. All rights reserved. @@ -26,11 +26,62 @@ // OF THE POSSIBILITY OF SUCH DAMAGE. ReadiumSDK.HostAppFeedback = function() { + + var initNavigatorEpubReadingSystem = function() { + + // Adjust to taste (application/vendor -level metadata): + window.navigator.epubReadingSystem.name = "Readium SDKLauncher-iOS"; + window.navigator.epubReadingSystem.version = "1.0.0"; + + // Readium "internal" version: + ReadiumSDK.READIUM_version = "1.0.0"; + + // Do not edit the following lines! (low-level metadata) + // The templated values ("ReadiumSDK.READIUM_"-prefixed values) are auto-generated by the build script, + // see the "epubReadingSystem.js" file. + + window.navigator.epubReadingSystem.readium = {}; + window.navigator.epubReadingSystem.readium.buildInfo = {}; + + window.navigator.epubReadingSystem.readium.buildInfo.dateTime = ReadiumSDK.READIUM_dateTimeString; + //new Date(timestamp).toString(); + + window.navigator.epubReadingSystem.readium.buildInfo.version = ReadiumSDK.READIUM_version; + + window.navigator.epubReadingSystem.readium.buildInfo.gitRepositories = []; + + var repo1 = {}; + repo1.name = "SDKLauncher-iOS"; + repo1.sha = ReadiumSDK.READIUM_iOS_sha; + repo1.tag = ReadiumSDK.READIUM_iOS_tag; + repo1.clean = ReadiumSDK.READIUM_iOS_clean; + repo1.url = "https://github.com/readium/" + repo1.name + "/tree/" + repo1.sha; + window.navigator.epubReadingSystem.readium.buildInfo.gitRepositories.push(repo1); + + var repo2 = {}; + repo2.name = "readium-sdk"; + repo2.sha = ReadiumSDK.READIUM_SDK_sha; + repo2.tag = ReadiumSDK.READIUM_SDK_tag; + repo2.clean = ReadiumSDK.READIUM_SDK_clean; + repo2.url = "https://github.com/readium/" + repo2.name + "/tree/" + repo2.sha; + window.navigator.epubReadingSystem.readium.buildInfo.gitRepositories.push(repo2); + + var repo3 = {}; + repo3.name = "readium-shared-js"; + repo3.sha = ReadiumSDK.READIUM_SHARED_JS_sha; + repo3.tag = ReadiumSDK.READIUM_SHARED_JS_tag; + repo3.clean = ReadiumSDK.READIUM_SHARED_JS_clean; + repo3.url = "https://github.com/readium/" + repo3.name + "/tree/" + repo3.sha; + window.navigator.epubReadingSystem.readium.buildInfo.gitRepositories.push(repo3); + + // Debug check: + //console.debug(JSON.stringify(window.navigator.epubReadingSystem, undefined, 2)); + }; + ReadiumSDK.on(ReadiumSDK.Events.READER_INITIALIZED, function() { - - window.navigator.epubReadingSystem.name = "Launcher-iOS"; - window.navigator.epubReadingSystem.version = "0.0.1"; - + + initNavigatorEpubReadingSystem(); + ReadiumSDK.reader.on(ReadiumSDK.Events.PAGINATION_CHANGED, this.onPaginationChanged, this); ReadiumSDK.reader.on(ReadiumSDK.Events.SETTINGS_APPLIED, this.onSettingsApplied, this); ReadiumSDK.reader.on(ReadiumSDK.Events.MEDIA_OVERLAY_STATUS_CHANGED, this.onMediaOverlayStatusChanged, this); diff --git a/Resources/reader.html b/Resources/reader.html index 6be8781..3fedd02 100644 --- a/Resources/reader.html +++ b/Resources/reader.html @@ -46,6 +46,8 @@ + +