Skip to content

Commit

Permalink
V1.3 (#32)
Browse files Browse the repository at this point in the history
- Updated CI to run instrumentation tests and have better caching mechanism
- Upgraded project to use JDK 11
- Moved all dependency versions to ext variable set
- Bumped target and compile SDK to API 31
- Refactored `PresentationExtensions` and Enum classes to use string resources. Closes #13 
- Added instrumentation tests for `PresentationExtensions`
- Fixed small formatting issues with text
- Removed useless GraphQl calls for next episode airing time
- Handled invalid deeplinks using regex by querying default browser of phone and force opening url. Closes #30 
- Added tests for accepted deeplink regex
- Refactored `openAnimeById`, `openMangaById` and `openImageSlider` to global navigation actions
- Removed dead code
- Refactored standalone companion object classes to objects
- Extracted `UIConstants` to reuse chip styles, Image transformations, Corner radius and grid count
- Added `printStackTrace()` calls to missed catch blocks
- Cleaned up `MPAndroidChart` value formatter to use ktx functions
- Refactored `Uri.parse(url)` calls to `url.toUri()`
- Moved api constants and `MALExternalLinks` to data package
- Added `AnimeAiringStatus`, `AnimeNsfwRating`, `AnimeRating`, `MangaNsfwRating`, `MangaPublishingStatus` enums and tests
- Forced all paging data sources to work on `IO` thread
- Forced Datastore to use `IO` thread
- Refactored `MHError` to have general static error types
- Removed magic numbers to enum classes
- Fixed bug with 0 `timeToAiring` of episode returning invalid string
- Decomposed UI binding functions to smaller functions for readability
- Fixed Anime Seasonal screen not loading on navigation with season args
- Fixed Anime Ranking screen not loading on navigation with ranking args
- Fixed Manga Ranking screen not loading on navigation with ranking args
- Fixed incompatible manga ranking type slugs across manga service and manga rank service by mapping
- Refactored `OAuthRepository` to use `MHTaskState`
- Move fab explode animation to after navigation
- Rearrange `strings.xml `
- Cleaned up comments
- Updated `Readme` to use latest kotlin version and changed project info section
  • Loading branch information
Sharkaboi authored Aug 13, 2021
1 parent eda685c commit 45a534b
Show file tree
Hide file tree
Showing 122 changed files with 3,207 additions and 2,356 deletions.
99 changes: 90 additions & 9 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,102 @@ name: Android CI
on: [ push, pull_request ]

jobs:
test:
name: Run Unit Tests
build:
name: Gradle Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Checkout repo
uses: actions/checkout@v1

- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- name: set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
java-version: '11'
distribution: 'adopt'

- name: Setup Gradle
run: chmod +x gradlew

- name: Gradle build
run: bash ./gradlew build
run: bash ./gradlew assembleDebug

test:
name: Run Tests and lint checks
runs-on: macos-latest
timeout-minutes: 60
needs: build
strategy:
matrix:
api-level: [23, 26, 28]

steps:
- name: Checkout repo
uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-default

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'

- name: Setup Gradle
run: chmod +x gradlew

- name: Run kltlint
run: ./gradlew ktlintCheck

- name: Unit tests
run: bash ./gradlew test --stacktrace
- name: kltlint check
run: bash ./gradlew ktlintCheck
run: ./gradlew test --stacktrace

- name: Create AVD snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: default
disable-animations: false
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: echo "Generated AVD snapshot."

- name: Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86
target: default
disable-animations: true
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save
emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160
script: ./gradlew connectedCheck --stacktrace

- name: Upload Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: app/build/reports
if: always()
36 changes: 27 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<b><h1 align="center">MediaHub</h1></b>
</p>
<p align="center">
<a href="https://github.com/JetBrains/kotlin/releases/tag/v1.5.21" alt="Kotlin">
<img alt="Kotlin" src="https://img.shields.io/badge/Kotlin-1.5.21-blue" />
<a href="https://github.com/JetBrains/kotlin/releases" alt="Kotlin">
<img alt="Kotlin" src="https://img.shields.io/github/v/release/Jetbrains/kotlin" />
</a>
<a href="https://github.com/Sharkaboi/MediaHub/blob/master/LICENSE" alt="License">
<img alt="License" src="https://img.shields.io/badge/License-MIT-orange" />
Expand All @@ -25,6 +25,7 @@
</p>

## Uses

* [Kotlin](https://kotlinlang.org/)
* MVI/MVVM Architecture
* [Retrofit](https://square.github.io/retrofit/)
Expand All @@ -50,9 +51,11 @@
* [OSS licenses plugin](https://developers.google.com/android/guides/opensource)

## Releases

* Check out the latest releases [here](https://github.com/Sharkaboi/MediaHub/releases)

## Screenshots

Anime | Manga
:-------------------------:|:-------------------------:
![](assets/screenshots/anime.png) | ![](assets/screenshots/manga.png)
Expand All @@ -74,30 +77,45 @@ Settings | Update
![](assets/screenshots/settings.png) | ![](assets/screenshots/update.png)

## Build instructions

* Install Gradle and Kotlin.
* Clone project.
* Register your app with MyAnimeList as show [here](https://myanimelist.net/blog.php?eid=835707)
* In the project root, add `clientId=<CLIENT ID>` to the `secrets.properties` file. Create if not found.
* Open in Android studio or Intellij and build and sync project (Be sure the generated classes of Hilt, ViewBinding and Apollo are generated).
* In the project root, add `clientId=<CLIENT ID>` to the `secrets.properties` file. Create if not
found.
* Open in Android studio or Intellij and build and sync project (Be sure the generated classes of
Hilt, ViewBinding and Apollo are generated).
* Run on any device and perform OAuth login to give access to your account.

## Credits

* [Photo by Audrey Mari from Pexels](https://www.pexels.com/photo/photo-of-japanese-lanterns-3421920/)
* [Tabler icons by Paweł Kuna](https://tablericons.com/)
* [Bubbles icons by Umar Irshad](https://www.iconfinder.com/iconsets/48-bubbles)

## Contributing

PR's are welcome. Please try to follow the template.

## Privacy, Security and other info
* App only acts as intermediate to MyAnimeList and AniList and does not have it's own server or store any data.

* App only acts as intermediate to MyAnimeList and AniList and does not have it's own server or
store any data.
* App only has network permissions, the `WRITE_EXTERNAL_STORAGE`,
`READ_EXTERNAL_STORAGE` & `FOREGROUND_SERVICE` in the merged manifest is from [LeakCanary](https://square.github.io/leakcanary/) which is not included in the release builds.
* App stores the token using [Datastore](https://developer.android.com/topic/libraries/architecture/datastore), which doesn't have an encryption library yet.
This implies anyone with debugging access or root access to your phone can get the your OAuth token. Please keep this in mind.
* The app doesn't fetch "live data" and only shows the snapshot of data of when it was fetched. Please refresh to see any changes made through the MyAnimeList website or other clients.
`READ_EXTERNAL_STORAGE` & `FOREGROUND_SERVICE` in the merged manifest is
from [LeakCanary](https://square.github.io/leakcanary/) which is not included in the release
builds.
* App stores the token
using [Datastore](https://developer.android.com/topic/libraries/architecture/datastore), which
is not encrypted. This implies anyone with debugging access or root access
to your phone can get the your OAuth token if needed. Please keep this in mind.
* The app doesn't fetch "live data" and only shows the snapshot of data of when it was fetched.
Please refresh to see any changes made through the MyAnimeList website or other clients.
* The app queries all browsers in the device to handle unsupported MyAnimeList deeplinks. This is
done as the API does not still support all the features provided in the web interface.

## Licence

```
MIT License
Expand Down
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ plugins {
}

android {
compileSdkVersion 30
compileSdkVersion 31

defaultConfig {
applicationId "com.sharkaboi.mediahub"
minSdkVersion 23
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.2"
versionName "1.3"

multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -34,11 +34,11 @@ android {
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
}

buildFeatures {
Expand Down
Loading

0 comments on commit 45a534b

Please sign in to comment.