Skip to content

Commit

Permalink
Merge pull request #37 from camarm-dev/dev
Browse files Browse the repository at this point in the history
Base sqlite sur mobile (#24) et 1.0.0-rc !
  • Loading branch information
camarm-dev authored Dec 3, 2023
2 parents ebec260 + 7ec6067 commit 2819587
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 10 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
# Remède
Open Source and free alternative to Antidote.

[Data credits](https://remede.camarm.fr/FR#données-remède)[License](https://github.com/camarm-dev/remede/blob/main/LICENSE)[Website](https://remede.camarm.fr)**[Download](https://remede.camarm.fr)**
[Open application](https://remede-app.camarm.fr)

[Data credits](https://remede.camarm.fr/FR#données-remède)[License](https://github.com/camarm-dev/remede/blob/main/LICENSE)[Website](https://remede.camarm.fr)**[Download](https://remede.camarm.fr)****[Try online](https://remede-app.camarm.fr)**

</div>

Expand Down
23 changes: 23 additions & 0 deletions app/android/.idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions app/android/.idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "remede",
"private": true,
"version": "1.0.0-beta.1",
"version": "1.0.0-rc",
"type": "module",
"license": "Cecill V2.1",
"scripts": {
Expand Down
11 changes: 6 additions & 5 deletions app/src/functions/offline.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {InformationsResponse} from "@/functions/types/api_responses";
import {Directory, Filesystem} from '@capacitor/filesystem'
import {Preferences} from '@capacitor/preferences'
import {Capacitor} from "@capacitor/core";

async function getOfflineDictionaryStatus() {
const status = JSON.parse((await Preferences.get({ key: 'offlineDictionary' })).value || '{}')
Expand Down Expand Up @@ -62,12 +63,12 @@ async function deleteDictionary() {


async function getRawDictionary() {
const file = await Filesystem.readFile({
path: 'remedeSQLite.db',
directory: Directory.Data
})
const path = (await getOfflineDictionaryStatus()).path
const newSrc = Capacitor.convertFileSrc(`${path}`)

const file = await fetch(newSrc).then(resp => resp.arrayBuffer())

return await file.data.arrayBuffer().then(buf => new Uint8Array(buf))
return new Uint8Array(file)
}

export {
Expand Down
12 changes: 10 additions & 2 deletions app/src/views/SettingsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<ion-icon :icon="trashBinOutline" slot="start"></ion-icon>
<ion-label>Supprimer</ion-label>
</ion-item>
<ion-item v-if="hasUpdate" button color="primary" @click="loading = true; deleteDictionary(); reloadDictionaryStatus(); downloadDictionary()">
<ion-item v-if="hasUpdate" button color="primary" @click="loading = true; deleteDictionary(); reloadDictionaryStatus(); download()">
<ion-icon :icon="refreshOutline" slot="start"></ion-icon>
<ion-label>Mettre à jour vers "{{ latestDictionary }}"</ion-label>
</ion-item>
Expand Down Expand Up @@ -71,7 +71,7 @@
Il est conseillé de redémarrer l'application après le téléchargement.
</ion-note>
<ion-note class="ion-padding" v-if="!downloaded && canDownload && !loading">
Télécharger le dictionnaire prendra environ 205Mb de stockage !
Télécharger le dictionnaire prendra environ 220Mb de stockage !
</ion-note>
</ion-list>

Expand Down Expand Up @@ -158,6 +158,14 @@ export default {
this.loading = true
try {
await downloadDictionary()
const successMessage = await toastController.create({
header: 'Téléchargement réussi',
message: `Le dictionnaire hors-ligne a été téléchargé`,
duration: 5000,
color: 'success'
})
await successMessage.present()
} catch (e) {
const message = await toastController.create({
header: 'Échec de téléchargement',
Expand Down
Binary file modified builds/remede.apk
Binary file not shown.
10 changes: 10 additions & 0 deletions docs/EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ npm i
```shell
npm i -g @ionic/cli
```
- Install Git LFS
1. Install extension [here](https://packagecloud.io/github/git-lfs/install)
2. Setup extension
```shell
git lfs install
```

### Mobile application

Expand All @@ -55,6 +61,10 @@ npm run dev
```shell
pip install fastapi uvicorn starlette
```
- Fetch database with Git LFS
```shell
git lfs pull
```
- Start the server
```shell
python3 server.py
Expand Down
8 changes: 8 additions & 0 deletions docs/FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ npm i
```shell
npm i -g @ionic/cli
```
- Installer Git LFS
```shell
git lfs install
```

### Application mobile

Expand All @@ -55,6 +59,10 @@ npm run dev
```shell
pip install fastapi uvicorn starlette
```
- Récupérer la base de données avec Git LFS
```shell
git lfs pull
```
- Lancer le serveur
```shell
python3 server.py
Expand Down
16 changes: 15 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ <h1 class="title is-large has-text-grey">
<div class="dropdown mr-5" onclick="this.classList.toggle('is-active')">
<div class="dropdown-trigger">
<button class="button is-link is-outlined" aria-haspopup="true" aria-controls="dropdown-menu2">
<span class="icon is-small mt-0">
<i class="fas fa-download has-text-link" aria-hidden="true"></i>
</span>
<span>Télécharger</span>
<span class="icon is-small mt-0">
<i class="fas fa-angle-down has-text-link" aria-hidden="true"></i>
Expand Down Expand Up @@ -92,7 +95,18 @@ <h4 class="subtitle mb-0">
</div>
</div>
</div>
<button onclick="location.href = '/FR'" class="button is-focused is-success">Documentation</button>
<button onclick="location.href = '/FR'" class="button is-focused is-success mr-5">
<span class="icon mt-0">
<i class="fas fa-book has-text-white" aria-hidden="true"></i>
</span>
<span>Documentation</span>
</button>
<button onclick="window.open('https://remede-app.camarm.fr')" class="button is-outlined is-link">
<span class="icon mt-0">
<i class="fas fa-external-link-square has-text-link" aria-hidden="true"></i>
</span>
<span>Ouvrir l'app</span>
</button>
</p>
</div>
</div>
Expand Down

0 comments on commit 2819587

Please sign in to comment.