Compare commits
392 Commits
Author | SHA1 | Date | |
---|---|---|---|
689012131f | |||
6cdcf92782 | |||
9c8bcbfdd3 | |||
0b83a66b85 | |||
9711cc868c | |||
f8cb7599e6 | |||
7636618e23 | |||
5bc54c12f1 | |||
e10e530dee | |||
d69118b085 | |||
dc90549b9d | |||
b552dbc904 | |||
a6a1678b47 | |||
7a46ef5f19 | |||
f9e0f7b390 | |||
9211baf7ec | |||
de6131f4f5 | |||
2cb11e443c | |||
a43ffcdef4 | |||
6615e68430 | |||
36daa7ccc1 | |||
6e5481f345 | |||
ba1c14ca0e | |||
c69bb2ef71 | |||
9cb4754132 | |||
5ba8289c87 | |||
258782c648 | |||
c568bc1515 | |||
da668f93cf | |||
037dbd792f | |||
7ec7afed87 | |||
bea50e6db5 | |||
6a00e75816 | |||
957adaf6ee | |||
827fb33eeb | |||
19c96ee83f | |||
5a7f52c773 | |||
dddeff802f | |||
91f6310892 | |||
0389642543 | |||
8528e0beff | |||
e665a8f18b | |||
6d5acbad2c | |||
7217d0f753 | |||
16a5d88dfb | |||
646a46727f | |||
f5e9197f98 | |||
b47f26684b | |||
3a03b5f1c6 | |||
3d0dcead50 | |||
b64b41c11c | |||
77c5330f91 | |||
2b55ec02ff | |||
49ebae6e63 | |||
44a9db48a6 | |||
0008a72be1 | |||
a43acaaa07 | |||
e6c9abb4e5 | |||
3b9451184c | |||
45d1727dbe | |||
8d7b611c44 | |||
c3adb9b6d6 | |||
d87283eb31 | |||
d139c22782 | |||
e557021ad9 | |||
37af5de25c | |||
db6c84775b | |||
72d8b4aa84 | |||
170b7c4379 | |||
79e9e1a780 | |||
98dcc62bb7 | |||
ea0fb00bde | |||
4aa6b0b995 | |||
57d11e825b | |||
2f43b6e552 | |||
765f8a2d1f | |||
04c727a0c8 | |||
55518cb044 | |||
cebd1aa75d | |||
4a38a0be70 | |||
b4b9d91ea6 | |||
a6a2bcff3b | |||
2979d8b62a | |||
aba2068a84 | |||
076948a680 | |||
1cfabe43a5 | |||
02b87c8c6a | |||
eb94e06d54 | |||
d3b3939d26 | |||
9c5d2fbf84 | |||
428e40d7fe | |||
9c819835ca | |||
626169de11 | |||
72ef5f428e | |||
4ae3f7b016 | |||
7c94837af0 | |||
2a91346155 | |||
ec6d18968f | |||
b61e63249c | |||
d73aa605f9 | |||
14f4808434 | |||
2bc6d7ad0d | |||
888052cd9c | |||
bdc2281fdc | |||
d01edc2312 | |||
484a3aa731 | |||
51be23470f | |||
19495ffce9 | |||
bd766d33db | |||
ff8b3f8837 | |||
e678e6d7f9 | |||
f6f3447f1d | |||
e1c1f305c4 | |||
c8c9001277 | |||
3422951e47 | |||
3278c11cce | |||
e00dea51f1 | |||
5bf411039d | |||
62ca394c9a | |||
255b89bbb3 | |||
f7987f4b29 | |||
0b583439dd | |||
ca481dc6f5 | |||
f6a92a4cc3 | |||
55a6219a42 | |||
ad653f10df | |||
7a780486f6 | |||
c01b0eff9d | |||
3a4614e2b7 | |||
44ee8859b1 | |||
3dd7878ae5 | |||
0305a005ab | |||
2229f0e3e9 | |||
d9aab7afa2 | |||
0558f30646 | |||
238f257c6c | |||
40372e7cea | |||
b65a060fca | |||
c1ed748188 | |||
b911521ccc | |||
b046679542 | |||
3decc95a20 | |||
c301198006 | |||
190a5f2067 | |||
27e1a07eec | |||
64feae9f1c | |||
085158721e | |||
44888b048d | |||
b9a12e46bf | |||
2fe5e62e72 | |||
6305e1a908 | |||
6bf7a2e26c | |||
34487175d8 | |||
f02db914bf | |||
18e0a59e2b | |||
e4371af284 | |||
44d5f69de1 | |||
d13e0adb00 | |||
e60e573ac0 | |||
91dbc9e3d7 | |||
8ccbea2c21 | |||
211cb5e4f2 | |||
b60c59216d | |||
d20f3180cf | |||
17761af9d6 | |||
067817bace | |||
51800d91b2 | |||
3640c4f249 | |||
05aa38b591 | |||
983dcd8656 | |||
59cf4fb222 | |||
d6ebcc97e3 | |||
047579c394 | |||
a90fd4b776 | |||
03d3a5db11 | |||
bf5e61490d | |||
d87fa589a8 | |||
1fff1c2b14 | |||
58d66b6e70 | |||
202d13d509 | |||
db808de06c | |||
d8dae09f39 | |||
32640e0796 | |||
4e80441167 | |||
075cfb20b1 | |||
56e4e9be5e | |||
53c798ebdb | |||
022a4d1ea2 | |||
dfa25d8445 | |||
b2efe0d981 | |||
2a7f846d3f | |||
da5817d08a | |||
cacf2f651a | |||
605c816a32 | |||
1587be2fa8 | |||
00b23ca20c | |||
34db20ab0c | |||
0d271d925a | |||
b7da43a52a | |||
44af5d59fb | |||
bc776993a9 | |||
9a19ce9ca4 | |||
6855296de4 | |||
800a31f160 | |||
8b83b37b09 | |||
43e95cfdc6 | |||
ae2a697e01 | |||
b695c7f600 | |||
3a1a383383 | |||
97810d02ab | |||
30b337a364 | |||
8f6c847562 | |||
e5d54c95f3 | |||
eb5ad81ec1 | |||
3aa9f0ca2f | |||
8e587358aa | |||
4492f4a864 | |||
b453225941 | |||
13ccfda009 | |||
95ffb0a687 | |||
f131edf857 | |||
bd2d26418a | |||
aeb3b2a030 | |||
7bc5219d81 | |||
6cb4ea4b0f | |||
0bdd33ef4a | |||
792de4cd3d | |||
3f5fbbc71b | |||
206b40ce1b | |||
43c56b5534 | |||
a1076539dc | |||
3071e19584 | |||
f2130998ec | |||
8a5ca8c91f | |||
fada13e2d3 | |||
6e19eb943d | |||
c70fe3430c | |||
3c48264539 | |||
539cf2207b | |||
f0e897713c | |||
a448092008 | |||
f5b46707ff | |||
e6247d4428 | |||
d0869b235a | |||
464900d95b | |||
368274239e | |||
ee33197494 | |||
d3ea743707 | |||
976d4b8ce2 | |||
b77fc0d32a | |||
bd3716609e | |||
5b87cc9009 | |||
4f7be8d2cb | |||
8733e7782f | |||
e03b0dfa01 | |||
efafd2094a | |||
1560335749 | |||
5bee155f1e | |||
c9dc9a323f | |||
87e7e00705 | |||
57681b35ea | |||
8fb09d7b7d | |||
168f750863 | |||
3e1acbd3bf | |||
21ef2adcf6 | |||
3f6159e976 | |||
555b5ec112 | |||
60a9bcae46 | |||
eeb1341c1f | |||
c77b50d51b | |||
8644ce32d5 | |||
94506aca52 | |||
eee4e1f4b5 | |||
c1942d012f | |||
fe846b463a | |||
0ea2e68249 | |||
be0445b227 | |||
48249f3093 | |||
8d7110735d | |||
94957850c3 | |||
fa2cfc8427 | |||
3d467c43ba | |||
b76032044d | |||
495b84204c | |||
ea4b299de6 | |||
acb5e2afd4 | |||
50863d6ac2 | |||
e15eb03299 | |||
be48791d51 | |||
c0e1a5b401 | |||
cb1b467a21 | |||
f14346ff32 | |||
af8108a649 | |||
5743928126 | |||
388d37bf9c | |||
d572fc737f | |||
47b0f1b527 | |||
1afa7ecf3c | |||
9139febbdf | |||
2dd0b56333 | |||
3b970209a5 | |||
6f590eb194 | |||
b20b8fb243 | |||
7e4a212951 | |||
6dfeed3a26 | |||
06a27199ee | |||
76039e5eb9 | |||
6a4aaff8d6 | |||
9e2985864a | |||
412057b512 | |||
963caadced | |||
8388a8a5fc | |||
a801c8f8be | |||
9d8ad73e63 | |||
182f6c8a81 | |||
1e4a3536cf | |||
169a314664 | |||
904eed648b | |||
3bb94adece | |||
105b70fcad | |||
b4bf7c7589 | |||
ff425d6d2b | |||
4fceb854b3 | |||
3adac154b4 | |||
a320cf8f7c | |||
1ed0884dfd | |||
021e9726c6 | |||
3c438757e3 | |||
99c4a65df5 | |||
2c442fc87b | |||
44ba0d76de | |||
17aa77ad41 | |||
c18302b812 | |||
de8e9bde49 | |||
000cbd11a2 | |||
5e3b89636f | |||
dd085a14fa | |||
bfe558d887 | |||
4841a0439d | |||
cac76857c4 | |||
6b8b7c9143 | |||
53584026dc | |||
7900ad913f | |||
8ec844a8fe | |||
19ff953ab2 | |||
e29c211cf2 | |||
2492a9c204 | |||
61de1de532 | |||
b5862da776 | |||
e0c802bf67 | |||
dcac138ff8 | |||
23411a608f | |||
87facd2663 | |||
bad0776cab | |||
a063aabc7c | |||
1fdbdf34b9 | |||
624fd71dbb | |||
dfa10883d3 | |||
aff40df707 | |||
42f9594210 | |||
3e3a080b70 | |||
39534aeda4 | |||
e39b053d2d | |||
28fd7460cb | |||
82b207b03a | |||
4984cb9b26 | |||
e2ba265048 | |||
d1cd497a23 | |||
dd5ce752da | |||
e5e95e7dec | |||
f5e4c63fed | |||
70d42bb864 | |||
82df5b9515 | |||
6568c4abf8 | |||
d79b1c9a58 | |||
26565b627a | |||
c0a53cb90c | |||
2bcbac5ab3 | |||
5581fdcab8 | |||
6a8161cd98 | |||
e0b067fadd | |||
f37ddfe00f | |||
3a887f597b | |||
52d359827e | |||
a70ccbb0d0 | |||
2b6386c522 | |||
60ae14719d | |||
a4594b2853 | |||
6578d2eb49 | |||
e543c0aa2c | |||
17c80416fe | |||
f2cb7f741b |
@ -1,3 +1,12 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Utwórz raport błędu, aby pomóc nam ulepszyć Wulkanowego
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Co powinno się dziać
|
## Co powinno się dziać
|
||||||
|
|
||||||
|
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Zaproponuj nowy pomysł dla Wulkanowego
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
** Czy Twoja prośba o funkcję jest związana z problemem? Proszę opisz.**
|
||||||
|
Jasny i zwięzły opis problemu. Np. Zawsze jestem sfrustrowany, gdy [...]
|
||||||
|
|
||||||
|
** Opisz żądane rozwiązanie **
|
||||||
|
Jasny i zwięzły opis tego, co chcesz, aby się wydarzyło.
|
||||||
|
|
||||||
|
** Opisz alternatywy, które rozważałeś **
|
||||||
|
Jasny i zwięzły opis wszelkich rozważanych alternatywnych rozwiązań lub funkcji.
|
||||||
|
|
||||||
|
** Dodatkowy kontekst **
|
||||||
|
Dodaj inny kontekst lub zrzuty ekranu dotyczące żądania funkcji tutaj.
|
12
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: gradle
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
open-pull-requests-limit: 10
|
||||||
|
target-branch: develop
|
||||||
|
ignore:
|
||||||
|
- dependency-name: io.github.wulkanowy:sdk
|
||||||
|
reviewers:
|
||||||
|
- Faierbel
|
72
.github/workflows/deploy-store.yml
vendored
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
name: Deploy to app stores
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [ created ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
deploy-google-play:
|
||||||
|
name: Deploy to google play
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
environment: google-play
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
||||||
|
- name: Decrypt keys
|
||||||
|
env:
|
||||||
|
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
|
||||||
|
SERVICES_ENCRYPT_KEY: ${{ secrets.SERVICES_ENCRYPT_KEY }}
|
||||||
|
run: |
|
||||||
|
gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/google-services.json.gpg
|
||||||
|
gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/upload-key.jks.gpg
|
||||||
|
- name: Upload apk to google play
|
||||||
|
env:
|
||||||
|
PLAY_STORE_PASSWORD: ${{ secrets.PLAY_STORE_PASSWORD }}
|
||||||
|
PLAY_KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS }}
|
||||||
|
PLAY_KEY_PASSWORD: ${{ secrets.PLAY_KEY_PASSWORD }}
|
||||||
|
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }}
|
||||||
|
run: ./gradlew publishPlayReleaseApps -PenableFirebase --stacktrace;
|
||||||
|
|
||||||
|
deploy-app-gallery:
|
||||||
|
name: Deploy to AppGallery
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
environment: app-gallery
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
||||||
|
- name: Decrypt keys
|
||||||
|
env:
|
||||||
|
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
|
||||||
|
SERVICES_ENCRYPT_KEY: ${{ secrets.SERVICES_ENCRYPT_KEY }}
|
||||||
|
run: |
|
||||||
|
gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/agconnect-services.json.gpg
|
||||||
|
gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/upload-key.jks.gpg
|
||||||
|
- name: Prepare credentials
|
||||||
|
env:
|
||||||
|
AGC_CREDENTIALS: ${{ secrets.AGC_CREDENTIALS }}
|
||||||
|
run: echo $AGC_CREDENTIALS > ./app/src/release/agconnect-credentials.json
|
||||||
|
- name: Build and publish HMS version
|
||||||
|
env:
|
||||||
|
PLAY_STORE_PASSWORD: ${{ secrets.PLAY_STORE_PASSWORD }}
|
||||||
|
PLAY_KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS }}
|
||||||
|
PLAY_KEY_PASSWORD: ${{ secrets.PLAY_KEY_PASSWORD }}
|
||||||
|
run: ./gradlew bundleHmsRelease --stacktrace && ./gradlew publishHuaweiAppGalleryHmsRelease --stacktrace
|
144
.github/workflows/deploy-test.yml
vendored
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
name: Deploy to app tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# branches: [ develop ]
|
||||||
|
branches: [ '!*' ]
|
||||||
|
pull_request_target:
|
||||||
|
# branches: [ develop ]
|
||||||
|
branches: [ '!*' ]
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
deploy-appcenter:
|
||||||
|
name: App Center
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
environment: app-center
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
||||||
|
- name: Set run number with offset
|
||||||
|
env:
|
||||||
|
BUILD_NUMBER_OFFSET: ${{ secrets.BUILD_NUMBER_OFFSET }}
|
||||||
|
run: echo "RUN_NUMBER=$((GITHUB_RUN_NUMBER+BUILD_NUMBER_OFFSET))" >> $GITHUB_ENV
|
||||||
|
- name: Prepare build configuration
|
||||||
|
run: |
|
||||||
|
sed -i -e "s#applicationIdSuffix \".dev\"#applicationIdSuffix \".${GITHUB_HEAD_REF//[-.\/]/_}\"#" app/build.gradle
|
||||||
|
sed -i -e "s#.dev\"#.${GITHUB_HEAD_REF//[-.\/]/_}\"#" app/src/debug/google-services.json
|
||||||
|
sed -i -e "s#.dev\"#.${GITHUB_HEAD_REF//[-.\/]/_}\"#" app/src/debug/agconnect-services.json
|
||||||
|
sed -i -e '/versionNameSuffix/d' app/build.gradle
|
||||||
|
- name: Add signing config
|
||||||
|
run: |
|
||||||
|
cat >> app/build.gradle <<EOF
|
||||||
|
android.signingConfigs.debug {
|
||||||
|
storeFile file("bitrise.jks")
|
||||||
|
storePassword System.getenv("BITRISE_KEYSTORE_PASSWORD")
|
||||||
|
keyAlias System.getenv("BITRISE_KEY_ALIAS")
|
||||||
|
keyPassword System.getenv("BITRISE_KEY_PASSWORD")
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
- name: Decrypt keys
|
||||||
|
env:
|
||||||
|
BITRISE_ENCRYPT_KEY: ${{ secrets.BITRISE_ENCRYPT_KEY }}
|
||||||
|
run: |
|
||||||
|
gpg --yes --batch --passphrase=$BITRISE_ENCRYPT_KEY ./app/bitrise.jks.gpg
|
||||||
|
- name: Bump version
|
||||||
|
uses: chkfung/android-version-actions@v1.1
|
||||||
|
with:
|
||||||
|
gradlePath: app/build.gradle
|
||||||
|
versionCode: ${{ env.RUN_NUMBER }}
|
||||||
|
versionName: ${{ env.RUN_NUMBER }}-${{ github.head_ref }}
|
||||||
|
- name: Build apk
|
||||||
|
env:
|
||||||
|
BITRISE_KEYSTORE_PASSWORD: ${{ secrets.BITRISE_KEYSTORE_PASSWORD }}
|
||||||
|
BITRISE_KEY_ALIAS: ${{ secrets.BITRISE_KEY_ALIAS }}
|
||||||
|
BITRISE_KEY_PASSWORD: ${{ secrets.BITRISE_KEY_PASSWORD }}
|
||||||
|
run: ./gradlew assembleFdroidDebug --stacktrace
|
||||||
|
- name: Upload apk to github artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: wulkanowyDEV-${{ env.RUN_NUMBER }}.apk
|
||||||
|
path: app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk
|
||||||
|
- name: Deploy to app center
|
||||||
|
uses: wzieba/AppCenter-Github-Action@v1
|
||||||
|
with:
|
||||||
|
appName: wulkanowy/wulkanowy
|
||||||
|
token: ${{ secrets.APP_CENTER_TOKEN }}
|
||||||
|
group: Testers
|
||||||
|
file: app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk
|
||||||
|
notifyTesters: true
|
||||||
|
debug: true
|
||||||
|
|
||||||
|
deploy-app-distribution:
|
||||||
|
name: App Distribution
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
environment: app-distribution
|
||||||
|
if: github.event_name != 'pull_request_target'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
||||||
|
- name: Set run number with offset
|
||||||
|
env:
|
||||||
|
BUILD_NUMBER_OFFSET: ${{ secrets.BUILD_NUMBER_OFFSET }}
|
||||||
|
run: echo "RUN_NUMBER=$((GITHUB_RUN_NUMBER+BUILD_NUMBER_OFFSET))" >> $GITHUB_ENV
|
||||||
|
- name: Add signing config
|
||||||
|
run: |
|
||||||
|
cat >> app/build.gradle <<EOF
|
||||||
|
android.signingConfigs.debug {
|
||||||
|
storeFile file("bitrise.jks")
|
||||||
|
storePassword System.getenv("BITRISE_KEYSTORE_PASSWORD")
|
||||||
|
keyAlias System.getenv("BITRISE_KEY_ALIAS")
|
||||||
|
keyPassword System.getenv("BITRISE_KEY_PASSWORD")
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
- name: Decrypt keys
|
||||||
|
env:
|
||||||
|
BITRISE_ENCRYPT_KEY: ${{ secrets.BITRISE_ENCRYPT_KEY }}
|
||||||
|
BITRISE_SERVICES_ENCRYPT_KEY: ${{ secrets.BITRISE_SERVICES_ENCRYPT_KEY }}
|
||||||
|
run: |
|
||||||
|
gpg --yes --batch --passphrase=$BITRISE_SERVICES_ENCRYPT_KEY ./app/src/debug/google-services.json.gpg
|
||||||
|
gpg --yes --batch --passphrase=$BITRISE_ENCRYPT_KEY ./app/bitrise.jks.gpg
|
||||||
|
- name: Bump version
|
||||||
|
uses: chkfung/android-version-actions@v1.1
|
||||||
|
with:
|
||||||
|
gradlePath: app/build.gradle
|
||||||
|
versionCode: ${{ env.RUN_NUMBER }}
|
||||||
|
versionName: ${{ env.RUN_NUMBER }}
|
||||||
|
- name: Build apk
|
||||||
|
env:
|
||||||
|
BITRISE_KEYSTORE_PASSWORD: ${{ secrets.BITRISE_KEYSTORE_PASSWORD }}
|
||||||
|
BITRISE_KEY_ALIAS: ${{ secrets.BITRISE_KEY_ALIAS }}
|
||||||
|
BITRISE_KEY_PASSWORD: ${{ secrets.BITRISE_KEY_PASSWORD }}
|
||||||
|
run: ./gradlew assemblePlayDebug -PenableFirebase --stacktrace
|
||||||
|
- name: Upload apk to github artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: wulkanowyDEV-${{ env.RUN_NUMBER }}-dev.apk
|
||||||
|
path: app/build/outputs/apk/play/debug/app-play-debug.apk
|
||||||
|
- name: Deploy to app distribution
|
||||||
|
uses: wzieba/Firebase-Distribution-Github-Action@v1
|
||||||
|
with:
|
||||||
|
appId: ${{ secrets.FIREBASE_APP_ID }}
|
||||||
|
token: ${{ secrets.FIREBASE_TOKEN }}
|
||||||
|
groups: discord
|
||||||
|
file: app/build/outputs/apk/play/debug/app-play-debug.apk
|
122
.github/workflows/test.yml
vendored
@ -1,48 +1,21 @@
|
|||||||
name: Test and deploy
|
name: Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ develop ]
|
branches: [ master, develop ]
|
||||||
tags: [ '*' ]
|
tags: [ '*' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ develop ]
|
branches: [ master, develop ]
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
name: Pre-build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 10
|
|
||||||
steps:
|
|
||||||
- uses: fkirc/skip-duplicate-actions@master
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: gradle/wrapper-validation-action@v1
|
|
||||||
- uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 11
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.gradle/caches
|
|
||||||
~/.gradle/wrapper
|
|
||||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
|
||||||
- name: Build
|
|
||||||
run: ./gradlew --build-cache compileFdroidDebugUnitTestKotlin preFdroidDebugAndroidTestBuild dexBuilderFdroidDebugAndroidTest packageFdroidDebug packageFdroidDebugAndroidTest
|
|
||||||
- name: Prepare build cache
|
|
||||||
run: tar -cf prebuild.tar .build-cache .gradle app/build
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: prebuild.tar
|
|
||||||
path: prebuild.tar
|
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
name: Unit tests
|
name: Unit tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
needs: [ build ]
|
|
||||||
steps:
|
steps:
|
||||||
|
- uses: fkirc/skip-duplicate-actions@master
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
- uses: gradle/wrapper-validation-action@v1
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
@ -52,91 +25,10 @@ jobs:
|
|||||||
~/.gradle/caches
|
~/.gradle/caches
|
||||||
~/.gradle/wrapper
|
~/.gradle/wrapper
|
||||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: prebuild.tar
|
|
||||||
- name: Extract build cache
|
|
||||||
run: tar -xf prebuild.tar
|
|
||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
run: |
|
run: |
|
||||||
./gradlew --build-cache -Pcoverage testFdroidDebugUnitTest --stacktrace
|
./gradlew testFdroidDebugUnitTest --stacktrace
|
||||||
./gradlew --build-cache -Pcoverage jacocoTestReport --stacktrace
|
./gradlew jacocoTestReport --stacktrace
|
||||||
- uses: codecov/codecov-action@v1
|
- uses: codecov/codecov-action@v1
|
||||||
with:
|
with:
|
||||||
flags: unit
|
flags: unit
|
||||||
|
|
||||||
instrumentation-tests:
|
|
||||||
name: Instrumentation tests
|
|
||||||
runs-on: macOS-latest
|
|
||||||
timeout-minutes: 15
|
|
||||||
needs: [ build ]
|
|
||||||
strategy:
|
|
||||||
fail-fast: true
|
|
||||||
matrix:
|
|
||||||
api-level: [21, 29]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 11
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.gradle/caches
|
|
||||||
~/.gradle/wrapper
|
|
||||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: prebuild.tar
|
|
||||||
- name: Extract build cache
|
|
||||||
run: tar -xf prebuild.tar
|
|
||||||
- name: Instrumentation tests
|
|
||||||
uses: reactivecircus/android-emulator-runner@v2
|
|
||||||
with:
|
|
||||||
api-level: ${{ matrix.api-level }}
|
|
||||||
arch: x86
|
|
||||||
script: |
|
|
||||||
./gradlew --build-cache -Pcoverage connectedFdroidDebugAndroidTest --stacktrace
|
|
||||||
./gradlew --build-cache -Pcoverage jacocoTestReport --stacktrace
|
|
||||||
- uses: codecov/codecov-action@v1
|
|
||||||
with:
|
|
||||||
flags: instrumented,api-${{ matrix.api-level }}
|
|
||||||
|
|
||||||
deploy-google-play:
|
|
||||||
name: Deploy to google play
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 10
|
|
||||||
environment: google-play
|
|
||||||
needs: [ build, unit-tests, instrumentation-tests ]
|
|
||||||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 11
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.gradle/caches
|
|
||||||
~/.gradle/wrapper
|
|
||||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: prebuild.tar
|
|
||||||
- name: Extract build cache
|
|
||||||
run: tar -xf prebuild.tar
|
|
||||||
- name: Decrypt keys
|
|
||||||
env:
|
|
||||||
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
|
|
||||||
SERVICES_ENCRYPT_KEY: ${{ secrets.SERVICES_ENCRYPT_KEY }}
|
|
||||||
run: |
|
|
||||||
gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/google-services.json.gpg
|
|
||||||
gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/key.p12.gpg
|
|
||||||
gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/upload-key.jks.gpg
|
|
||||||
- name: Upload apk to google play
|
|
||||||
env:
|
|
||||||
PLAY_KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS }}
|
|
||||||
PLAY_KEY_PASSWORD: ${{ secrets.PLAY_KEY_PASSWORD }}
|
|
||||||
PLAY_SERVICE_ACCOUNT_EMAIL: ${{ secrets.PLAY_SERVICE_ACCOUNT_EMAIL }}
|
|
||||||
PLAY_STORE_PASSWORD: ${{ secrets.PLAY_STORE_PASSWORD }}
|
|
||||||
run: ./gradlew publishPlayRelease -PenableFirebase --stacktrace;
|
|
||||||
|
2
.gitignore
vendored
@ -117,3 +117,5 @@ Thumbs.db
|
|||||||
|
|
||||||
|
|
||||||
app/src/release/agconnect-services.json
|
app/src/release/agconnect-services.json
|
||||||
|
app/src/release/agconnect-credentials.json
|
||||||
|
.idea/deploymentTargetDropDown.xml
|
||||||
|
24
.idea/codeStyles/Project.xml
generated
@ -7,29 +7,11 @@
|
|||||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
|
||||||
<value>
|
|
||||||
<package name="" alias="false" withSubpackages="true" />
|
|
||||||
<package name="java" alias="false" withSubpackages="true" />
|
|
||||||
<package name="javax" alias="false" withSubpackages="true" />
|
|
||||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
|
||||||
<package name="" alias="true" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
||||||
<option name="CONTINUATION_INDENT_IN_PARAMETER_LISTS" value="false" />
|
|
||||||
<option name="CONTINUATION_INDENT_IN_ARGUMENT_LISTS" value="false" />
|
|
||||||
<option name="CONTINUATION_INDENT_FOR_EXPRESSION_BODIES" value="false" />
|
|
||||||
<option name="CONTINUATION_INDENT_FOR_CHAINED_CALLS" value="false" />
|
|
||||||
<option name="CONTINUATION_INDENT_IN_SUPERTYPE_LISTS" value="false" />
|
|
||||||
<option name="CONTINUATION_INDENT_IN_IF_CONDITIONS" value="false" />
|
|
||||||
<option name="CONTINUATION_INDENT_IN_ELVIS" value="false" />
|
|
||||||
<option name="WRAP_ELVIS_EXPRESSIONS" value="0" />
|
<option name="WRAP_ELVIS_EXPRESSIONS" value="0" />
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<MarkdownNavigatorCodeStyleSettings>
|
|
||||||
<option name="RIGHT_MARGIN" value="72" />
|
|
||||||
</MarkdownNavigatorCodeStyleSettings>
|
|
||||||
<codeStyleSettings language="XML">
|
<codeStyleSettings language="XML">
|
||||||
<indentOptions>
|
<indentOptions>
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
@ -143,13 +125,11 @@
|
|||||||
</arrangement>
|
</arrangement>
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
<codeStyleSettings language="kotlin">
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
||||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
||||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||||
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
|
|
||||||
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
|
|
||||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
|
||||||
<indentOptions>
|
<indentOptions>
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
</indentOptions>
|
</indentOptions>
|
||||||
|
2
LICENSE
@ -186,7 +186,7 @@
|
|||||||
same "printed page" as the copyright notice for easier
|
same "printed page" as the copyright notice for easier
|
||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright 2019 Wulkanowy
|
Copyright 2021 Wulkanowy
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
13
README.en.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Wulkanowy
|
# Wulkanowy
|
||||||
|
|
||||||
[](https://github.com/wulkanowy/wulkanowy/actions)
|
[](https://github.com/wulkanowy/wulkanowy/actions)
|
||||||
[](https://codecov.io/gh/wulkanowy/wulkanowy)
|
[](https://codecov.io/gh/wulkanowy/wulkanowy)
|
||||||
[](https://discord.gg/vccAQBr)
|
[](https://discord.gg/vccAQBr)
|
||||||
[](https://f-droid.org/packages/io.github.wulkanowy/)
|
[](https://f-droid.org/packages/io.github.wulkanowy/)
|
||||||
@ -12,7 +12,7 @@ Unofficial android VULCAN UONET+ register client for both students and their par
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* logging in using the email and password OR using token and pin
|
* logging in using the email and password
|
||||||
* functions from the register website:
|
* functions from the register website:
|
||||||
* grades
|
* grades
|
||||||
* grade statistics
|
* grade statistics
|
||||||
@ -25,15 +25,19 @@ Unofficial android VULCAN UONET+ register client for both students and their par
|
|||||||
* homework
|
* homework
|
||||||
* notes
|
* notes
|
||||||
* lucky number
|
* lucky number
|
||||||
|
* additional lessons
|
||||||
|
* school conferences
|
||||||
|
* student and school information
|
||||||
* calculation of the average independently of school's preferences
|
* calculation of the average independently of school's preferences
|
||||||
* notifications, e.g. about a new grade
|
* notifications, e.g. about a new grade
|
||||||
|
* support for multiple accounts with the ability to rename students
|
||||||
* dark and black (AMOLED) theme
|
* dark and black (AMOLED) theme
|
||||||
* offline mode
|
* offline mode
|
||||||
* no ads
|
* no ads
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
You can download the current beta version from the Google Play, F-Droid or Huawei AppGallery store
|
You can download the current version from the Google Play, F-Droid or Huawei AppGallery store
|
||||||
|
|
||||||
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
||||||
alt="Get it on Google Play"
|
alt="Get it on Google Play"
|
||||||
@ -60,6 +64,9 @@ You can also download a [development version](https://wulkanowy.github.io/#downl
|
|||||||
|
|
||||||
Please contribute to the project either by creating a PR or submitting an issue on GitHub.
|
Please contribute to the project either by creating a PR or submitting an issue on GitHub.
|
||||||
|
|
||||||
|
For people interested in translating the application into different languages, we provide Crowdin
|
||||||
|
https://crowdin.com/project/wulkanowy2
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details
|
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details
|
||||||
|
15
README.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Wulkanowy
|
# Wulkanowy
|
||||||
|
|
||||||
[](https://github.com/wulkanowy/wulkanowy/actions)
|
[](https://github.com/wulkanowy/wulkanowy/actions)
|
||||||
[](https://codecov.io/gh/wulkanowy/wulkanowy)
|
[](https://codecov.io/gh/wulkanowy/wulkanowy)
|
||||||
[](https://discord.gg/vccAQBr)
|
[](https://discord.gg/vccAQBr)
|
||||||
[](https://f-droid.org/packages/io.github.wulkanowy/)
|
[](https://f-droid.org/packages/io.github.wulkanowy/)
|
||||||
@ -12,7 +12,7 @@ Nieoficjalny klient dziennika VULCAN UONET+ dla ucznia i rodzica
|
|||||||
|
|
||||||
## Funkcje
|
## Funkcje
|
||||||
|
|
||||||
* logowanie za pomocą e-maila i hasła LUB tokena i pinu
|
* logowanie za pomocą e-maila i hasła
|
||||||
* funkcje ze strony internetowej dziennika:
|
* funkcje ze strony internetowej dziennika:
|
||||||
* oceny
|
* oceny
|
||||||
* statystyki ocen
|
* statystyki ocen
|
||||||
@ -25,15 +25,19 @@ Nieoficjalny klient dziennika VULCAN UONET+ dla ucznia i rodzica
|
|||||||
* zadania domowe
|
* zadania domowe
|
||||||
* uwagi
|
* uwagi
|
||||||
* szczęśliwy numerek
|
* szczęśliwy numerek
|
||||||
|
* dodatkowe lekcje
|
||||||
|
* zebrania w szkole
|
||||||
|
* informacje o uczniu i szkole
|
||||||
* obliczanie średniej niezależnie od preferencji szkoły
|
* obliczanie średniej niezależnie od preferencji szkoły
|
||||||
* powiadomienia np. o nowej ocenie
|
* powiadomienia np. o nowej ocenie
|
||||||
|
* obsługa wielu kont wraz z możliwością zmiany nazwy ucznia
|
||||||
* ciemny i czarny (AMOLED) motyw
|
* ciemny i czarny (AMOLED) motyw
|
||||||
* tryb offilne
|
* tryb offline
|
||||||
* brak reklam
|
* brak reklam
|
||||||
|
|
||||||
## Pobierz
|
## Pobierz
|
||||||
|
|
||||||
Aktualną wersję beta możesz pobrać ze sklepu Google Play, F-Droid lub Huawei AppGallery
|
Aktualną wersję możesz pobrać ze sklepu Google Play, F-Droid lub Huawei AppGallery
|
||||||
|
|
||||||
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
||||||
alt="Pobierz z Google Play"
|
alt="Pobierz z Google Play"
|
||||||
@ -61,6 +65,9 @@ Możesz także pobrać [wersję rozwojową](https://wulkanowy.github.io/#downloa
|
|||||||
|
|
||||||
Wnieś swój wkład w projekt, tworząc PR lub wysyłając issue na GitHub.
|
Wnieś swój wkład w projekt, tworząc PR lub wysyłając issue na GitHub.
|
||||||
|
|
||||||
|
Dla osób zainteresowanych tłumaczeniem aplikacji na różne języki udostępniamy Crowdina
|
||||||
|
https://crowdin.com/project/wulkanowy2
|
||||||
|
|
||||||
## Licencja
|
## Licencja
|
||||||
|
|
||||||
Ten projekt udostępniany jest na licencji Apache License 2.0 - szczegóły w pliku [LICENSE](LICENSE)
|
Ten projekt udostępniany jest na licencji Apache License 2.0 - szczegóły w pliku [LICENSE](LICENSE)
|
||||||
|
BIN
app/bitrise.jks.gpg
Normal file
161
app/build.gradle
@ -1,29 +1,34 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-parcelize'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
apply plugin: 'dagger.hilt.android.plugin'
|
apply plugin: 'dagger.hilt.android.plugin'
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
apply plugin: 'com.google.firebase.crashlytics'
|
apply plugin: 'com.google.firebase.crashlytics'
|
||||||
apply plugin: 'com.github.triplet.play'
|
apply plugin: 'com.github.triplet.play'
|
||||||
|
apply plugin: 'ru.cian.huawei-publish'
|
||||||
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
|
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
|
||||||
|
apply plugin: 'com.huawei.agconnect'
|
||||||
apply from: 'jacoco.gradle'
|
apply from: 'jacoco.gradle'
|
||||||
apply from: 'sonarqube.gradle'
|
apply from: 'sonarqube.gradle'
|
||||||
apply from: 'hooks.gradle'
|
apply from: 'hooks.gradle'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
buildToolsVersion '30.0.2'
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "io.github.wulkanowy"
|
applicationId "io.github.wulkanowy"
|
||||||
testApplicationId "io.github.tests.wulkanowy"
|
testApplicationId "io.github.tests.wulkanowy"
|
||||||
minSdkVersion 17
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 79
|
versionCode 97
|
||||||
versionName "0.24.1"
|
versionName "1.3.0"
|
||||||
multiDexEnabled true
|
|
||||||
resValue "string", "app_name", "Wulkanowy"
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
|
resValue "string", "app_name", "Wulkanowy"
|
||||||
|
buildConfigField "long", "BUILD_TIMESTAMP", String.valueOf(System.currentTimeMillis())
|
||||||
|
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
firebase_enabled: project.hasProperty("enableFirebase")
|
firebase_enabled: project.hasProperty("enableFirebase")
|
||||||
]
|
]
|
||||||
@ -38,7 +43,8 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
|
// https://github.com/robolectric/robolectric/issues/3928#issuecomment-395309991
|
||||||
|
debug.assets.srcDirs += files("$projectDir/schemas".toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
@ -61,7 +67,6 @@ android {
|
|||||||
resValue "string", "app_name", "Wulkanowy DEV " + defaultConfig.versionCode
|
resValue "string", "app_name", "Wulkanowy DEV " + defaultConfig.versionCode
|
||||||
applicationIdSuffix ".dev"
|
applicationIdSuffix ".dev"
|
||||||
versionNameSuffix "-dev"
|
versionNameSuffix "-dev"
|
||||||
testCoverageEnabled = project.hasProperty('coverage')
|
|
||||||
ext.enableCrashlytics = project.hasProperty("enableFirebase")
|
ext.enableCrashlytics = project.hasProperty("enableFirebase")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +76,6 @@ android {
|
|||||||
productFlavors {
|
productFlavors {
|
||||||
hms {
|
hms {
|
||||||
dimension "platform"
|
dimension "platform"
|
||||||
minSdkVersion 19
|
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
install_channel: "AppGallery"
|
install_channel: "AppGallery"
|
||||||
]
|
]
|
||||||
@ -92,22 +96,32 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
playConfigs {
|
||||||
viewBinding = true
|
play { enabled.set(true) }
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
buildFeatures {
|
||||||
disable 'HardwareIds'
|
viewBinding true
|
||||||
|
}
|
||||||
|
|
||||||
|
bundle {
|
||||||
|
language {
|
||||||
|
enableSplit = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
testOptions.unitTests {
|
||||||
|
includeAndroidResources = true
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
coreLibraryDesugaringEnabled true
|
coreLibraryDesugaringEnabled true
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "11"
|
||||||
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn", "-Xjvm-default=all"]
|
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn", "-Xjvm-default=all"]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,53 +135,65 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kapt {
|
||||||
|
correctErrorTypes true
|
||||||
|
}
|
||||||
|
|
||||||
play {
|
play {
|
||||||
serviceAccountEmail = System.getenv("PLAY_SERVICE_ACCOUNT_EMAIL") ?: "jan@fakelog.cf"
|
|
||||||
serviceAccountCredentials = file('key.p12')
|
|
||||||
defaultToAppBundles = false
|
defaultToAppBundles = false
|
||||||
track = 'alpha'
|
track = 'production'
|
||||||
updatePriority = 3
|
updatePriority = 3
|
||||||
|
enabled.set(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
huaweiPublish {
|
||||||
|
instances {
|
||||||
|
hmsRelease {
|
||||||
|
credentialsPath = "$rootDir/app/src/release/agconnect-credentials.json"
|
||||||
|
buildFormat = "aab"
|
||||||
|
deployType = "draft"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
work_manager = "2.4.0"
|
work_manager = "2.6.0"
|
||||||
room = "2.2.6"
|
android_hilt = "1.0.0"
|
||||||
chucker = "3.4.0"
|
room = "2.3.0"
|
||||||
mockk = "1.10.5"
|
chucker = "3.5.2"
|
||||||
moshi = "1.11.0"
|
mockk = "1.12.0"
|
||||||
|
moshi = "1.12.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "io.github.wulkanowy:sdk:0.24.1"
|
implementation "io.github.wulkanowy:sdk:1.3.0"
|
||||||
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
|
|
||||||
|
|
||||||
implementation "androidx.core:core-ktx:1.3.2"
|
implementation "androidx.core:core-ktx:1.6.0"
|
||||||
implementation "androidx.activity:activity-ktx:1.1.0"
|
implementation "androidx.activity:activity-ktx:1.3.1"
|
||||||
implementation "androidx.appcompat:appcompat:1.2.0"
|
implementation "androidx.appcompat:appcompat:1.3.1"
|
||||||
implementation "androidx.appcompat:appcompat-resources:1.2.0"
|
implementation "androidx.appcompat:appcompat-resources:1.3.1"
|
||||||
implementation "androidx.fragment:fragment-ktx:1.2.5"
|
implementation "androidx.fragment:fragment-ktx:1.3.6"
|
||||||
implementation "androidx.annotation:annotation:1.1.0"
|
implementation "androidx.annotation:annotation:1.2.0"
|
||||||
implementation "androidx.multidex:multidex:2.0.1"
|
|
||||||
|
|
||||||
implementation "androidx.preference:preference-ktx:1.1.1"
|
implementation "androidx.preference:preference-ktx:1.1.1"
|
||||||
implementation "androidx.recyclerview:recyclerview:1.1.0"
|
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
||||||
implementation "androidx.viewpager:viewpager:1.0.0"
|
implementation "androidx.viewpager:viewpager:1.0.0"
|
||||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||||
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
|
implementation "androidx.constraintlayout:constraintlayout:2.1.1"
|
||||||
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
|
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
|
||||||
implementation "com.google.android.material:material:1.2.1"
|
implementation "com.google.android.material:material:1.4.0"
|
||||||
implementation "com.github.wulkanowy:material-chips-input:2.1.1"
|
implementation "com.github.wulkanowy:material-chips-input:2.3.1"
|
||||||
implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
|
implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
|
||||||
implementation "me.zhanghai.android.materialprogressbar:library:1.6.1"
|
implementation 'com.github.lopspower:CircularImageView:4.2.0'
|
||||||
|
|
||||||
implementation "androidx.work:work-runtime-ktx:$work_manager"
|
implementation "androidx.work:work-runtime-ktx:$work_manager"
|
||||||
playImplementation "androidx.work:work-gcm:$work_manager"
|
playImplementation "androidx.work:work-gcm:$work_manager"
|
||||||
|
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:$room"
|
implementation "androidx.room:room-runtime:$room"
|
||||||
implementation "androidx.room:room-ktx:$room"
|
implementation "androidx.room:room-ktx:$room"
|
||||||
@ -175,53 +201,56 @@ dependencies {
|
|||||||
|
|
||||||
implementation "com.google.dagger:hilt-android:$hilt_version"
|
implementation "com.google.dagger:hilt-android:$hilt_version"
|
||||||
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
|
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
|
||||||
implementation 'androidx.hilt:hilt-work:1.0.0-alpha02'
|
kapt "androidx.hilt:hilt-compiler:$android_hilt"
|
||||||
kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha02'
|
implementation "androidx.hilt:hilt-work:$android_hilt"
|
||||||
|
|
||||||
implementation "com.aurelhubert:ahbottomnavigation:2.3.4"
|
implementation 'com.github.ncapdevi:FragNav:3.3.0'
|
||||||
implementation "com.ncapdevi:frag-nav:3.3.0"
|
implementation "com.github.YarikSOffice:lingver:1.3.0"
|
||||||
implementation "com.github.YarikSOffice:lingver:1.2.2"
|
|
||||||
|
|
||||||
implementation "com.squareup.moshi:moshi:$moshi"
|
implementation "com.squareup.moshi:moshi:$moshi"
|
||||||
implementation "com.squareup.moshi:moshi-adapters:$moshi"
|
implementation "com.squareup.moshi:moshi-adapters:$moshi"
|
||||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi"
|
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi"
|
||||||
implementation "com.jakewharton.timber:timber:4.7.1"
|
|
||||||
|
implementation "com.jakewharton.timber:timber:5.0.1"
|
||||||
implementation "at.favre.lib:slf4j-timber:1.0.1"
|
implementation "at.favre.lib:slf4j-timber:1.0.1"
|
||||||
implementation "fr.bipi.treessence:treessence:0.3.2"
|
implementation 'com.github.bastienpaulfr:Treessence:1.0.4'
|
||||||
implementation "com.mikepenz:aboutlibraries-core:$about_libraries"
|
implementation "com.mikepenz:aboutlibraries-core:$about_libraries"
|
||||||
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
|
implementation "io.coil-kt:coil:1.3.2"
|
||||||
implementation "io.coil-kt:coil:1.1.1"
|
|
||||||
implementation "io.github.wulkanowy:AppKillerManager:3.0.0"
|
implementation "io.github.wulkanowy:AppKillerManager:3.0.0"
|
||||||
implementation 'me.xdrop:fuzzywuzzy:1.3.1'
|
implementation 'me.xdrop:fuzzywuzzy:1.3.1'
|
||||||
|
implementation 'com.fredporciuncula:flow-preferences:1.5.0'
|
||||||
|
|
||||||
playImplementation platform('com.google.firebase:firebase-bom:26.3.0')
|
playImplementation platform('com.google.firebase:firebase-bom:28.4.1')
|
||||||
playImplementation 'com.google.firebase:firebase-analytics-ktx'
|
playImplementation 'com.google.firebase:firebase-analytics-ktx'
|
||||||
playImplementation 'com.google.firebase:firebase-inappmessaging-display-ktx'
|
|
||||||
playImplementation "com.google.firebase:firebase-inappmessaging-ktx"
|
|
||||||
playImplementation 'com.google.firebase:firebase-messaging:'
|
playImplementation 'com.google.firebase:firebase-messaging:'
|
||||||
playImplementation 'com.google.firebase:firebase-crashlytics:'
|
playImplementation 'com.google.firebase:firebase-crashlytics:'
|
||||||
|
playImplementation 'com.google.android.play:core:1.10.2'
|
||||||
playImplementation 'com.google.android.play:core-ktx:1.8.1'
|
playImplementation 'com.google.android.play:core-ktx:1.8.1'
|
||||||
playImplementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
|
|
||||||
|
|
||||||
hmsImplementation 'com.huawei.hms:hianalytics:5.1.0.301'
|
hmsImplementation 'com.huawei.hms:hianalytics:6.2.0.301'
|
||||||
hmsImplementation 'com.huawei.agconnect:agconnect-crash:1.4.2.301'
|
hmsImplementation 'com.huawei.agconnect:agconnect-crash:1.6.0.300'
|
||||||
|
|
||||||
releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:$chucker"
|
releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:$chucker"
|
||||||
|
|
||||||
debugImplementation "com.github.ChuckerTeam.Chucker:library:$chucker"
|
debugImplementation "com.github.ChuckerTeam.Chucker:library:$chucker"
|
||||||
debugImplementation "com.amitshekhar.android:debug-db:1.0.6"
|
debugImplementation 'com.github.amitshekhariitbhu.Android-Debug-Database:debug-db:v1.0.6'
|
||||||
|
|
||||||
testImplementation "junit:junit:4.13.1"
|
testImplementation "junit:junit:4.13.2"
|
||||||
testImplementation "io.mockk:mockk:$mockk"
|
testImplementation "io.mockk:mockk:$mockk"
|
||||||
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.2'
|
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2'
|
||||||
|
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
||||||
|
|
||||||
androidTestImplementation "androidx.test:core:1.3.0"
|
testImplementation 'org.robolectric:robolectric:4.6.1'
|
||||||
androidTestImplementation "androidx.test:runner:1.3.0"
|
testImplementation "androidx.test:runner:1.4.0"
|
||||||
androidTestImplementation "androidx.test.ext:junit:1.1.2"
|
testImplementation "androidx.test.ext:junit:1.1.3"
|
||||||
|
testImplementation "androidx.test:core:1.4.0"
|
||||||
|
testImplementation "androidx.room:room-testing:$room"
|
||||||
|
testImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
|
||||||
|
kaptTest "com.google.dagger:hilt-android-compiler:$hilt_version"
|
||||||
|
|
||||||
|
androidTestImplementation "androidx.test:core:1.4.0"
|
||||||
|
androidTestImplementation "androidx.test:runner:1.4.0"
|
||||||
|
androidTestImplementation "androidx.test.ext:junit:1.1.3"
|
||||||
androidTestImplementation "io.mockk:mockk-android:$mockk"
|
androidTestImplementation "io.mockk:mockk-android:$mockk"
|
||||||
androidTestImplementation "androidx.room:room-testing:$room"
|
|
||||||
androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
|
||||||
apply plugin: 'com.huawei.agconnect'
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
apply plugin: "jacoco"
|
apply plugin: "jacoco"
|
||||||
|
|
||||||
jacoco {
|
jacoco {
|
||||||
toolVersion "0.8.5"
|
toolVersion "0.8.7"
|
||||||
reportsDir = file("$buildDir/reports")
|
reportsDirectory.set(file("$buildDir/reports"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(Test) {
|
tasks.withType(Test) {
|
||||||
@ -16,8 +16,8 @@ task jacocoTestReport(type: JacocoReport) {
|
|||||||
description = "Generate Jacoco coverage reports"
|
description = "Generate Jacoco coverage reports"
|
||||||
|
|
||||||
reports {
|
reports {
|
||||||
xml.enabled = true
|
xml.required.set(true)
|
||||||
html.enabled = true
|
html.required.set(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
def excludes = ['**/R.class',
|
def excludes = ['**/R.class',
|
||||||
|
BIN
app/key.p12.gpg
29
app/proguard-rules.pro
vendored
@ -1,33 +1,21 @@
|
|||||||
# Optimizations
|
# General
|
||||||
-optimizationpasses 5
|
|
||||||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
|
||||||
-dontusemixedcaseclassnames
|
|
||||||
-dontskipnonpubliclibraryclasses
|
|
||||||
-dontskipnonpubliclibraryclassmembers
|
|
||||||
-dontpreverify
|
|
||||||
-dontobfuscate
|
-dontobfuscate
|
||||||
-allowaccessmodification
|
|
||||||
-repackageclasses ''
|
|
||||||
-verbose
|
|
||||||
|
|
||||||
|
|
||||||
#Keep all wulkanowy files
|
#Config for wulkanowy
|
||||||
-keep class io.github.wulkanowy.** {*;}
|
-keep class io.github.wulkanowy.** {*;}
|
||||||
|
|
||||||
|
|
||||||
#Config for anallitycs
|
#Config for firebase crashlitycs
|
||||||
-keepattributes *Annotation*
|
|
||||||
-keepattributes SourceFile,LineNumberTable
|
-keepattributes SourceFile,LineNumberTable
|
||||||
-keep class com.crashlytics.** {*;}
|
|
||||||
-keep public class * extends java.lang.Exception
|
-keep public class * extends java.lang.Exception
|
||||||
-dontwarn com.crashlytics.**
|
|
||||||
|
|
||||||
|
|
||||||
#Config for OkHttp
|
#Config for Okio and OkHttp
|
||||||
|
-dontwarn javax.annotation.**
|
||||||
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
|
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
|
||||||
-dontwarn org.codehaus.mojo.animal_sniffer.*
|
-dontwarn org.codehaus.mojo.animal_sniffer.*
|
||||||
-dontwarn okhttp3.internal.platform.ConscryptPlatform
|
-dontwarn okhttp3.internal.platform.ConscryptPlatform
|
||||||
-dontwarn javax.annotation.**
|
|
||||||
|
|
||||||
|
|
||||||
#Config for MPAndroidChart
|
#Config for MPAndroidChart
|
||||||
@ -36,10 +24,3 @@
|
|||||||
|
|
||||||
#Config for Material Components
|
#Config for Material Components
|
||||||
-keep class com.google.android.material.tabs.** { *; }
|
-keep class com.google.android.material.tabs.** { *; }
|
||||||
|
|
||||||
|
|
||||||
#Config for About Libraries
|
|
||||||
-keep class .R
|
|
||||||
-keep class **.R$* {
|
|
||||||
<fields>;
|
|
||||||
}
|
|
||||||
|
2136
app/schemas/io.github.wulkanowy.data.db.AppDatabase/31.json
Normal file
2142
app/schemas/io.github.wulkanowy.data.db.AppDatabase/32.json
Normal file
2142
app/schemas/io.github.wulkanowy.data.db.AppDatabase/33.json
Normal file
2142
app/schemas/io.github.wulkanowy.data.db.AppDatabase/34.json
Normal file
2148
app/schemas/io.github.wulkanowy.data.db.AppDatabase/35.json
Normal file
2160
app/schemas/io.github.wulkanowy.data.db.AppDatabase/36.json
Normal file
2204
app/schemas/io.github.wulkanowy.data.db.AppDatabase/37.json
Normal file
2248
app/schemas/io.github.wulkanowy.data.db.AppDatabase/38.json
Normal file
2260
app/schemas/io.github.wulkanowy.data.db.AppDatabase/39.json
Normal file
2316
app/schemas/io.github.wulkanowy.data.db.AppDatabase/40.json
Normal file
@ -1,11 +0,0 @@
|
|||||||
package io.github.wulkanowy.data
|
|
||||||
|
|
||||||
import io.github.wulkanowy.utils.DispatchersProvider
|
|
||||||
import kotlinx.coroutines.CoroutineDispatcher
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
|
|
||||||
class TestDispatchersProvider : DispatchersProvider() {
|
|
||||||
|
|
||||||
override val backgroundThread: CoroutineDispatcher
|
|
||||||
get() = Dispatchers.Unconfined
|
|
||||||
}
|
|
Before Width: | Height: | Size: 478 B |
Before Width: | Height: | Size: 652 B |
Before Width: | Height: | Size: 384 B |
Before Width: | Height: | Size: 460 B |
Before Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 451 B |
Before Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 588 B |
Before Width: | Height: | Size: 897 B |
Before Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 586 B |
Before Width: | Height: | Size: 781 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 692 B |
Before Width: | Height: | Size: 805 B |
19
app/src/debug/res/drawable/ic_stat_timetable.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="#FFFFFF"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<group
|
||||||
|
android:scaleX="0.92"
|
||||||
|
android:scaleY="0.92"
|
||||||
|
android:translateX="0.96"
|
||||||
|
android:translateY="0.96">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFF"
|
||||||
|
android:pathData="M3.9512,2A2,2 0,0 0,2 4L2,18A2,2 0,0 0,4 20L10.0996,20C11.3596,21.24 13.09,22 15,22A7,7 0,0 0,15.7988 21.9551L15.7988,19.7832A4.85,4.85 0,0 1,15 19.8496C12.32,19.8496 10.1504,17.68 10.1504,15A4.85,4.85 0,0 1,15 10.1504C17.4677,10.1504 19.4978,11.9912 19.8047,14.375C20.566,14.3758 21.3108,14.5325 21.9922,14.834C21.9491,12.9905 21.2036,11.3226 20,10.0996L20,4A2,2 0,0 0,18 2L4,2A2,2 0,0 0,3.9512 2zM4,5L10,5L10,8L4,8L4,5zM12,5L18,5L18,8L12,8L12,5zM4,10L10.0996,10C9.2596,10.82 8.6291,11.85 8.2891,13L4,13L4,10zM14,12L14,15.6895L15.7988,16.7266L15.7988,14.9922L15.5,14.8203L15.5,12L14,12zM4,15L8,15C8,16.07 8.2399,17.09 8.6699,18L4,18L4,15z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFF"
|
||||||
|
android:pathData="m17.298,24v-8.1249h2.5c0.7143,0 1.3523,0.1618 1.9141,0.4855 0.5655,0.3199 1.0063,0.7775 1.3225,1.3728 0.3162,0.5915 0.4743,1.2649 0.4743,2.0201v0.3739c0,0.7552 -0.1562,1.4267 -0.4687,2.0145 -0.3088,0.5878 -0.7459,1.0435 -1.3114,1.3672C21.1633,23.8326 20.5253,23.9963 19.8148,24ZM18.9721,17.2311v5.4241h0.8091c0.6548,0 1.1551,-0.2139 1.5011,-0.6417 0.346,-0.4278 0.5227,-1.0398 0.5301,-1.8359v-0.4297c0,-0.8259 -0.1711,-1.4509 -0.5134,-1.875 -0.3423,-0.4278 -0.8426,-0.6417 -1.5011,-0.6417z" />
|
||||||
|
</group>
|
||||||
|
</vector>
|
@ -0,0 +1,17 @@
|
|||||||
|
package io.github.wulkanowy.utils
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||||
|
import javax.inject.Singleton
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
class InAppReviewHelper @Inject constructor(
|
||||||
|
@ApplicationContext private val context: Context
|
||||||
|
) {
|
||||||
|
|
||||||
|
fun showInAppReview(activity: MainActivity) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
@ -3,11 +3,6 @@ package io.github.wulkanowy.utils
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.huawei.agconnect.crash.AGConnectCrash
|
import com.huawei.agconnect.crash.AGConnectCrash
|
||||||
import fr.bipi.tressence.base.FormatterPriorityTree
|
import fr.bipi.tressence.base.FormatterPriorityTree
|
||||||
import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException
|
|
||||||
import io.github.wulkanowy.sdk.scrapper.exception.FeatureDisabledException
|
|
||||||
import java.io.InterruptedIOException
|
|
||||||
import java.net.SocketTimeoutException
|
|
||||||
import java.net.UnknownHostException
|
|
||||||
|
|
||||||
class CrashLogTree : FormatterPriorityTree(Log.VERBOSE) {
|
class CrashLogTree : FormatterPriorityTree(Log.VERBOSE) {
|
||||||
|
|
||||||
@ -20,21 +15,10 @@ class CrashLogTree : FormatterPriorityTree(Log.VERBOSE) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CrashLogExceptionTree : FormatterPriorityTree(Log.ERROR) {
|
class CrashLogExceptionTree : FormatterPriorityTree(Log.ERROR, ExceptionFilter) {
|
||||||
|
|
||||||
private val connectCrash by lazy { AGConnectCrash.getInstance() }
|
private val connectCrash by lazy { AGConnectCrash.getInstance() }
|
||||||
|
|
||||||
override fun skipLog(priority: Int, tag: String?, message: String, t: Throwable?): Boolean {
|
|
||||||
return when (t) {
|
|
||||||
is FeatureDisabledException,
|
|
||||||
is FeatureNotAvailableException,
|
|
||||||
is UnknownHostException,
|
|
||||||
is SocketTimeoutException,
|
|
||||||
is InterruptedIOException -> true
|
|
||||||
else -> super.skipLog(priority, tag, message, t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
|
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
|
||||||
if (skipLog(priority, tag, message, t)) return
|
if (skipLog(priority, tag, message, t)) return
|
||||||
|
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package io.github.wulkanowy.utils
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||||
|
import javax.inject.Inject
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
class InAppReviewHelper @Inject constructor(
|
||||||
|
@ApplicationContext private val context: Context
|
||||||
|
) {
|
||||||
|
|
||||||
|
fun showInAppReview(activity: MainActivity) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
@ -18,6 +19,18 @@
|
|||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<data android:scheme="https" />
|
<data android:scheme="https" />
|
||||||
</intent>
|
</intent>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<data android:scheme="mailto" />
|
||||||
|
</intent>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<data android:scheme="tel" />
|
||||||
|
</intent>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<data android:scheme="geo" />
|
||||||
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
@ -32,6 +45,7 @@
|
|||||||
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.modules.splash.SplashActivity"
|
android:name=".ui.modules.splash.SplashActivity"
|
||||||
|
android:exported="true"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/WulkanowyTheme.SplashScreen"
|
android:theme="@style/WulkanowyTheme.SplashScreen"
|
||||||
tools:ignore="LockedOrientationActivity">
|
tools:ignore="LockedOrientationActivity">
|
||||||
@ -44,7 +58,7 @@
|
|||||||
android:name=".ui.modules.login.LoginActivity"
|
android:name=".ui.modules.login.LoginActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/login_title"
|
android:label="@string/login_title"
|
||||||
android:theme="@style/WulkanowyTheme.NoActionBar"
|
android:theme="@style/WulkanowyTheme.Login"
|
||||||
android:windowSoftInputMode="adjustResize" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.modules.main.MainActivity"
|
android:name=".ui.modules.main.MainActivity"
|
||||||
@ -56,11 +70,12 @@
|
|||||||
android:name=".ui.modules.message.send.SendMessageActivity"
|
android:name=".ui.modules.message.send.SendMessageActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/send_message_title"
|
android:label="@string/send_message_title"
|
||||||
android:theme="@style/WulkanowyTheme.NoActionBar"
|
android:theme="@style/WulkanowyTheme.MessageSend"
|
||||||
android:windowSoftInputMode="adjustResize" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.modules.timetablewidget.TimetableWidgetConfigureActivity"
|
android:name=".ui.modules.timetablewidget.TimetableWidgetConfigureActivity"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
|
android:exported="true"
|
||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
android:theme="@style/WulkanowyTheme.WidgetAccountSwitcher">
|
android:theme="@style/WulkanowyTheme.WidgetAccountSwitcher">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -70,6 +85,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.modules.luckynumberwidget.LuckyNumberWidgetConfigureActivity"
|
android:name=".ui.modules.luckynumberwidget.LuckyNumberWidgetConfigureActivity"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
|
android:exported="true"
|
||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
android:theme="@style/WulkanowyTheme.WidgetAccountSwitcher">
|
android:theme="@style/WulkanowyTheme.WidgetAccountSwitcher">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -80,6 +96,22 @@
|
|||||||
<service
|
<service
|
||||||
android:name=".services.widgets.TimetableWidgetService"
|
android:name=".services.widgets.TimetableWidgetService"
|
||||||
android:permission="android.permission.BIND_REMOTEVIEWS" />
|
android:permission="android.permission.BIND_REMOTEVIEWS" />
|
||||||
|
<service
|
||||||
|
android:name=".services.piggyback.VulcanNotificationListenerService"
|
||||||
|
android:exported="true"
|
||||||
|
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.service.notification.NotificationListenerService" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
<service
|
||||||
|
android:name=".services.messaging.AppMessagingService"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".ui.modules.timetablewidget.TimetableWidgetProvider"
|
android:name=".ui.modules.timetablewidget.TimetableWidgetProvider"
|
||||||
@ -94,6 +126,7 @@
|
|||||||
</receiver>
|
</receiver>
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".ui.modules.luckynumberwidget.LuckyNumberWidgetProvider"
|
android:name=".ui.modules.luckynumberwidget.LuckyNumberWidgetProvider"
|
||||||
|
android:exported="true"
|
||||||
android:label="@string/lucky_number_title">
|
android:label="@string/lucky_number_title">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
@ -106,11 +139,9 @@
|
|||||||
<receiver android:name=".services.alarm.TimetableNotificationReceiver" />
|
<receiver android:name=".services.alarm.TimetableNotificationReceiver" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.work.impl.WorkManagerInitializer"
|
android:name="androidx.startup.InitializationProvider"
|
||||||
android:authorities="${applicationId}.workmanager-init"
|
android:authorities="${applicationId}.androidx-startup"
|
||||||
android:exported="false"
|
|
||||||
tools:node="remove" />
|
tools:node="remove" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="${applicationId}.fileprovider"
|
android:authorities="${applicationId}.fileprovider"
|
||||||
@ -155,7 +186,7 @@
|
|||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||||
android:resource="@drawable/ic_stat_push" />
|
android:resource="@drawable/ic_stat_all" />
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||||
|
@ -34,5 +34,21 @@
|
|||||||
{
|
{
|
||||||
"displayName": "Mateusz Idziejczak",
|
"displayName": "Mateusz Idziejczak",
|
||||||
"githubUsername": "Luncenok"
|
"githubUsername": "Luncenok"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"displayName": "Daniel Olczyk",
|
||||||
|
"githubUsername": "MRmlik12"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"displayName": "Damian Czupryn",
|
||||||
|
"githubUsername": "Daxxxis"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"displayName": "Kamil Studziński",
|
||||||
|
"githubUsername": "studzinskik"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"displayName": "Tomasz F.",
|
||||||
|
"githubUsername": "Pengwius"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package io.github.wulkanowy
|
package io.github.wulkanowy
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
|
||||||
import android.util.Log.DEBUG
|
import android.util.Log.DEBUG
|
||||||
import android.util.Log.INFO
|
import android.util.Log.INFO
|
||||||
import android.util.Log.VERBOSE
|
import android.util.Log.VERBOSE
|
||||||
|
import android.webkit.WebView
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.hilt.work.HiltWorkerFactory
|
import androidx.hilt.work.HiltWorkerFactory
|
||||||
import androidx.multidex.MultiDex
|
|
||||||
import androidx.work.Configuration
|
import androidx.work.Configuration
|
||||||
import com.yariksoffice.lingver.Lingver
|
import com.yariksoffice.lingver.Lingver
|
||||||
import dagger.hilt.android.HiltAndroidApp
|
import dagger.hilt.android.HiltAndroidApp
|
||||||
@ -40,29 +41,26 @@ class WulkanowyApp : Application(), Configuration.Provider {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var analyticsHelper: AnalyticsHelper
|
lateinit var analyticsHelper: AnalyticsHelper
|
||||||
|
|
||||||
override fun attachBaseContext(base: Context?) {
|
@SuppressLint("UnsafeOptInUsageWarning")
|
||||||
super.attachBaseContext(base)
|
|
||||||
MultiDex.install(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
Lingver.init(this)
|
FragmentManager.enableNewStateManager(false)
|
||||||
|
initializeAppLanguage()
|
||||||
themeManager.applyDefaultTheme()
|
themeManager.applyDefaultTheme()
|
||||||
|
|
||||||
initLogging()
|
initLogging()
|
||||||
logCurrentLanguage()
|
fixWebViewLocale()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initLogging() {
|
private fun initLogging() {
|
||||||
if (appInfo.isDebug) {
|
if (appInfo.isDebug) {
|
||||||
Timber.plant(DebugLogTree())
|
Timber.plant(DebugLogTree())
|
||||||
Timber.plant(FileLoggerTree.Builder()
|
Timber.plant(
|
||||||
.withFileName("wulkanowy.%g.log")
|
FileLoggerTree.Builder()
|
||||||
.withDirName(applicationContext.filesDir.absolutePath)
|
.withFileName("wulkanowy.%g.log")
|
||||||
.withFileLimit(10)
|
.withDirName(applicationContext.filesDir.absolutePath)
|
||||||
.withMinPriority(DEBUG)
|
.withFileLimit(10)
|
||||||
.build()
|
.withMinPriority(DEBUG)
|
||||||
|
.build()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Timber.plant(CrashLogExceptionTree())
|
Timber.plant(CrashLogExceptionTree())
|
||||||
@ -71,14 +69,24 @@ class WulkanowyApp : Application(), Configuration.Provider {
|
|||||||
registerActivityLifecycleCallbacks(ActivityLifecycleLogger())
|
registerActivityLifecycleCallbacks(ActivityLifecycleLogger())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun logCurrentLanguage() {
|
private fun initializeAppLanguage() {
|
||||||
val newLang = if (preferencesRepository.appLanguage == "system") {
|
Lingver.init(this)
|
||||||
appInfo.systemLanguage
|
|
||||||
} else {
|
|
||||||
preferencesRepository.appLanguage
|
|
||||||
}
|
|
||||||
|
|
||||||
analyticsHelper.logEvent("language", "startup" to newLang)
|
if (preferencesRepository.appLanguage == "system") {
|
||||||
|
Lingver.getInstance().setFollowSystemLocale(this)
|
||||||
|
analyticsHelper.logEvent("language", "startup" to appInfo.systemLanguage)
|
||||||
|
} else {
|
||||||
|
analyticsHelper.logEvent("language", "startup" to preferencesRepository.appLanguage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fixWebViewLocale() {
|
||||||
|
//https://stackoverflow.com/questions/40398528/android-webview-language-changes-abruptly-on-android-7-0-and-above
|
||||||
|
try {
|
||||||
|
WebView(this).destroy()
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
//Ignore exceptions
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getWorkManagerConfiguration() = Configuration.Builder()
|
override fun getWorkManagerConfiguration() = Configuration.Builder()
|
||||||
|
@ -8,6 +8,8 @@ import androidx.preference.PreferenceManager
|
|||||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||||
import com.chuckerteam.chucker.api.RetentionManager
|
import com.chuckerteam.chucker.api.RetentionManager
|
||||||
|
import com.fredporciuncula.flow.preferences.FlowSharedPreferences
|
||||||
|
import com.squareup.moshi.Moshi
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
@ -17,6 +19,8 @@ import io.github.wulkanowy.data.db.AppDatabase
|
|||||||
import io.github.wulkanowy.data.db.SharedPrefProvider
|
import io.github.wulkanowy.data.db.SharedPrefProvider
|
||||||
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
||||||
import io.github.wulkanowy.sdk.Sdk
|
import io.github.wulkanowy.sdk.Sdk
|
||||||
|
import io.github.wulkanowy.utils.AppInfo
|
||||||
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@ -33,17 +37,21 @@ internal class RepositoryModule {
|
|||||||
setSimpleHttpLogger { Timber.d(it) }
|
setSimpleHttpLogger { Timber.d(it) }
|
||||||
|
|
||||||
// for debug only
|
// for debug only
|
||||||
addInterceptor(ChuckerInterceptor.Builder(context)
|
addInterceptor(
|
||||||
.collector(chuckerCollector)
|
ChuckerInterceptor.Builder(context)
|
||||||
.alwaysReadResponseBody(true)
|
.collector(chuckerCollector)
|
||||||
.build(), network = true
|
.alwaysReadResponseBody(true)
|
||||||
|
.build(), network = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
fun provideChuckerCollector(@ApplicationContext context: Context, prefRepository: PreferencesRepository): ChuckerCollector {
|
fun provideChuckerCollector(
|
||||||
|
@ApplicationContext context: Context,
|
||||||
|
prefRepository: PreferencesRepository
|
||||||
|
): ChuckerCollector {
|
||||||
return ChuckerCollector(
|
return ChuckerCollector(
|
||||||
context = context,
|
context = context,
|
||||||
showNotification = prefRepository.isDebugNotificationEnable,
|
showNotification = prefRepository.isDebugNotificationEnable,
|
||||||
@ -53,7 +61,11 @@ internal class RepositoryModule {
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
fun provideDatabase(@ApplicationContext context: Context, sharedPrefProvider: SharedPrefProvider) = AppDatabase.newInstance(context, sharedPrefProvider)
|
fun provideDatabase(
|
||||||
|
@ApplicationContext context: Context,
|
||||||
|
sharedPrefProvider: SharedPrefProvider,
|
||||||
|
appInfo: AppInfo
|
||||||
|
) = AppDatabase.newInstance(context, sharedPrefProvider, appInfo)
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
@ -65,7 +77,18 @@ internal class RepositoryModule {
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
fun provideSharedPref(@ApplicationContext context: Context): SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
fun provideSharedPref(@ApplicationContext context: Context): SharedPreferences =
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
|
||||||
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
fun provideFlowSharedPref(sharedPreferences: SharedPreferences) =
|
||||||
|
FlowSharedPreferences(sharedPreferences)
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
fun provideMoshi() = Moshi.Builder().build()
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
@ -89,7 +112,8 @@ internal class RepositoryModule {
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
fun provideGradeSemesterStatisticsDao(database: AppDatabase) = database.gradeSemesterStatisticsDao
|
fun provideGradeSemesterStatisticsDao(database: AppDatabase) =
|
||||||
|
database.gradeSemesterStatisticsDao
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
@ -166,4 +190,20 @@ internal class RepositoryModule {
|
|||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
fun provideTimetableAdditionalDao(database: AppDatabase) = database.timetableAdditionalDao
|
fun provideTimetableAdditionalDao(database: AppDatabase) = database.timetableAdditionalDao
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
fun provideStudentInfoDao(database: AppDatabase) = database.studentInfoDao
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
fun provideTimetableHeaderDao(database: AppDatabase) = database.timetableHeaderDao
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
fun provideSchoolAnnouncementDao(database: AppDatabase) = database.schoolAnnouncementDao
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
fun provideNotificationDao(database: AppDatabase) = database.notificationDao
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import androidx.room.Room
|
|||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.RoomDatabase.JournalMode.TRUNCATE
|
import androidx.room.RoomDatabase.JournalMode.TRUNCATE
|
||||||
import androidx.room.TypeConverters
|
import androidx.room.TypeConverters
|
||||||
import androidx.room.migration.Migration
|
|
||||||
import io.github.wulkanowy.data.db.dao.AttendanceDao
|
import io.github.wulkanowy.data.db.dao.AttendanceDao
|
||||||
import io.github.wulkanowy.data.db.dao.AttendanceSummaryDao
|
import io.github.wulkanowy.data.db.dao.AttendanceSummaryDao
|
||||||
import io.github.wulkanowy.data.db.dao.CompletedLessonsDao
|
import io.github.wulkanowy.data.db.dao.CompletedLessonsDao
|
||||||
@ -23,15 +22,19 @@ import io.github.wulkanowy.data.db.dao.MessageAttachmentDao
|
|||||||
import io.github.wulkanowy.data.db.dao.MessagesDao
|
import io.github.wulkanowy.data.db.dao.MessagesDao
|
||||||
import io.github.wulkanowy.data.db.dao.MobileDeviceDao
|
import io.github.wulkanowy.data.db.dao.MobileDeviceDao
|
||||||
import io.github.wulkanowy.data.db.dao.NoteDao
|
import io.github.wulkanowy.data.db.dao.NoteDao
|
||||||
|
import io.github.wulkanowy.data.db.dao.NotificationDao
|
||||||
import io.github.wulkanowy.data.db.dao.RecipientDao
|
import io.github.wulkanowy.data.db.dao.RecipientDao
|
||||||
import io.github.wulkanowy.data.db.dao.ReportingUnitDao
|
import io.github.wulkanowy.data.db.dao.ReportingUnitDao
|
||||||
|
import io.github.wulkanowy.data.db.dao.SchoolAnnouncementDao
|
||||||
import io.github.wulkanowy.data.db.dao.SchoolDao
|
import io.github.wulkanowy.data.db.dao.SchoolDao
|
||||||
import io.github.wulkanowy.data.db.dao.SemesterDao
|
import io.github.wulkanowy.data.db.dao.SemesterDao
|
||||||
import io.github.wulkanowy.data.db.dao.StudentDao
|
import io.github.wulkanowy.data.db.dao.StudentDao
|
||||||
|
import io.github.wulkanowy.data.db.dao.StudentInfoDao
|
||||||
import io.github.wulkanowy.data.db.dao.SubjectDao
|
import io.github.wulkanowy.data.db.dao.SubjectDao
|
||||||
import io.github.wulkanowy.data.db.dao.TeacherDao
|
import io.github.wulkanowy.data.db.dao.TeacherDao
|
||||||
import io.github.wulkanowy.data.db.dao.TimetableAdditionalDao
|
import io.github.wulkanowy.data.db.dao.TimetableAdditionalDao
|
||||||
import io.github.wulkanowy.data.db.dao.TimetableDao
|
import io.github.wulkanowy.data.db.dao.TimetableDao
|
||||||
|
import io.github.wulkanowy.data.db.dao.TimetableHeaderDao
|
||||||
import io.github.wulkanowy.data.db.entities.Attendance
|
import io.github.wulkanowy.data.db.entities.Attendance
|
||||||
import io.github.wulkanowy.data.db.entities.AttendanceSummary
|
import io.github.wulkanowy.data.db.entities.AttendanceSummary
|
||||||
import io.github.wulkanowy.data.db.entities.CompletedLesson
|
import io.github.wulkanowy.data.db.entities.CompletedLesson
|
||||||
@ -48,15 +51,19 @@ import io.github.wulkanowy.data.db.entities.Message
|
|||||||
import io.github.wulkanowy.data.db.entities.MessageAttachment
|
import io.github.wulkanowy.data.db.entities.MessageAttachment
|
||||||
import io.github.wulkanowy.data.db.entities.MobileDevice
|
import io.github.wulkanowy.data.db.entities.MobileDevice
|
||||||
import io.github.wulkanowy.data.db.entities.Note
|
import io.github.wulkanowy.data.db.entities.Note
|
||||||
|
import io.github.wulkanowy.data.db.entities.Notification
|
||||||
import io.github.wulkanowy.data.db.entities.Recipient
|
import io.github.wulkanowy.data.db.entities.Recipient
|
||||||
import io.github.wulkanowy.data.db.entities.ReportingUnit
|
import io.github.wulkanowy.data.db.entities.ReportingUnit
|
||||||
import io.github.wulkanowy.data.db.entities.School
|
import io.github.wulkanowy.data.db.entities.School
|
||||||
|
import io.github.wulkanowy.data.db.entities.SchoolAnnouncement
|
||||||
import io.github.wulkanowy.data.db.entities.Semester
|
import io.github.wulkanowy.data.db.entities.Semester
|
||||||
import io.github.wulkanowy.data.db.entities.Student
|
import io.github.wulkanowy.data.db.entities.Student
|
||||||
|
import io.github.wulkanowy.data.db.entities.StudentInfo
|
||||||
import io.github.wulkanowy.data.db.entities.Subject
|
import io.github.wulkanowy.data.db.entities.Subject
|
||||||
import io.github.wulkanowy.data.db.entities.Teacher
|
import io.github.wulkanowy.data.db.entities.Teacher
|
||||||
import io.github.wulkanowy.data.db.entities.Timetable
|
import io.github.wulkanowy.data.db.entities.Timetable
|
||||||
import io.github.wulkanowy.data.db.entities.TimetableAdditional
|
import io.github.wulkanowy.data.db.entities.TimetableAdditional
|
||||||
|
import io.github.wulkanowy.data.db.entities.TimetableHeader
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration10
|
import io.github.wulkanowy.data.db.migrations.Migration10
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration11
|
import io.github.wulkanowy.data.db.migrations.Migration11
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration12
|
import io.github.wulkanowy.data.db.migrations.Migration12
|
||||||
@ -80,12 +87,23 @@ import io.github.wulkanowy.data.db.migrations.Migration28
|
|||||||
import io.github.wulkanowy.data.db.migrations.Migration29
|
import io.github.wulkanowy.data.db.migrations.Migration29
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration3
|
import io.github.wulkanowy.data.db.migrations.Migration3
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration30
|
import io.github.wulkanowy.data.db.migrations.Migration30
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration31
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration32
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration33
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration34
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration35
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration36
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration37
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration38
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration39
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration4
|
import io.github.wulkanowy.data.db.migrations.Migration4
|
||||||
|
import io.github.wulkanowy.data.db.migrations.Migration40
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration5
|
import io.github.wulkanowy.data.db.migrations.Migration5
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration6
|
import io.github.wulkanowy.data.db.migrations.Migration6
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration7
|
import io.github.wulkanowy.data.db.migrations.Migration7
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration8
|
import io.github.wulkanowy.data.db.migrations.Migration8
|
||||||
import io.github.wulkanowy.data.db.migrations.Migration9
|
import io.github.wulkanowy.data.db.migrations.Migration9
|
||||||
|
import io.github.wulkanowy.utils.AppInfo
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@ -116,6 +134,10 @@ import javax.inject.Singleton
|
|||||||
School::class,
|
School::class,
|
||||||
Conference::class,
|
Conference::class,
|
||||||
TimetableAdditional::class,
|
TimetableAdditional::class,
|
||||||
|
StudentInfo::class,
|
||||||
|
TimetableHeader::class,
|
||||||
|
SchoolAnnouncement::class,
|
||||||
|
Notification::class
|
||||||
],
|
],
|
||||||
version = AppDatabase.VERSION_SCHEMA,
|
version = AppDatabase.VERSION_SCHEMA,
|
||||||
exportSchema = true
|
exportSchema = true
|
||||||
@ -124,50 +146,60 @@ import javax.inject.Singleton
|
|||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val VERSION_SCHEMA = 30
|
const val VERSION_SCHEMA = 40
|
||||||
|
|
||||||
fun getMigrations(sharedPrefProvider: SharedPrefProvider): Array<Migration> {
|
fun getMigrations(sharedPrefProvider: SharedPrefProvider, appInfo: AppInfo) = arrayOf(
|
||||||
return arrayOf(
|
Migration2(),
|
||||||
Migration2(),
|
Migration3(),
|
||||||
Migration3(),
|
Migration4(),
|
||||||
Migration4(),
|
Migration5(),
|
||||||
Migration5(),
|
Migration6(),
|
||||||
Migration6(),
|
Migration7(),
|
||||||
Migration7(),
|
Migration8(),
|
||||||
Migration8(),
|
Migration9(),
|
||||||
Migration9(),
|
Migration10(),
|
||||||
Migration10(),
|
Migration11(),
|
||||||
Migration11(),
|
Migration12(),
|
||||||
Migration12(),
|
Migration13(),
|
||||||
Migration13(),
|
Migration14(),
|
||||||
Migration14(),
|
Migration15(),
|
||||||
Migration15(),
|
Migration16(),
|
||||||
Migration16(),
|
Migration17(),
|
||||||
Migration17(),
|
Migration18(),
|
||||||
Migration18(),
|
Migration19(sharedPrefProvider),
|
||||||
Migration19(sharedPrefProvider),
|
Migration20(),
|
||||||
Migration20(),
|
Migration21(),
|
||||||
Migration21(),
|
Migration22(),
|
||||||
Migration22(),
|
Migration23(),
|
||||||
Migration23(),
|
Migration24(),
|
||||||
Migration24(),
|
Migration25(),
|
||||||
Migration25(),
|
Migration26(),
|
||||||
Migration26(),
|
Migration27(),
|
||||||
Migration27(),
|
Migration28(),
|
||||||
Migration28(),
|
Migration29(),
|
||||||
Migration29(),
|
Migration30(),
|
||||||
Migration30(),
|
Migration31(),
|
||||||
)
|
Migration32(),
|
||||||
}
|
Migration33(),
|
||||||
|
Migration34(),
|
||||||
|
Migration35(appInfo),
|
||||||
|
Migration36(),
|
||||||
|
Migration37(),
|
||||||
|
Migration38(),
|
||||||
|
Migration39(),
|
||||||
|
Migration40()
|
||||||
|
)
|
||||||
|
|
||||||
fun newInstance(context: Context, sharedPrefProvider: SharedPrefProvider): AppDatabase {
|
fun newInstance(
|
||||||
return Room.databaseBuilder(context, AppDatabase::class.java, "wulkanowy_database")
|
context: Context,
|
||||||
.setJournalMode(TRUNCATE)
|
sharedPrefProvider: SharedPrefProvider,
|
||||||
.fallbackToDestructiveMigrationFrom(VERSION_SCHEMA + 1)
|
appInfo: AppInfo
|
||||||
.fallbackToDestructiveMigrationOnDowngrade()
|
) = Room.databaseBuilder(context, AppDatabase::class.java, "wulkanowy_database")
|
||||||
.addMigrations(*getMigrations(sharedPrefProvider))
|
.setJournalMode(TRUNCATE)
|
||||||
.build()
|
.fallbackToDestructiveMigrationFrom(VERSION_SCHEMA + 1)
|
||||||
}
|
.fallbackToDestructiveMigrationOnDowngrade()
|
||||||
|
.addMigrations(*getMigrations(sharedPrefProvider, appInfo))
|
||||||
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract val studentDao: StudentDao
|
abstract val studentDao: StudentDao
|
||||||
@ -219,4 +251,12 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
abstract val conferenceDao: ConferenceDao
|
abstract val conferenceDao: ConferenceDao
|
||||||
|
|
||||||
abstract val timetableAdditionalDao: TimetableAdditionalDao
|
abstract val timetableAdditionalDao: TimetableAdditionalDao
|
||||||
|
|
||||||
|
abstract val studentInfoDao: StudentInfoDao
|
||||||
|
|
||||||
|
abstract val timetableHeaderDao: TimetableHeaderDao
|
||||||
|
|
||||||
|
abstract val schoolAnnouncementDao: SchoolAnnouncementDao
|
||||||
|
|
||||||
|
abstract val notificationDao: NotificationDao
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,15 @@ class SharedPrefProvider @Inject constructor(
|
|||||||
|
|
||||||
fun getLong(key: String, defaultValue: Long) = sharedPref.getLong(key, defaultValue)
|
fun getLong(key: String, defaultValue: Long) = sharedPref.getLong(key, defaultValue)
|
||||||
|
|
||||||
|
fun getString(key: String) = sharedPref.getString(key, null)
|
||||||
|
|
||||||
fun getString(key: String, defaultValue: String): String = sharedPref.getString(key, defaultValue) ?: defaultValue
|
fun getString(key: String, defaultValue: String): String = sharedPref.getString(key, defaultValue) ?: defaultValue
|
||||||
|
|
||||||
fun putString(key: String, value: String, sync: Boolean = false) {
|
fun getBoolean(key: String, defaultValue: Boolean): Boolean = sharedPref.getBoolean(key, defaultValue)
|
||||||
|
|
||||||
|
fun putBoolean(key: String, value: Boolean, sync: Boolean = false) = sharedPref.edit(sync) { putBoolean(key, value) }
|
||||||
|
|
||||||
|
fun putString(key: String, value: String?, sync: Boolean = false) {
|
||||||
sharedPref.edit(sync) { putString(key, value) }
|
sharedPref.edit(sync) { putString(key, value) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,13 @@ import androidx.room.Dao
|
|||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import io.github.wulkanowy.data.db.entities.Conference
|
import io.github.wulkanowy.data.db.entities.Conference
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import java.time.LocalDateTime
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
@Singleton
|
@Singleton
|
||||||
interface ConferenceDao : BaseDao<Conference> {
|
interface ConferenceDao : BaseDao<Conference> {
|
||||||
|
|
||||||
@Query("SELECT * FROM Conferences WHERE diary_id = :diaryId AND student_id = :studentId")
|
@Query("SELECT * FROM Conferences WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :startDate")
|
||||||
fun loadAll(diaryId: Int, studentId: Int): Flow<List<Conference>>
|
fun loadAll(diaryId: Int, studentId: Int, startDate: LocalDateTime): Flow<List<Conference>>
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,7 @@ interface LuckyNumberDao : BaseDao<LuckyNumber> {
|
|||||||
|
|
||||||
@Query("SELECT * FROM LuckyNumbers WHERE student_id = :studentId AND date = :date")
|
@Query("SELECT * FROM LuckyNumbers WHERE student_id = :studentId AND date = :date")
|
||||||
fun load(studentId: Int, date: LocalDate): Flow<LuckyNumber?>
|
fun load(studentId: Int, date: LocalDate): Flow<LuckyNumber?>
|
||||||
|
|
||||||
|
@Query("SELECT * FROM LuckyNumbers WHERE student_id = :studentId AND date >= :start AND date <= :end")
|
||||||
|
fun getAll(studentId: Int, start: LocalDate, end: LocalDate): Flow<List<LuckyNumber>>
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.github.wulkanowy.data.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Query
|
||||||
|
import io.github.wulkanowy.data.db.entities.Notification
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Dao
|
||||||
|
interface NotificationDao : BaseDao<Notification> {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM Notifications WHERE student_id = :studentId OR student_id = -1")
|
||||||
|
fun loadAll(studentId: Long): Flow<List<Notification>>
|
||||||
|
}
|
@ -9,6 +9,6 @@ import javax.inject.Singleton
|
|||||||
@Dao
|
@Dao
|
||||||
interface RecipientDao : BaseDao<Recipient> {
|
interface RecipientDao : BaseDao<Recipient> {
|
||||||
|
|
||||||
@Query("SELECT * FROM Recipients WHERE student_id = :userLoginId AND unit_id = :unitId AND role = :role")
|
@Query("SELECT * FROM Recipients WHERE student_id = :studentId AND unit_id = :unitId AND role = :role")
|
||||||
suspend fun loadAll(userLoginId: Int, unitId: Int, role: Int): List<Recipient>
|
suspend fun loadAll(studentId: Int, unitId: Int, role: Int): List<Recipient>
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.github.wulkanowy.data.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Query
|
||||||
|
import io.github.wulkanowy.data.db.entities.SchoolAnnouncement
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
@Singleton
|
||||||
|
interface SchoolAnnouncementDao : BaseDao<SchoolAnnouncement> {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM SchoolAnnouncements WHERE student_id = :studentId")
|
||||||
|
fun loadAll(studentId: Int): Flow<List<SchoolAnnouncement>>
|
||||||
|
}
|
@ -6,36 +6,47 @@ import androidx.room.Insert
|
|||||||
import androidx.room.OnConflictStrategy.ABORT
|
import androidx.room.OnConflictStrategy.ABORT
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import androidx.room.Transaction
|
import androidx.room.Transaction
|
||||||
|
import androidx.room.Update
|
||||||
import io.github.wulkanowy.data.db.entities.Student
|
import io.github.wulkanowy.data.db.entities.Student
|
||||||
|
import io.github.wulkanowy.data.db.entities.StudentNickAndAvatar
|
||||||
import io.github.wulkanowy.data.db.entities.StudentWithSemesters
|
import io.github.wulkanowy.data.db.entities.StudentWithSemesters
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Dao
|
@Dao
|
||||||
interface StudentDao {
|
abstract class StudentDao {
|
||||||
|
|
||||||
@Insert(onConflict = ABORT)
|
@Insert(onConflict = ABORT)
|
||||||
suspend fun insertAll(student: List<Student>): List<Long>
|
abstract suspend fun insertAll(student: List<Student>): List<Long>
|
||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
suspend fun delete(student: Student)
|
abstract suspend fun delete(student: Student)
|
||||||
|
|
||||||
|
@Update(entity = Student::class)
|
||||||
|
abstract suspend fun update(studentNickAndAvatar: StudentNickAndAvatar)
|
||||||
|
|
||||||
@Query("SELECT * FROM Students WHERE is_current = 1")
|
@Query("SELECT * FROM Students WHERE is_current = 1")
|
||||||
suspend fun loadCurrent(): Student?
|
abstract suspend fun loadCurrent(): Student?
|
||||||
|
|
||||||
@Query("SELECT * FROM Students WHERE id = :id")
|
@Query("SELECT * FROM Students WHERE id = :id")
|
||||||
suspend fun loadById(id: Int): Student?
|
abstract suspend fun loadById(id: Long): Student?
|
||||||
|
|
||||||
@Query("SELECT * FROM Students")
|
@Query("SELECT * FROM Students")
|
||||||
suspend fun loadAll(): List<Student>
|
abstract suspend fun loadAll(): List<Student>
|
||||||
|
|
||||||
@Transaction
|
@Transaction
|
||||||
@Query("SELECT * FROM Students")
|
@Query("SELECT * FROM Students")
|
||||||
suspend fun loadStudentsWithSemesters(): List<StudentWithSemesters>
|
abstract suspend fun loadStudentsWithSemesters(): List<StudentWithSemesters>
|
||||||
|
|
||||||
@Query("UPDATE Students SET is_current = 1 WHERE id = :id")
|
@Query("UPDATE Students SET is_current = 1 WHERE id = :id")
|
||||||
suspend fun updateCurrent(id: Long)
|
abstract suspend fun updateCurrent(id: Long)
|
||||||
|
|
||||||
@Query("UPDATE Students SET is_current = 0")
|
@Query("UPDATE Students SET is_current = 0")
|
||||||
suspend fun resetCurrent()
|
abstract suspend fun resetCurrent()
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
open suspend fun switchCurrent(id: Long) {
|
||||||
|
resetCurrent()
|
||||||
|
updateCurrent(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.github.wulkanowy.data.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Query
|
||||||
|
import io.github.wulkanowy.data.db.entities.StudentInfo
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Dao
|
||||||
|
interface StudentInfoDao : BaseDao<StudentInfo> {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM StudentInfo WHERE student_id = :studentId")
|
||||||
|
fun loadStudentInfo(studentId: Int): Flow<StudentInfo?>
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package io.github.wulkanowy.data.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Query
|
||||||
|
import io.github.wulkanowy.data.db.entities.TimetableHeader
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import java.time.LocalDate
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
@Singleton
|
||||||
|
interface TimetableHeaderDao : BaseDao<TimetableHeader> {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM TimetableHeaders WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
|
||||||
|
fun loadAll(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Flow<List<TimetableHeader>>
|
||||||
|
}
|
@ -32,4 +32,7 @@ data class Conference(
|
|||||||
|
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
var id: Long = 0
|
var id: Long = 0
|
||||||
|
|
||||||
|
@ColumnInfo(name = "is_notified")
|
||||||
|
var isNotified: Boolean = true
|
||||||
}
|
}
|
||||||
|
@ -36,4 +36,7 @@ data class Exam(
|
|||||||
|
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
var id: Long = 0
|
var id: Long = 0
|
||||||
|
|
||||||
|
@ColumnInfo(name = "is_notified")
|
||||||
|
var isNotified: Boolean = true
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,7 @@ data class Homework(
|
|||||||
|
|
||||||
@ColumnInfo(name = "is_done")
|
@ColumnInfo(name = "is_done")
|
||||||
var isDone: Boolean = false
|
var isDone: Boolean = false
|
||||||
|
|
||||||
|
@ColumnInfo(name = "is_notified")
|
||||||
|
var isNotified: Boolean = true
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import java.time.LocalDateTime
|
|||||||
data class Message(
|
data class Message(
|
||||||
|
|
||||||
@ColumnInfo(name = "student_id")
|
@ColumnInfo(name = "student_id")
|
||||||
val studentId: Int,
|
val studentId: Long,
|
||||||
|
|
||||||
@ColumnInfo(name = "real_id")
|
@ColumnInfo(name = "real_id")
|
||||||
val realId: Int,
|
val realId: Int,
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package io.github.wulkanowy.data.db.entities
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import io.github.wulkanowy.services.sync.notifications.NotificationType
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
@Entity(tableName = "Notifications")
|
||||||
|
data class Notification(
|
||||||
|
|
||||||
|
@ColumnInfo(name = "student_id")
|
||||||
|
val studentId: Long,
|
||||||
|
|
||||||
|
val title: String,
|
||||||
|
|
||||||
|
val content: String,
|
||||||
|
|
||||||
|
val type: NotificationType,
|
||||||
|
|
||||||
|
val date: LocalDateTime,
|
||||||
|
|
||||||
|
val data: String? = null
|
||||||
|
) {
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
var id: Long = 0
|
||||||
|
}
|
@ -3,13 +3,15 @@ package io.github.wulkanowy.data.db.entities
|
|||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = true)
|
||||||
@Entity(tableName = "Recipients")
|
@Entity(tableName = "Recipients")
|
||||||
data class Recipient(
|
data class Recipient(
|
||||||
|
|
||||||
@ColumnInfo(name = "student_id")
|
@ColumnInfo(name = "student_id")
|
||||||
val userLoginId: Int,
|
val studentId: Int,
|
||||||
|
|
||||||
@ColumnInfo(name = "real_id")
|
@ColumnInfo(name = "real_id")
|
||||||
val realId: String,
|
val realId: String,
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package io.github.wulkanowy.data.db.entities
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import java.io.Serializable
|
||||||
|
import java.time.LocalDate
|
||||||
|
|
||||||
|
@Entity(tableName = "SchoolAnnouncements")
|
||||||
|
data class SchoolAnnouncement(
|
||||||
|
|
||||||
|
@ColumnInfo(name = "student_id")
|
||||||
|
val studentId: Int,
|
||||||
|
|
||||||
|
val date: LocalDate,
|
||||||
|
|
||||||
|
val subject: String,
|
||||||
|
|
||||||
|
val content: String
|
||||||
|
) : Serializable {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
var id: Long = 0
|
||||||
|
|
||||||
|
@ColumnInfo(name = "is_notified")
|
||||||
|
var isNotified: Boolean = true
|
||||||
|
}
|
@ -7,7 +7,13 @@ import androidx.room.PrimaryKey
|
|||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
@Entity(tableName = "Students", indices = [Index(value = ["email", "symbol", "student_id", "school_id", "class_id"], unique = true)])
|
@Entity(
|
||||||
|
tableName = "Students",
|
||||||
|
indices = [Index(
|
||||||
|
value = ["email", "symbol", "student_id", "school_id", "class_id"],
|
||||||
|
unique = true
|
||||||
|
)]
|
||||||
|
)
|
||||||
data class Student(
|
data class Student(
|
||||||
|
|
||||||
@ColumnInfo(name = "scrapper_base_url")
|
@ColumnInfo(name = "scrapper_base_url")
|
||||||
@ -52,7 +58,7 @@ data class Student(
|
|||||||
@ColumnInfo(name = "school_id")
|
@ColumnInfo(name = "school_id")
|
||||||
val schoolSymbol: String,
|
val schoolSymbol: String,
|
||||||
|
|
||||||
@ColumnInfo(name ="school_short")
|
@ColumnInfo(name = "school_short")
|
||||||
val schoolShortName: String,
|
val schoolShortName: String,
|
||||||
|
|
||||||
@ColumnInfo(name = "school_name")
|
@ColumnInfo(name = "school_name")
|
||||||
@ -73,4 +79,9 @@ data class Student(
|
|||||||
|
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
var id: Long = 0
|
var id: Long = 0
|
||||||
|
|
||||||
|
var nick = ""
|
||||||
|
|
||||||
|
@ColumnInfo(name = "avatar_color")
|
||||||
|
var avatarColor = 0L
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,85 @@
|
|||||||
|
package io.github.wulkanowy.data.db.entities
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Embedded
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import io.github.wulkanowy.data.enums.Gender
|
||||||
|
import java.io.Serializable
|
||||||
|
import java.time.LocalDate
|
||||||
|
|
||||||
|
@Entity(tableName = "StudentInfo")
|
||||||
|
data class StudentInfo(
|
||||||
|
|
||||||
|
@ColumnInfo(name = "student_id")
|
||||||
|
val studentId: Int,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "full_name")
|
||||||
|
val fullName: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "first_name")
|
||||||
|
val firstName: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "second_name")
|
||||||
|
val secondName: String,
|
||||||
|
|
||||||
|
val surname: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "birth_date")
|
||||||
|
val birthDate: LocalDate,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "birth_place")
|
||||||
|
val birthPlace: String,
|
||||||
|
|
||||||
|
val gender: Gender,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "has_polish_citizenship")
|
||||||
|
val hasPolishCitizenship: Boolean,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "family_name")
|
||||||
|
val familyName: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "parents_names")
|
||||||
|
val parentsNames: String,
|
||||||
|
|
||||||
|
val address: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "registered_address")
|
||||||
|
val registeredAddress: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "correspondence_address")
|
||||||
|
val correspondenceAddress: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "phone_number")
|
||||||
|
val phoneNumber: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cell_phone_number")
|
||||||
|
val cellPhoneNumber: String,
|
||||||
|
|
||||||
|
val email: String,
|
||||||
|
|
||||||
|
@Embedded(prefix = "first_guardian_")
|
||||||
|
val firstGuardian: StudentGuardian?,
|
||||||
|
|
||||||
|
@Embedded(prefix = "second_guardian_")
|
||||||
|
val secondGuardian: StudentGuardian?
|
||||||
|
|
||||||
|
) : Serializable {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
var id: Long = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
data class StudentGuardian(
|
||||||
|
|
||||||
|
@ColumnInfo(name = "full_name")
|
||||||
|
val fullName: String,
|
||||||
|
|
||||||
|
val kinship: String,
|
||||||
|
|
||||||
|
val address: String,
|
||||||
|
|
||||||
|
val phones: String,
|
||||||
|
|
||||||
|
val email: String
|
||||||
|
) : Serializable
|
@ -0,0 +1,20 @@
|
|||||||
|
package io.github.wulkanowy.data.db.entities
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
data class StudentNickAndAvatar(
|
||||||
|
|
||||||
|
val nick: String,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "avatar_color")
|
||||||
|
var avatarColor: Long
|
||||||
|
|
||||||
|
) : Serializable {
|
||||||
|
|
||||||
|
@PrimaryKey
|
||||||
|
var id: Long = 0
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package io.github.wulkanowy.data.db.entities
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import java.io.Serializable
|
||||||
|
import java.time.LocalDate
|
||||||
|
|
||||||
|
@Entity(tableName = "TimetableHeaders")
|
||||||
|
data class TimetableHeader(
|
||||||
|
|
||||||
|
@ColumnInfo(name = "student_id")
|
||||||
|
val studentId: Int,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "diary_id")
|
||||||
|
val diaryId: Int,
|
||||||
|
|
||||||
|
val date: LocalDate,
|
||||||
|
|
||||||
|
val content: String,
|
||||||
|
) : Serializable {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
var id: Long = 0
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration31 : Migration(30, 31) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL(
|
||||||
|
"""CREATE TABLE IF NOT EXISTS StudentInfo (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
student_id INTEGER NOT NULL,
|
||||||
|
full_name TEXT NOT NULL,
|
||||||
|
first_name TEXT NOT NULL,
|
||||||
|
second_name TEXT NOT NULL,
|
||||||
|
surname TEXT NOT NULL,
|
||||||
|
birth_date INTEGER NOT NULL,
|
||||||
|
birth_place TEXT NOT NULL,
|
||||||
|
gender TEXT NOT NULL,
|
||||||
|
has_polish_citizenship INTEGER NOT NULL,
|
||||||
|
family_name TEXT NOT NULL,
|
||||||
|
parents_names TEXT NOT NULL,
|
||||||
|
address TEXT NOT NULL,
|
||||||
|
registered_address TEXT NOT NULL,
|
||||||
|
correspondence_address TEXT NOT NULL,
|
||||||
|
phone_number TEXT NOT NULL,
|
||||||
|
cell_phone_number TEXT NOT NULL,
|
||||||
|
email TEXT NOT NULL,
|
||||||
|
first_guardian_full_name TEXT NOT NULL,
|
||||||
|
first_guardian_kinship TEXT NOT NULL,
|
||||||
|
first_guardian_address TEXT NOT NULL,
|
||||||
|
first_guardian_phones TEXT NOT NULL,
|
||||||
|
first_guardian_email TEXT NOT NULL,
|
||||||
|
second_guardian_full_name TEXT NOT NULL,
|
||||||
|
second_guardian_kinship TEXT NOT NULL,
|
||||||
|
second_guardian_address TEXT NOT NULL,
|
||||||
|
second_guardian_phones TEXT NOT NULL,
|
||||||
|
second_guardian_email TEXT NOT NULL)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration32 : Migration(31, 32) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE Students ADD COLUMN nick TEXT NOT NULL DEFAULT \"\"")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration33 : Migration(32, 33) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS StudentInfo")
|
||||||
|
|
||||||
|
database.execSQL(
|
||||||
|
"""CREATE TABLE IF NOT EXISTS StudentInfo (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
student_id INTEGER NOT NULL,
|
||||||
|
full_name TEXT NOT NULL,
|
||||||
|
first_name TEXT NOT NULL,
|
||||||
|
second_name TEXT NOT NULL,
|
||||||
|
surname TEXT NOT NULL,
|
||||||
|
birth_date INTEGER NOT NULL,
|
||||||
|
birth_place TEXT NOT NULL,
|
||||||
|
gender TEXT NOT NULL,
|
||||||
|
has_polish_citizenship INTEGER NOT NULL,
|
||||||
|
family_name TEXT NOT NULL,
|
||||||
|
parents_names TEXT NOT NULL,
|
||||||
|
address TEXT NOT NULL,
|
||||||
|
registered_address TEXT NOT NULL,
|
||||||
|
correspondence_address TEXT NOT NULL,
|
||||||
|
phone_number TEXT NOT NULL,
|
||||||
|
cell_phone_number TEXT NOT NULL,
|
||||||
|
email TEXT NOT NULL,
|
||||||
|
first_guardian_full_name TEXT,
|
||||||
|
first_guardian_kinship TEXT,
|
||||||
|
first_guardian_address TEXT,
|
||||||
|
first_guardian_phones TEXT,
|
||||||
|
first_guardian_email TEXT,
|
||||||
|
second_guardian_full_name TEXT,
|
||||||
|
second_guardian_kinship TEXT,
|
||||||
|
second_guardian_address TEXT,
|
||||||
|
second_guardian_phones TEXT,
|
||||||
|
second_guardian_email TEXT)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration34 : Migration(33, 34) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("DELETE FROM ReportingUnits")
|
||||||
|
database.execSQL("DELETE FROM Recipients")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.core.database.getLongOrNull
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
import io.github.wulkanowy.utils.AppInfo
|
||||||
|
|
||||||
|
class Migration35(private val appInfo: AppInfo) : Migration(34, 35) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE Students ADD COLUMN `avatar_color` INTEGER NOT NULL DEFAULT 0")
|
||||||
|
|
||||||
|
val studentsCursor = database.query("SELECT * FROM Students")
|
||||||
|
|
||||||
|
while (studentsCursor.moveToNext()) {
|
||||||
|
val studentId = studentsCursor.getLongOrNull(0)
|
||||||
|
database.execSQL(
|
||||||
|
"""UPDATE Students
|
||||||
|
SET avatar_color = ${appInfo.defaultColorsForAvatar.random()}
|
||||||
|
WHERE id = $studentId"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration36 : Migration(35, 36) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE Exams ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
|
database.execSQL("ALTER TABLE Homework ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration37 : Migration(36, 37) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL(
|
||||||
|
"""
|
||||||
|
CREATE TABLE IF NOT EXISTS TimetableHeaders (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
student_id INTEGER NOT NULL,
|
||||||
|
diary_id INTEGER NOT NULL,
|
||||||
|
date INTEGER NOT NULL,
|
||||||
|
content TEXT NOT NULL
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration38 : Migration(37, 38) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("""
|
||||||
|
CREATE TABLE IF NOT EXISTS `SchoolAnnouncements` (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
`student_id` INTEGER NOT NULL,
|
||||||
|
`date` INTEGER NOT NULL,
|
||||||
|
`subject` TEXT NOT NULL,
|
||||||
|
`content` TEXT NOT NULL
|
||||||
|
)
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration39 : Migration(38, 39) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE Conferences ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
|
database.execSQL("ALTER TABLE SchoolAnnouncements ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration40 : Migration(39, 40) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL(
|
||||||
|
"""
|
||||||
|
CREATE TABLE IF NOT EXISTS `Notifications` (
|
||||||
|
`student_id` INTEGER NOT NULL,
|
||||||
|
`title` TEXT NOT NULL,
|
||||||
|
`content` TEXT NOT NULL,
|
||||||
|
`type` TEXT NOT NULL,
|
||||||
|
`date` INTEGER NOT NULL,
|
||||||
|
`data` TEXT,
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
package io.github.wulkanowy.data.enums
|
||||||
|
|
||||||
|
enum class Gender { MALE, FEMALE }
|
@ -0,0 +1,14 @@
|
|||||||
|
package io.github.wulkanowy.data.mappers
|
||||||
|
|
||||||
|
import io.github.wulkanowy.data.db.entities.SchoolAnnouncement
|
||||||
|
import io.github.wulkanowy.data.db.entities.Student
|
||||||
|
import io.github.wulkanowy.sdk.pojo.DirectorInformation as SdkDirectorInformation
|
||||||
|
|
||||||
|
fun List<SdkDirectorInformation>.mapToEntities(student: Student) = map {
|
||||||
|
SchoolAnnouncement(
|
||||||
|
studentId = student.studentId,
|
||||||
|
date = it.date,
|
||||||
|
subject = it.subject,
|
||||||
|
content = it.content,
|
||||||
|
)
|
||||||
|
}
|
@ -5,10 +5,9 @@ import io.github.wulkanowy.data.db.entities.GradePointsStatistics
|
|||||||
import io.github.wulkanowy.data.db.entities.GradeSemesterStatistics
|
import io.github.wulkanowy.data.db.entities.GradeSemesterStatistics
|
||||||
import io.github.wulkanowy.data.db.entities.Semester
|
import io.github.wulkanowy.data.db.entities.Semester
|
||||||
import io.github.wulkanowy.data.pojos.GradeStatisticsItem
|
import io.github.wulkanowy.data.pojos.GradeStatisticsItem
|
||||||
import io.github.wulkanowy.ui.modules.grade.statistics.ViewType
|
|
||||||
import io.github.wulkanowy.sdk.pojo.GradeStatisticsSubject as SdkGradeStatisticsSubject
|
|
||||||
import io.github.wulkanowy.sdk.pojo.GradeStatisticsSemester as SdkGradeStatisticsSemester
|
|
||||||
import io.github.wulkanowy.sdk.pojo.GradePointsStatistics as SdkGradePointsStatistics
|
import io.github.wulkanowy.sdk.pojo.GradePointsStatistics as SdkGradePointsStatistics
|
||||||
|
import io.github.wulkanowy.sdk.pojo.GradeStatisticsSemester as SdkGradeStatisticsSemester
|
||||||
|
import io.github.wulkanowy.sdk.pojo.GradeStatisticsSubject as SdkGradeStatisticsSubject
|
||||||
|
|
||||||
@JvmName("mapToEntitiesSubject")
|
@JvmName("mapToEntitiesSubject")
|
||||||
fun List<SdkGradeStatisticsSubject>.mapToEntities(semester: Semester) = map {
|
fun List<SdkGradeStatisticsSubject>.mapToEntities(semester: Semester) = map {
|
||||||
@ -51,7 +50,7 @@ fun List<SdkGradePointsStatistics>.mapToEntities(semester: Semester) = map {
|
|||||||
|
|
||||||
fun List<GradePartialStatistics>.mapPartialToStatisticItems() = filterNot { it.classAmounts.isEmpty() }.map {
|
fun List<GradePartialStatistics>.mapPartialToStatisticItems() = filterNot { it.classAmounts.isEmpty() }.map {
|
||||||
GradeStatisticsItem(
|
GradeStatisticsItem(
|
||||||
type = ViewType.PARTIAL,
|
type = GradeStatisticsItem.DataType.PARTIAL,
|
||||||
average = it.classAverage,
|
average = it.classAverage,
|
||||||
partial = it,
|
partial = it,
|
||||||
points = null,
|
points = null,
|
||||||
@ -61,7 +60,7 @@ fun List<GradePartialStatistics>.mapPartialToStatisticItems() = filterNot { it.c
|
|||||||
|
|
||||||
fun List<GradeSemesterStatistics>.mapSemesterToStatisticItems() = filterNot { it.amounts.isEmpty() }.map {
|
fun List<GradeSemesterStatistics>.mapSemesterToStatisticItems() = filterNot { it.amounts.isEmpty() }.map {
|
||||||
GradeStatisticsItem(
|
GradeStatisticsItem(
|
||||||
type = ViewType.SEMESTER,
|
type = GradeStatisticsItem.DataType.SEMESTER,
|
||||||
partial = null,
|
partial = null,
|
||||||
points = null,
|
points = null,
|
||||||
average = "",
|
average = "",
|
||||||
@ -71,7 +70,7 @@ fun List<GradeSemesterStatistics>.mapSemesterToStatisticItems() = filterNot { it
|
|||||||
|
|
||||||
fun List<GradePointsStatistics>.mapPointsToStatisticsItems() = map {
|
fun List<GradePointsStatistics>.mapPointsToStatisticsItems() = map {
|
||||||
GradeStatisticsItem(
|
GradeStatisticsItem(
|
||||||
type = ViewType.POINTS,
|
type = GradeStatisticsItem.DataType.POINTS,
|
||||||
partial = null,
|
partial = null,
|
||||||
semester = null,
|
semester = null,
|
||||||
average = "",
|
average = "",
|
||||||
|
@ -4,14 +4,14 @@ import io.github.wulkanowy.data.db.entities.Message
|
|||||||
import io.github.wulkanowy.data.db.entities.MessageAttachment
|
import io.github.wulkanowy.data.db.entities.MessageAttachment
|
||||||
import io.github.wulkanowy.data.db.entities.Recipient
|
import io.github.wulkanowy.data.db.entities.Recipient
|
||||||
import io.github.wulkanowy.data.db.entities.Student
|
import io.github.wulkanowy.data.db.entities.Student
|
||||||
import io.github.wulkanowy.sdk.pojo.Recipient as SdkRecipient
|
|
||||||
import io.github.wulkanowy.sdk.pojo.MessageAttachment as SdkMessageAttachment
|
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import io.github.wulkanowy.sdk.pojo.Message as SdkMessage
|
import io.github.wulkanowy.sdk.pojo.Message as SdkMessage
|
||||||
|
import io.github.wulkanowy.sdk.pojo.MessageAttachment as SdkMessageAttachment
|
||||||
|
import io.github.wulkanowy.sdk.pojo.Recipient as SdkRecipient
|
||||||
|
|
||||||
fun List<SdkMessage>.mapToEntities(student: Student) = map {
|
fun List<SdkMessage>.mapToEntities(student: Student) = map {
|
||||||
Message(
|
Message(
|
||||||
studentId = student.id.toInt(),
|
studentId = student.id,
|
||||||
realId = it.id ?: 0,
|
realId = it.id ?: 0,
|
||||||
messageId = it.messageId ?: 0,
|
messageId = it.messageId ?: 0,
|
||||||
sender = it.sender?.name.orEmpty(),
|
sender = it.sender?.name.orEmpty(),
|
||||||
|
@ -5,7 +5,7 @@ import io.github.wulkanowy.sdk.pojo.Recipient as SdkRecipient
|
|||||||
|
|
||||||
fun List<SdkRecipient>.mapToEntities(userLoginId: Int) = map {
|
fun List<SdkRecipient>.mapToEntities(userLoginId: Int) = map {
|
||||||
Recipient(
|
Recipient(
|
||||||
userLoginId = userLoginId,
|
studentId = userLoginId,
|
||||||
realId = it.id,
|
realId = it.id,
|
||||||
realName = it.name,
|
realName = it.name,
|
||||||
name = it.shortName,
|
name = it.shortName,
|
||||||
|
@ -6,7 +6,7 @@ import io.github.wulkanowy.sdk.pojo.ReportingUnit as SdkReportingUnit
|
|||||||
|
|
||||||
fun List<SdkReportingUnit>.mapToEntities(student: Student) = map {
|
fun List<SdkReportingUnit>.mapToEntities(student: Student) = map {
|
||||||
ReportingUnit(
|
ReportingUnit(
|
||||||
studentId = student.studentId,
|
studentId = student.id.toInt(),
|
||||||
unitId = it.id,
|
unitId = it.id,
|
||||||
roles = it.roles,
|
roles = it.roles,
|
||||||
senderId = it.senderId,
|
senderId = it.senderId,
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package io.github.wulkanowy.data.mappers
|
||||||
|
|
||||||
|
import io.github.wulkanowy.data.db.entities.Semester
|
||||||
|
import io.github.wulkanowy.data.db.entities.StudentGuardian
|
||||||
|
import io.github.wulkanowy.data.db.entities.StudentInfo
|
||||||
|
import io.github.wulkanowy.data.enums.Gender
|
||||||
|
import io.github.wulkanowy.sdk.pojo.StudentGuardian as SdkStudentGuardian
|
||||||
|
import io.github.wulkanowy.sdk.pojo.StudentInfo as SdkStudentInfo
|
||||||
|
|
||||||
|
fun SdkStudentInfo.mapToEntity(semester: Semester) = StudentInfo(
|
||||||
|
studentId = semester.studentId,
|
||||||
|
fullName = fullName,
|
||||||
|
firstName = firstName,
|
||||||
|
secondName = secondName,
|
||||||
|
surname = surname,
|
||||||
|
birthDate = birthDate,
|
||||||
|
birthPlace = birthPlace,
|
||||||
|
gender = Gender.valueOf(gender.name),
|
||||||
|
hasPolishCitizenship = hasPolishCitizenship,
|
||||||
|
familyName = familyName,
|
||||||
|
parentsNames = parentsNames,
|
||||||
|
address = address,
|
||||||
|
registeredAddress = registeredAddress,
|
||||||
|
correspondenceAddress = correspondenceAddress,
|
||||||
|
phoneNumber = phoneNumber,
|
||||||
|
cellPhoneNumber = phoneNumber,
|
||||||
|
email = email,
|
||||||
|
firstGuardian = guardianFirst?.mapToEntity(),
|
||||||
|
secondGuardian = guardianSecond?.mapToEntity()
|
||||||
|
)
|
||||||
|
|
||||||
|
fun SdkStudentGuardian.mapToEntity() = StudentGuardian(
|
||||||
|
fullName = fullName,
|
||||||
|
kinship = kinship,
|
||||||
|
address = address,
|
||||||
|
phones = phones,
|
||||||
|
email = email
|
||||||
|
)
|
@ -5,7 +5,7 @@ import io.github.wulkanowy.data.db.entities.StudentWithSemesters
|
|||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import io.github.wulkanowy.sdk.pojo.Student as SdkStudent
|
import io.github.wulkanowy.sdk.pojo.Student as SdkStudent
|
||||||
|
|
||||||
fun List<SdkStudent>.mapToEntities(password: String = "") = map {
|
fun List<SdkStudent>.mapToEntities(password: String = "", colors: List<Long>) = map {
|
||||||
StudentWithSemesters(
|
StudentWithSemesters(
|
||||||
student = Student(
|
student = Student(
|
||||||
email = it.email,
|
email = it.email,
|
||||||
@ -28,8 +28,10 @@ fun List<SdkStudent>.mapToEntities(password: String = "") = map {
|
|||||||
mobileBaseUrl = it.mobileBaseUrl,
|
mobileBaseUrl = it.mobileBaseUrl,
|
||||||
privateKey = it.privateKey,
|
privateKey = it.privateKey,
|
||||||
certificateKey = it.certificateKey,
|
certificateKey = it.certificateKey,
|
||||||
loginMode = it.loginMode.name
|
loginMode = it.loginMode.name,
|
||||||
),
|
).apply {
|
||||||
|
avatarColor = colors.random()
|
||||||
|
},
|
||||||
semesters = it.semesters.mapToEntities(it.studentId)
|
semesters = it.semesters.mapToEntities(it.studentId)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,19 @@ package io.github.wulkanowy.data.mappers
|
|||||||
import io.github.wulkanowy.data.db.entities.Semester
|
import io.github.wulkanowy.data.db.entities.Semester
|
||||||
import io.github.wulkanowy.data.db.entities.Timetable
|
import io.github.wulkanowy.data.db.entities.Timetable
|
||||||
import io.github.wulkanowy.data.db.entities.TimetableAdditional
|
import io.github.wulkanowy.data.db.entities.TimetableAdditional
|
||||||
|
import io.github.wulkanowy.data.db.entities.TimetableHeader
|
||||||
|
import io.github.wulkanowy.data.pojos.TimetableFull
|
||||||
|
import io.github.wulkanowy.sdk.pojo.TimetableFull as SdkTimetableFull
|
||||||
|
import io.github.wulkanowy.sdk.pojo.TimetableDayHeader as SdkTimetableHeader
|
||||||
import io.github.wulkanowy.sdk.pojo.Timetable as SdkTimetable
|
import io.github.wulkanowy.sdk.pojo.Timetable as SdkTimetable
|
||||||
import io.github.wulkanowy.sdk.pojo.TimetableAdditional as SdkTimetableAdditional
|
import io.github.wulkanowy.sdk.pojo.TimetableAdditional as SdkTimetableAdditional
|
||||||
|
|
||||||
|
fun SdkTimetableFull.mapToEntities(semester: Semester) = TimetableFull(
|
||||||
|
lessons = lessons.mapToEntities(semester),
|
||||||
|
additional = additional.mapToEntities(semester),
|
||||||
|
headers = headers.mapToEntities(semester)
|
||||||
|
)
|
||||||
|
|
||||||
fun List<SdkTimetable>.mapToEntities(semester: Semester) = map {
|
fun List<SdkTimetable>.mapToEntities(semester: Semester) = map {
|
||||||
Timetable(
|
Timetable(
|
||||||
studentId = semester.studentId,
|
studentId = semester.studentId,
|
||||||
@ -39,3 +49,13 @@ fun List<SdkTimetableAdditional>.mapToEntities(semester: Semester) = map {
|
|||||||
end = it.end
|
end = it.end
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmName("mapToEntitiesTimetableHeaders")
|
||||||
|
fun List<SdkTimetableHeader>.mapToEntities(semester: Semester) = map {
|
||||||
|
TimetableHeader(
|
||||||
|
studentId = semester.studentId,
|
||||||
|
diaryId = semester.diaryId,
|
||||||
|
date = it.date,
|
||||||
|
content = it.content
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -3,11 +3,10 @@ package io.github.wulkanowy.data.pojos
|
|||||||
import io.github.wulkanowy.data.db.entities.GradePartialStatistics
|
import io.github.wulkanowy.data.db.entities.GradePartialStatistics
|
||||||
import io.github.wulkanowy.data.db.entities.GradePointsStatistics
|
import io.github.wulkanowy.data.db.entities.GradePointsStatistics
|
||||||
import io.github.wulkanowy.data.db.entities.GradeSemesterStatistics
|
import io.github.wulkanowy.data.db.entities.GradeSemesterStatistics
|
||||||
import io.github.wulkanowy.ui.modules.grade.statistics.ViewType
|
|
||||||
|
|
||||||
data class GradeStatisticsItem(
|
data class GradeStatisticsItem(
|
||||||
|
|
||||||
val type: ViewType,
|
val type: DataType,
|
||||||
|
|
||||||
val average: String,
|
val average: String,
|
||||||
|
|
||||||
@ -16,4 +15,11 @@ data class GradeStatisticsItem(
|
|||||||
val semester: GradeSemesterStatistics?,
|
val semester: GradeSemesterStatistics?,
|
||||||
|
|
||||||
val points: GradePointsStatistics?
|
val points: GradePointsStatistics?
|
||||||
)
|
|
||||||
|
) {
|
||||||
|
enum class DataType {
|
||||||
|
SEMESTER,
|
||||||
|
PARTIAL,
|
||||||
|
POINTS,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package io.github.wulkanowy.data.pojos
|
||||||
|
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
import io.github.wulkanowy.ui.modules.message.send.RecipientChipItem
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = true)
|
||||||
|
data class MessageDraft(
|
||||||
|
val recipients: List<RecipientChipItem>,
|
||||||
|
val subject: String,
|
||||||
|
val content: String,
|
||||||
|
)
|
@ -0,0 +1,36 @@
|
|||||||
|
package io.github.wulkanowy.data.pojos
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes
|
||||||
|
import androidx.annotation.PluralsRes
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import io.github.wulkanowy.services.sync.notifications.NotificationType
|
||||||
|
import io.github.wulkanowy.ui.modules.main.MainView
|
||||||
|
|
||||||
|
sealed interface NotificationData {
|
||||||
|
val type: NotificationType
|
||||||
|
val startMenu: MainView.Section
|
||||||
|
val icon: Int
|
||||||
|
val titleStringRes: Int
|
||||||
|
val contentStringRes: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
data class MultipleNotificationsData(
|
||||||
|
override val type: NotificationType,
|
||||||
|
override val startMenu: MainView.Section,
|
||||||
|
@DrawableRes override val icon: Int,
|
||||||
|
@PluralsRes override val titleStringRes: Int,
|
||||||
|
@PluralsRes override val contentStringRes: Int,
|
||||||
|
|
||||||
|
@PluralsRes val summaryStringRes: Int,
|
||||||
|
val lines: List<String>,
|
||||||
|
) : NotificationData
|
||||||
|
|
||||||
|
data class OneNotificationData(
|
||||||
|
override val type: NotificationType,
|
||||||
|
override val startMenu: MainView.Section,
|
||||||
|
@DrawableRes override val icon: Int,
|
||||||
|
@StringRes override val titleStringRes: Int,
|
||||||
|
@StringRes override val contentStringRes: Int,
|
||||||
|
|
||||||
|
val contentValues: List<String>,
|
||||||
|
) : NotificationData
|
@ -0,0 +1,11 @@
|
|||||||
|
package io.github.wulkanowy.data.pojos
|
||||||
|
|
||||||
|
import io.github.wulkanowy.data.db.entities.Timetable
|
||||||
|
import io.github.wulkanowy.data.db.entities.TimetableAdditional
|
||||||
|
import io.github.wulkanowy.data.db.entities.TimetableHeader
|
||||||
|
|
||||||
|
data class TimetableFull(
|
||||||
|
val lessons: List<Timetable>,
|
||||||
|
val additional: List<TimetableAdditional>,
|
||||||
|
val headers: List<TimetableHeader>,
|
||||||
|
)
|
@ -15,6 +15,7 @@ class AppCreatorRepository @Inject constructor(
|
|||||||
private val dispatchers: DispatchersProvider
|
private val dispatchers: DispatchersProvider
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@Suppress("BlockingMethodInNonBlockingContext")
|
||||||
suspend fun getAppCreators() = withContext(dispatchers.backgroundThread) {
|
suspend fun getAppCreators() = withContext(dispatchers.backgroundThread) {
|
||||||
val moshi = Moshi.Builder().build()
|
val moshi = Moshi.Builder().build()
|
||||||
val type = Types.newParameterizedType(List::class.java, Contributor::class.java)
|
val type = Types.newParameterizedType(List::class.java, Contributor::class.java)
|
||||||
|