Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #50 from AULFA/offline-demo-version
Browse files Browse the repository at this point in the history
Add a new offline demo version.
  • Loading branch information
TheSunShower authored Sep 8, 2022
2 parents 3cf7c8a + d47478d commit cd8fc93
Show file tree
Hide file tree
Showing 38 changed files with 394 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ci-local/credentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ copy .ci/credentials/online-app-credentials.json one.lfa.android.app.myanmar.onl
copy .ci/credentials/online-app-credentials.json one.lfa.android.app.online/src/main/assets/account_bundled_credentials.json
copy .ci/credentials/online-app-credentials.json one.lfa.android.app.vietnam.online/src/main/assets/account_bundled_credentials.json

copy .ci/credentials/lfaAnalytics.xml one.lfa.android.app.demo/src/main/assets/lfaAnalytics.xml
copy .ci/credentials/lfaAnalytics.xml one.lfa.android.app.ethiopia/src/main/assets/lfaAnalytics.xml
copy .ci/credentials/lfaAnalytics.xml one.lfa.android.app.fiji/src/main/assets/lfaAnalytics.xml
copy .ci/credentials/lfaAnalytics.xml one.lfa.android.app.grande/src/main/assets/lfaAnalytics.xml
Expand Down
1 change: 1 addition & 0 deletions .ci-local/deploy-ssh.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
one.lfa.android.app.bhutan.online
one.lfa.android.app.demo
one.lfa.android.app.ethiopia
one.lfa.android.app.fiji
one.lfa.android.app.grande
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ task preFlightChecks {
def requiredFiles = [:]
requiredFiles["lfa-keystore.jks"] = keystoreHash
requiredFiles["one.lfa.android.app.bhutan.online/src/main/assets/account_bundled_credentials.json"] = credsHash
requiredFiles["one.lfa.android.app.demo/src/main/assets/lfaAnalytics.xml"] = analyticsHash
requiredFiles["one.lfa.android.app.ethiopia/src/main/assets/lfaAnalytics.xml"] = analyticsHash
requiredFiles["one.lfa.android.app.fiji/src/main/assets/lfaAnalytics.xml"] = analyticsHash
requiredFiles["one.lfa.android.app.grande/src/main/assets/account_bundled_credentials.json"] = credsHash
Expand Down
79 changes: 79 additions & 0 deletions one.lfa.android.app.demo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
def buildVersion() {
def propsFile = file("version.properties")
def Properties props = new Properties()
def code
if (propsFile.canRead()) {
props.load(new FileInputStream(propsFile))
code = props["VERSION_CODE"].toInteger()
} else {
throw new FileNotFoundException("Could not read ${propsFile}")
}

props["VERSION_CODE"] = (code + 1).toString()
props.store(new FileOutputStream(propsFile), "")
logger.info("incrementing build version ${code} -> ${code + 1}")
return code
}

android {
buildToolsVersion androidBuildToolsVersion

packagingOptions {
exclude "META-INF/LICENSE"

doNotStrip "*/armeabi-v7a/*.so"
doNotStrip "*/arm64-v8a/*.so"

exclude ("/lib/mips/**")
exclude ("/lib/mips64/**")
exclude ("/lib/x86_64/**")
exclude ("/lib/x86/**")

// The PDF library and Readium both provide this shared library. This will
// cause the build to fail because Gradle doesn"t know which one to pick.
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/armeabi-v7a/libc++_shared.so"
}

defaultConfig {
versionName = VERSION_NAME
versionCode = buildVersion()
setProperty("archivesBaseName", "${POM_NAME}-${VERSION_NAME}-${versionCode}")
}

signingConfigs {
debug {
keyAlias findProperty("au.org.libraryforall.keyAlias")
keyPassword findProperty("au.org.libraryforall.keyPassword")
storeFile file("${project.rootDir}/lfa-keystore.jks")
storePassword findProperty("au.org.libraryforall.storePassword")
}
release {
keyAlias findProperty("au.org.libraryforall.keyAlias")
keyPassword findProperty("au.org.libraryforall.keyPassword")
storeFile file("${project.rootDir}/lfa-keystore.jks")
storePassword findProperty("au.org.libraryforall.storePassword")
}
}

buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}

lintOptions {
checkReleaseBuilds false
}
}

dependencies {
api project(":one.lfa.android.analytics")
api project(":one.lfa.android.services")

implementation libraries.simplified_main
implementation libraries.simplified_accounts_source_file
}
4 changes: 4 additions & 0 deletions one.lfa.android.app.demo/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=one.lfa.android.app.demo
POM_DESCRIPTION=LFA Android (Demo offline application)
POM_NAME=one.lfa.android.app.demo
POM_PACKAGING=apk
94 changes: 94 additions & 0 deletions one.lfa.android.app.demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="one.lfa.android.app.demo">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<queries>
<package android:name="au.org.libraryforall.updater.app" />
<package android:name="au.org.libraryforall.updater.inclusiv" />
<package android:name="org.libraryforall.lfastudentdashboard" />
<package android:name="org.libraryforall.lfastudentdashboard.myanmar" />
<package android:name="org.libraryforall.lfastudentdashboard.vietnam" />
<provider android:authorities="au.org.libraryforall" />
<provider android:authorities="org.libraryforall.analytics.AnalyticsProvider" />
</queries>

<application
android:name="org.nypl.simplified.main.MainApplication"
tools:replace="android:allowBackup"
android:allowBackup="true"
android:contentDescription="Library For All"
android:icon="@mipmap/ic_launcher"
android:label="Library For All"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/LFA_NoActionBar"
android:usesCleartextTraffic="true">

<!-- Main entry point for the application. -->
<activity
android:name="org.nypl.simplified.main.MainActivity"
android:contentDescription="Library For All"
android:exported="true"
android:launchMode="singleTop"
android:label="Library For All">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="simplified-vanilla-oauth" />
</intent-filter>
</activity>

<!-- A file provider that exposes everything in the app. -->
<!-- The purpose of this is for sending error reports. -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>

<uses-library
android:name="org.apache.http.legacy"
android:required="false" />

<activity
android:name="org.nypl.simplified.viewer.epub.readium1.ReaderActivity"
android:exported="false" />

<activity
android:name="org.nypl.simplified.viewer.epub.readium2.ReaderActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:parentActivityName="org.nypl.simplified.main.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/LFA_ActionBar" />

<activity
android:name="org.nypl.simplified.viewer.epub.readium1.toc.ReaderTOCActivity"
android:exported="false" />

<activity
android:name="org.nypl.simplified.viewer.pdf.PdfReaderActivity"
android:exported="false" />

<activity
android:name="org.nypl.simplified.viewer.audiobook.AudioBookPlayerActivity"
android:exported="false" />

</application>

</manifest>
102 changes: 102 additions & 0 deletions one.lfa.android.app.demo/src/main/assets/Accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
[
{
"@version": "20190708",
"idUUID": "urn:uuid:3cd65800-4d21-4c56-8506-5843565a3b75",
"displayName": "Global English",
"subtitle": "",
"logo": "simplified-asset:logos/globe.png",
"supportsSimplyESync": false,
"supportsBarcodeScanner": false,
"supportsBarcodeDisplay": false,
"supportsReservations": false,
"supportsCardCreator": false,
"supportsHelpCenter": false,
"addAutomatically": true,
"catalogURI": "content://au.org.libraryforall/3cd65800-4d21-4c56-8506-5843565a3b75/feeds/E388214F46F3111E4D7FE547930C2915E5D44DE3734C7FBFE4BD34D02124977E.atom",
"mainColor": "#ec1c24"
},
{
"@version": "20190708",
"idUUID": "urn:uuid:58f0fb4b-0f60-4939-a4cf-1b2b74d6c587",
"displayName": "Somalia",
"subtitle": "",
"logo": "simplified-asset:logos/somalia.png",
"supportsSimplyESync": false,
"supportsBarcodeScanner": false,
"supportsBarcodeDisplay": false,
"supportsReservations": false,
"supportsCardCreator": false,
"supportsHelpCenter": false,
"addAutomatically": true,
"catalogURI": "content://au.org.libraryforall/58f0fb4b-0f60-4939-a4cf-1b2b74d6c587/feeds/A3F5F15BA1946CB9268F3BBBED376135F0638A375532F18033F6482CBD1B1075.atom",
"mainColor": "#ec1c24"
},

{
"@version": "20190708",
"idUUID": "urn:uuid:0c41f814-fd53-431f-8d18-2d861544d26a",
"displayName": "Vietnam",
"subtitle": "",
"logo": "simplified-asset:logos/vietnam.png",
"supportsSimplyESync": false,
"supportsBarcodeScanner": false,
"supportsBarcodeDisplay": false,
"supportsReservations": false,
"supportsCardCreator": false,
"supportsHelpCenter": false,
"addAutomatically": true,
"catalogURI": "content://au.org.libraryforall/0c41f814-fd53-431f-8d18-2d861544d26a/feeds/07A1BEDCC41D0B7C9B1194CA395AC20C0155188951511B7B0C8F2E9BA8DCCA31.atom",
"mainColor": "#ec1c24"
},

{
"@version": "20190708",
"idUUID": "urn:uuid:f5b1f8d9-43ad-42ea-9b96-a291e7ce8fb5",
"displayName": "ປະເທດລາວ (Laos)",
"subtitle": "",
"logo": "simplified-asset:logos/laos.png",
"supportsSimplyESync": false,
"supportsBarcodeScanner": false,
"supportsBarcodeDisplay": false,
"supportsReservations": false,
"supportsCardCreator": false,
"supportsHelpCenter": false,
"addAutomatically": true,
"catalogURI": "content://au.org.libraryforall/f5b1f8d9-43ad-42ea-9b96-a291e7ce8fb5/feeds/DAE5313E5E65D49C7AFF7388819E7A42A93B0614523BE11C278489FC536670AE.atom",
"mainColor": "#ec1c24"
},

{
"@version": "20190708",
"idUUID": "urn:uuid:ad3b1341-22b9-4022-ab81-8d7f93c72cdd",
"displayName": "Myanmar",
"subtitle": "",
"logo": "simplified-asset:logos/myanmar.png",
"supportsSimplyESync": false,
"supportsBarcodeScanner": false,
"supportsBarcodeDisplay": false,
"supportsReservations": false,
"supportsCardCreator": false,
"supportsHelpCenter": false,
"addAutomatically": true,
"catalogURI": "content://au.org.libraryforall/ad3b1341-22b9-4022-ab81-8d7f93c72cdd/feeds/6F90E501B459F8D9404930EF705A297FFCEF7389D8F5D5D70019A0A2E6112894.atom",
"mainColor": "#ec1c24"
},

{
"@version": "20190708",
"idUUID": "urn:uuid:f07ef516-ea25-498f-ba23-80ff2904e6e6",
"displayName": "Timor Leste",
"subtitle": "",
"logo": "simplified-asset:logos/timor.png",
"supportsSimplyESync": false,
"supportsBarcodeScanner": false,
"supportsBarcodeDisplay": false,
"supportsReservations": false,
"supportsCardCreator": false,
"supportsHelpCenter": false,
"addAutomatically": true,
"catalogURI": "content://au.org.libraryforall/f07ef516-ea25-498f-ba23-80ff2904e6e6/feeds/B3CB1505FEF3ADA2894675D1077D8D41CC55A5D4858611ECC9712BABE77A8B4D.atom",
"mainColor": "#ec1c24"
}
]
Binary file added one.lfa.android.app.demo/src/main/assets/bundled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package one.lfa.android.app.demo

import org.joda.time.DateTime
import org.nypl.simplified.accounts.api.AccountProviderFallbackType
import org.nypl.simplified.accounts.api.AccountProvider
import org.nypl.simplified.accounts.api.AccountProviderAuthenticationDescription
import org.nypl.simplified.accounts.api.AccountProviderType
import java.net.URI

class LFADemoAccountsFallback : AccountProviderFallbackType {
override fun get(): AccountProviderType =
AccountProvider(
addAutomatically = true,
annotationsURI = null,
authentication = AccountProviderAuthenticationDescription.Anonymous,
authenticationAlternatives = listOf(),
authenticationDocumentURI = null,
catalogURI = URI.create("content://au.org.libraryforall/e5d0c561-aa74-4f19-a043-c084f8346212/feeds/7A0A560E3AF8DDDD996E01FD43C618413A8A2B6CC118933F950C3618939EE1CD.atom"),
cardCreatorURI = null,
displayName = "Papua New Guinea",
eula = null,
id = URI.create("urn:provider:com.cantookstation.lfa.bundled"),
idNumeric = -1,
isProduction = true,
license = null,
loansURI = null,
logo = URI.create("simplified-asset:bundled.png"),
mainColor = "#ec1c24",
patronSettingsURI = null,
privacyPolicy = null,
subtitle = "",
supportEmail = null,
supportsReservations = false,
updated = DateTime.now()
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package one.lfa.android.app.demo

import org.nypl.simplified.ui.branding.BrandingSplashServiceType

/**
* A splash service for the app.
*/

class LFADemoSplashService : BrandingSplashServiceType {

override val shouldShowLibrarySelectionScreen: Boolean =
true

override fun splashImageResource(): Int {
return R.drawable.splash
}

override fun splashImageTitleResource(): Int {
return R.drawable.splash
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#EC1C24</color>
</resources>
Loading

0 comments on commit cd8fc93

Please sign in to comment.