readium-shared-js icon indicating copy to clipboard operation
readium-shared-js copied to clipboard

JavaScript different on different platforms?

Open rkwright opened this issue 9 years ago • 6 comments

This issue is a Bug

Reported by Michelle SIntov: We discussed that in our project, we have iOS JS that is not the same as Android JS. Maybe this is because we are using WKWebView? Here are screen shots of our Android JS and then iOS folders, for what it's worth. I think you said that readium-shared-js should be the same across platforms?

Related issue(s) and/or pull request(s)

None known

Expected Behaviour

shared-js shouldn't vary across platforms

Observed behaviour

It does??

Steps to reproduce

Look at screen shot

fpp #### Test file(s)

If relevant, please indicate public EPUB URL(s), or whether you can share ebook(s) privately. It is often next to impossible to reproduce bugs without the original file.

Product

SDKLauncher-iOS vs. SDKLauncher-Android

Additional information

None available

rkwright avatar Aug 18 '16 19:08 rkwright

Something seriously wrong with the shared-js folder on iOS. See this screen shot of my tree from 0.25-alpha: shared-js

Somehow most of the needed folders are missing. FPP must be loading the lib from one of the bundle folders. Not good practice.

@danielweck Any comment?

rkwright avatar Aug 18 '16 20:08 rkwright

The source tree for SDKLauncher-iOS includes the readium-shared-js Git submodule inside the Resources subfolder, instead of the usual top-level folder (as in OSX and Android launchers): https://github.com/readium/SDKLauncher-iOS/tree/develop/Resources However, the "App Bundle" generated by the XCode build script does not (naturally) include the entire readium-shared-js directory, which would be enormous (including the readium-cfi-js Git submodule too!). Instead, the XCode project configuration picks a select number of files to be included in the generated iOS "App Bundle": https://github.com/readium/SDKLauncher-iOS/blob/develop/SDKLauncher-iOS.xcodeproj/project.pbxproj Strictly-speaking, a vendor will typically choose to deploy their app with the single RequireJS module bundle (which includes the Almond lightweight AMD loader), rather than the multiple bundles (one each for CFI lib, external libs, etc.) which require a separate full-fat RequireJS.js loader script (see contents in https://github.com/readium/readium-shared-js/tree/develop/build-output/_multiple-bundles ). So, that's basically readium-shared-js/build-output/_single-bundle/readium-shared-js_all.js and its associated source map (in the same folder), see contents in https://github.com/readium/readium-shared-js/tree/develop/build-output/_single-bundle

danielweck avatar Aug 24 '16 10:08 danielweck

As for SDKLauncher-Android, the readium-shared-js Git submodule is located in the top / root folder: https://github.com/readium/SDKLauncher-Android/tree/develop

The Gradle build script (which Android Studio uses to generate the application APK) takes care of copying the RequireJS AMD module bundles to a suitable location: https://github.com/readium/SDKLauncher-Android/blob/develop/SDKLauncher-Android/app/build.gradle#L20

task buildCssAssets(type: Copy) {
    from '../../readium-shared-js/build-output/css'
    into './src/main/assets/readium-shared-js/builds/css'
}

task buildSingleBundleAssets(type: Copy) {
    from '../../readium-shared-js/build-output/_multiple-bundles'
    into './src/main/assets/readium-shared-js/builds/multiple-bundle'
}

task buildMultipleBundleAssets(type: Copy) {
    from '../../readium-shared-js/build-output/_single-bundle'
    into './src/main/assets/readium-shared-js/builds/single-bundle'
}

danielweck avatar Aug 24 '16 10:08 danielweck

It's a similar story with SDKLauncher-OSX: https://github.com/readium/SDKLauncher-OSX/tree/develop https://github.com/readium/SDKLauncher-OSX/blob/develop/LauncherOSX.xcodeproj/project.pbxproj (files copied from readium-shared-js/build-output/ to a suitable project location)

danielweck avatar Aug 24 '16 10:08 danielweck

Looking at the file system screenshots in the issue description, I am under the impression that the way ReadiumJS is integrated in the vendor app has diverged from the model used in Readium's "launcher apps".

danielweck avatar Aug 24 '16 10:08 danielweck

  • @msintov

danielweck avatar Aug 24 '16 16:08 danielweck