Compare commits
94 Commits
v1.10.0_15
...
v1.18.0_27
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72c334e5e0 | ||
|
|
e7f35822af | ||
|
|
bd2152d568 | ||
|
|
b1d7ef03e2 | ||
|
|
aa74417d11 | ||
|
|
229b009b7f | ||
|
|
bece6253d5 | ||
|
|
ae7e582ec8 | ||
|
|
d69470e207 | ||
|
|
c60e852226 | ||
|
|
a205478a29 | ||
|
|
22d30522e1 | ||
|
|
19b1fad274 | ||
|
|
9a6dfacf9b | ||
|
|
7f236c5b18 | ||
|
|
25985c732d | ||
|
|
9ce50b7e3d | ||
|
|
f5e93a8179 | ||
|
|
2b5cef156c | ||
|
|
f3032f74a4 | ||
|
|
58ec7553ea | ||
|
|
357f7d1c31 | ||
|
|
e6d30d72fa | ||
|
|
355038a91a | ||
|
|
97d9b80baa | ||
|
|
b6814fad57 | ||
|
|
7586c65103 | ||
|
|
633170d743 | ||
|
|
c5be7827c3 | ||
|
|
e84c705e31 | ||
|
|
36162509e0 | ||
|
|
76bf1c0379 | ||
|
|
32b847c26e | ||
|
|
a45d6fdf57 | ||
|
|
c071e64a7e | ||
|
|
663f12851e | ||
|
|
c4ef523564 | ||
|
|
992f792c0a | ||
|
|
97611fa057 | ||
|
|
32240777c3 | ||
|
|
6065ff8caa | ||
|
|
8db073941d | ||
|
|
5e281b44e9 | ||
|
|
142ede350e | ||
|
|
a2e1d4caa2 | ||
|
|
5f00d8b9c6 | ||
|
|
2e85e18020 | ||
|
|
40a8115101 | ||
|
|
d02b97e1c1 | ||
|
|
485b152beb | ||
|
|
c918f5b001 | ||
|
|
cca2f7d178 | ||
|
|
baf533de35 | ||
|
|
dfc0d6eee7 | ||
|
|
7948cb8110 | ||
|
|
568436f188 | ||
|
|
04b59318f9 | ||
|
|
1a3d05ffc3 | ||
|
|
2f2db74d73 | ||
|
|
ef097d15dd | ||
|
|
caaa474c23 | ||
|
|
63bebd92e0 | ||
|
|
ad36b8b10f | ||
|
|
18c22d2a6c | ||
|
|
73024edba9 | ||
|
|
a360c0a3d7 | ||
|
|
34657f820f | ||
|
|
8840911f22 | ||
|
|
4aa66f4156 | ||
|
|
799a1c99f2 | ||
|
|
c4247bfea3 | ||
|
|
1e3464fe47 | ||
|
|
b7603fd150 | ||
|
|
517a3363d6 | ||
|
|
3511b69fc8 | ||
|
|
e6efc61b3b | ||
|
|
360c1d9a15 | ||
|
|
e3449f9c8f | ||
|
|
a8e723d722 | ||
|
|
d116234523 | ||
|
|
dce2bc7508 | ||
|
|
2bf764f560 | ||
|
|
587b77e70b | ||
|
|
53cd9fd8bf | ||
|
|
a8220172f8 | ||
|
|
397f8c70b4 | ||
|
|
68ff5377b0 | ||
|
|
b359dc3cb6 | ||
|
|
5b036067ed | ||
|
|
b9f38162d5 | ||
|
|
ab6909bfbd | ||
|
|
53c3c916a6 | ||
|
|
6924aa5eb1 | ||
|
|
a3b45d62b6 |
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -16,10 +16,10 @@ Note: Please search to see if an issue already exists for the bug you encountere
|
|||||||
A clear and concise description of what the bug is.
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
**Task List**
|
**Task List**
|
||||||
[ ] I have read thoroughly the README setup and installation instructions.
|
- [ ] I have read thoroughly the README setup and installation instructions.
|
||||||
[ ] If my setup is different, I have included my docker-compose file.
|
- [ ] If my setup is different, I have included my docker-compose file.
|
||||||
[ ] I have included my redacted `.env` file.
|
- [ ] I have included my redacted `.env` file.
|
||||||
[ ] I have included information on my machine, and environment.
|
- [ ] I have included information on my machine, and environment.
|
||||||
|
|
||||||
**To Reproduce**
|
**To Reproduce**
|
||||||
Steps to reproduce the behavior:
|
Steps to reproduce the behavior:
|
||||||
|
|||||||
54
.github/workflows/build_push_docker_latest.yml
vendored
@@ -4,17 +4,16 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_push_server_latest:
|
# This image include both the server and microservices - the two containers can be slitted into separated
|
||||||
|
# service with its coressponding entry file.
|
||||||
|
build_and_push_server_monorepo_latest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
# ref: "main" # branch
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
@@ -27,23 +26,22 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Build and push Immich
|
- name: Build and push Immich Mono Repo
|
||||||
uses: docker/build-push-action@v3.0.0
|
uses: docker/build-push-action@v3.0.0
|
||||||
with:
|
with:
|
||||||
context: ./server
|
context: ./server
|
||||||
file: ./server/Dockerfile
|
file: ./server/Dockerfile
|
||||||
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
altran1502/immich-server:latest
|
altran1502/immich-server:latest
|
||||||
|
|
||||||
build_and_push_microservice_latest:
|
build_and_push_machine_learning_latest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
# ref: "main" # branch
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
@@ -56,15 +54,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Build and Push Microservices
|
- name: Build and Push Machine Learning
|
||||||
uses: docker/build-push-action@v3.0.0
|
uses: docker/build-push-action@v3.0.0
|
||||||
with:
|
with:
|
||||||
context: ./microservices
|
context: ./machine-learning
|
||||||
file: ./microservices/Dockerfile
|
file: ./machine-learning/Dockerfile
|
||||||
platforms: linux/arm/v7,linux/amd64
|
platforms: linux/arm/v7,linux/amd64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
altran1502/immich-microservices:latest
|
altran1502/immich-machine-learning:latest
|
||||||
|
|
||||||
build_and_push_web_latest:
|
build_and_push_web_latest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -72,7 +70,6 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
# ref: "main" # branch
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2.0.0
|
uses: docker/setup-qemu-action@v2.0.0
|
||||||
@@ -91,6 +88,33 @@ jobs:
|
|||||||
file: ./web/Dockerfile
|
file: ./web/Dockerfile
|
||||||
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
||||||
target: prod
|
target: prod
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
altran1502/immich-web:latest
|
altran1502/immich-web:latest
|
||||||
|
|
||||||
|
build_and_push_nginx_latest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2.0.0
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2.0.0
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and Push Proxy
|
||||||
|
uses: docker/build-push-action@v3.0.0
|
||||||
|
with:
|
||||||
|
context: ./nginx
|
||||||
|
file: ./nginx/Dockerfile
|
||||||
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
altran1502/immich-proxy:latest
|
||||||
|
|||||||
122
.github/workflows/build_push_docker_staging.yml
vendored
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
name: Build and Push Docker Image - Staging
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# This image include both the server and microservices - the two containers can be slitted into separated
|
||||||
|
# service with its coressponding entry file.
|
||||||
|
build_and_push_server_monorepo_staging:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2.0.0
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2.0.0
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and push Immich Mono Repo
|
||||||
|
uses: docker/build-push-action@v3.0.0
|
||||||
|
with:
|
||||||
|
context: ./server
|
||||||
|
file: ./server/Dockerfile
|
||||||
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
||||||
|
push: ${{ github.event_name == 'pull_request' }}
|
||||||
|
tags: |
|
||||||
|
altran1502/immich-server:staging
|
||||||
|
|
||||||
|
build_and_push_machine_learning_staging:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2.0.0
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2.0.0
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and Push Machine Learning
|
||||||
|
uses: docker/build-push-action@v3.0.0
|
||||||
|
with:
|
||||||
|
context: ./machine-learning
|
||||||
|
file: ./machine-learning/Dockerfile
|
||||||
|
platforms: linux/arm/v7,linux/amd64
|
||||||
|
push: ${{ github.event_name == 'pull_request' }}
|
||||||
|
tags: |
|
||||||
|
altran1502/immich-machine-learning:staging
|
||||||
|
|
||||||
|
build_and_push_web_staging:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2.0.0
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2.0.0
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and Push Web
|
||||||
|
uses: docker/build-push-action@v3.0.0
|
||||||
|
with:
|
||||||
|
context: ./web
|
||||||
|
file: ./web/Dockerfile
|
||||||
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
||||||
|
target: prod
|
||||||
|
push: ${{ github.event_name == 'pull_request' }}
|
||||||
|
tags: |
|
||||||
|
altran1502/immich-web:staging
|
||||||
|
|
||||||
|
build_and_push_nginx_staging:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2.0.0
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2.0.0
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and Push Proxy
|
||||||
|
uses: docker/build-push-action@v3.0.0
|
||||||
|
with:
|
||||||
|
context: ./nginx
|
||||||
|
file: ./nginx/Dockerfile
|
||||||
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
||||||
|
push: ${{ github.event_name == 'pull_request' }}
|
||||||
|
tags: |
|
||||||
|
altran1502/immich-proxy:staging
|
||||||
62
.github/workflows/build_push_server_release.yml
vendored
@@ -6,7 +6,7 @@ on:
|
|||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_push_server_release:
|
build_and_push_server_monorepo_release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -43,44 +43,40 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: |
|
tags: |
|
||||||
altran1502/immich-server:${{ steps.previoustag.outputs.tag }}
|
altran1502/immich-server:${{ steps.previoustag.outputs.tag }}
|
||||||
|
altran1502/immich-server:release
|
||||||
|
|
||||||
build_and_push_microservice_release:
|
build_and_push_machine_learning_release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: "main"
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: "Get Previous tag"
|
- name: "Get Previous tag"
|
||||||
id: previoustag
|
id: previoustag
|
||||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||||
with:
|
with:
|
||||||
fallback: latest
|
fallback: latest
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2.0.0
|
uses: docker/setup-qemu-action@v2.0.0
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v2.0.0
|
uses: docker/setup-buildx-action@v2.0.0
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and Push Machine Learning
|
||||||
- name: Build and push immich-microservices release
|
|
||||||
uses: docker/build-push-action@v3.0.0
|
uses: docker/build-push-action@v3.0.0
|
||||||
with:
|
with:
|
||||||
context: ./microservices
|
context: ./machine-learning
|
||||||
file: ./microservices/Dockerfile
|
file: ./machine-learning/Dockerfile
|
||||||
platforms: linux/arm/v7,linux/amd64
|
platforms: linux/arm/v7,linux/amd64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
altran1502/immich-microservices:${{ steps.previoustag.outputs.tag }}
|
altran1502/immich-machine-learning:${{ steps.previoustag.outputs.tag }}
|
||||||
|
altran1502/immich-machine-learning:release
|
||||||
|
|
||||||
build_and_push_web_release:
|
build_and_push_web_release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -120,3 +116,43 @@ jobs:
|
|||||||
target: prod
|
target: prod
|
||||||
tags: |
|
tags: |
|
||||||
altran1502/immich-web:${{ steps.previoustag.outputs.tag }}
|
altran1502/immich-web:${{ steps.previoustag.outputs.tag }}
|
||||||
|
altran1502/immich-web:release
|
||||||
|
|
||||||
|
build_and_push_nginx_release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: "main"
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: "Get Previous tag"
|
||||||
|
id: previoustag
|
||||||
|
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||||
|
with:
|
||||||
|
fallback: latest
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2.0.0
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2.0.0
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push immich-proxy release
|
||||||
|
uses: docker/build-push-action@v3.0.0
|
||||||
|
with:
|
||||||
|
context: ./nginx
|
||||||
|
file: ./nginx/Dockerfile
|
||||||
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: |
|
||||||
|
altran1502/immich-proxy:release
|
||||||
|
altran1502/immich-proxy:${{ steps.previoustag.outputs.tag }}
|
||||||
|
|||||||
17
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
name: Test
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push: { branches: master }
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-server-e2e:
|
||||||
|
name: Run test suite
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Run Immich Server 2E2 Test
|
||||||
|
run: docker-compose -f ./docker/docker-compose.test.yml --env-file ./docker/.env.test up --abort-on-container-exit --exit-code-from immich_server_test
|
||||||
10
Makefile
@@ -1,20 +1,20 @@
|
|||||||
dev:
|
dev:
|
||||||
docker-compose -f ./docker/docker-compose.dev.yml up --remove-orphans
|
rm -rf ./server/dist && docker-compose -f ./docker/docker-compose.dev.yml up --remove-orphans
|
||||||
|
|
||||||
dev-update:
|
dev-update:
|
||||||
docker-compose -f ./docker/docker-compose.dev.yml up --build -V --remove-orphans
|
rm -rf ./server/dist && docker-compose -f ./docker/docker-compose.dev.yml up --build -V --remove-orphans
|
||||||
|
|
||||||
dev-scale:
|
dev-scale:
|
||||||
docker-compose -f ./docker/docker-compose.dev.yml up --build -V --scale immich_server=3 --remove-orphans
|
rm -rf ./server/dist && docker-compose -f ./docker/docker-compose.dev.yml up --build -V --scale immich-server=3 --remove-orphans
|
||||||
|
|
||||||
stage:
|
stage:
|
||||||
docker-compose -f ./docker/docker-compose.staging.yml up --build -V --remove-orphans
|
docker-compose -f ./docker/docker-compose.staging.yml up --build -V --remove-orphans
|
||||||
|
|
||||||
test-e2e:
|
test-e2e:
|
||||||
docker-compose -f ./docker/docker-compose.test.yml --env-file ./docker/.env.test up --abort-on-container-exit --exit-code-from immich_server_test
|
docker-compose -f ./docker/docker-compose.test.yml --env-file ./docker/.env.test up --renew-anon-volumes --abort-on-container-exit --exit-code-from immich_server_test --remove-orphans
|
||||||
|
|
||||||
prod:
|
prod:
|
||||||
docker-compose -f ./docker/docker-compose.yml up --build -V --remove-orphans
|
docker-compose -f ./docker/docker-compose.yml up --build -V --remove-orphans
|
||||||
|
|
||||||
prod-scale:
|
prod-scale:
|
||||||
docker-compose -f ./docker/docker-compose.yml up --build -V --scale immich_server=3 --scale immich_microservices=3 --remove-orphans
|
docker-compose -f ./docker/docker-compose.yml up --build -V --scale immich-server=3 --scale immich-microservices=3 --remove-orphans
|
||||||
84
README.md
@@ -8,22 +8,24 @@
|
|||||||
<img src="https://img.shields.io/teamcity/http/immichci.little-home.net/s/Immich_BuildAndPublishIOSToTestFlight.svg?style=for-the-badge&label=iOS&logo=teamcity&logoColor=000000&labelColor=ececec" alt="iOS Build"/>
|
<img src="https://img.shields.io/teamcity/http/immichci.little-home.net/s/Immich_BuildAndPublishIOSToTestFlight.svg?style=for-the-badge&label=iOS&logo=teamcity&logoColor=000000&labelColor=ececec" alt="iOS Build"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://actions-badge.atrox.dev/alextran1502/immich/goto?ref=main">
|
<a href="https://actions-badge.atrox.dev/alextran1502/immich/goto?ref=main">
|
||||||
<img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Falextran1502%2Fimmich%2Fbadge%3Fref%3Dmain&style=for-the-badge&label=Server Docker&logo=docker&labelColor=ececec" />
|
<img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Falextran1502%2Fimmich%2Fbadge%3Fref%3Dmain&style=for-the-badge&label=Github Action&logo=github&labelColor=ececec&logoColor=000000" />
|
||||||
|
</a>
|
||||||
|
<a href="https://discord.gg/D8JsnBEuKb">
|
||||||
|
<img src="https://img.shields.io/discord/979116623879368755.svg?label=Immich%20Discord&logo=Discord&style=for-the-badge&logoColor=000000&labelColor=ececec" atl="Immich Discord"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="design/immich-logo.svg" width="200" title="Immich Logo">
|
<img src="design/feature-panel.png" title="Immich Logo">
|
||||||
</p>
|
</p>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
# Immich
|
# Immich
|
||||||
|
|
||||||
Self-hosted photo and video backup solution directly from your mobile phone.
|
**High performance self-hosted photo and video backup solution.**
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -31,7 +33,7 @@ Loading ~4000 images/videos
|
|||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
### Mobile client
|
### Mobile
|
||||||
<p align="left">
|
<p align="left">
|
||||||
<img src="design/login-screen.png" width="150" title="Login With Custom URL">
|
<img src="design/login-screen.png" width="150" title="Login With Custom URL">
|
||||||
<img src="design/backup-screen.png" width="150" title="Backup Setting Info">
|
<img src="design/backup-screen.png" width="150" title="Backup Setting Info">
|
||||||
@@ -42,9 +44,10 @@ Loading ~4000 images/videos
|
|||||||
<img src="design/nsc6.png" width="150" title="EXIF Info">
|
<img src="design/nsc6.png" width="150" title="EXIF Info">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
### Web client
|
### Web
|
||||||
<p align="center">
|
<p align="left">
|
||||||
<img src="design/dashboard_photos.jpeg" width="100%" title="Home Dashboard">
|
<img src="design/web-home.jpeg" width="49%" title="Home Dashboard">
|
||||||
|
<img src="design/web-detail.jpeg" width="49%" title="Detail">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
# Note
|
# Note
|
||||||
@@ -55,24 +58,20 @@ This project is under heavy development, there will be continuous functions, fea
|
|||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
- Upload and view assets (videos/images).
|
| | Mobile | Web |
|
||||||
- Auto Backup.
|
| - | - | - |
|
||||||
- Download asset to local device.
|
| Upload and view videos and photos | Yes | Yes
|
||||||
- Multi-user supported.
|
| Auto backup when app is opened | Yes | N/A
|
||||||
- Quick navigation with drag scroll bar.
|
| Selective album(s) for backup | Yes | N/A
|
||||||
- Support HEIC/HEIF Backup.
|
| Download photos and videos to local device | Yes | Yes
|
||||||
- Extract and display EXIF info.
|
| Multi-user support | Yes | Yes
|
||||||
- Real-time render from multi-device upload event.
|
| Shared Albums | Yes | No
|
||||||
- Image Tagging/Classification based on ImageNet dataset
|
| Quick navigation with draggable scrollbar | Yes | Yes
|
||||||
- Object detection based on COCO SSD.
|
| Support RAW (HEIC, HEIF, DNG, Apple ProRaw) | Yes | Yes
|
||||||
- Search assets based on tags and exif data (lens, make, model, orientation)
|
| Metadata view (EXIF, map) | Yes | Yes
|
||||||
- [Optional] Reverse geocoding using Mapbox (Generous free-tier of 100,000 search/month)
|
| Search by metadata, objects and image tags | Yes | No
|
||||||
- Show asset's location information on map (OpenStreetMap).
|
| Administrative functions (user management) | No | Yes
|
||||||
- Show curated places on the search page
|
|
||||||
- Show curated objects on the search page
|
|
||||||
- Shared album with users on the same server
|
|
||||||
- Selective backup - albums can be included and excluded during the backup process.
|
|
||||||
- Web interface is available for administrative tasks (creating new users) and viewing assets on the server - additional features are coming.
|
|
||||||
|
|
||||||
# System Requirement
|
# System Requirement
|
||||||
|
|
||||||
@@ -95,7 +94,7 @@ You can use docker compose for development and testing out the application, ther
|
|||||||
3. **PostgreSQL** - Main database of the application
|
3. **PostgreSQL** - Main database of the application
|
||||||
4. **Redis** - For sharing websocket instance between docker instances and background tasks message queue.
|
4. **Redis** - For sharing websocket instance between docker instances and background tasks message queue.
|
||||||
5. **Nginx** - Load balancing and optimized file uploading.
|
5. **Nginx** - Load balancing and optimized file uploading.
|
||||||
6. **TensorFlow** - Object Detection and Image Classification.
|
6. **TensorFlow** - Object Detection (COCO SSD) and Image Classification (ImageNet).
|
||||||
|
|
||||||
## Step 1: Populate .env file
|
## Step 1: Populate .env file
|
||||||
|
|
||||||
@@ -144,8 +143,8 @@ MAPBOX_KEY=
|
|||||||
# This is the URL of your vm/server where you host Immich, so that the web frontend
|
# This is the URL of your vm/server where you host Immich, so that the web frontend
|
||||||
# know where can it make the request to.
|
# know where can it make the request to.
|
||||||
# For example: If your server IP address is 10.1.11.50, the environment variable will
|
# For example: If your server IP address is 10.1.11.50, the environment variable will
|
||||||
# be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283
|
# be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283/api
|
||||||
VITE_SERVER_ENDPOINT=http://192.168.1.216:2283
|
VITE_SERVER_ENDPOINT=http://192.168.1.216:2283/api
|
||||||
```
|
```
|
||||||
|
|
||||||
## Step 2: Start the server
|
## Step 2: Start the server
|
||||||
@@ -156,23 +155,17 @@ To **start**, run
|
|||||||
docker-compose -f ./docker/docker-compose.yml up
|
docker-compose -f ./docker/docker-compose.yml up
|
||||||
```
|
```
|
||||||
|
|
||||||
If you have a few thousand photos/videos, I suggest running docker-compose with *scaling* option for the `immich_server` container to handle high I/O load when using fast scrolling.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose -f ./docker/docker-compose.yml up --scale immich-server=5
|
|
||||||
```
|
|
||||||
|
|
||||||
To *update* docker-compose with newest image (if you have started the docker-compose previously)
|
To *update* docker-compose with newest image (if you have started the docker-compose previously)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose -f ./docker/docker-compose.yml pull && docker-compose -f ./docker/docker-compose.yml up
|
docker-compose -f ./docker/docker-compose.yml pull && docker-compose -f ./docker/docker-compose.yml up
|
||||||
```
|
```
|
||||||
|
|
||||||
The server will be running at `http://your-ip:2283` through `Nginx`
|
The server will be running at `http://your-ip:2283/api`
|
||||||
|
|
||||||
## Step 3: Register User
|
## Step 3: Register User
|
||||||
|
|
||||||
Access the web interface at `http://your-ip:2285` to register an admin account.
|
Access the web interface at `http://your-ip:2283` to register an admin account.
|
||||||
|
|
||||||
<p align="left">
|
<p align="left">
|
||||||
<img src="design/admin-registration-form.png" width="300" title="Admin Registration">
|
<img src="design/admin-registration-form.png" width="300" title="Admin Registration">
|
||||||
@@ -186,7 +179,11 @@ Additional accounts on the server can be created by the admin account.
|
|||||||
|
|
||||||
## Step 4: Run mobile app
|
## Step 4: Run mobile app
|
||||||
|
|
||||||
The app is distributed on several platforms below.
|
Login the mobile app with your server address
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<img src="design/login-screen.jpeg" width="250" title="Example login screen">
|
||||||
|
<p/>
|
||||||
|
|
||||||
## F-Droid
|
## F-Droid
|
||||||
You can get the app on F-droid by clicking the image below.
|
You can get the app on F-droid by clicking the image below.
|
||||||
@@ -228,6 +225,15 @@ make dev # required Makefile installed on the system.
|
|||||||
|
|
||||||
All servers and web container are hot reload for quick feedback loop.
|
All servers and web container are hot reload for quick feedback loop.
|
||||||
|
|
||||||
|
## Note for developers
|
||||||
|
### 1 - OpenAPI
|
||||||
|
OpenAPI is used to generate the client (Typescript, Dart) SDK. `openapi-generator-cli` can be installed [here](https://openapi-generator.tech/docs/installation/). When you add a new or modify an existing endpoint, you must run the generate command below to update the client SDK.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run api:generate # Run from server directory
|
||||||
|
```
|
||||||
|
You can find the generated client SDK in the [`web/src/api`](web/src/api) for Typescript SDK and [`mobile/openapi`](mobile/openapi) for Dart SDK.
|
||||||
|
|
||||||
# Support
|
# Support
|
||||||
|
|
||||||
If you like the app, find it helpful, and want to support me to offset the cost of publishing to AppStores, you can sponsor the project with [**Github Sponsor**](https://github.com/sponsors/alextran1502), or a one time donation with the Buy Me a coffee link below.
|
If you like the app, find it helpful, and want to support me to offset the cost of publishing to AppStores, you can sponsor the project with [**Github Sponsor**](https://github.com/sponsors/alextran1502), or a one time donation with the Buy Me a coffee link below.
|
||||||
@@ -257,5 +263,5 @@ You need to change the CPU type from `kvm64` to `host` under VMs hardware tab.
|
|||||||
`Hardware > Processors > Edit > Advanced > Type (dropdown menu) > host`
|
`Hardware > Processors > Edit > Advanced > Type (dropdown menu) > host`
|
||||||
|
|
||||||
Otherwise you can:
|
Otherwise you can:
|
||||||
- edit `docker-compose.yml` file and comment the whole `immich_microservices` service **which will disable machine learning features like object detection and image classification**
|
- edit `docker-compose.yml` file and comment the whole `immich-machine-learning` service **which will disable machine learning features like object detection and image classification**
|
||||||
- switch to a different VM/desktop with different architecture.
|
- switch to a different VM/desktop with different architecture.
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 154 KiB |
BIN
design/feature-panel.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
design/login-screen.jpeg
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
design/web-admin.jpeg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
design/web-detail.jpeg
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
design/web-home.jpeg
Normal file
|
After Width: | Height: | Size: 206 KiB |
@@ -7,6 +7,8 @@ DB_USERNAME=postgres
|
|||||||
DB_PASSWORD=postgres
|
DB_PASSWORD=postgres
|
||||||
DB_DATABASE_NAME=immich
|
DB_DATABASE_NAME=immich
|
||||||
|
|
||||||
|
# Optional Database settings:
|
||||||
|
# DB_PORT=5432
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -17,6 +19,12 @@ DB_DATABASE_NAME=immich
|
|||||||
|
|
||||||
REDIS_HOSTNAME=immich_redis
|
REDIS_HOSTNAME=immich_redis
|
||||||
|
|
||||||
|
# Optional Redis settings:
|
||||||
|
# REDIS_PORT=6379
|
||||||
|
# REDIS_DBINDEX=0
|
||||||
|
# REDIS_PASSWORD=
|
||||||
|
# REDIS_SOCKET=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -51,13 +59,23 @@ MAPBOX_KEY=
|
|||||||
|
|
||||||
|
|
||||||
###################################################################################
|
###################################################################################
|
||||||
# WEB
|
# WEB - Required
|
||||||
###################################################################################
|
###################################################################################
|
||||||
|
|
||||||
# This is the URL of your vm/server where you host Immich, so that the web frontend
|
# This is the URL of your vm/server where you host Immich, so that the web frontend
|
||||||
# know where can it make the request to.
|
# know where can it make the request to.
|
||||||
# For example: If your server IP address is 10.1.11.50, the environment variable will
|
# For example: If your server IP address is 10.1.11.50, the environment variable will
|
||||||
# be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283
|
# be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283/api
|
||||||
# !CAUTION! THERE IS NO FORWARD SLASH AT THE END
|
# !CAUTION! THERE IS NO FORWARD SLASH AT THE END
|
||||||
|
|
||||||
VITE_SERVER_ENDPOINT=
|
VITE_SERVER_ENDPOINT=
|
||||||
|
|
||||||
|
|
||||||
|
####################################################################################
|
||||||
|
# WEB - Optional
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
# Custom message on the login page, should be written in HTML form.
|
||||||
|
# For example VITE_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
|
||||||
|
|
||||||
|
VITE_LOGIN_PAGE_MESSAGE=
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
DB_HOSTNAME=immich_postgres_test
|
|
||||||
# Database
|
# Database
|
||||||
|
DB_HOSTNAME=immich_postgres_test
|
||||||
DB_USERNAME=postgres
|
DB_USERNAME=postgres
|
||||||
DB_PASSWORD=postgres
|
DB_PASSWORD=postgres
|
||||||
DB_DATABASE_NAME=e2e_test
|
DB_DATABASE_NAME=e2e_test
|
||||||
|
|
||||||
|
# Redis
|
||||||
|
REDIS_HOSTNAME=immich_redis_test
|
||||||
|
|
||||||
# Upload File Config
|
# Upload File Config
|
||||||
UPLOAD_LOCATION=./upload
|
UPLOAD_LOCATION=./upload
|
||||||
|
|
||||||
@@ -13,4 +16,7 @@ JWT_SECRET=randomstringthatissolongandpowerfulthatnoonecanguess
|
|||||||
# MAPBOX
|
# MAPBOX
|
||||||
## ENABLE_MAPBOX is either true of false -> if true, you have to provide MAPBOX_KEY
|
## ENABLE_MAPBOX is either true of false -> if true, you have to provide MAPBOX_KEY
|
||||||
ENABLE_MAPBOX=false
|
ENABLE_MAPBOX=false
|
||||||
|
|
||||||
|
# WEB
|
||||||
MAPBOX_KEY=
|
MAPBOX_KEY=
|
||||||
|
VITE_SERVER_ENDPOINT=http://localhost:2283/api
|
||||||
@@ -2,13 +2,11 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
immich-server:
|
immich-server:
|
||||||
image: immich-server-dev:1.9.0
|
image: immich-server-dev:latest
|
||||||
build:
|
build:
|
||||||
context: ../server
|
context: ../server
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
command: npm run start:dev
|
command: npm run start:dev immich
|
||||||
expose:
|
|
||||||
- "3000"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ../server:/usr/src/app
|
- ../server:/usr/src/app
|
||||||
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
@@ -20,19 +18,15 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- database
|
- database
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
|
|
||||||
immich-microservices:
|
immich-machine-learning:
|
||||||
image: immich-microservices-dev:1.9.0
|
image: immich-machine-learning-dev:latest
|
||||||
build:
|
build:
|
||||||
context: ../microservices
|
context: ../machine-learning
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
command: npm run start:dev
|
command: npm run start:dev
|
||||||
expose:
|
|
||||||
- "3001"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ../microservices:/usr/src/app
|
- ../machine-learning:/usr/src/app
|
||||||
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
env_file:
|
env_file:
|
||||||
@@ -41,8 +35,24 @@ services:
|
|||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
networks:
|
|
||||||
- immich-network
|
immich-microservices:
|
||||||
|
image: immich-microservices:latest
|
||||||
|
build:
|
||||||
|
context: ../server
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
command: npm run start:dev microservices
|
||||||
|
volumes:
|
||||||
|
- ../server:/usr/src/app
|
||||||
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
|
- /usr/src/app/node_modules
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
- immich-server
|
||||||
|
|
||||||
immich-web:
|
immich-web:
|
||||||
image: immich-web-dev:1.9.0
|
image: immich-web-dev:1.9.0
|
||||||
@@ -54,20 +64,16 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
ports:
|
ports:
|
||||||
- 3002:3002
|
- 3000:3000
|
||||||
- 24678:24678
|
- 24678:24678
|
||||||
volumes:
|
volumes:
|
||||||
- ../web:/usr/src/app
|
- ../web:/usr/src/app
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
container_name: immich_redis
|
container_name: immich_redis
|
||||||
image: redis:6.2
|
image: redis:6.2
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
|
|
||||||
database:
|
database:
|
||||||
container_name: immich_postgres
|
container_name: immich_postgres
|
||||||
@@ -83,25 +89,21 @@ services:
|
|||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
|
|
||||||
nginx:
|
immich-proxy:
|
||||||
container_name: proxy_nginx
|
container_name: immich_proxy
|
||||||
image: nginx:latest
|
image: immich-proxy-dev:latest
|
||||||
volumes:
|
build:
|
||||||
- ./settings/nginx-conf:/etc/nginx/conf.d
|
context: ../nginx
|
||||||
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- 2283:80
|
- 2283:80
|
||||||
- 2284:443
|
- 2284:443
|
||||||
logging:
|
logging:
|
||||||
driver: none
|
driver: none
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- immich-server
|
- immich-server
|
||||||
|
restart: always
|
||||||
|
|
||||||
networks:
|
|
||||||
immich-network:
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
|
||||||
immich-server:
|
|
||||||
image: immich-server-dev:1.9.0
|
|
||||||
build:
|
|
||||||
context: ../server
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
command: npm run start:dev
|
|
||||||
expose:
|
|
||||||
- "3000"
|
|
||||||
volumes:
|
|
||||||
- ../server:/usr/src/app
|
|
||||||
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
|
||||||
- /usr/src/app/node_modules
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
depends_on:
|
|
||||||
- redis
|
|
||||||
- database
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
|
|
||||||
immich-microservices:
|
|
||||||
image: immich-microservices-dev:1.9.0
|
|
||||||
build:
|
|
||||||
context: ../microservices
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
command: npm run start:dev
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- driver: nvidia
|
|
||||||
count: 1
|
|
||||||
capabilities: [ gpu ]
|
|
||||||
expose:
|
|
||||||
- "3001"
|
|
||||||
volumes:
|
|
||||||
- ../microservices:/usr/src/app
|
|
||||||
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
|
||||||
- /usr/src/app/node_modules
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
- immich_server
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
|
|
||||||
redis:
|
|
||||||
container_name: immich_redis
|
|
||||||
image: redis:6.2
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
|
|
||||||
database:
|
|
||||||
container_name: immich_postgres
|
|
||||||
image: postgres:14
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
environment:
|
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
||||||
POSTGRES_USER: ${DB_USERNAME}
|
|
||||||
POSTGRES_DB: ${DB_DATABASE_NAME}
|
|
||||||
PG_DATA: /var/lib/postgresql/data
|
|
||||||
volumes:
|
|
||||||
- pgdata:/var/lib/postgresql/data
|
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
|
|
||||||
nginx:
|
|
||||||
container_name: proxy_nginx
|
|
||||||
image: nginx:latest
|
|
||||||
volumes:
|
|
||||||
- ./settings/nginx-conf:/etc/nginx/conf.d
|
|
||||||
ports:
|
|
||||||
- 2283:80
|
|
||||||
- 2284:443
|
|
||||||
logging:
|
|
||||||
driver: none
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
depends_on:
|
|
||||||
- immich-server
|
|
||||||
|
|
||||||
networks:
|
|
||||||
immich-network:
|
|
||||||
volumes:
|
|
||||||
pgdata:
|
|
||||||
@@ -2,13 +2,8 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
immich-server:
|
immich-server:
|
||||||
image: immich-server-staging:latest
|
image: altran1502/immich-server:staging
|
||||||
build:
|
entrypoint: ["/bin/sh", "./start-server.sh"]
|
||||||
context: ../server
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
|
||||||
expose:
|
|
||||||
- "3000"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
env_file:
|
env_file:
|
||||||
@@ -18,18 +13,25 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- database
|
- database
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
immich-microservices:
|
immich-microservices:
|
||||||
image: immich-microservices-staging:latest
|
image: altran1502/immich-server:staging
|
||||||
build:
|
entrypoint: ["/bin/sh", "./start-microservices.sh"]
|
||||||
context: ../microservices
|
volumes:
|
||||||
dockerfile: Dockerfile
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
- database
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
immich-machine-learning:
|
||||||
|
image: altran1502/immich-machine-learning:staging
|
||||||
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
||||||
expose:
|
|
||||||
- "3001"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
env_file:
|
env_file:
|
||||||
@@ -38,34 +40,20 @@ services:
|
|||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
immich-web:
|
immich-web:
|
||||||
image: immich-web-staging:latest
|
image: altran1502/immich-web:staging
|
||||||
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
||||||
build:
|
|
||||||
context: ../web
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
target: prod
|
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
ports:
|
|
||||||
- 2285:3000
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
container_name: immich_redis
|
container_name: immich_redis
|
||||||
image: redis:6.2
|
image: redis:6.2
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
database:
|
database:
|
||||||
container_name: immich_postgres
|
container_name: immich_postgres
|
||||||
image: postgres:14
|
image: postgres:14
|
||||||
@@ -78,28 +66,19 @@ services:
|
|||||||
PG_DATA: /var/lib/postgresql/data
|
PG_DATA: /var/lib/postgresql/data
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
ports:
|
restart: always
|
||||||
- 5432:5432
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
|
|
||||||
nginx:
|
immich-proxy:
|
||||||
container_name: proxy_nginx
|
container_name: immich_proxy
|
||||||
image: nginx:latest
|
image: altran1502/immich-proxy:staging
|
||||||
volumes:
|
|
||||||
- ./settings/nginx-conf:/etc/nginx/conf.d
|
|
||||||
ports:
|
ports:
|
||||||
- 2283:80
|
- 2283:80
|
||||||
- 2284:443
|
- 2284:443
|
||||||
logging:
|
logging:
|
||||||
driver: none
|
driver: none
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- immich-server
|
- immich-server
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
networks:
|
|
||||||
immich-network:
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
@@ -2,7 +2,7 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
immich_server_test:
|
immich_server_test:
|
||||||
image: immich-server-dev:1.9.0
|
image: immich-server-dev:latest
|
||||||
build:
|
build:
|
||||||
context: ../server
|
context: ../server
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@@ -19,15 +19,10 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- database
|
- database
|
||||||
networks:
|
|
||||||
- immich_network_test
|
|
||||||
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
container_name: immich_redis_test
|
container_name: immich_redis_test
|
||||||
image: redis:6.2
|
image: redis:6.2
|
||||||
networks:
|
|
||||||
- immich_network_test
|
|
||||||
|
|
||||||
database:
|
database:
|
||||||
container_name: immich_postgres_test
|
container_name: immich_postgres_test
|
||||||
@@ -40,13 +35,6 @@ services:
|
|||||||
POSTGRES_DB: ${DB_DATABASE_NAME}
|
POSTGRES_DB: ${DB_DATABASE_NAME}
|
||||||
PG_DATA: /var/lib/postgresql/data
|
PG_DATA: /var/lib/postgresql/data
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata-test:/var/lib/postgresql/data
|
- /var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
networks:
|
|
||||||
- immich_network_test
|
|
||||||
|
|
||||||
networks:
|
|
||||||
immich_network_test:
|
|
||||||
volumes:
|
|
||||||
pgdata-test:
|
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
immich-server:
|
immich-server:
|
||||||
image: altran1502/immich-server:latest
|
image: altran1502/immich-server:release
|
||||||
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
entrypoint: ["/bin/sh", "./start-server.sh"]
|
||||||
expose:
|
|
||||||
- "3000"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
env_file:
|
env_file:
|
||||||
@@ -15,15 +13,25 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- database
|
- database
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
immich-microservices:
|
immich-microservices:
|
||||||
image: altran1502/immich-microservices:latest
|
image: altran1502/immich-server:release
|
||||||
|
entrypoint: ["/bin/sh", "./start-microservices.sh"]
|
||||||
|
volumes:
|
||||||
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
- database
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
immich-machine-learning:
|
||||||
|
image: altran1502/immich-machine-learning:release
|
||||||
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
||||||
expose:
|
|
||||||
- "3001"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
env_file:
|
env_file:
|
||||||
@@ -32,30 +40,20 @@ services:
|
|||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
immich-web:
|
immich-web:
|
||||||
image: altran1502/immich-web:latest
|
image: altran1502/immich-web:release
|
||||||
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
ports:
|
|
||||||
- 2285:3000
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
container_name: immich_redis
|
container_name: immich_redis
|
||||||
image: redis:6.2
|
image: redis:6.2
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
database:
|
database:
|
||||||
container_name: immich_postgres
|
container_name: immich_postgres
|
||||||
image: postgres:14
|
image: postgres:14
|
||||||
@@ -68,29 +66,18 @@ services:
|
|||||||
PG_DATA: /var/lib/postgresql/data
|
PG_DATA: /var/lib/postgresql/data
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
nginx:
|
immich-proxy:
|
||||||
container_name: proxy_nginx
|
container_name: immich_proxy
|
||||||
image: nginx:latest
|
image: altran1502/immich-proxy:release
|
||||||
volumes:
|
|
||||||
- ./settings/nginx-conf:/etc/nginx/conf.d
|
|
||||||
ports:
|
ports:
|
||||||
- 2283:80
|
- 2283:80
|
||||||
- 2284:443
|
|
||||||
logging:
|
logging:
|
||||||
driver: none
|
driver: none
|
||||||
networks:
|
|
||||||
- immich-network
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- immich-server
|
- immich-server
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
networks:
|
|
||||||
immich-network:
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
map $http_upgrade $connection_upgrade {
|
|
||||||
default upgrade;
|
|
||||||
'' close;
|
|
||||||
}
|
|
||||||
|
|
||||||
# events {
|
|
||||||
# worker_connections 1000;
|
|
||||||
# }
|
|
||||||
|
|
||||||
server {
|
|
||||||
|
|
||||||
gzip on;
|
|
||||||
gzip_min_length 1000;
|
|
||||||
gunzip on;
|
|
||||||
|
|
||||||
client_max_body_size 50000M;
|
|
||||||
|
|
||||||
listen 80;
|
|
||||||
access_log off;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
|
|
||||||
# Compression
|
|
||||||
gzip_static on;
|
|
||||||
gzip_min_length 1000;
|
|
||||||
gzip_comp_level 2;
|
|
||||||
|
|
||||||
proxy_buffering off;
|
|
||||||
proxy_buffer_size 16k;
|
|
||||||
proxy_busy_buffers_size 24k;
|
|
||||||
proxy_buffers 64 4k;
|
|
||||||
proxy_force_ranges on;
|
|
||||||
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
|
|
||||||
proxy_pass http://immich-server:3000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
15
localizely.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
config_version: 1.0
|
||||||
|
project_id: ead34689-ec52-41d9-b675-09bc85a6cbd7
|
||||||
|
file_type: json
|
||||||
|
upload:
|
||||||
|
files:
|
||||||
|
- file: mobile/assets/i18n/en-US.json
|
||||||
|
locale_code: en
|
||||||
|
- file: mobile/assets/i18n/de-DE.json
|
||||||
|
locale_code: de
|
||||||
|
download:
|
||||||
|
files:
|
||||||
|
- file: mobile/assets/i18n/en-US.json
|
||||||
|
locale_code: en
|
||||||
|
- file: mobile/assets/i18n/de-DE.json
|
||||||
|
locale_code: de
|
||||||
@@ -33,3 +33,5 @@ lerna-debug.log*
|
|||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
|
||||||
|
upload/
|
||||||
@@ -9,7 +9,7 @@ COPY package.json package-lock.json ./
|
|||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install gcc g++ make cmake python3 python3-pip ffmpeg -y
|
RUN apt-get install gcc g++ make cmake python3 python3-pip ffmpeg -y
|
||||||
|
|
||||||
RUN npm install
|
RUN npm ci
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
|||||||
export const databaseConfig: TypeOrmModuleOptions = {
|
export const databaseConfig: TypeOrmModuleOptions = {
|
||||||
type: 'postgres',
|
type: 'postgres',
|
||||||
host: process.env.DB_HOSTNAME || 'immich_postgres',
|
host: process.env.DB_HOSTNAME || 'immich_postgres',
|
||||||
port: 5432,
|
port: parseInt(process.env.DB_PORT || '5432'),
|
||||||
username: process.env.DB_USERNAME,
|
username: process.env.DB_USERNAME,
|
||||||
password: process.env.DB_PASSWORD,
|
password: process.env.DB_PASSWORD,
|
||||||
database: process.env.DB_DATABASE_NAME,
|
database: process.env.DB_DATABASE_NAME,
|
||||||
@@ -7,7 +7,7 @@ export class ImageClassifierController {
|
|||||||
private readonly imageClassifierService: ImageClassifierService,
|
private readonly imageClassifierService: ImageClassifierService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@Post('/tagImage')
|
@Post('/tag-image')
|
||||||
async tagImage(@Body('thumbnailPath') thumbnailPath: string) {
|
async tagImage(@Body('thumbnailPath') thumbnailPath: string) {
|
||||||
return await this.imageClassifierService.tagImage(thumbnailPath);
|
return await this.imageClassifierService.tagImage(thumbnailPath);
|
||||||
}
|
}
|
||||||
@@ -5,17 +5,17 @@ import { Logger } from '@nestjs/common';
|
|||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
|
|
||||||
await app.listen(3001, () => {
|
await app.listen(3003, () => {
|
||||||
if (process.env.NODE_ENV == 'development') {
|
if (process.env.NODE_ENV == 'development') {
|
||||||
Logger.log(
|
Logger.log(
|
||||||
'Running Immich Microservices in DEVELOPMENT environment',
|
'Running Immich Machine Learning in DEVELOPMENT environment',
|
||||||
'IMMICH MICROSERVICES',
|
'IMMICH MICROSERVICES',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV == 'production') {
|
if (process.env.NODE_ENV == 'production') {
|
||||||
Logger.log(
|
Logger.log(
|
||||||
'Running Immich Microservices in PRODUCTION environment',
|
'Running Immich Machine Learning in PRODUCTION environment',
|
||||||
'IMMICH MICROSERVICES',
|
'IMMICH MICROSERVICES',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ export class ObjectDetectionController {
|
|||||||
private readonly objectDetectionService: ObjectDetectionService,
|
private readonly objectDetectionService: ObjectDetectionService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@Post('/detectObject')
|
@Post('/detect-object')
|
||||||
async detectObject(@Body('thumbnailPath') thumbnailPath: string) {
|
async detectObject(@Body('thumbnailPath') thumbnailPath: string) {
|
||||||
return await this.objectDetectionService.detectObject(thumbnailPath);
|
return await this.objectDetectionService.detectObject(thumbnailPath);
|
||||||
}
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
devenv/
|
|
||||||
3
machine_learning/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
__pycache__/
|
|
||||||
devenv/
|
|
||||||
app/upload
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
## GPU Build
|
|
||||||
# FROM tensorflow/tensorflow:latest-gpu as gpu
|
|
||||||
|
|
||||||
# WORKDIR /code
|
|
||||||
|
|
||||||
# COPY ./requirements.txt /code/requirements.txt
|
|
||||||
|
|
||||||
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
||||||
|
|
||||||
# COPY ./app /code/app
|
|
||||||
|
|
||||||
|
|
||||||
## CPU BUILD
|
|
||||||
FROM python:3.8 as cpu
|
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install ffmpeg libsm6 libxext6 -y
|
|
||||||
|
|
||||||
WORKDIR /code
|
|
||||||
|
|
||||||
COPY ./requirements.txt /code/requirements.txt
|
|
||||||
|
|
||||||
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
||||||
|
|
||||||
COPY ./app /code/app
|
|
||||||
|
Before Width: | Height: | Size: 193 KiB |
@@ -1,37 +0,0 @@
|
|||||||
from tensorflow.keras.applications import InceptionV3
|
|
||||||
from tensorflow.keras.applications.inception_v3 import preprocess_input, decode_predictions
|
|
||||||
from tensorflow.keras.preprocessing import image
|
|
||||||
import numpy as np
|
|
||||||
from PIL import Image
|
|
||||||
import cv2
|
|
||||||
IMG_SIZE = 299
|
|
||||||
PREDICTION_MODEL = InceptionV3(weights='imagenet')
|
|
||||||
|
|
||||||
|
|
||||||
def classify_image(image_path: str):
|
|
||||||
img_path = f'./app/{image_path}'
|
|
||||||
# img = image.load_img(img_path, target_size=(IMG_SIZE, IMG_SIZE))
|
|
||||||
|
|
||||||
target_image = cv2.imread(img_path, cv2.IMREAD_UNCHANGED)
|
|
||||||
resized_target_image = cv2.resize(target_image, (IMG_SIZE, IMG_SIZE))
|
|
||||||
|
|
||||||
x = image.img_to_array(resized_target_image)
|
|
||||||
x = np.expand_dims(x, axis=0)
|
|
||||||
x = preprocess_input(x)
|
|
||||||
|
|
||||||
preds = PREDICTION_MODEL.predict(x)
|
|
||||||
result = decode_predictions(preds, top=3)[0]
|
|
||||||
payload = []
|
|
||||||
for _, value, _ in result:
|
|
||||||
payload.append(value)
|
|
||||||
|
|
||||||
return payload
|
|
||||||
|
|
||||||
|
|
||||||
def warm_up():
|
|
||||||
img_path = f'./app/test.png'
|
|
||||||
img = image.load_img(img_path, target_size=(IMG_SIZE, IMG_SIZE))
|
|
||||||
x = image.img_to_array(img)
|
|
||||||
x = np.expand_dims(x, axis=0)
|
|
||||||
x = preprocess_input(x)
|
|
||||||
PREDICTION_MODEL.predict(x)
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
from pydantic import BaseModel
|
|
||||||
from fastapi import FastAPI
|
|
||||||
|
|
||||||
from .object_detection import object_detection
|
|
||||||
from .image_classifier import image_classifier
|
|
||||||
|
|
||||||
from tf2_yolov4.anchors import YOLOV4_ANCHORS
|
|
||||||
from tf2_yolov4.model import YOLOv4
|
|
||||||
|
|
||||||
|
|
||||||
HEIGHT, WIDTH = (640, 960)
|
|
||||||
|
|
||||||
# Warm up model
|
|
||||||
image_classifier.warm_up()
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
|
|
||||||
class TagImagePayload(BaseModel):
|
|
||||||
thumbnail_path: str
|
|
||||||
|
|
||||||
|
|
||||||
@app.post("/tagImage")
|
|
||||||
async def post_root(payload: TagImagePayload):
|
|
||||||
image_path = payload.thumbnail_path
|
|
||||||
|
|
||||||
if image_path[0] == '.':
|
|
||||||
image_path = image_path[2:]
|
|
||||||
|
|
||||||
return image_classifier.classify_image(image_path=image_path)
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
|
||||||
async def test():
|
|
||||||
|
|
||||||
object_detection.run_detection()
|
|
||||||
# image = tf.io.read_file("./app/cars.jpg")
|
|
||||||
# image = tf.image.decode_image(image)
|
|
||||||
# image = tf.image.resize(image, (HEIGHT, WIDTH))
|
|
||||||
# images = tf.expand_dims(image, axis=0) / 255.0
|
|
||||||
|
|
||||||
# model = YOLOv4(
|
|
||||||
# (HEIGHT, WIDTH, 3),
|
|
||||||
# 80,
|
|
||||||
# YOLOV4_ANCHORS,
|
|
||||||
# "darknet",
|
|
||||||
# )
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
def run_detection():
|
|
||||||
print("run detection")
|
|
||||||
|
Before Width: | Height: | Size: 345 KiB |
@@ -1,8 +0,0 @@
|
|||||||
opencv-python==4.5.5.64
|
|
||||||
fastapi>=0.68.0,<0.69.0
|
|
||||||
pydantic>=1.8.0,<2.0.0
|
|
||||||
uvicorn>=0.15.0,<0.16.0
|
|
||||||
tensorflow==2.8.0
|
|
||||||
numpy==1.22.2
|
|
||||||
pillow==9.0.1
|
|
||||||
tf2_yolov4==0.1.0
|
|
||||||
@@ -1,10 +1,45 @@
|
|||||||
# This file tracks properties of this Flutter project.
|
# This file tracks properties of this Flutter project.
|
||||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||||
#
|
#
|
||||||
# This file should be version controlled and should not be manually edited.
|
# This file should be version controlled.
|
||||||
|
|
||||||
version:
|
version:
|
||||||
revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
|
revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
||||||
project_type: app
|
project_type: app
|
||||||
|
|
||||||
|
# Tracks metadata for the flutter migrate command
|
||||||
|
migration:
|
||||||
|
platforms:
|
||||||
|
- platform: root
|
||||||
|
create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
- platform: android
|
||||||
|
create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
- platform: ios
|
||||||
|
create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
- platform: linux
|
||||||
|
create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
- platform: macos
|
||||||
|
create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
- platform: web
|
||||||
|
create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
- platform: windows
|
||||||
|
create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
|
||||||
|
|
||||||
|
# User provided section
|
||||||
|
|
||||||
|
# List of Local paths (relative to this file) that should be
|
||||||
|
# ignored by the migrate tool.
|
||||||
|
#
|
||||||
|
# Files that are not part of the templates will be ignored by default.
|
||||||
|
unmanaged_files:
|
||||||
|
- 'lib/main.dart'
|
||||||
|
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||||
|
|||||||
@@ -21,9 +21,18 @@ linter:
|
|||||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||||
# producing the lint.
|
# producing the lint.
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||||
|
use_build_context_synchronously: false
|
||||||
|
require_trailing_commas: true
|
||||||
|
unrelated_type_equality_checks: true
|
||||||
|
|
||||||
# Additional information about this file can be found at
|
# Additional information about this file can be found at
|
||||||
# https://dart.dev/guides/language/analysis-options
|
# https://dart.dev/guides/language/analysis-options
|
||||||
|
analyzer:
|
||||||
|
exclude:
|
||||||
|
- openapi/
|
||||||
|
- openapi/test/
|
||||||
|
- lib/generated_plugin_registrant.dart
|
||||||
|
|||||||
@@ -81,5 +81,4 @@ flutter {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
implementation 'com.android.support:multidex:1.0.3'
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,4 +23,11 @@
|
|||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||||
|
|
||||||
|
<queries>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<data android:scheme="https" />
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
// Generated file.
|
|
||||||
//
|
|
||||||
// If you wish to remove Flutter's multidex support, delete this entire file.
|
|
||||||
//
|
|
||||||
// Modifications to this file should be done in a copy under a different name
|
|
||||||
// as this file may be regenerated.
|
|
||||||
|
|
||||||
package io.flutter.app;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.content.Context;
|
|
||||||
import androidx.annotation.CallSuper;
|
|
||||||
import androidx.multidex.MultiDex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extension of {@link android.app.Application}, adding multidex support.
|
|
||||||
*/
|
|
||||||
public class FlutterMultiDexApplication extends Application {
|
|
||||||
@Override
|
|
||||||
@CallSuper
|
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(base);
|
|
||||||
MultiDex.install(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
* Update to Material Design 3
|
||||||
|
* Fixed back button navigation - no longer return back to the home page
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* Added announcement pop-up when a new released is pushed out in Github.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
* Fixed crash issue when upload large file on slow network
|
||||||
|
* Updated album to conform with server refactoring of SharedAlbum to Album
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
* Added zoom functionality to the image viewer
|
||||||
|
* Fixed issue with the user is logged out after turning off the app
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* Fixed WebSocket endpoint to confirm with the new settings on the server
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
* Fixed app does not resume back up when reopening a closed app
|
||||||
|
* Fixed wrong asset count on the upload page
|
||||||
|
* Added mechanism to change the password of new user on the first login (except Admin)
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
* Fixed admin is forced to change password upon logging in on mobile app
|
||||||
|
* Fixed change password form validation
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* Removed thumbnail generation on mobile - the operation now will be on the server to reduce CPU load and battery usage.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* Hot fix: Restore shared album functionality
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* Add information for uploading asset and error indication with error message for each failed upload.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* Refactored app to use OpenAPI SDK to improve performance and project structure.
|
||||||
@@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
|
||||||
distributionSha256Sum=0080de8491f0918e4f529a6db6820fa0b9e818ee2386117f4394f95feb1d5583
|
distributionSha256Sum=cd5c2958a107ee7f0722004a12d0f8559b4564c34daad7df06cffd4d12a426d0
|
||||||
103
mobile/assets/i18n/de-DE.json
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"album_info_card_backup_album_excluded": "AUSGESCHLOSSEN",
|
||||||
|
"album_info_card_backup_album_included": "EINGESCHLOSSEN",
|
||||||
|
"album_viewer_appbar_share_delete": "Album löschen",
|
||||||
|
"album_viewer_appbar_share_err_delete": "Album konnte nicht gelöscht werden",
|
||||||
|
"album_viewer_appbar_share_err_leave": "Album konnte nicht verlassen werden",
|
||||||
|
"album_viewer_appbar_share_err_remove": "Beim Löschen von Elementen aus dem Album ist ein Problem aufgetreten",
|
||||||
|
"album_viewer_appbar_share_err_title": "Der Titel konnte nicht geändert werden",
|
||||||
|
"album_viewer_appbar_share_leave": "Album verlassen",
|
||||||
|
"album_viewer_appbar_share_remove": "Entferne vom Album",
|
||||||
|
"album_viewer_page_share_add_users": "Nutzer hinzufügen",
|
||||||
|
"backup_album_selection_page_albums_device": "Alben auf dem Gerät ({})",
|
||||||
|
"backup_album_selection_page_albums_tap": "Tippen um einzuschließen, doppelt tippen um zu entfernen",
|
||||||
|
"backup_album_selection_page_assets_scatter": "Elemente können sich über mehrere Alben verteilen. Daher können diese vor der Sicherung eingeschlossen oder ausgeschlossen werden",
|
||||||
|
"backup_album_selection_page_select_albums": "Alben auswählen",
|
||||||
|
"backup_album_selection_page_selection_info": "Auswahl",
|
||||||
|
"backup_album_selection_page_total_assets": "Elemente",
|
||||||
|
"backup_all": "Alle",
|
||||||
|
"backup_controller_page_albums": "Gesicherte Alben",
|
||||||
|
"backup_controller_page_backup": "Sicherung",
|
||||||
|
"backup_controller_page_backup_selected": "Ausgewählt: ",
|
||||||
|
"backup_controller_page_backup_sub": "Gesicherte Fotos und Videos",
|
||||||
|
"backup_controller_page_cancel": "Abbrechen",
|
||||||
|
"backup_controller_page_created": "Erstellt: {}",
|
||||||
|
"backup_controller_page_desc_backup": "Aktiviere die Sicherung um Elemente automatisch auf den Server zu laden.",
|
||||||
|
"backup_controller_page_excluded": "Ausgeschlossen: ",
|
||||||
|
"backup_controller_page_failed": "Fehlgeschlagen ({})",
|
||||||
|
"backup_controller_page_filename": "Dateiname: {} [{}]",
|
||||||
|
"backup_controller_page_id": "ID: {}",
|
||||||
|
"backup_controller_page_info": "Informationen zur Sicherung",
|
||||||
|
"backup_controller_page_none_selected": "Keine ausgewählt",
|
||||||
|
"backup_controller_page_remainder": "Übrig",
|
||||||
|
"backup_controller_page_remainder_sub": "Noch zu sichernde Fotos und Videos",
|
||||||
|
"backup_controller_page_select": "Auswählen",
|
||||||
|
"backup_controller_page_server_storage": "Server Speicher",
|
||||||
|
"backup_controller_page_start_backup": "Sicherung starten",
|
||||||
|
"backup_controller_page_status_off": "Sicherung ist inaktiv",
|
||||||
|
"backup_controller_page_status_on": "Sicherung ist aktiv",
|
||||||
|
"backup_controller_page_storage_format": "{} von {} genutzt",
|
||||||
|
"backup_controller_page_to_backup": "Zu sichernde Alben",
|
||||||
|
"backup_controller_page_total": "Gesamt",
|
||||||
|
"backup_controller_page_total_sub": "Alle Fotos und Videos",
|
||||||
|
"backup_controller_page_turn_off": "Sicherung ausschalten",
|
||||||
|
"backup_controller_page_turn_on": "Sicherung einschalten",
|
||||||
|
"backup_controller_page_uploading_file_info": "Informationen",
|
||||||
|
"backup_err_only_album": "Das einzige Album kann nicht entfernt werden",
|
||||||
|
"backup_info_card_assets": "Elemente",
|
||||||
|
"control_bottom_app_bar_delete": "Löschen",
|
||||||
|
"create_shared_album_page_share": "Teilen",
|
||||||
|
"create_shared_album_page_share_add_assets": "ELEMENTE HINZUFÜGEN",
|
||||||
|
"create_shared_album_page_share_select_photos": "Fotos auswählen",
|
||||||
|
"daily_title_text_date": "E, dd MMM",
|
||||||
|
"daily_title_text_date_year": "E, dd MMM, yyyy",
|
||||||
|
"date_format": "E d. LLL y • hh:mm",
|
||||||
|
"delete_dialog_alert": "Diese Elemente werden unwiderruflich von Immich und dem Gerät entfernt",
|
||||||
|
"delete_dialog_cancel": "Abbrechen",
|
||||||
|
"delete_dialog_ok": "Löschen",
|
||||||
|
"delete_dialog_title": "Für immer löschen",
|
||||||
|
"exif_bottom_sheet_description": "Beschreibung hinzufügen...",
|
||||||
|
"exif_bottom_sheet_details": "DETAILS",
|
||||||
|
"exif_bottom_sheet_location": "STANDORT",
|
||||||
|
"login_form_button_text": "Anmelden",
|
||||||
|
"login_form_email_hint": "deine@email.de",
|
||||||
|
"login_form_endpoint_hint": "http://deine-server-ip:port/api",
|
||||||
|
"login_form_endpoint_url": "Server URL",
|
||||||
|
"login_form_err_http": "Bitte gebe http:// oder https:// an",
|
||||||
|
"login_form_err_invalid_email": "Ungültige E-Mail",
|
||||||
|
"login_form_err_leading_whitespace": "Führendes Leerzichen",
|
||||||
|
"login_form_err_trailing_whitespace": "Folgendes Leerzeichen",
|
||||||
|
"login_form_label_email": "E-Mail",
|
||||||
|
"login_form_label_password": "Passwort",
|
||||||
|
"login_form_password_hint": "password",
|
||||||
|
"login_form_save_login": "Angemeldet bleiben",
|
||||||
|
"monthly_title_text_date_format": "MMMM y",
|
||||||
|
"profile_drawer_client_server_up_to_date": "App und Server sind aktuell",
|
||||||
|
"profile_drawer_sign_out": "Abmelden",
|
||||||
|
"search_bar_hint": "Durchsuche deine Fotos",
|
||||||
|
"search_page_no_places": "Keine Informationen über Orte verfügbar",
|
||||||
|
"search_page_places": "Orte",
|
||||||
|
"search_page_things": "Dinge",
|
||||||
|
"search_result_page_new_search_hint": "Neue Suche",
|
||||||
|
"select_additional_user_for_sharing_page_suggestions": "Vorschläge",
|
||||||
|
"select_user_for_sharing_page_err_album": "Album konnte nicht erstellt werden",
|
||||||
|
"share_add": "Hinzufügen",
|
||||||
|
"share_add_photos": "Fotos hinzufügen",
|
||||||
|
"share_add_title": "Titel hinzufügen",
|
||||||
|
"share_create_album": "Album erstellen",
|
||||||
|
"share_invite": "Zum Album einladen",
|
||||||
|
"sharing_page_album": "Geteilte Alben",
|
||||||
|
"sharing_page_description": "Erstelle ein geteiltes Album um Fotos und Videos mit Personen in deinem Netzwerk zu teilen.",
|
||||||
|
"sharing_page_empty_list": "LEERE LISTE",
|
||||||
|
"sharing_silver_appbar_create_shared_album": "Neues geteiltes Album",
|
||||||
|
"sharing_silver_appbar_share_partner": "Teile mit Partner",
|
||||||
|
"tab_controller_nav_photos": "Fotos",
|
||||||
|
"tab_controller_nav_search": "Suche",
|
||||||
|
"tab_controller_nav_sharing": "Teilen",
|
||||||
|
"version_announcement_overlay_ack": "Ich habe verstanden",
|
||||||
|
"version_announcement_overlay_release_notes": "Änderungsprotokoll",
|
||||||
|
"version_announcement_overlay_text_1": "Hallo mein Freund! Es gibt eine neue Version von",
|
||||||
|
"version_announcement_overlay_text_2": "Bitte nehm dir die Zeit und lese das ",
|
||||||
|
"version_announcement_overlay_text_3": " und achte darauf, dass deine docker-compose und .env Dateien aktuell sind, vor allem wenn du ein System für automatische Updates benutzt (z.B. Watchtower).",
|
||||||
|
"version_announcement_overlay_title": "Neue Server-Version verfügbar \uD83C\uDF89"
|
||||||
|
}
|
||||||
105
mobile/assets/i18n/en-US.json
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
{
|
||||||
|
"album_info_card_backup_album_excluded": "EXCLUDED",
|
||||||
|
"album_info_card_backup_album_included": "INCLUDED",
|
||||||
|
"album_viewer_appbar_share_delete": "Delete album",
|
||||||
|
"album_viewer_appbar_share_err_delete": "Failed to delete album",
|
||||||
|
"album_viewer_appbar_share_err_leave": "Failed to leave album",
|
||||||
|
"album_viewer_appbar_share_err_remove": "There are problems in removing assets from album",
|
||||||
|
"album_viewer_appbar_share_err_title": "Failed to change album title",
|
||||||
|
"album_viewer_appbar_share_leave": "Leave album",
|
||||||
|
"album_viewer_appbar_share_remove": "Remove from album",
|
||||||
|
"album_viewer_page_share_add_users": "Add users",
|
||||||
|
"backup_album_selection_page_albums_device": "Albums on device ({})",
|
||||||
|
"backup_album_selection_page_albums_tap": "Tap to include, double tap to exclude",
|
||||||
|
"backup_album_selection_page_assets_scatter": "Assets can scatter across multiple albums. Thus, albums can be included or excluded during the backup process.",
|
||||||
|
"backup_album_selection_page_select_albums": "Select Albums",
|
||||||
|
"backup_album_selection_page_selection_info": "Selection Info",
|
||||||
|
"backup_album_selection_page_total_assets": "Total unique assets",
|
||||||
|
"backup_all": "All",
|
||||||
|
"backup_controller_page_albums": "Backup Albums",
|
||||||
|
"backup_controller_page_backup": "Backup",
|
||||||
|
"backup_controller_page_backup_selected": "Selected: ",
|
||||||
|
"backup_controller_page_backup_sub": "Backed up photos and videos",
|
||||||
|
"backup_controller_page_cancel": "Cancel",
|
||||||
|
"backup_controller_page_created": "Created on: {}",
|
||||||
|
"backup_controller_page_desc_backup": "Turn on backup to automatically upload new assets to the server.",
|
||||||
|
"backup_controller_page_excluded": "Excluded: ",
|
||||||
|
"backup_controller_page_failed": "Failed ({})",
|
||||||
|
"backup_controller_page_filename": "File name: {} [{}]",
|
||||||
|
"backup_controller_page_id": "ID: {}",
|
||||||
|
"backup_controller_page_info": "Backup Information",
|
||||||
|
"backup_controller_page_none_selected": "None selected",
|
||||||
|
"backup_controller_page_remainder": "Remainder",
|
||||||
|
"backup_controller_page_remainder_sub": "Remaining photos and albums to back up from selection",
|
||||||
|
"backup_controller_page_select": "Select",
|
||||||
|
"backup_controller_page_server_storage": "Server Storage",
|
||||||
|
"backup_controller_page_start_backup": "Start Backup",
|
||||||
|
"backup_controller_page_status_off": "Backup is off",
|
||||||
|
"backup_controller_page_status_on": "Backup is on",
|
||||||
|
"backup_controller_page_storage_format": "{} of {} used",
|
||||||
|
"backup_controller_page_to_backup": "Albums to be backup",
|
||||||
|
"backup_controller_page_total": "Total",
|
||||||
|
"backup_controller_page_total_sub": "All unique photos and videos from selected albums",
|
||||||
|
"backup_controller_page_turn_off": "Turn off Backup",
|
||||||
|
"backup_controller_page_turn_on": "Turn on Backup",
|
||||||
|
"backup_controller_page_uploading_file_info": "Uploading file info",
|
||||||
|
"backup_err_only_album": "Cannot remove the only album",
|
||||||
|
"backup_info_card_assets": "assets",
|
||||||
|
"control_bottom_app_bar_delete": "Delete",
|
||||||
|
"create_shared_album_page_share": "Share",
|
||||||
|
"create_shared_album_page_share_add_assets": "ADD ASSETS",
|
||||||
|
"create_shared_album_page_share_select_photos": "Select Photos",
|
||||||
|
"daily_title_text_date": "E, MMM dd",
|
||||||
|
"daily_title_text_date_year": "E, MMM dd, yyyy",
|
||||||
|
"date_format": "E, LLL d, y • h:mm a",
|
||||||
|
"delete_dialog_alert": "These items will be permanently deleted from Immich and from your device",
|
||||||
|
"delete_dialog_cancel": "Cancel",
|
||||||
|
"delete_dialog_ok": "Delete",
|
||||||
|
"delete_dialog_title": "Delete Permanently",
|
||||||
|
"exif_bottom_sheet_description": "Add Description...",
|
||||||
|
"exif_bottom_sheet_details": "DETAILS",
|
||||||
|
"exif_bottom_sheet_location": "LOCATION",
|
||||||
|
"login_form_button_text": "Login",
|
||||||
|
"login_form_email_hint": "youremail@email.com",
|
||||||
|
"login_form_endpoint_hint": "http://your-server-ip:port/api",
|
||||||
|
"login_form_endpoint_url": "Server Endpoint URL",
|
||||||
|
"login_form_err_http": "Please specify http:// or https://",
|
||||||
|
"login_form_err_invalid_email": "Invalid Email",
|
||||||
|
"login_form_err_leading_whitespace": "Leading whitespace",
|
||||||
|
"login_form_err_trailing_whitespace": "Trailing whitespace",
|
||||||
|
"login_form_label_email": "Email",
|
||||||
|
"login_form_label_password": "Password",
|
||||||
|
"login_form_password_hint": "password",
|
||||||
|
"login_form_save_login": "Stay logged in",
|
||||||
|
"login_form_failed_login": "Error logging you in, check server url, email and password",
|
||||||
|
"monthly_title_text_date_format": "MMMM y",
|
||||||
|
"profile_drawer_client_server_up_to_date": "Client and Server are up-to-date",
|
||||||
|
"profile_drawer_sign_out": "Sign Out",
|
||||||
|
"search_bar_hint": "Search your photos",
|
||||||
|
"search_page_no_places": "No Places Info Available",
|
||||||
|
"search_page_places": "Places",
|
||||||
|
"search_page_things": "Things",
|
||||||
|
"search_result_page_new_search_hint": "New Search",
|
||||||
|
"select_additional_user_for_sharing_page_suggestions": "Suggestions",
|
||||||
|
"select_user_for_sharing_page_err_album": "Failed to create album",
|
||||||
|
"select_user_for_sharing_page_share_suggestions": "Suggestions",
|
||||||
|
"share_add": "Add",
|
||||||
|
"share_add_photos": "Add photos",
|
||||||
|
"share_add_title": "Add a title",
|
||||||
|
"share_create_album": "Create album",
|
||||||
|
"share_invite": "Invite to album",
|
||||||
|
"sharing_page_album": "Shared albums",
|
||||||
|
"sharing_page_description": "Create shared albums to share photos and videos with people in your network.",
|
||||||
|
"sharing_page_empty_list": "EMPTY LIST",
|
||||||
|
"sharing_silver_appbar_create_shared_album": "Create shared album",
|
||||||
|
"sharing_silver_appbar_share_partner": "Share with partner",
|
||||||
|
"tab_controller_nav_photos": "Photos",
|
||||||
|
"tab_controller_nav_search": "Search",
|
||||||
|
"tab_controller_nav_sharing": "Sharing",
|
||||||
|
"version_announcement_overlay_ack": "Acknowledge",
|
||||||
|
"version_announcement_overlay_release_notes": "release notes",
|
||||||
|
"version_announcement_overlay_text_1": "Hi friend, there is a new release of",
|
||||||
|
"version_announcement_overlay_text_2": "please take your time to visit the ",
|
||||||
|
"version_announcement_overlay_text_3": " and ensure your docker-compose and .env setup is up-to-date to prevent any misconfigurations, especially if you use WatchTower or any mechanism that handles updating your server application automatically.",
|
||||||
|
"version_announcement_overlay_title": "New Server Version Available \uD83C\uDF89"
|
||||||
|
}
|
||||||
@@ -23,6 +23,8 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- FMDB (>= 2.7.5)
|
- FMDB (>= 2.7.5)
|
||||||
- Toast (4.0.0)
|
- Toast (4.0.0)
|
||||||
|
- url_launcher_ios (0.0.1):
|
||||||
|
- Flutter
|
||||||
- video_player_avfoundation (0.0.1):
|
- video_player_avfoundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- wakelock (0.0.1):
|
- wakelock (0.0.1):
|
||||||
@@ -37,6 +39,7 @@ DEPENDENCIES:
|
|||||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||||
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
|
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
|
||||||
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||||
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
|
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
|
||||||
- wakelock (from `.symlinks/plugins/wakelock/ios`)
|
- wakelock (from `.symlinks/plugins/wakelock/ios`)
|
||||||
|
|
||||||
@@ -63,6 +66,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/photo_manager/ios"
|
:path: ".symlinks/plugins/photo_manager/ios"
|
||||||
sqflite:
|
sqflite:
|
||||||
:path: ".symlinks/plugins/sqflite/ios"
|
:path: ".symlinks/plugins/sqflite/ios"
|
||||||
|
url_launcher_ios:
|
||||||
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
video_player_avfoundation:
|
video_player_avfoundation:
|
||||||
:path: ".symlinks/plugins/video_player_avfoundation/ios"
|
:path: ".symlinks/plugins/video_player_avfoundation/ios"
|
||||||
wakelock:
|
wakelock:
|
||||||
@@ -80,6 +85,7 @@ SPEC CHECKSUMS:
|
|||||||
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
|
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
|
||||||
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
|
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
|
||||||
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
||||||
|
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
|
||||||
video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff
|
video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff
|
||||||
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
|
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
@@ -76,5 +76,17 @@
|
|||||||
<false />
|
<false />
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
<true />
|
<true />
|
||||||
|
|
||||||
|
|
||||||
|
<key>LSApplicationQueriesSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>https</string>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<key>CFBundleLocalizations</key>
|
||||||
|
<array>
|
||||||
|
<string>en</string>
|
||||||
|
<string>de</string>
|
||||||
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -19,7 +19,7 @@ platform :ios do
|
|||||||
desc "iOS Beta"
|
desc "iOS Beta"
|
||||||
lane :beta do
|
lane :beta do
|
||||||
increment_version_number(
|
increment_version_number(
|
||||||
version_number: "1.10.0"
|
version_number: "1.18.0"
|
||||||
)
|
)
|
||||||
increment_build_number(
|
increment_build_number(
|
||||||
build_number: latest_testflight_build_number + 1,
|
build_number: latest_testflight_build_number + 1,
|
||||||
|
|||||||
@@ -2,14 +2,17 @@
|
|||||||
const String userInfoBox = "immichBoxUserInfo"; // Box
|
const String userInfoBox = "immichBoxUserInfo"; // Box
|
||||||
const String accessTokenKey = "immichBoxAccessTokenKey"; // Key 1
|
const String accessTokenKey = "immichBoxAccessTokenKey"; // Key 1
|
||||||
const String deviceIdKey = 'immichBoxDeviceIdKey'; // Key 2
|
const String deviceIdKey = 'immichBoxDeviceIdKey'; // Key 2
|
||||||
|
const String isLoggedInKey = 'immichIsLoggedInKey'; // Key 3
|
||||||
// Server endpoint
|
const String serverEndpointKey = 'immichBoxServerEndpoint'; // Key 4
|
||||||
const String serverEndpointKey = 'immichBoxServerEndpoint';
|
|
||||||
|
|
||||||
// Login Info
|
// Login Info
|
||||||
const String hiveLoginInfoBox = "immichLoginInfoBox";
|
const String hiveLoginInfoBox = "immichLoginInfoBox"; // Box
|
||||||
const String savedLoginInfoKey = "immichSavedLoginInfoKey";
|
const String savedLoginInfoKey = "immichSavedLoginInfoKey"; // Key 1
|
||||||
|
|
||||||
// Backup Info
|
// Backup Info
|
||||||
const String hiveBackupInfoBox = "immichBackupAlbumInfoBox";
|
const String hiveBackupInfoBox = "immichBackupAlbumInfoBox"; // Box
|
||||||
const String backupInfoKey = "immichBackupAlbumInfoKey";
|
const String backupInfoKey = "immichBackupAlbumInfoKey"; // Key 1
|
||||||
|
|
||||||
|
// Github Release Info
|
||||||
|
const String hiveGithubReleaseInfoBox = "immichGithubReleaseInfoBox"; // Box
|
||||||
|
const String githubReleaseInfoKey = "immichGithubReleaseInfoKey"; // Key 1
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/immich_colors.dart';
|
import 'package:immich_mobile/constants/immich_colors.dart';
|
||||||
import 'package:immich_mobile/modules/backup/models/hive_backup_albums.model.dart';
|
import 'package:immich_mobile/modules/backup/models/hive_backup_albums.model.dart';
|
||||||
|
import 'package:immich_mobile/modules/backup/providers/backup.provider.dart';
|
||||||
import 'package:immich_mobile/modules/login/models/hive_saved_login_info.model.dart';
|
import 'package:immich_mobile/modules/login/models/hive_saved_login_info.model.dart';
|
||||||
import 'package:immich_mobile/shared/providers/asset.provider.dart';
|
import 'package:immich_mobile/modules/login/providers/authentication.provider.dart';
|
||||||
import 'package:immich_mobile/routing/router.dart';
|
import 'package:immich_mobile/routing/router.dart';
|
||||||
import 'package:immich_mobile/routing/tab_navigation_observer.dart';
|
import 'package:immich_mobile/routing/tab_navigation_observer.dart';
|
||||||
import 'package:immich_mobile/shared/providers/app_state.provider.dart';
|
import 'package:immich_mobile/shared/providers/app_state.provider.dart';
|
||||||
import 'package:immich_mobile/modules/backup/providers/backup.provider.dart';
|
import 'package:immich_mobile/shared/providers/asset.provider.dart';
|
||||||
|
import 'package:immich_mobile/shared/providers/release_info.provider.dart';
|
||||||
import 'package:immich_mobile/shared/providers/server_info.provider.dart';
|
import 'package:immich_mobile/shared/providers/server_info.provider.dart';
|
||||||
import 'package:immich_mobile/shared/providers/websocket.provider.dart';
|
import 'package:immich_mobile/shared/providers/websocket.provider.dart';
|
||||||
import 'package:immich_mobile/shared/views/immich_loading_overlay.dart';
|
import 'package:immich_mobile/shared/views/immich_loading_overlay.dart';
|
||||||
|
import 'package:immich_mobile/shared/views/version_announcement_overlay.dart';
|
||||||
|
|
||||||
import 'constants/hive_box.dart';
|
import 'constants/hive_box.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
@@ -24,6 +29,7 @@ void main() async {
|
|||||||
await Hive.openBox(userInfoBox);
|
await Hive.openBox(userInfoBox);
|
||||||
await Hive.openBox<HiveSavedLoginInfo>(hiveLoginInfoBox);
|
await Hive.openBox<HiveSavedLoginInfo>(hiveLoginInfoBox);
|
||||||
await Hive.openBox<HiveBackupAlbums>(hiveBackupInfoBox);
|
await Hive.openBox<HiveBackupAlbums>(hiveBackupInfoBox);
|
||||||
|
await Hive.openBox(hiveGithubReleaseInfoBox);
|
||||||
|
|
||||||
SystemChrome.setSystemUIOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
const SystemUiOverlayStyle(
|
const SystemUiOverlayStyle(
|
||||||
@@ -31,27 +37,53 @@ void main() async {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
runApp(const ProviderScope(child: ImmichApp()));
|
await EasyLocalization.ensureInitialized();
|
||||||
|
|
||||||
|
var locales = const [
|
||||||
|
// Default locale
|
||||||
|
Locale('en', 'US'),
|
||||||
|
// Additional locales
|
||||||
|
Locale('de', 'DE')
|
||||||
|
];
|
||||||
|
|
||||||
|
runApp(
|
||||||
|
EasyLocalization(
|
||||||
|
supportedLocales: locales,
|
||||||
|
path: 'assets/i18n',
|
||||||
|
useFallbackTranslations: true,
|
||||||
|
fallbackLocale: locales.first,
|
||||||
|
child: const ProviderScope(child: ImmichApp()),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImmichApp extends ConsumerStatefulWidget {
|
class ImmichApp extends ConsumerStatefulWidget {
|
||||||
const ImmichApp({Key? key}) : super(key: key);
|
const ImmichApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ImmichAppState createState() => _ImmichAppState();
|
ImmichAppState createState() => ImmichAppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserver {
|
class ImmichAppState extends ConsumerState<ImmichApp>
|
||||||
|
with WidgetsBindingObserver {
|
||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case AppLifecycleState.resumed:
|
case AppLifecycleState.resumed:
|
||||||
debugPrint("[APP STATE] resumed");
|
debugPrint("[APP STATE] resumed");
|
||||||
ref.watch(appStateProvider.notifier).state = AppStateEnum.resumed;
|
ref.watch(appStateProvider.notifier).state = AppStateEnum.resumed;
|
||||||
ref.watch(backupProvider.notifier).resumeBackup();
|
|
||||||
|
var isAuthenticated = ref.watch(authenticationProvider).isAuthenticated;
|
||||||
|
|
||||||
|
if (isAuthenticated) {
|
||||||
|
ref.watch(backupProvider.notifier).resumeBackup();
|
||||||
|
ref.watch(assetProvider.notifier).getAllAsset();
|
||||||
|
ref.watch(serverInfoProvider.notifier).getServerVersion();
|
||||||
|
}
|
||||||
|
|
||||||
ref.watch(websocketProvider.notifier).connect();
|
ref.watch(websocketProvider.notifier).connect();
|
||||||
ref.watch(assetProvider.notifier).getAllAsset();
|
|
||||||
ref.watch(serverInfoProvider.notifier).getServerVersion();
|
ref.watch(releaseInfoProvider.notifier).checkGithubReleaseInfo();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -82,6 +114,7 @@ class _ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserv
|
|||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
initApp().then((_) => debugPrint("App Init Completed"));
|
initApp().then((_) => debugPrint("App Init Completed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,11 +124,15 @@ class _ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserv
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
final _immichRouter = AppRouter();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
var router = ref.watch(appRouterProvider);
|
||||||
|
ref.watch(releaseInfoProvider.notifier).checkGithubReleaseInfo();
|
||||||
|
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
localizationsDelegates: context.localizationDelegates,
|
||||||
|
supportedLocales: context.supportedLocales,
|
||||||
|
locale: context.locale,
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
home: Stack(
|
home: Stack(
|
||||||
children: [
|
children: [
|
||||||
@@ -103,10 +140,13 @@ class _ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserv
|
|||||||
title: 'Immich',
|
title: 'Immich',
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: true,
|
||||||
brightness: Brightness.light,
|
brightness: Brightness.light,
|
||||||
primarySwatch: Colors.indigo,
|
primarySwatch: Colors.indigo,
|
||||||
fontFamily: 'WorkSans',
|
fontFamily: 'WorkSans',
|
||||||
snackBarTheme: const SnackBarThemeData(contentTextStyle: TextStyle(fontFamily: 'WorkSans')),
|
snackBarTheme: const SnackBarThemeData(
|
||||||
|
contentTextStyle: TextStyle(fontFamily: 'WorkSans'),
|
||||||
|
),
|
||||||
scaffoldBackgroundColor: immichBackgroundColor,
|
scaffoldBackgroundColor: immichBackgroundColor,
|
||||||
appBarTheme: const AppBarTheme(
|
appBarTheme: const AppBarTheme(
|
||||||
backgroundColor: immichBackgroundColor,
|
backgroundColor: immichBackgroundColor,
|
||||||
@@ -116,10 +156,13 @@ class _ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserv
|
|||||||
systemOverlayStyle: SystemUiOverlayStyle.dark,
|
systemOverlayStyle: SystemUiOverlayStyle.dark,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
routeInformationParser: _immichRouter.defaultRouteParser(),
|
routeInformationParser: router.defaultRouteParser(),
|
||||||
routerDelegate: _immichRouter.delegate(navigatorObservers: () => [TabNavigationObserver(ref: ref)]),
|
routerDelegate: router.delegate(
|
||||||
|
navigatorObservers: () => [TabNavigationObserver(ref: ref)],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const ImmichLoadingOverlay(),
|
const ImmichLoadingOverlay(),
|
||||||
|
const VersionAnnouncementOverlay(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,22 +28,26 @@ class ImageViewerPageState {
|
|||||||
|
|
||||||
factory ImageViewerPageState.fromMap(Map<String, dynamic> map) {
|
factory ImageViewerPageState.fromMap(Map<String, dynamic> map) {
|
||||||
return ImageViewerPageState(
|
return ImageViewerPageState(
|
||||||
downloadAssetStatus: DownloadAssetStatus.values[map['downloadAssetStatus'] ?? 0],
|
downloadAssetStatus:
|
||||||
|
DownloadAssetStatus.values[map['downloadAssetStatus'] ?? 0],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
factory ImageViewerPageState.fromJson(String source) => ImageViewerPageState.fromMap(json.decode(source));
|
factory ImageViewerPageState.fromJson(String source) =>
|
||||||
|
ImageViewerPageState.fromMap(json.decode(source));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'ImageViewerPageState(downloadAssetStatus: $downloadAssetStatus)';
|
String toString() =>
|
||||||
|
'ImageViewerPageState(downloadAssetStatus: $downloadAssetStatus)';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return other is ImageViewerPageState && other.downloadAssetStatus == downloadAssetStatus;
|
return other is ImageViewerPageState &&
|
||||||
|
other.downloadAssetStatus == downloadAssetStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -3,15 +3,20 @@ import 'package:fluttertoast/fluttertoast.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/models/image_viewer_page_state.model.dart';
|
import 'package:immich_mobile/modules/asset_viewer/models/image_viewer_page_state.model.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/services/image_viewer.service.dart';
|
import 'package:immich_mobile/modules/asset_viewer/services/image_viewer.service.dart';
|
||||||
import 'package:immich_mobile/shared/models/immich_asset.model.dart';
|
|
||||||
import 'package:immich_mobile/shared/ui/immich_toast.dart';
|
import 'package:immich_mobile/shared/ui/immich_toast.dart';
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
class ImageViewerStateNotifier extends StateNotifier<ImageViewerPageState> {
|
class ImageViewerStateNotifier extends StateNotifier<ImageViewerPageState> {
|
||||||
final ImageViewerService _imageViewerService = ImageViewerService();
|
final ImageViewerService _imageViewerService;
|
||||||
|
|
||||||
ImageViewerStateNotifier() : super(ImageViewerPageState(downloadAssetStatus: DownloadAssetStatus.idle));
|
ImageViewerStateNotifier(this._imageViewerService)
|
||||||
|
: super(
|
||||||
|
ImageViewerPageState(
|
||||||
|
downloadAssetStatus: DownloadAssetStatus.idle,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
void downloadAsset(ImmichAsset asset, BuildContext context) async {
|
void downloadAsset(AssetResponseDto asset, BuildContext context) async {
|
||||||
state = state.copyWith(downloadAssetStatus: DownloadAssetStatus.loading);
|
state = state.copyWith(downloadAssetStatus: DownloadAssetStatus.loading);
|
||||||
|
|
||||||
bool isSuccess = await _imageViewerService.downloadAssetToDevice(asset);
|
bool isSuccess = await _imageViewerService.downloadAssetToDevice(asset);
|
||||||
@@ -40,4 +45,6 @@ class ImageViewerStateNotifier extends StateNotifier<ImageViewerPageState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final imageViewerStateProvider =
|
final imageViewerStateProvider =
|
||||||
StateNotifierProvider<ImageViewerStateNotifier, ImageViewerPageState>(((ref) => ImageViewerStateNotifier()));
|
StateNotifierProvider<ImageViewerStateNotifier, ImageViewerPageState>(
|
||||||
|
((ref) => ImageViewerStateNotifier(ref.watch(imageViewerServiceProvider))),
|
||||||
|
);
|
||||||
|
|||||||
@@ -1,31 +1,35 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/hive_box.dart';
|
import 'package:immich_mobile/shared/services/api.service.dart';
|
||||||
import 'package:immich_mobile/shared/models/immich_asset.model.dart';
|
import 'package:openapi/api.dart';
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
|
|
||||||
import 'package:photo_manager/photo_manager.dart';
|
import 'package:photo_manager/photo_manager.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
|
final imageViewerServiceProvider =
|
||||||
|
Provider((ref) => ImageViewerService(ref.watch(apiServiceProvider)));
|
||||||
|
|
||||||
class ImageViewerService {
|
class ImageViewerService {
|
||||||
Future<bool> downloadAssetToDevice(ImmichAsset asset) async {
|
final ApiService _apiService;
|
||||||
|
ImageViewerService(this._apiService);
|
||||||
|
|
||||||
|
Future<bool> downloadAssetToDevice(AssetResponseDto asset) async {
|
||||||
try {
|
try {
|
||||||
String fileName = p.basename(asset.originalPath);
|
String fileName = p.basename(asset.originalPath);
|
||||||
var savedEndpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
|
||||||
Uri filePath =
|
|
||||||
Uri.parse("$savedEndpoint/asset/download?aid=${asset.deviceAssetId}&did=${asset.deviceId}&isThumb=false");
|
|
||||||
|
|
||||||
var res = await http.get(
|
var res = await _apiService.assetApi.downloadFileWithHttpInfo(
|
||||||
filePath,
|
asset.deviceAssetId,
|
||||||
headers: {"Authorization": "Bearer ${Hive.box(userInfoBox).get(accessTokenKey)}"},
|
asset.deviceId,
|
||||||
|
isThumb: false,
|
||||||
|
isWeb: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final AssetEntity? entity;
|
final AssetEntity? entity;
|
||||||
|
|
||||||
if (asset.type == 'IMAGE') {
|
if (asset.type == AssetTypeEnum.IMAGE) {
|
||||||
entity = await PhotoManager.editor.saveImage(
|
entity = await PhotoManager.editor.saveImage(
|
||||||
res.bodyBytes,
|
res.bodyBytes,
|
||||||
title: p.basename(asset.originalPath),
|
title: p.basename(asset.originalPath),
|
||||||
@@ -37,14 +41,10 @@ class ImageViewerService {
|
|||||||
entity = await PhotoManager.editor.saveVideo(tempFile, title: fileName);
|
entity = await PhotoManager.editor.saveVideo(tempFile, title: fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity != null) {
|
return entity != null;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error saving file $e");
|
debugPrint("Error saving file $e");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,173 +1,185 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/shared/models/immich_asset_with_exif.model.dart';
|
import 'package:openapi/api.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
|
|
||||||
class ExifBottomSheet extends ConsumerWidget {
|
class ExifBottomSheet extends ConsumerWidget {
|
||||||
final ImmichAssetWithExif assetDetail;
|
final AssetResponseDto assetDetail;
|
||||||
|
|
||||||
const ExifBottomSheet({Key? key, required this.assetDetail}) : super(key: key);
|
const ExifBottomSheet({Key? key, required this.assetDetail})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
_buildMap() {
|
_buildMap() {
|
||||||
return (assetDetail.exifInfo!.latitude != null && assetDetail.exifInfo!.longitude != null)
|
return Padding(
|
||||||
? Padding(
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
child: Container(
|
||||||
child: Container(
|
height: 150,
|
||||||
height: 150,
|
width: MediaQuery.of(context).size.width,
|
||||||
width: MediaQuery.of(context).size.width,
|
decoration: const BoxDecoration(
|
||||||
decoration: const BoxDecoration(
|
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
),
|
||||||
),
|
child: FlutterMap(
|
||||||
child: FlutterMap(
|
options: MapOptions(
|
||||||
options: MapOptions(
|
center: LatLng(
|
||||||
center: LatLng(assetDetail.exifInfo!.latitude!, assetDetail.exifInfo!.longitude!),
|
assetDetail.exifInfo?.latitude?.toDouble() ?? 0,
|
||||||
zoom: 16.0,
|
assetDetail.exifInfo?.longitude?.toDouble() ?? 0,
|
||||||
),
|
|
||||||
layers: [
|
|
||||||
TileLayerOptions(
|
|
||||||
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
||||||
subdomains: ['a', 'b', 'c'],
|
|
||||||
attributionBuilder: (_) {
|
|
||||||
return const Text(
|
|
||||||
"© OpenStreetMap",
|
|
||||||
style: TextStyle(fontSize: 10),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
MarkerLayerOptions(
|
|
||||||
markers: [
|
|
||||||
Marker(
|
|
||||||
anchorPos: AnchorPos.align(AnchorAlign.top),
|
|
||||||
point: LatLng(assetDetail.exifInfo!.latitude!, assetDetail.exifInfo!.longitude!),
|
|
||||||
builder: (ctx) => const Image(image: AssetImage('assets/location-pin.png')),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
zoom: 16.0,
|
||||||
: Container();
|
),
|
||||||
|
layers: [
|
||||||
|
TileLayerOptions(
|
||||||
|
urlTemplate:
|
||||||
|
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
|
subdomains: ['a', 'b', 'c'],
|
||||||
|
attributionBuilder: (_) {
|
||||||
|
return const Text(
|
||||||
|
"© OpenStreetMap",
|
||||||
|
style: TextStyle(fontSize: 10),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
MarkerLayerOptions(
|
||||||
|
markers: [
|
||||||
|
Marker(
|
||||||
|
anchorPos: AnchorPos.align(AnchorAlign.top),
|
||||||
|
point: LatLng(
|
||||||
|
assetDetail.exifInfo?.latitude?.toDouble() ?? 0,
|
||||||
|
assetDetail.exifInfo?.longitude?.toDouble() ?? 0,
|
||||||
|
),
|
||||||
|
builder: (ctx) => const Image(
|
||||||
|
image: AssetImage('assets/location-pin.png'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildLocationText() {
|
_buildLocationText() {
|
||||||
return (assetDetail.exifInfo!.city != null && assetDetail.exifInfo!.state != null)
|
return Text(
|
||||||
? Text(
|
"${assetDetail.exifInfo!.city}, ${assetDetail.exifInfo!.state}",
|
||||||
"${assetDetail.exifInfo!.city}, ${assetDetail.exifInfo!.state}",
|
style: TextStyle(
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey[200], fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
)
|
color: Colors.grey[200],
|
||||||
: Container();
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8),
|
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
assetDetail.exifInfo?.dateTimeOriginal != null
|
if (assetDetail.exifInfo?.dateTimeOriginal != null)
|
||||||
? Text(
|
Text(
|
||||||
DateFormat('E, LLL d, y • h:mm a').format(
|
DateFormat('date_format'.tr()).format(
|
||||||
DateTime.parse(assetDetail.exifInfo!.dateTimeOriginal!),
|
assetDetail.exifInfo!.dateTimeOriginal!,
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.grey[400],
|
color: Colors.grey[400],
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
: Container(),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 16.0),
|
padding: const EdgeInsets.only(top: 16.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Add Description...",
|
"exif_bottom_sheet_description",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.grey[500],
|
color: Colors.grey[500],
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
),
|
).tr(),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Location
|
// Location
|
||||||
assetDetail.exifInfo?.latitude != null
|
if (assetDetail.exifInfo?.latitude != null)
|
||||||
? Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 32.0),
|
padding: const EdgeInsets.only(top: 32.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Divider(
|
Divider(
|
||||||
thickness: 1,
|
thickness: 1,
|
||||||
color: Colors.grey[600],
|
color: Colors.grey[600],
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"LOCATION",
|
|
||||||
style: TextStyle(fontSize: 11, color: Colors.grey[400]),
|
|
||||||
),
|
|
||||||
_buildMap(),
|
|
||||||
_buildLocationText(),
|
|
||||||
Text(
|
|
||||||
"${assetDetail.exifInfo!.latitude!.toStringAsFixed(4)}, ${assetDetail.exifInfo!.longitude!.toStringAsFixed(4)}",
|
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
Text(
|
||||||
: Container(),
|
"exif_bottom_sheet_location",
|
||||||
|
style: TextStyle(fontSize: 11, color: Colors.grey[400]),
|
||||||
|
).tr(),
|
||||||
|
if (assetDetail.exifInfo?.latitude != null &&
|
||||||
|
assetDetail.exifInfo?.longitude != null)
|
||||||
|
_buildMap(),
|
||||||
|
if (assetDetail.exifInfo?.city != null &&
|
||||||
|
assetDetail.exifInfo?.state != null)
|
||||||
|
_buildLocationText(),
|
||||||
|
Text(
|
||||||
|
"${assetDetail.exifInfo?.latitude?.toStringAsFixed(4)}, ${assetDetail.exifInfo?.longitude?.toStringAsFixed(4)}",
|
||||||
|
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
// Detail
|
// Detail
|
||||||
assetDetail.exifInfo != null
|
if (assetDetail.exifInfo != null)
|
||||||
? Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 32.0),
|
padding: const EdgeInsets.only(top: 32.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Divider(
|
Divider(
|
||||||
thickness: 1,
|
thickness: 1,
|
||||||
color: Colors.grey[600],
|
color: Colors.grey[600],
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 8.0),
|
|
||||||
child: Text(
|
|
||||||
"DETAILS",
|
|
||||||
style: TextStyle(fontSize: 11, color: Colors.grey[400]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
contentPadding: const EdgeInsets.all(0),
|
|
||||||
dense: true,
|
|
||||||
textColor: Colors.grey[300],
|
|
||||||
iconColor: Colors.grey[300],
|
|
||||||
leading: const Icon(Icons.image),
|
|
||||||
title: Text(
|
|
||||||
"${assetDetail.exifInfo?.imageName!}${p.extension(assetDetail.originalPath)}",
|
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
subtitle: assetDetail.exifInfo?.exifImageHeight != null
|
|
||||||
? Text(
|
|
||||||
"${assetDetail.exifInfo?.exifImageHeight} x ${assetDetail.exifInfo?.exifImageWidth} ${assetDetail.exifInfo?.fileSizeInByte!}B ")
|
|
||||||
: Container(),
|
|
||||||
),
|
|
||||||
assetDetail.exifInfo?.make != null
|
|
||||||
? ListTile(
|
|
||||||
contentPadding: const EdgeInsets.all(0),
|
|
||||||
dense: true,
|
|
||||||
textColor: Colors.grey[300],
|
|
||||||
iconColor: Colors.grey[300],
|
|
||||||
leading: const Icon(Icons.camera),
|
|
||||||
title: Text(
|
|
||||||
"${assetDetail.exifInfo?.make} ${assetDetail.exifInfo?.model}",
|
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
subtitle: Text(
|
|
||||||
"ƒ/${assetDetail.exifInfo?.fNumber} 1/${(1 / assetDetail.exifInfo!.exposureTime!).toStringAsFixed(0)} ${assetDetail.exifInfo?.focalLength}mm ISO${assetDetail.exifInfo?.iso} "),
|
|
||||||
)
|
|
||||||
: Container()
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
Padding(
|
||||||
: Container()
|
padding: const EdgeInsets.only(bottom: 8.0),
|
||||||
|
child: Text(
|
||||||
|
"exif_bottom_sheet_details",
|
||||||
|
style: TextStyle(fontSize: 11, color: Colors.grey[400]),
|
||||||
|
).tr(),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding: const EdgeInsets.all(0),
|
||||||
|
dense: true,
|
||||||
|
textColor: Colors.grey[300],
|
||||||
|
iconColor: Colors.grey[300],
|
||||||
|
leading: const Icon(Icons.image),
|
||||||
|
title: Text(
|
||||||
|
"${assetDetail.exifInfo?.imageName!}${p.extension(assetDetail.originalPath)}",
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
subtitle: assetDetail.exifInfo?.exifImageHeight != null
|
||||||
|
? Text(
|
||||||
|
"${assetDetail.exifInfo?.exifImageHeight} x ${assetDetail.exifInfo?.exifImageWidth} ${assetDetail.exifInfo?.fileSizeInByte!}B ",
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
if (assetDetail.exifInfo?.make != null)
|
||||||
|
ListTile(
|
||||||
|
contentPadding: const EdgeInsets.all(0),
|
||||||
|
dense: true,
|
||||||
|
textColor: Colors.grey[300],
|
||||||
|
iconColor: Colors.grey[300],
|
||||||
|
leading: const Icon(Icons.camera),
|
||||||
|
title: Text(
|
||||||
|
"${assetDetail.exifInfo?.make} ${assetDetail.exifInfo?.model}",
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
"ƒ/${assetDetail.exifInfo?.fNumber} 1/${(1 / (assetDetail.exifInfo?.exposureTime ?? 1)).toStringAsFixed(0)} ${assetDetail.exifInfo?.focalLength}mm ISO${assetDetail.exifInfo?.iso} ",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
125
mobile/lib/modules/asset_viewer/ui/remote_photo_view.dart
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:photo_view/photo_view.dart';
|
||||||
|
|
||||||
|
enum _RemoteImageStatus { empty, thumbnail, full }
|
||||||
|
|
||||||
|
class _RemotePhotoViewState extends State<RemotePhotoView> {
|
||||||
|
late CachedNetworkImageProvider _imageProvider;
|
||||||
|
_RemoteImageStatus _status = _RemoteImageStatus.empty;
|
||||||
|
bool _zoomedIn = false;
|
||||||
|
|
||||||
|
static const int swipeThreshold = 100;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
bool allowMoving = _status == _RemoteImageStatus.full;
|
||||||
|
|
||||||
|
return PhotoView(
|
||||||
|
imageProvider: _imageProvider,
|
||||||
|
minScale: PhotoViewComputedScale.contained,
|
||||||
|
maxScale: allowMoving ? 1.0 : PhotoViewComputedScale.contained,
|
||||||
|
enablePanAlways: true,
|
||||||
|
scaleStateChangedCallback: _scaleStateChanged,
|
||||||
|
onScaleEnd: _onScaleListener,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onScaleListener(
|
||||||
|
BuildContext context,
|
||||||
|
ScaleEndDetails details,
|
||||||
|
PhotoViewControllerValue controllerValue,
|
||||||
|
) {
|
||||||
|
// Disable swipe events when zoomed in
|
||||||
|
if (_zoomedIn) return;
|
||||||
|
|
||||||
|
if (controllerValue.position.dy > swipeThreshold) {
|
||||||
|
widget.onSwipeDown();
|
||||||
|
} else if (controllerValue.position.dy < -swipeThreshold) {
|
||||||
|
widget.onSwipeUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _scaleStateChanged(PhotoViewScaleState state) {
|
||||||
|
_zoomedIn = state == PhotoViewScaleState.zoomedIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
CachedNetworkImageProvider _authorizedImageProvider(String url) {
|
||||||
|
return CachedNetworkImageProvider(
|
||||||
|
url,
|
||||||
|
headers: {"Authorization": widget.authToken},
|
||||||
|
cacheKey: url,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _performStateTransition(
|
||||||
|
_RemoteImageStatus newStatus,
|
||||||
|
CachedNetworkImageProvider provider,
|
||||||
|
) {
|
||||||
|
// Transition to same status is forbidden
|
||||||
|
if (_status == newStatus) return;
|
||||||
|
// Transition full -> thumbnail is forbidden
|
||||||
|
if (_status == _RemoteImageStatus.full &&
|
||||||
|
newStatus == _RemoteImageStatus.thumbnail) return;
|
||||||
|
|
||||||
|
if (!mounted) return;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_status = newStatus;
|
||||||
|
_imageProvider = provider;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _loadImages() {
|
||||||
|
CachedNetworkImageProvider thumbnailProvider =
|
||||||
|
_authorizedImageProvider(widget.thumbnailUrl);
|
||||||
|
_imageProvider = thumbnailProvider;
|
||||||
|
|
||||||
|
thumbnailProvider.resolve(const ImageConfiguration()).addListener(
|
||||||
|
ImageStreamListener((ImageInfo imageInfo, _) {
|
||||||
|
_performStateTransition(
|
||||||
|
_RemoteImageStatus.thumbnail,
|
||||||
|
thumbnailProvider,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
CachedNetworkImageProvider fullProvider =
|
||||||
|
_authorizedImageProvider(widget.imageUrl);
|
||||||
|
fullProvider.resolve(const ImageConfiguration()).addListener(
|
||||||
|
ImageStreamListener((ImageInfo imageInfo, _) {
|
||||||
|
_performStateTransition(_RemoteImageStatus.full, fullProvider);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_loadImages();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemotePhotoView extends StatefulWidget {
|
||||||
|
const RemotePhotoView({
|
||||||
|
Key? key,
|
||||||
|
required this.thumbnailUrl,
|
||||||
|
required this.imageUrl,
|
||||||
|
required this.authToken,
|
||||||
|
required this.onSwipeDown,
|
||||||
|
required this.onSwipeUp,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final String thumbnailUrl;
|
||||||
|
final String imageUrl;
|
||||||
|
final String authToken;
|
||||||
|
|
||||||
|
final void Function() onSwipeDown;
|
||||||
|
final void Function() onSwipeUp;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _RemotePhotoViewState();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/shared/models/immich_asset.model.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
class TopControlAppBar extends ConsumerWidget with PreferredSizeWidget {
|
class TopControlAppBar extends ConsumerWidget with PreferredSizeWidget {
|
||||||
const TopControlAppBar(
|
const TopControlAppBar({
|
||||||
{Key? key, required this.asset, required this.onMoreInfoPressed, required this.onDownloadPressed})
|
Key? key,
|
||||||
: super(key: key);
|
required this.asset,
|
||||||
|
required this.onMoreInfoPressed,
|
||||||
|
required this.onDownloadPressed,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
final ImmichAsset asset;
|
final AssetResponseDto asset;
|
||||||
final Function onMoreInfoPressed;
|
final Function onMoreInfoPressed;
|
||||||
final Function onDownloadPressed;
|
final Function onDownloadPressed;
|
||||||
|
|
||||||
@@ -42,17 +47,20 @@ class TopControlAppBar extends ConsumerWidget with PreferredSizeWidget {
|
|||||||
iconSize: iconSize,
|
iconSize: iconSize,
|
||||||
splashRadius: iconSize,
|
splashRadius: iconSize,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print("favorite");
|
log("favorite");
|
||||||
},
|
},
|
||||||
icon: asset.isFavorite ? const Icon(Icons.favorite_rounded) : const Icon(Icons.favorite_border_rounded),
|
icon: asset.isFavorite
|
||||||
|
? const Icon(Icons.favorite_rounded)
|
||||||
|
: const Icon(Icons.favorite_border_rounded),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
iconSize: iconSize,
|
iconSize: iconSize,
|
||||||
splashRadius: iconSize,
|
splashRadius: iconSize,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
onMoreInfoPressed();
|
onMoreInfoPressed();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.more_horiz_rounded))
|
icon: const Icon(Icons.more_horiz_rounded),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:flutter_swipe_detector/flutter_swipe_detector.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/hive_box.dart';
|
import 'package:immich_mobile/constants/hive_box.dart';
|
||||||
@@ -10,31 +8,37 @@ import 'package:immich_mobile/modules/asset_viewer/models/image_viewer_page_stat
|
|||||||
import 'package:immich_mobile/modules/asset_viewer/providers/image_viewer_page_state.provider.dart';
|
import 'package:immich_mobile/modules/asset_viewer/providers/image_viewer_page_state.provider.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/ui/download_loading_indicator.dart';
|
import 'package:immich_mobile/modules/asset_viewer/ui/download_loading_indicator.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/ui/exif_bottom_sheet.dart';
|
import 'package:immich_mobile/modules/asset_viewer/ui/exif_bottom_sheet.dart';
|
||||||
|
import 'package:immich_mobile/modules/asset_viewer/ui/remote_photo_view.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/ui/top_control_app_bar.dart';
|
import 'package:immich_mobile/modules/asset_viewer/ui/top_control_app_bar.dart';
|
||||||
import 'package:immich_mobile/modules/home/services/asset.service.dart';
|
import 'package:immich_mobile/modules/home/services/asset.service.dart';
|
||||||
import 'package:immich_mobile/shared/models/immich_asset.model.dart';
|
import 'package:openapi/api.dart';
|
||||||
import 'package:immich_mobile/shared/models/immich_asset_with_exif.model.dart';
|
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class ImageViewerPage extends HookConsumerWidget {
|
class ImageViewerPage extends HookConsumerWidget {
|
||||||
final String imageUrl;
|
final String imageUrl;
|
||||||
final String heroTag;
|
final String heroTag;
|
||||||
final String thumbnailUrl;
|
final String thumbnailUrl;
|
||||||
final ImmichAsset asset;
|
final AssetResponseDto asset;
|
||||||
final AssetService _assetService = AssetService();
|
|
||||||
ImmichAssetWithExif? assetDetail;
|
|
||||||
|
|
||||||
ImageViewerPage(
|
AssetResponseDto? assetDetail;
|
||||||
{Key? key, required this.imageUrl, required this.heroTag, required this.thumbnailUrl, required this.asset})
|
|
||||||
: super(key: key);
|
ImageViewerPage({
|
||||||
|
Key? key,
|
||||||
|
required this.imageUrl,
|
||||||
|
required this.heroTag,
|
||||||
|
required this.thumbnailUrl,
|
||||||
|
required this.asset,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final downloadAssetStatus = ref.watch(imageViewerStateProvider).downloadAssetStatus;
|
final downloadAssetStatus =
|
||||||
|
ref.watch(imageViewerStateProvider).downloadAssetStatus;
|
||||||
var box = Hive.box(userInfoBox);
|
var box = Hive.box(userInfoBox);
|
||||||
|
|
||||||
getAssetExif() async {
|
getAssetExif() async {
|
||||||
assetDetail = await _assetService.getAssetById(asset.id);
|
assetDetail =
|
||||||
|
await ref.watch(assetServiceProvider).getAssetById(asset.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
showInfo() {
|
showInfo() {
|
||||||
@@ -49,10 +53,13 @@ class ImageViewerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(
|
||||||
getAssetExif();
|
() {
|
||||||
return null;
|
getAssetExif();
|
||||||
}, []);
|
return null;
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
@@ -60,75 +67,31 @@ class ImageViewerPage extends HookConsumerWidget {
|
|||||||
asset: asset,
|
asset: asset,
|
||||||
onMoreInfoPressed: showInfo,
|
onMoreInfoPressed: showInfo,
|
||||||
onDownloadPressed: () {
|
onDownloadPressed: () {
|
||||||
ref.watch(imageViewerStateProvider.notifier).downloadAsset(asset, context);
|
ref
|
||||||
|
.watch(imageViewerStateProvider.notifier)
|
||||||
|
.downloadAsset(asset, context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: SwipeDetector(
|
body: SafeArea(
|
||||||
onSwipeDown: (_) {
|
child: Stack(
|
||||||
AutoRouter.of(context).pop();
|
children: [
|
||||||
},
|
Center(
|
||||||
onSwipeUp: (_) {
|
child: Hero(
|
||||||
showInfo();
|
tag: heroTag,
|
||||||
},
|
child: RemotePhotoView(
|
||||||
child: SafeArea(
|
thumbnailUrl: thumbnailUrl,
|
||||||
child: Stack(
|
imageUrl: imageUrl,
|
||||||
children: [
|
authToken: "Bearer ${box.get(accessTokenKey)}",
|
||||||
Center(
|
onSwipeDown: () => AutoRouter.of(context).pop(),
|
||||||
child: Hero(
|
onSwipeUp: () => showInfo(),
|
||||||
tag: heroTag,
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
imageUrl: imageUrl,
|
|
||||||
httpHeaders: {"Authorization": "Bearer ${box.get(accessTokenKey)}"},
|
|
||||||
fadeInDuration: const Duration(milliseconds: 250),
|
|
||||||
errorWidget: (context, url, error) => ConstrainedBox(
|
|
||||||
constraints: const BoxConstraints(maxWidth: 300),
|
|
||||||
child: Wrap(
|
|
||||||
spacing: 32,
|
|
||||||
runSpacing: 32,
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: [
|
|
||||||
const Text(
|
|
||||||
"Failed To Render Image - Possibly Corrupted Data",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(fontSize: 16, color: Colors.white),
|
|
||||||
),
|
|
||||||
SingleChildScrollView(
|
|
||||||
child: Text(
|
|
||||||
error.toString(),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
placeholder: (context, url) {
|
|
||||||
return CachedNetworkImage(
|
|
||||||
cacheKey: thumbnailUrl,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
imageUrl: thumbnailUrl,
|
|
||||||
httpHeaders: {"Authorization": "Bearer ${box.get(accessTokenKey)}"},
|
|
||||||
placeholderFadeInDuration: const Duration(milliseconds: 0),
|
|
||||||
progressIndicatorBuilder: (context, url, downloadProgress) => Transform.scale(
|
|
||||||
scale: 0.2,
|
|
||||||
child: CircularProgressIndicator(value: downloadProgress.progress),
|
|
||||||
),
|
|
||||||
errorWidget: (context, url, error) => Icon(
|
|
||||||
Icons.error,
|
|
||||||
color: Colors.grey[300],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (downloadAssetStatus == DownloadAssetStatus.loading)
|
),
|
||||||
const Center(
|
if (downloadAssetStatus == DownloadAssetStatus.loading)
|
||||||
child: DownloadLoadingIndicator(),
|
const Center(
|
||||||
),
|
child: DownloadLoadingIndicator(),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,22 +12,22 @@ import 'package:immich_mobile/modules/asset_viewer/ui/download_loading_indicator
|
|||||||
import 'package:immich_mobile/modules/asset_viewer/ui/exif_bottom_sheet.dart';
|
import 'package:immich_mobile/modules/asset_viewer/ui/exif_bottom_sheet.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/ui/top_control_app_bar.dart';
|
import 'package:immich_mobile/modules/asset_viewer/ui/top_control_app_bar.dart';
|
||||||
import 'package:immich_mobile/modules/home/services/asset.service.dart';
|
import 'package:immich_mobile/modules/home/services/asset.service.dart';
|
||||||
import 'package:immich_mobile/shared/models/immich_asset.model.dart';
|
import 'package:openapi/api.dart';
|
||||||
import 'package:immich_mobile/shared/models/immich_asset_with_exif.model.dart';
|
|
||||||
import 'package:video_player/video_player.dart';
|
import 'package:video_player/video_player.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class VideoViewerPage extends HookConsumerWidget {
|
class VideoViewerPage extends HookConsumerWidget {
|
||||||
final String videoUrl;
|
final String videoUrl;
|
||||||
final ImmichAsset asset;
|
final AssetResponseDto asset;
|
||||||
ImmichAssetWithExif? assetDetail;
|
AssetResponseDto? assetDetail;
|
||||||
final AssetService _assetService = AssetService();
|
|
||||||
|
|
||||||
VideoViewerPage({Key? key, required this.videoUrl, required this.asset}) : super(key: key);
|
VideoViewerPage({Key? key, required this.videoUrl, required this.asset})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final downloadAssetStatus = ref.watch(imageViewerStateProvider).downloadAssetStatus;
|
final downloadAssetStatus =
|
||||||
|
ref.watch(imageViewerStateProvider).downloadAssetStatus;
|
||||||
|
|
||||||
String jwtToken = Hive.box(userInfoBox).get(accessTokenKey);
|
String jwtToken = Hive.box(userInfoBox).get(accessTokenKey);
|
||||||
|
|
||||||
@@ -44,13 +44,17 @@ class VideoViewerPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAssetExif() async {
|
getAssetExif() async {
|
||||||
assetDetail = await _assetService.getAssetById(asset.id);
|
assetDetail =
|
||||||
|
await ref.watch(assetServiceProvider).getAssetById(asset.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(
|
||||||
getAssetExif();
|
() {
|
||||||
return null;
|
getAssetExif();
|
||||||
}, []);
|
return null;
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
@@ -60,7 +64,9 @@ class VideoViewerPage extends HookConsumerWidget {
|
|||||||
showInfo();
|
showInfo();
|
||||||
},
|
},
|
||||||
onDownloadPressed: () {
|
onDownloadPressed: () {
|
||||||
ref.watch(imageViewerStateProvider.notifier).downloadAsset(asset, context);
|
ref
|
||||||
|
.watch(imageViewerStateProvider.notifier)
|
||||||
|
.downloadAsset(asset, context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: SwipeDetector(
|
body: SwipeDetector(
|
||||||
@@ -93,7 +99,8 @@ class VideoThumbnailPlayer extends StatefulWidget {
|
|||||||
final String url;
|
final String url;
|
||||||
final String? jwtToken;
|
final String? jwtToken;
|
||||||
|
|
||||||
const VideoThumbnailPlayer({Key? key, required this.url, this.jwtToken}) : super(key: key);
|
const VideoThumbnailPlayer({Key? key, required this.url, this.jwtToken})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<VideoThumbnailPlayer> createState() => _VideoThumbnailPlayerState();
|
State<VideoThumbnailPlayer> createState() => _VideoThumbnailPlayerState();
|
||||||
@@ -111,8 +118,10 @@ class _VideoThumbnailPlayerState extends State<VideoThumbnailPlayer> {
|
|||||||
|
|
||||||
Future<void> initializePlayer() async {
|
Future<void> initializePlayer() async {
|
||||||
try {
|
try {
|
||||||
videoPlayerController =
|
videoPlayerController = VideoPlayerController.network(
|
||||||
VideoPlayerController.network(widget.url, httpHeaders: {"Authorization": "Bearer ${widget.jwtToken}"});
|
widget.url,
|
||||||
|
httpHeaders: {"Authorization": "Bearer ${widget.jwtToken}"},
|
||||||
|
);
|
||||||
|
|
||||||
await videoPlayerController.initialize();
|
await videoPlayerController.initialize();
|
||||||
_createChewieController();
|
_createChewieController();
|
||||||
@@ -142,7 +151,7 @@ class _VideoThumbnailPlayerState extends State<VideoThumbnailPlayer> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return chewieController != null && chewieController!.videoPlayerController.value.isInitialized
|
return chewieController?.videoPlayerController.value.isInitialized == true
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
child: Chewie(
|
child: Chewie(
|
||||||
controller: chewieController!,
|
controller: chewieController!,
|
||||||
|
|||||||
@@ -21,13 +21,16 @@ class AvailableAlbum {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'AvailableAlbum(albumEntity: $albumEntity, thumbnailData: $thumbnailData)';
|
String toString() =>
|
||||||
|
'AvailableAlbum(albumEntity: $albumEntity, thumbnailData: $thumbnailData)';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return other is AvailableAlbum && other.albumEntity == albumEntity && other.thumbnailData == thumbnailData;
|
return other is AvailableAlbum &&
|
||||||
|
other.albumEntity == albumEntity &&
|
||||||
|
other.thumbnailData == thumbnailData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:cancellation_token_http/http.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
import 'package:photo_manager/photo_manager.dart';
|
import 'package:photo_manager/photo_manager.dart';
|
||||||
|
|
||||||
import 'package:immich_mobile/modules/backup/models/available_album.model.dart';
|
import 'package:immich_mobile/modules/backup/models/available_album.model.dart';
|
||||||
import 'package:immich_mobile/shared/models/server_info.model.dart';
|
import 'package:immich_mobile/modules/backup/models/current_upload_asset.model.dart';
|
||||||
|
|
||||||
enum BackUpProgressEnum { idle, inProgress, done }
|
enum BackUpProgressEnum { idle, inProgress, done }
|
||||||
|
|
||||||
class BackUpState extends Equatable {
|
class BackUpState {
|
||||||
// enum
|
// enum
|
||||||
final BackUpProgressEnum backupProgress;
|
final BackUpProgressEnum backupProgress;
|
||||||
final List<String> allAssetOnDatabase;
|
final List<String> allAssetsInDatabase;
|
||||||
final double progressInPercentage;
|
final double progressInPercentage;
|
||||||
final CancelToken cancelToken;
|
final CancellationToken cancelToken;
|
||||||
final ServerInfo serverInfo;
|
final ServerInfoResponseDto serverInfo;
|
||||||
|
|
||||||
/// All available albums on the device
|
/// All available albums on the device
|
||||||
final List<AvailableAlbum> availableAlbums;
|
final List<AvailableAlbum> availableAlbums;
|
||||||
@@ -26,9 +27,12 @@ class BackUpState extends Equatable {
|
|||||||
/// All assets from the selected albums that have been backup
|
/// All assets from the selected albums that have been backup
|
||||||
final Set<String> selectedAlbumsBackupAssetsIds;
|
final Set<String> selectedAlbumsBackupAssetsIds;
|
||||||
|
|
||||||
|
// Current Backup Asset
|
||||||
|
final CurrentUploadAsset currentUploadAsset;
|
||||||
|
|
||||||
const BackUpState({
|
const BackUpState({
|
||||||
required this.backupProgress,
|
required this.backupProgress,
|
||||||
required this.allAssetOnDatabase,
|
required this.allAssetsInDatabase,
|
||||||
required this.progressInPercentage,
|
required this.progressInPercentage,
|
||||||
required this.cancelToken,
|
required this.cancelToken,
|
||||||
required this.serverInfo,
|
required this.serverInfo,
|
||||||
@@ -37,23 +41,25 @@ class BackUpState extends Equatable {
|
|||||||
required this.excludedBackupAlbums,
|
required this.excludedBackupAlbums,
|
||||||
required this.allUniqueAssets,
|
required this.allUniqueAssets,
|
||||||
required this.selectedAlbumsBackupAssetsIds,
|
required this.selectedAlbumsBackupAssetsIds,
|
||||||
|
required this.currentUploadAsset,
|
||||||
});
|
});
|
||||||
|
|
||||||
BackUpState copyWith({
|
BackUpState copyWith({
|
||||||
BackUpProgressEnum? backupProgress,
|
BackUpProgressEnum? backupProgress,
|
||||||
List<String>? allAssetOnDatabase,
|
List<String>? allAssetsInDatabase,
|
||||||
double? progressInPercentage,
|
double? progressInPercentage,
|
||||||
CancelToken? cancelToken,
|
CancellationToken? cancelToken,
|
||||||
ServerInfo? serverInfo,
|
ServerInfoResponseDto? serverInfo,
|
||||||
List<AvailableAlbum>? availableAlbums,
|
List<AvailableAlbum>? availableAlbums,
|
||||||
Set<AssetPathEntity>? selectedBackupAlbums,
|
Set<AssetPathEntity>? selectedBackupAlbums,
|
||||||
Set<AssetPathEntity>? excludedBackupAlbums,
|
Set<AssetPathEntity>? excludedBackupAlbums,
|
||||||
Set<AssetEntity>? allUniqueAssets,
|
Set<AssetEntity>? allUniqueAssets,
|
||||||
Set<String>? selectedAlbumsBackupAssetsIds,
|
Set<String>? selectedAlbumsBackupAssetsIds,
|
||||||
|
CurrentUploadAsset? currentUploadAsset,
|
||||||
}) {
|
}) {
|
||||||
return BackUpState(
|
return BackUpState(
|
||||||
backupProgress: backupProgress ?? this.backupProgress,
|
backupProgress: backupProgress ?? this.backupProgress,
|
||||||
allAssetOnDatabase: allAssetOnDatabase ?? this.allAssetOnDatabase,
|
allAssetsInDatabase: allAssetsInDatabase ?? this.allAssetsInDatabase,
|
||||||
progressInPercentage: progressInPercentage ?? this.progressInPercentage,
|
progressInPercentage: progressInPercentage ?? this.progressInPercentage,
|
||||||
cancelToken: cancelToken ?? this.cancelToken,
|
cancelToken: cancelToken ?? this.cancelToken,
|
||||||
serverInfo: serverInfo ?? this.serverInfo,
|
serverInfo: serverInfo ?? this.serverInfo,
|
||||||
@@ -61,28 +67,51 @@ class BackUpState extends Equatable {
|
|||||||
selectedBackupAlbums: selectedBackupAlbums ?? this.selectedBackupAlbums,
|
selectedBackupAlbums: selectedBackupAlbums ?? this.selectedBackupAlbums,
|
||||||
excludedBackupAlbums: excludedBackupAlbums ?? this.excludedBackupAlbums,
|
excludedBackupAlbums: excludedBackupAlbums ?? this.excludedBackupAlbums,
|
||||||
allUniqueAssets: allUniqueAssets ?? this.allUniqueAssets,
|
allUniqueAssets: allUniqueAssets ?? this.allUniqueAssets,
|
||||||
selectedAlbumsBackupAssetsIds: selectedAlbumsBackupAssetsIds ?? this.selectedAlbumsBackupAssetsIds,
|
selectedAlbumsBackupAssetsIds:
|
||||||
|
selectedAlbumsBackupAssetsIds ?? this.selectedAlbumsBackupAssetsIds,
|
||||||
|
currentUploadAsset: currentUploadAsset ?? this.currentUploadAsset,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'BackUpState(backupProgress: $backupProgress, allAssetOnDatabase: $allAssetOnDatabase, progressInPercentage: $progressInPercentage, cancelToken: $cancelToken, serverInfo: $serverInfo, availableAlbums: $availableAlbums, selectedBackupAlbums: $selectedBackupAlbums, excludedBackupAlbums: $excludedBackupAlbums, allUniqueAssets: $allUniqueAssets, selectedAlbumsBackupAssetsIds: $selectedAlbumsBackupAssetsIds)';
|
return 'BackUpState(backupProgress: $backupProgress, allAssetsInDatabase: $allAssetsInDatabase, progressInPercentage: $progressInPercentage, cancelToken: $cancelToken, serverInfo: $serverInfo, availableAlbums: $availableAlbums, selectedBackupAlbums: $selectedBackupAlbums, excludedBackupAlbums: $excludedBackupAlbums, allUniqueAssets: $allUniqueAssets, selectedAlbumsBackupAssetsIds: $selectedAlbumsBackupAssetsIds, currentUploadAsset: $currentUploadAsset)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props {
|
bool operator ==(Object other) {
|
||||||
return [
|
if (identical(this, other)) return true;
|
||||||
backupProgress,
|
final collectionEquals = const DeepCollectionEquality().equals;
|
||||||
allAssetOnDatabase,
|
|
||||||
progressInPercentage,
|
return other is BackUpState &&
|
||||||
cancelToken,
|
other.backupProgress == backupProgress &&
|
||||||
serverInfo,
|
collectionEquals(other.allAssetsInDatabase, allAssetsInDatabase) &&
|
||||||
availableAlbums,
|
other.progressInPercentage == progressInPercentage &&
|
||||||
selectedBackupAlbums,
|
other.cancelToken == cancelToken &&
|
||||||
excludedBackupAlbums,
|
other.serverInfo == serverInfo &&
|
||||||
allUniqueAssets,
|
collectionEquals(other.availableAlbums, availableAlbums) &&
|
||||||
selectedAlbumsBackupAssetsIds,
|
collectionEquals(other.selectedBackupAlbums, selectedBackupAlbums) &&
|
||||||
];
|
collectionEquals(other.excludedBackupAlbums, excludedBackupAlbums) &&
|
||||||
|
collectionEquals(other.allUniqueAssets, allUniqueAssets) &&
|
||||||
|
collectionEquals(
|
||||||
|
other.selectedAlbumsBackupAssetsIds,
|
||||||
|
selectedAlbumsBackupAssetsIds,
|
||||||
|
) &&
|
||||||
|
other.currentUploadAsset == currentUploadAsset;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return backupProgress.hashCode ^
|
||||||
|
allAssetsInDatabase.hashCode ^
|
||||||
|
progressInPercentage.hashCode ^
|
||||||
|
cancelToken.hashCode ^
|
||||||
|
serverInfo.hashCode ^
|
||||||
|
availableAlbums.hashCode ^
|
||||||
|
selectedBackupAlbums.hashCode ^
|
||||||
|
excludedBackupAlbums.hashCode ^
|
||||||
|
allUniqueAssets.hashCode ^
|
||||||
|
selectedAlbumsBackupAssetsIds.hashCode ^
|
||||||
|
currentUploadAsset.hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class CurrentUploadAsset {
|
||||||
|
final String id;
|
||||||
|
final DateTime createdAt;
|
||||||
|
final String fileName;
|
||||||
|
final String fileType;
|
||||||
|
|
||||||
|
CurrentUploadAsset({
|
||||||
|
required this.id,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.fileName,
|
||||||
|
required this.fileType,
|
||||||
|
});
|
||||||
|
|
||||||
|
CurrentUploadAsset copyWith({
|
||||||
|
String? id,
|
||||||
|
DateTime? createdAt,
|
||||||
|
String? fileName,
|
||||||
|
String? fileType,
|
||||||
|
}) {
|
||||||
|
return CurrentUploadAsset(
|
||||||
|
id: id ?? this.id,
|
||||||
|
createdAt: createdAt ?? this.createdAt,
|
||||||
|
fileName: fileName ?? this.fileName,
|
||||||
|
fileType: fileType ?? this.fileType,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
final result = <String, dynamic>{};
|
||||||
|
|
||||||
|
result.addAll({'id': id});
|
||||||
|
result.addAll({'createdAt': createdAt.millisecondsSinceEpoch});
|
||||||
|
result.addAll({'fileName': fileName});
|
||||||
|
result.addAll({'fileType': fileType});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory CurrentUploadAsset.fromMap(Map<String, dynamic> map) {
|
||||||
|
return CurrentUploadAsset(
|
||||||
|
id: map['id'] ?? '',
|
||||||
|
createdAt: DateTime.fromMillisecondsSinceEpoch(map['createdAt']),
|
||||||
|
fileName: map['fileName'] ?? '',
|
||||||
|
fileType: map['fileType'] ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
|
factory CurrentUploadAsset.fromJson(String source) =>
|
||||||
|
CurrentUploadAsset.fromMap(json.decode(source));
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CurrentUploadAsset(id: $id, createdAt: $createdAt, fileName: $fileName, fileType: $fileType)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
|
return other is CurrentUploadAsset &&
|
||||||
|
other.id == id &&
|
||||||
|
other.createdAt == createdAt &&
|
||||||
|
other.fileName == fileName &&
|
||||||
|
other.fileType == fileType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return id.hashCode ^
|
||||||
|
createdAt.hashCode ^
|
||||||
|
fileName.hashCode ^
|
||||||
|
fileType.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:photo_manager/photo_manager.dart';
|
||||||
|
|
||||||
|
class ErrorUploadAsset extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final DateTime createdAt;
|
||||||
|
final String fileName;
|
||||||
|
final String fileType;
|
||||||
|
final AssetEntity asset;
|
||||||
|
final String errorMessage;
|
||||||
|
|
||||||
|
const ErrorUploadAsset({
|
||||||
|
required this.id,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.fileName,
|
||||||
|
required this.fileType,
|
||||||
|
required this.asset,
|
||||||
|
required this.errorMessage,
|
||||||
|
});
|
||||||
|
|
||||||
|
ErrorUploadAsset copyWith({
|
||||||
|
String? id,
|
||||||
|
DateTime? createdAt,
|
||||||
|
String? fileName,
|
||||||
|
String? fileType,
|
||||||
|
AssetEntity? asset,
|
||||||
|
String? errorMessage,
|
||||||
|
}) {
|
||||||
|
return ErrorUploadAsset(
|
||||||
|
id: id ?? this.id,
|
||||||
|
createdAt: createdAt ?? this.createdAt,
|
||||||
|
fileName: fileName ?? this.fileName,
|
||||||
|
fileType: fileType ?? this.fileType,
|
||||||
|
asset: asset ?? this.asset,
|
||||||
|
errorMessage: errorMessage ?? this.errorMessage,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ErrorUploadAsset(id: $id, createdAt: $createdAt, fileName: $fileName, fileType: $fileType, asset: $asset, errorMessage: $errorMessage)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
fileName,
|
||||||
|
fileType,
|
||||||
|
errorMessage,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,8 @@ class HiveBackupAlbums {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'HiveBackupAlbums(selectedAlbumIds: $selectedAlbumIds, excludedAlbumsIds: $excludedAlbumsIds)';
|
String toString() =>
|
||||||
|
'HiveBackupAlbums(selectedAlbumIds: $selectedAlbumIds, excludedAlbumsIds: $excludedAlbumsIds)';
|
||||||
|
|
||||||
HiveBackupAlbums copyWith({
|
HiveBackupAlbums copyWith({
|
||||||
List<String>? selectedAlbumIds,
|
List<String>? selectedAlbumIds,
|
||||||
@@ -49,7 +50,8 @@ class HiveBackupAlbums {
|
|||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
factory HiveBackupAlbums.fromJson(String source) => HiveBackupAlbums.fromMap(json.decode(source));
|
factory HiveBackupAlbums.fromJson(String source) =>
|
||||||
|
HiveBackupAlbums.fromMap(json.decode(source));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
|
|||||||
@@ -1,31 +1,39 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:cancellation_token_http/http.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/hive_box.dart';
|
import 'package:immich_mobile/constants/hive_box.dart';
|
||||||
import 'package:immich_mobile/modules/backup/models/available_album.model.dart';
|
import 'package:immich_mobile/modules/backup/models/available_album.model.dart';
|
||||||
|
import 'package:immich_mobile/modules/backup/models/backup_state.model.dart';
|
||||||
|
import 'package:immich_mobile/modules/backup/models/current_upload_asset.model.dart';
|
||||||
|
import 'package:immich_mobile/modules/backup/models/error_upload_asset.model.dart';
|
||||||
import 'package:immich_mobile/modules/backup/models/hive_backup_albums.model.dart';
|
import 'package:immich_mobile/modules/backup/models/hive_backup_albums.model.dart';
|
||||||
|
import 'package:immich_mobile/modules/backup/providers/error_backup_list.provider.dart';
|
||||||
|
import 'package:immich_mobile/modules/backup/services/backup.service.dart';
|
||||||
|
import 'package:immich_mobile/modules/login/models/authentication_state.model.dart';
|
||||||
import 'package:immich_mobile/modules/login/providers/authentication.provider.dart';
|
import 'package:immich_mobile/modules/login/providers/authentication.provider.dart';
|
||||||
import 'package:immich_mobile/shared/services/server_info.service.dart';
|
import 'package:immich_mobile/shared/services/server_info.service.dart';
|
||||||
import 'package:immich_mobile/modules/backup/models/backup_state.model.dart';
|
import 'package:openapi/api.dart';
|
||||||
import 'package:immich_mobile/shared/models/server_info.model.dart';
|
|
||||||
import 'package:immich_mobile/modules/backup/services/backup.service.dart';
|
|
||||||
import 'package:photo_manager/photo_manager.dart';
|
import 'package:photo_manager/photo_manager.dart';
|
||||||
|
|
||||||
class BackupNotifier extends StateNotifier<BackUpState> {
|
class BackupNotifier extends StateNotifier<BackUpState> {
|
||||||
BackupNotifier({this.ref})
|
BackupNotifier(
|
||||||
: super(
|
this._backupService,
|
||||||
|
this._serverInfoService,
|
||||||
|
this._authState,
|
||||||
|
this.ref,
|
||||||
|
) : super(
|
||||||
BackUpState(
|
BackUpState(
|
||||||
backupProgress: BackUpProgressEnum.idle,
|
backupProgress: BackUpProgressEnum.idle,
|
||||||
allAssetOnDatabase: const [],
|
allAssetsInDatabase: const [],
|
||||||
progressInPercentage: 0,
|
progressInPercentage: 0,
|
||||||
cancelToken: CancelToken(),
|
cancelToken: CancellationToken(),
|
||||||
serverInfo: ServerInfo(
|
serverInfo: ServerInfoResponseDto(
|
||||||
diskAvailable: "0",
|
diskAvailable: "0",
|
||||||
diskAvailableRaw: 0,
|
diskAvailableRaw: 0,
|
||||||
diskSize: "0",
|
diskSize: "0",
|
||||||
diskSizeRaw: 0,
|
diskSizeRaw: 0,
|
||||||
diskUsagePercentage: 0.0,
|
diskUsagePercentage: 0,
|
||||||
diskUse: "0",
|
diskUse: "0",
|
||||||
diskUseRaw: 0,
|
diskUseRaw: 0,
|
||||||
),
|
),
|
||||||
@@ -34,12 +42,21 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
excludedBackupAlbums: const {},
|
excludedBackupAlbums: const {},
|
||||||
allUniqueAssets: const {},
|
allUniqueAssets: const {},
|
||||||
selectedAlbumsBackupAssetsIds: const {},
|
selectedAlbumsBackupAssetsIds: const {},
|
||||||
|
currentUploadAsset: CurrentUploadAsset(
|
||||||
|
id: '...',
|
||||||
|
createdAt: DateTime.parse('2020-10-04'),
|
||||||
|
fileName: '...',
|
||||||
|
fileType: '...',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
) {
|
||||||
|
getBackupInfo();
|
||||||
|
}
|
||||||
|
|
||||||
Ref? ref;
|
final BackupService _backupService;
|
||||||
final BackupService _backupService = BackupService();
|
final ServerInfoService _serverInfoService;
|
||||||
final ServerInfoService _serverInfoService = ServerInfoService();
|
final AuthenticationState _authState;
|
||||||
|
final Ref ref;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// UI INTERACTION
|
/// UI INTERACTION
|
||||||
@@ -54,7 +71,8 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
removeExcludedAlbumForBackup(album);
|
removeExcludedAlbumForBackup(album);
|
||||||
}
|
}
|
||||||
|
|
||||||
state = state.copyWith(selectedBackupAlbums: {...state.selectedBackupAlbums, album});
|
state = state
|
||||||
|
.copyWith(selectedBackupAlbums: {...state.selectedBackupAlbums, album});
|
||||||
_updateBackupAssetCount();
|
_updateBackupAssetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +80,8 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
if (state.selectedBackupAlbums.contains(album)) {
|
if (state.selectedBackupAlbums.contains(album)) {
|
||||||
removeAlbumForBackup(album);
|
removeAlbumForBackup(album);
|
||||||
}
|
}
|
||||||
state = state.copyWith(excludedBackupAlbums: {...state.excludedBackupAlbums, album});
|
state = state
|
||||||
|
.copyWith(excludedBackupAlbums: {...state.excludedBackupAlbums, album});
|
||||||
_updateBackupAssetCount();
|
_updateBackupAssetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,19 +109,24 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
/// If this is the first time performing backup - set the default selected album to be
|
/// If this is the first time performing backup - set the default selected album to be
|
||||||
/// the one that has all assets (Recent on Android, Recents on iOS)
|
/// the one that has all assets (Recent on Android, Recents on iOS)
|
||||||
///
|
///
|
||||||
Future<void> getBackupAlbumsInfo() async {
|
Future<void> _getBackupAlbumsInfo() async {
|
||||||
// Get all albums on the device
|
// Get all albums on the device
|
||||||
List<AvailableAlbum> availableAlbums = [];
|
List<AvailableAlbum> availableAlbums = [];
|
||||||
List<AssetPathEntity> albums = await PhotoManager.getAssetPathList(hasAll: true, type: RequestType.common);
|
List<AssetPathEntity> albums = await PhotoManager.getAssetPathList(
|
||||||
|
hasAll: true,
|
||||||
|
type: RequestType.common,
|
||||||
|
);
|
||||||
|
|
||||||
for (AssetPathEntity album in albums) {
|
for (AssetPathEntity album in albums) {
|
||||||
AvailableAlbum availableAlbum = AvailableAlbum(albumEntity: album);
|
AvailableAlbum availableAlbum = AvailableAlbum(albumEntity: album);
|
||||||
|
|
||||||
var assetList = await album.getAssetListRange(start: 0, end: album.assetCount);
|
var assetList =
|
||||||
|
await album.getAssetListRange(start: 0, end: album.assetCount);
|
||||||
|
|
||||||
if (assetList.isNotEmpty) {
|
if (assetList.isNotEmpty) {
|
||||||
var thumbnailAsset = assetList.first;
|
var thumbnailAsset = assetList.first;
|
||||||
var thumbnailData = await thumbnailAsset.thumbnailDataWithSize(const ThumbnailSize(512, 512));
|
var thumbnailData = await thumbnailAsset
|
||||||
|
.thumbnailDataWithSize(const ThumbnailSize(512, 512));
|
||||||
availableAlbum = availableAlbum.copyWith(thumbnailData: thumbnailData);
|
availableAlbum = availableAlbum.copyWith(thumbnailData: thumbnailData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +137,8 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
|
|
||||||
// Put persistent storage info into local state of the app
|
// Put persistent storage info into local state of the app
|
||||||
// Get local storage on selected backup album
|
// Get local storage on selected backup album
|
||||||
Box<HiveBackupAlbums> backupAlbumInfoBox = Hive.box<HiveBackupAlbums>(hiveBackupInfoBox);
|
Box<HiveBackupAlbums> backupAlbumInfoBox =
|
||||||
|
Hive.box<HiveBackupAlbums>(hiveBackupInfoBox);
|
||||||
HiveBackupAlbums? backupAlbumInfo = backupAlbumInfoBox.get(
|
HiveBackupAlbums? backupAlbumInfo = backupAlbumInfoBox.get(
|
||||||
backupInfoKey,
|
backupInfoKey,
|
||||||
defaultValue: HiveBackupAlbums(
|
defaultValue: HiveBackupAlbums(
|
||||||
@@ -132,7 +157,11 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
debugPrint("First time backup setup recent album as default");
|
debugPrint("First time backup setup recent album as default");
|
||||||
|
|
||||||
// Get album that contains all assets
|
// Get album that contains all assets
|
||||||
var list = await PhotoManager.getAssetPathList(hasAll: true, onlyAll: true, type: RequestType.common);
|
var list = await PhotoManager.getAssetPathList(
|
||||||
|
hasAll: true,
|
||||||
|
onlyAll: true,
|
||||||
|
type: RequestType.common,
|
||||||
|
);
|
||||||
AssetPathEntity albumHasAllAssets = list.first;
|
AssetPathEntity albumHasAllAssets = list.first;
|
||||||
|
|
||||||
backupAlbumInfoBox.put(
|
backupAlbumInfoBox.put(
|
||||||
@@ -150,12 +179,16 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
try {
|
try {
|
||||||
for (var selectedAlbumId in backupAlbumInfo!.selectedAlbumIds) {
|
for (var selectedAlbumId in backupAlbumInfo!.selectedAlbumIds) {
|
||||||
var albumAsset = await AssetPathEntity.fromId(selectedAlbumId);
|
var albumAsset = await AssetPathEntity.fromId(selectedAlbumId);
|
||||||
state = state.copyWith(selectedBackupAlbums: {...state.selectedBackupAlbums, albumAsset});
|
state = state.copyWith(
|
||||||
|
selectedBackupAlbums: {...state.selectedBackupAlbums, albumAsset},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var excludedAlbumId in backupAlbumInfo.excludedAlbumsIds) {
|
for (var excludedAlbumId in backupAlbumInfo.excludedAlbumsIds) {
|
||||||
var albumAsset = await AssetPathEntity.fromId(excludedAlbumId);
|
var albumAsset = await AssetPathEntity.fromId(excludedAlbumId);
|
||||||
state = state.copyWith(excludedBackupAlbums: {...state.excludedBackupAlbums, albumAsset});
|
state = state.copyWith(
|
||||||
|
excludedBackupAlbums: {...state.excludedBackupAlbums, albumAsset},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("[ERROR] Failed to generate album from id $e");
|
debugPrint("[ERROR] Failed to generate album from id $e");
|
||||||
@@ -167,39 +200,48 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
/// Find the assets that are not overlapping between the two sets
|
/// Find the assets that are not overlapping between the two sets
|
||||||
/// Those assets are unique and are used as the total assets
|
/// Those assets are unique and are used as the total assets
|
||||||
///
|
///
|
||||||
void _updateBackupAssetCount() async {
|
Future<void> _updateBackupAssetCount() async {
|
||||||
Set<AssetEntity> assetsFromSelectedAlbums = {};
|
Set<AssetEntity> assetsFromSelectedAlbums = {};
|
||||||
Set<AssetEntity> assetsFromExcludedAlbums = {};
|
Set<AssetEntity> assetsFromExcludedAlbums = {};
|
||||||
|
|
||||||
for (var album in state.selectedBackupAlbums) {
|
for (var album in state.selectedBackupAlbums) {
|
||||||
var assets = await album.getAssetListRange(start: 0, end: album.assetCount);
|
var assets =
|
||||||
|
await album.getAssetListRange(start: 0, end: album.assetCount);
|
||||||
assetsFromSelectedAlbums.addAll(assets);
|
assetsFromSelectedAlbums.addAll(assets);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var album in state.excludedBackupAlbums) {
|
for (var album in state.excludedBackupAlbums) {
|
||||||
var assets = await album.getAssetListRange(start: 0, end: album.assetCount);
|
var assets =
|
||||||
|
await album.getAssetListRange(start: 0, end: album.assetCount);
|
||||||
assetsFromExcludedAlbums.addAll(assets);
|
assetsFromExcludedAlbums.addAll(assets);
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<AssetEntity> allUniqueAssets = assetsFromSelectedAlbums.difference(assetsFromExcludedAlbums);
|
Set<AssetEntity> allUniqueAssets =
|
||||||
List<String> allAssetOnDatabase = await _backupService.getDeviceBackupAsset();
|
assetsFromSelectedAlbums.difference(assetsFromExcludedAlbums);
|
||||||
|
var allAssetsInDatabase = await _backupService.getDeviceBackupAsset();
|
||||||
|
|
||||||
|
if (allAssetsInDatabase == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Find asset that were backup from selected albums
|
// Find asset that were backup from selected albums
|
||||||
Set<String> selectedAlbumsBackupAssets = Set.from(allUniqueAssets.map((e) => e.id));
|
Set<String> selectedAlbumsBackupAssets =
|
||||||
selectedAlbumsBackupAssets.removeWhere((assetId) => !allAssetOnDatabase.contains(assetId));
|
Set.from(allUniqueAssets.map((e) => e.id));
|
||||||
|
selectedAlbumsBackupAssets
|
||||||
|
.removeWhere((assetId) => !allAssetsInDatabase.contains(assetId));
|
||||||
|
|
||||||
if (allUniqueAssets.isEmpty) {
|
if (allUniqueAssets.isEmpty) {
|
||||||
debugPrint("No Asset On Device");
|
debugPrint("No Asset On Device");
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
backupProgress: BackUpProgressEnum.idle,
|
backupProgress: BackUpProgressEnum.idle,
|
||||||
allAssetOnDatabase: allAssetOnDatabase,
|
allAssetsInDatabase: allAssetsInDatabase,
|
||||||
allUniqueAssets: {},
|
allUniqueAssets: {},
|
||||||
selectedAlbumsBackupAssetsIds: selectedAlbumsBackupAssets,
|
selectedAlbumsBackupAssetsIds: selectedAlbumsBackupAssets,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
allAssetOnDatabase: allAssetOnDatabase,
|
allAssetsInDatabase: allAssetsInDatabase,
|
||||||
allUniqueAssets: allUniqueAssets,
|
allUniqueAssets: allUniqueAssets,
|
||||||
selectedAlbumsBackupAssetsIds: selectedAlbumsBackupAssets,
|
selectedAlbumsBackupAssetsIds: selectedAlbumsBackupAssets,
|
||||||
);
|
);
|
||||||
@@ -207,6 +249,8 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
|
|
||||||
// Save to persistent storage
|
// Save to persistent storage
|
||||||
_updatePersistentAlbumsSelection();
|
_updatePersistentAlbumsSelection();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -214,10 +258,13 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
/// which albums are selected or excluded
|
/// which albums are selected or excluded
|
||||||
/// and then update the UI according to those information
|
/// and then update the UI according to those information
|
||||||
///
|
///
|
||||||
void getBackupInfo() async {
|
Future<void> getBackupInfo() async {
|
||||||
await getBackupAlbumsInfo();
|
await Future.wait([
|
||||||
_updateServerInfo();
|
_getBackupAlbumsInfo(),
|
||||||
_updateBackupAssetCount();
|
_updateServerInfo(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
await _updateBackupAssetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -225,7 +272,8 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
/// Hive database
|
/// Hive database
|
||||||
///
|
///
|
||||||
void _updatePersistentAlbumsSelection() {
|
void _updatePersistentAlbumsSelection() {
|
||||||
Box<HiveBackupAlbums> backupAlbumInfoBox = Hive.box<HiveBackupAlbums>(hiveBackupInfoBox);
|
Box<HiveBackupAlbums> backupAlbumInfoBox =
|
||||||
|
Hive.box<HiveBackupAlbums>(hiveBackupInfoBox);
|
||||||
backupAlbumInfoBox.put(
|
backupAlbumInfoBox.put(
|
||||||
backupInfoKey,
|
backupInfoKey,
|
||||||
HiveBackupAlbums(
|
HiveBackupAlbums(
|
||||||
@@ -239,11 +287,10 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
/// Invoke backup process
|
/// Invoke backup process
|
||||||
///
|
///
|
||||||
void startBackupProcess() async {
|
void startBackupProcess() async {
|
||||||
_updateServerInfo();
|
|
||||||
_updateBackupAssetCount();
|
|
||||||
|
|
||||||
state = state.copyWith(backupProgress: BackUpProgressEnum.inProgress);
|
state = state.copyWith(backupProgress: BackUpProgressEnum.inProgress);
|
||||||
|
|
||||||
|
await getBackupInfo();
|
||||||
|
|
||||||
var authResult = await PhotoManager.requestPermissionExtend();
|
var authResult = await PhotoManager.requestPermissionExtend();
|
||||||
if (authResult.isAuth) {
|
if (authResult.isAuth) {
|
||||||
await PhotoManager.clearFileCache();
|
await PhotoManager.clearFileCache();
|
||||||
@@ -254,10 +301,10 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<AssetEntity> assetsWillBeBackup = state.allUniqueAssets;
|
Set<AssetEntity> assetsWillBeBackup = Set.from(state.allUniqueAssets);
|
||||||
|
|
||||||
// Remove item that has already been backed up
|
// Remove item that has already been backed up
|
||||||
for (var assetId in state.allAssetOnDatabase) {
|
for (var assetId in state.allAssetsInDatabase) {
|
||||||
assetsWillBeBackup.removeWhere((e) => e.id == assetId);
|
assetsWillBeBackup.removeWhere((e) => e.id == assetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,82 +313,108 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Perform Backup
|
// Perform Backup
|
||||||
state = state.copyWith(cancelToken: CancelToken());
|
state = state.copyWith(cancelToken: CancellationToken());
|
||||||
_backupService.backupAsset(assetsWillBeBackup, state.cancelToken, _onAssetUploaded, _onUploadProgress);
|
_backupService.backupAsset(
|
||||||
|
assetsWillBeBackup,
|
||||||
|
state.cancelToken,
|
||||||
|
_onAssetUploaded,
|
||||||
|
_onUploadProgress,
|
||||||
|
_onSetCurrentBackupAsset,
|
||||||
|
_onBackupError,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
PhotoManager.openSetting();
|
PhotoManager.openSetting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onBackupError(ErrorUploadAsset errorAssetInfo) {
|
||||||
|
ref.watch(errorBackupListProvider.notifier).add(errorAssetInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onSetCurrentBackupAsset(CurrentUploadAsset currentUploadAsset) {
|
||||||
|
state = state.copyWith(currentUploadAsset: currentUploadAsset);
|
||||||
|
}
|
||||||
|
|
||||||
void cancelBackup() {
|
void cancelBackup() {
|
||||||
state.cancelToken.cancel('Cancel Backup');
|
state.cancelToken.cancel();
|
||||||
state = state.copyWith(backupProgress: BackUpProgressEnum.idle, progressInPercentage: 0.0);
|
state = state.copyWith(
|
||||||
|
backupProgress: BackUpProgressEnum.idle,
|
||||||
|
progressInPercentage: 0.0,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onAssetUploaded(String deviceAssetId, String deviceId) {
|
void _onAssetUploaded(String deviceAssetId, String deviceId) {
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
selectedAlbumsBackupAssetsIds: {...state.selectedAlbumsBackupAssetsIds, deviceAssetId},
|
selectedAlbumsBackupAssetsIds: {
|
||||||
allAssetOnDatabase: [...state.allAssetOnDatabase, deviceAssetId]);
|
...state.selectedAlbumsBackupAssetsIds,
|
||||||
|
deviceAssetId
|
||||||
|
},
|
||||||
|
allAssetsInDatabase: [...state.allAssetsInDatabase, deviceAssetId],
|
||||||
|
);
|
||||||
|
|
||||||
if (state.allUniqueAssets.length - state.selectedAlbumsBackupAssetsIds.length == 0) {
|
if (state.allUniqueAssets.length -
|
||||||
state = state.copyWith(backupProgress: BackUpProgressEnum.done, progressInPercentage: 0.0);
|
state.selectedAlbumsBackupAssetsIds.length ==
|
||||||
|
0) {
|
||||||
|
state = state.copyWith(
|
||||||
|
backupProgress: BackUpProgressEnum.done,
|
||||||
|
progressInPercentage: 0.0,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateServerInfo();
|
_updateServerInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onUploadProgress(int sent, int total) {
|
void _onUploadProgress(int sent, int total) {
|
||||||
state = state.copyWith(progressInPercentage: (sent.toDouble() / total.toDouble() * 100));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateServerInfo() async {
|
|
||||||
var serverInfo = await _serverInfoService.getServerInfo();
|
|
||||||
|
|
||||||
// Update server info
|
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
serverInfo: ServerInfo(
|
progressInPercentage: (sent.toDouble() / total.toDouble() * 100),
|
||||||
diskSize: serverInfo.diskSize,
|
|
||||||
diskUse: serverInfo.diskUse,
|
|
||||||
diskAvailable: serverInfo.diskAvailable,
|
|
||||||
diskSizeRaw: serverInfo.diskSizeRaw,
|
|
||||||
diskUseRaw: serverInfo.diskUseRaw,
|
|
||||||
diskAvailableRaw: serverInfo.diskAvailableRaw,
|
|
||||||
diskUsagePercentage: serverInfo.diskUsagePercentage,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resumeBackup() {
|
Future<void> _updateServerInfo() async {
|
||||||
var authState = ref?.read(authenticationProvider);
|
var serverInfo = await _serverInfoService.getServerInfo();
|
||||||
|
|
||||||
|
// Update server info
|
||||||
|
if (serverInfo != null) {
|
||||||
|
state = state.copyWith(
|
||||||
|
serverInfo: serverInfo,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void resumeBackup() {
|
||||||
// Check if user is login
|
// Check if user is login
|
||||||
var accessKey = Hive.box(userInfoBox).get(accessTokenKey);
|
var accessKey = Hive.box(userInfoBox).get(accessTokenKey);
|
||||||
|
|
||||||
// User has been logged out return
|
// User has been logged out return
|
||||||
if (authState != null) {
|
if (accessKey == null || !_authState.isAuthenticated) {
|
||||||
if (accessKey == null || !authState.isAuthenticated) {
|
debugPrint("[resumeBackup] not authenticated - abort");
|
||||||
debugPrint("[resumeBackup] not authenticated - abort");
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if this device is enable backup by the user
|
||||||
|
if ((_authState.deviceInfo.deviceId == _authState.deviceId) &&
|
||||||
|
_authState.deviceInfo.isAutoBackup) {
|
||||||
|
// check if backup is alreayd in process - then return
|
||||||
|
if (state.backupProgress == BackUpProgressEnum.inProgress) {
|
||||||
|
debugPrint("[resumeBackup] Backup is already in progress - abort");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this device is enable backup by the user
|
// Run backup
|
||||||
if ((authState.deviceInfo.deviceId == authState.deviceId) && authState.deviceInfo.isAutoBackup) {
|
debugPrint("[resumeBackup] Start back up");
|
||||||
// check if backup is alreayd in process - then return
|
startBackupProcess();
|
||||||
if (state.backupProgress == BackUpProgressEnum.inProgress) {
|
|
||||||
debugPrint("[resumeBackup] Backup is already in progress - abort");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run backup
|
|
||||||
debugPrint("[resumeBackup] Start back up");
|
|
||||||
startBackupProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final backupProvider = StateNotifierProvider<BackupNotifier, BackUpState>((ref) {
|
final backupProvider =
|
||||||
return BackupNotifier(ref: ref);
|
StateNotifierProvider<BackupNotifier, BackUpState>((ref) {
|
||||||
|
return BackupNotifier(
|
||||||
|
ref.watch(backupServiceProvider),
|
||||||
|
ref.watch(serverInfoServiceProvider),
|
||||||
|
ref.watch(authenticationProvider),
|
||||||
|
ref,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:immich_mobile/modules/backup/models/error_upload_asset.model.dart';
|
||||||
|
|
||||||
|
class ErrorBackupListNotifier extends StateNotifier<Set<ErrorUploadAsset>> {
|
||||||
|
ErrorBackupListNotifier() : super({});
|
||||||
|
|
||||||
|
add(ErrorUploadAsset errorAsset) {
|
||||||
|
state = state.union({errorAsset});
|
||||||
|
}
|
||||||
|
|
||||||
|
remove(ErrorUploadAsset errorAsset) {
|
||||||
|
state = state.difference({errorAsset});
|
||||||
|
}
|
||||||
|
|
||||||
|
empty() {
|
||||||
|
state = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final errorBackupListProvider =
|
||||||
|
StateNotifierProvider<ErrorBackupListNotifier, Set<ErrorUploadAsset>>(
|
||||||
|
(ref) => ErrorBackupListNotifier(),
|
||||||
|
);
|
||||||
@@ -2,42 +2,53 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/hive_box.dart';
|
import 'package:immich_mobile/constants/hive_box.dart';
|
||||||
import 'package:immich_mobile/shared/services/network.service.dart';
|
import 'package:immich_mobile/modules/backup/models/current_upload_asset.model.dart';
|
||||||
import 'package:immich_mobile/shared/models/device_info.model.dart';
|
import 'package:immich_mobile/modules/backup/models/error_upload_asset.model.dart';
|
||||||
import 'package:immich_mobile/utils/dio_http_interceptor.dart';
|
import 'package:immich_mobile/shared/services/api.service.dart';
|
||||||
import 'package:immich_mobile/utils/files_helper.dart';
|
import 'package:immich_mobile/utils/files_helper.dart';
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
import 'package:photo_manager/photo_manager.dart';
|
import 'package:photo_manager/photo_manager.dart';
|
||||||
import 'package:http_parser/http_parser.dart';
|
import 'package:http_parser/http_parser.dart';
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
|
import 'package:cancellation_token_http/http.dart' as http;
|
||||||
|
|
||||||
|
final backupServiceProvider = Provider(
|
||||||
|
(ref) => BackupService(
|
||||||
|
ref.watch(apiServiceProvider),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
class BackupService {
|
class BackupService {
|
||||||
final NetworkService _networkService = NetworkService();
|
final ApiService _apiService;
|
||||||
|
BackupService(this._apiService);
|
||||||
|
|
||||||
Future<List<String>> getDeviceBackupAsset() async {
|
Future<List<String>?> getDeviceBackupAsset() async {
|
||||||
String deviceId = Hive.box(userInfoBox).get(deviceIdKey);
|
String deviceId = Hive.box(userInfoBox).get(deviceIdKey);
|
||||||
|
|
||||||
Response response = await _networkService.getRequest(url: "asset/$deviceId");
|
try {
|
||||||
List<dynamic> result = jsonDecode(response.toString());
|
return await _apiService.assetApi.getUserAssetsByDeviceId(deviceId);
|
||||||
|
} catch (e) {
|
||||||
return result.cast<String>();
|
debugPrint('Error [getDeviceBackupAsset] ${e.toString()}');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
backupAsset(Set<AssetEntity> assetList, CancelToken cancelToken, Function(String, String) singleAssetDoneCb,
|
backupAsset(
|
||||||
Function(int, int) uploadProgress) async {
|
Set<AssetEntity> assetList,
|
||||||
var dio = Dio();
|
http.CancellationToken cancelToken,
|
||||||
dio.interceptors.add(AuthenticatedRequestInterceptor());
|
Function(String, String) singleAssetDoneCb,
|
||||||
|
Function(int, int) uploadProgressCb,
|
||||||
|
Function(CurrentUploadAsset) setCurrentUploadAssetCb,
|
||||||
|
Function(ErrorUploadAsset) errorCb,
|
||||||
|
) async {
|
||||||
String deviceId = Hive.box(userInfoBox).get(deviceIdKey);
|
String deviceId = Hive.box(userInfoBox).get(deviceIdKey);
|
||||||
String savedEndpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
String savedEndpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
||||||
File? file;
|
File? file;
|
||||||
|
|
||||||
MultipartFile assetRawUploadData;
|
|
||||||
MultipartFile thumbnailUploadData;
|
|
||||||
|
|
||||||
for (var entity in assetList) {
|
for (var entity in assetList) {
|
||||||
try {
|
try {
|
||||||
if (entity.type == AssetType.video) {
|
if (entity.type == AssetType.video) {
|
||||||
@@ -47,75 +58,81 @@ class BackupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
FormData formData;
|
|
||||||
String originalFileName = await entity.titleAsync;
|
String originalFileName = await entity.titleAsync;
|
||||||
String fileNameWithoutPath = originalFileName.toString().split(".")[0];
|
String fileNameWithoutPath =
|
||||||
|
originalFileName.toString().split(".")[0];
|
||||||
var fileExtension = p.extension(file.path);
|
var fileExtension = p.extension(file.path);
|
||||||
var mimeType = FileHelper.getMimeType(file.path);
|
var mimeType = FileHelper.getMimeType(file.path);
|
||||||
assetRawUploadData = await MultipartFile.fromFile(
|
var fileStream = file.openRead();
|
||||||
file.path,
|
var assetRawUploadData = http.MultipartFile(
|
||||||
|
"assetData",
|
||||||
|
fileStream,
|
||||||
|
file.lengthSync(),
|
||||||
filename: fileNameWithoutPath,
|
filename: fileNameWithoutPath,
|
||||||
contentType: MediaType(
|
contentType: MediaType(
|
||||||
mimeType["type"],
|
mimeType["type"],
|
||||||
mimeType["subType"],
|
mimeType["subType"],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
formData = FormData.fromMap({
|
|
||||||
'deviceAssetId': entity.id,
|
|
||||||
'deviceId': deviceId,
|
|
||||||
'assetType': _getAssetType(entity.type),
|
|
||||||
'createdAt': entity.createDateTime.toIso8601String(),
|
|
||||||
'modifiedAt': entity.modifiedDateTime.toIso8601String(),
|
|
||||||
'isFavorite': entity.isFavorite,
|
|
||||||
'fileExtension': fileExtension,
|
|
||||||
'duration': entity.videoDuration,
|
|
||||||
'assetData': [assetRawUploadData]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Build thumbnail multipart data
|
var box = Hive.box(userInfoBox);
|
||||||
var thumbnailData = await entity.thumbnailDataWithSize(const ThumbnailSize(1440, 2560));
|
|
||||||
if (thumbnailData != null) {
|
|
||||||
thumbnailUploadData = MultipartFile.fromBytes(
|
|
||||||
List.from(thumbnailData),
|
|
||||||
filename: fileNameWithoutPath,
|
|
||||||
contentType: MediaType(
|
|
||||||
"image",
|
|
||||||
"jpeg",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Send thumbnail data if it is exist
|
var req = MultipartRequest(
|
||||||
formData = FormData.fromMap({
|
'POST',
|
||||||
'deviceAssetId': entity.id,
|
Uri.parse('$savedEndpoint/asset/upload'),
|
||||||
'deviceId': deviceId,
|
onProgress: ((bytes, totalBytes) =>
|
||||||
'assetType': _getAssetType(entity.type),
|
uploadProgressCb(bytes, totalBytes)),
|
||||||
'createdAt': entity.createDateTime.toIso8601String(),
|
);
|
||||||
'modifiedAt': entity.modifiedDateTime.toIso8601String(),
|
req.headers["Authorization"] = "Bearer ${box.get(accessTokenKey)}";
|
||||||
'isFavorite': entity.isFavorite,
|
|
||||||
'fileExtension': fileExtension,
|
|
||||||
'duration': entity.videoDuration,
|
|
||||||
'thumbnailData': [thumbnailUploadData],
|
|
||||||
'assetData': [assetRawUploadData]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Response res = await dio.post(
|
req.fields['deviceAssetId'] = entity.id;
|
||||||
'$savedEndpoint/asset/upload',
|
req.fields['deviceId'] = deviceId;
|
||||||
data: formData,
|
req.fields['assetType'] = _getAssetType(entity.type);
|
||||||
cancelToken: cancelToken,
|
req.fields['createdAt'] = entity.createDateTime.toIso8601String();
|
||||||
onSendProgress: (sent, total) => uploadProgress(sent, total),
|
req.fields['modifiedAt'] = entity.modifiedDateTime.toIso8601String();
|
||||||
|
req.fields['isFavorite'] = entity.isFavorite.toString();
|
||||||
|
req.fields['fileExtension'] = fileExtension;
|
||||||
|
req.fields['duration'] = entity.videoDuration.toString();
|
||||||
|
|
||||||
|
req.files.add(assetRawUploadData);
|
||||||
|
|
||||||
|
setCurrentUploadAssetCb(
|
||||||
|
CurrentUploadAsset(
|
||||||
|
id: entity.id,
|
||||||
|
createdAt: entity.createDateTime,
|
||||||
|
fileName: originalFileName,
|
||||||
|
fileType: _getAssetType(entity.type),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res.statusCode == 201) {
|
var response = await req.send(cancellationToken: cancelToken);
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
singleAssetDoneCb(entity.id, deviceId);
|
singleAssetDoneCb(entity.id, deviceId);
|
||||||
|
} else {
|
||||||
|
var data = await response.stream.bytesToString();
|
||||||
|
var error = jsonDecode(data);
|
||||||
|
|
||||||
|
debugPrint(
|
||||||
|
"Error(${error['statusCode']}) uploading ${entity.id} | $originalFileName | Created on ${entity.createDateTime} | ${error['error']}",
|
||||||
|
);
|
||||||
|
|
||||||
|
errorCb(
|
||||||
|
ErrorUploadAsset(
|
||||||
|
asset: entity,
|
||||||
|
id: entity.id,
|
||||||
|
createdAt: entity.createDateTime,
|
||||||
|
fileName: originalFileName,
|
||||||
|
fileType: _getAssetType(entity.type),
|
||||||
|
errorMessage: error['error'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on DioError catch (e) {
|
} on http.CancelledException {
|
||||||
debugPrint("DioError backupAsset: ${e.response}");
|
debugPrint("Backup was cancelled by the user");
|
||||||
if (e.type == DioErrorType.cancel || e.type == DioErrorType.other) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("ERROR backupAsset: ${e.toString()}");
|
debugPrint("ERROR backupAsset: ${e.toString()}");
|
||||||
continue;
|
continue;
|
||||||
@@ -140,13 +157,60 @@ class BackupService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<DeviceInfoRemote> setAutoBackup(bool status, String deviceId, String deviceType) async {
|
Future<DeviceInfoResponseDto> setAutoBackup(
|
||||||
var res = await _networkService.patchRequest(url: 'device-info', data: {
|
bool status,
|
||||||
"isAutoBackup": status,
|
String deviceId,
|
||||||
"deviceId": deviceId,
|
DeviceTypeEnum deviceType,
|
||||||
"deviceType": deviceType,
|
) async {
|
||||||
});
|
try {
|
||||||
|
var updatedDeviceInfo = await _apiService.deviceInfoApi.updateDeviceInfo(
|
||||||
|
UpdateDeviceInfoDto(
|
||||||
|
deviceId: deviceId,
|
||||||
|
deviceType: deviceType,
|
||||||
|
isAutoBackup: status,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return DeviceInfoRemote.fromJson(res.toString());
|
if (updatedDeviceInfo == null) {
|
||||||
|
throw Exception("Error updating device info");
|
||||||
|
}
|
||||||
|
|
||||||
|
return updatedDeviceInfo;
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint("Error setAutoBackup: ${e.toString()}");
|
||||||
|
throw Error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MultipartRequest extends http.MultipartRequest {
|
||||||
|
/// Creates a new [MultipartRequest].
|
||||||
|
MultipartRequest(
|
||||||
|
String method,
|
||||||
|
Uri url, {
|
||||||
|
required this.onProgress,
|
||||||
|
}) : super(method, url);
|
||||||
|
|
||||||
|
final void Function(int bytes, int totalBytes) onProgress;
|
||||||
|
|
||||||
|
/// Freezes all mutable fields and returns a
|
||||||
|
/// single-subscription [http.ByteStream]
|
||||||
|
/// that will emit the request body.
|
||||||
|
@override
|
||||||
|
http.ByteStream finalize() {
|
||||||
|
final byteStream = super.finalize();
|
||||||
|
|
||||||
|
final total = contentLength;
|
||||||
|
var bytes = 0;
|
||||||
|
|
||||||
|
final t = StreamTransformer.fromHandlers(
|
||||||
|
handleData: (List<int> data, EventSink<List<int>> sink) {
|
||||||
|
bytes += data.length;
|
||||||
|
onProgress.call(bytes, total);
|
||||||
|
sink.add(data);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
final stream = byteStream.transform(t);
|
||||||
|
return http.ByteStream(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
@@ -14,16 +15,24 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
final Uint8List? imageData;
|
final Uint8List? imageData;
|
||||||
final AssetPathEntity albumInfo;
|
final AssetPathEntity albumInfo;
|
||||||
|
|
||||||
const AlbumInfoCard({Key? key, this.imageData, required this.albumInfo}) : super(key: key);
|
const AlbumInfoCard({Key? key, this.imageData, required this.albumInfo})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final bool isSelected = ref.watch(backupProvider).selectedBackupAlbums.contains(albumInfo);
|
final bool isSelected =
|
||||||
final bool isExcluded = ref.watch(backupProvider).excludedBackupAlbums.contains(albumInfo);
|
ref.watch(backupProvider).selectedBackupAlbums.contains(albumInfo);
|
||||||
|
final bool isExcluded =
|
||||||
|
ref.watch(backupProvider).excludedBackupAlbums.contains(albumInfo);
|
||||||
|
|
||||||
ColorFilter selectedFilter = ColorFilter.mode(Theme.of(context).primaryColor.withAlpha(100), BlendMode.darken);
|
ColorFilter selectedFilter = ColorFilter.mode(
|
||||||
ColorFilter excludedFilter = ColorFilter.mode(Colors.red.withAlpha(75), BlendMode.darken);
|
Theme.of(context).primaryColor.withAlpha(100),
|
||||||
ColorFilter unselectedFilter = const ColorFilter.mode(Colors.black, BlendMode.color);
|
BlendMode.darken,
|
||||||
|
);
|
||||||
|
ColorFilter excludedFilter =
|
||||||
|
ColorFilter.mode(Colors.red.withAlpha(75), BlendMode.darken);
|
||||||
|
ColorFilter unselectedFilter =
|
||||||
|
const ColorFilter.mode(Colors.black, BlendMode.color);
|
||||||
|
|
||||||
_buildSelectedTextBox() {
|
_buildSelectedTextBox() {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
@@ -31,9 +40,13 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
||||||
label: const Text(
|
label: const Text(
|
||||||
"INCLUDED",
|
"album_info_card_backup_album_included",
|
||||||
style: TextStyle(fontSize: 10, color: Colors.white, fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
),
|
fontSize: 10,
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
).tr(),
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
);
|
);
|
||||||
} else if (isExcluded) {
|
} else if (isExcluded) {
|
||||||
@@ -41,14 +54,18 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
||||||
label: const Text(
|
label: const Text(
|
||||||
"EXCLUDED",
|
"album_info_card_backup_album_excluded",
|
||||||
style: TextStyle(fontSize: 10, color: Colors.white, fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
),
|
fontSize: 10,
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
).tr(),
|
||||||
backgroundColor: Colors.red[300],
|
backgroundColor: Colors.red[300],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildImageFilter() {
|
_buildImageFilter() {
|
||||||
@@ -69,7 +86,7 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1) {
|
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1) {
|
||||||
ImmichToast.show(
|
ImmichToast.show(
|
||||||
context: context,
|
context: context,
|
||||||
msg: "Cannot remove the only album",
|
msg: "backup_err_only_album".tr(),
|
||||||
toastType: ToastType.error,
|
toastType: ToastType.error,
|
||||||
gravity: ToastGravity.BOTTOM,
|
gravity: ToastGravity.BOTTOM,
|
||||||
);
|
);
|
||||||
@@ -85,20 +102,27 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
HapticFeedback.selectionClick();
|
HapticFeedback.selectionClick();
|
||||||
|
|
||||||
if (isExcluded) {
|
if (isExcluded) {
|
||||||
ref.watch(backupProvider.notifier).removeExcludedAlbumForBackup(albumInfo);
|
ref
|
||||||
|
.watch(backupProvider.notifier)
|
||||||
|
.removeExcludedAlbumForBackup(albumInfo);
|
||||||
} else {
|
} else {
|
||||||
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1 &&
|
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1 &&
|
||||||
ref.watch(backupProvider).selectedBackupAlbums.contains(albumInfo)) {
|
ref
|
||||||
|
.watch(backupProvider)
|
||||||
|
.selectedBackupAlbums
|
||||||
|
.contains(albumInfo)) {
|
||||||
ImmichToast.show(
|
ImmichToast.show(
|
||||||
context: context,
|
context: context,
|
||||||
msg: "Cannot exclude the only album",
|
msg: "backup_err_only_album".tr(),
|
||||||
toastType: ToastType.error,
|
toastType: ToastType.error,
|
||||||
gravity: ToastGravity.BOTTOM,
|
gravity: ToastGravity.BOTTOM,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref.watch(backupProvider.notifier).addExcludedAlbumForBackup(albumInfo);
|
ref
|
||||||
|
.watch(backupProvider.notifier)
|
||||||
|
.addExcludedAlbumForBackup(albumInfo);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Card(
|
child: Card(
|
||||||
@@ -121,18 +145,27 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
width: 200,
|
width: 200,
|
||||||
height: 200,
|
height: 200,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)),
|
borderRadius: const BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(12),
|
||||||
|
topRight: Radius.circular(12),
|
||||||
|
),
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
colorFilter: _buildImageFilter(),
|
colorFilter: _buildImageFilter(),
|
||||||
image: imageData != null
|
image: imageData != null
|
||||||
? MemoryImage(imageData!)
|
? MemoryImage(imageData!)
|
||||||
: const AssetImage('assets/immich-logo-no-outline.png') as ImageProvider,
|
: const AssetImage(
|
||||||
|
'assets/immich-logo-no-outline.png',
|
||||||
|
) as ImageProvider,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: null,
|
child: null,
|
||||||
),
|
),
|
||||||
Positioned(bottom: 10, left: 25, child: _buildSelectedTextBox())
|
Positioned(
|
||||||
|
bottom: 10,
|
||||||
|
left: 25,
|
||||||
|
child: _buildSelectedTextBox(),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -150,13 +183,22 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
Text(
|
Text(
|
||||||
albumInfo.name,
|
albumInfo.name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14, color: Theme.of(context).primaryColor, fontWeight: FontWeight.bold),
|
fontSize: 14,
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 2.0),
|
padding: const EdgeInsets.only(top: 2.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
albumInfo.assetCount.toString() + (albumInfo.isAll ? " (ALL)" : ""),
|
albumInfo.assetCount.toString() +
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
(albumInfo.isAll
|
||||||
|
? " (${'backup_all'.tr()})"
|
||||||
|
: ""),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey[600],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -165,7 +207,8 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
AutoRouter.of(context).push(AlbumPreviewRoute(album: albumInfo));
|
AutoRouter.of(context)
|
||||||
|
.push(AlbumPreviewRoute(album: albumInfo));
|
||||||
},
|
},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.image_outlined,
|
Icons.image_outlined,
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class BackupInfoCard extends StatelessWidget {
|
class BackupInfoCard extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
||||||
final String subtitle;
|
final String subtitle;
|
||||||
final String info;
|
final String info;
|
||||||
const BackupInfoCard({Key? key, required this.title, required this.subtitle, required this.info}) : super(key: key);
|
const BackupInfoCard({
|
||||||
|
Key? key,
|
||||||
|
required this.title,
|
||||||
|
required this.subtitle,
|
||||||
|
required this.info,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -39,7 +45,7 @@ class BackupInfoCard extends StatelessWidget {
|
|||||||
info,
|
info,
|
||||||
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const Text("assets"),
|
const Text("backup_info_card_assets").tr(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,13 +16,17 @@ class AlbumPreviewPage extends HookConsumerWidget {
|
|||||||
final assets = useState<List<AssetEntity>>([]);
|
final assets = useState<List<AssetEntity>>([]);
|
||||||
|
|
||||||
_getAssetsInAlbum() async {
|
_getAssetsInAlbum() async {
|
||||||
assets.value = await album.getAssetListRange(start: 0, end: album.assetCount);
|
assets.value =
|
||||||
|
await album.getAssetListRange(start: 0, end: album.assetCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(
|
||||||
_getAssetsInAlbum();
|
() {
|
||||||
return null;
|
_getAssetsInAlbum();
|
||||||
}, []);
|
return null;
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@@ -37,7 +41,11 @@ class AlbumPreviewPage extends HookConsumerWidget {
|
|||||||
padding: const EdgeInsets.only(top: 4.0),
|
padding: const EdgeInsets.only(top: 4.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"ID ${album.id}",
|
"ID ${album.id}",
|
||||||
style: TextStyle(fontSize: 10, color: Colors.grey[600], fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
color: Colors.grey[600],
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -56,7 +64,10 @@ class AlbumPreviewPage extends HookConsumerWidget {
|
|||||||
itemCount: assets.value.length,
|
itemCount: assets.value.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
Future<Uint8List?> thumbData =
|
Future<Uint8List?> thumbData =
|
||||||
assets.value[index].thumbnailDataWithSize(const ThumbnailSize(200, 200), quality: 50);
|
assets.value[index].thumbnailDataWithSize(
|
||||||
|
const ThumbnailSize(200, 200),
|
||||||
|
quality: 50,
|
||||||
|
);
|
||||||
|
|
||||||
return FutureBuilder<Uint8List?>(
|
return FutureBuilder<Uint8List?>(
|
||||||
future: thumbData,
|
future: thumbData,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
@@ -16,10 +17,13 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
final selectedBackupAlbums = ref.watch(backupProvider).selectedBackupAlbums;
|
final selectedBackupAlbums = ref.watch(backupProvider).selectedBackupAlbums;
|
||||||
final excludedBackupAlbums = ref.watch(backupProvider).excludedBackupAlbums;
|
final excludedBackupAlbums = ref.watch(backupProvider).excludedBackupAlbums;
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(
|
||||||
ref.read(backupProvider.notifier).getBackupAlbumsInfo();
|
() {
|
||||||
return null;
|
ref.read(backupProvider.notifier).getBackupInfo();
|
||||||
}, []);
|
return null;
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
_buildAlbumSelectionList() {
|
_buildAlbumSelectionList() {
|
||||||
if (availableAlbums.isEmpty) {
|
if (availableAlbums.isEmpty) {
|
||||||
@@ -37,8 +41,13 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
itemBuilder: ((context, index) {
|
itemBuilder: ((context, index) {
|
||||||
var thumbnailData = availableAlbums[index].thumbnailData;
|
var thumbnailData = availableAlbums[index].thumbnailData;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: index == 0 ? const EdgeInsets.only(left: 16.00) : const EdgeInsets.all(0),
|
padding: index == 0
|
||||||
child: AlbumInfoCard(imageData: thumbnailData, albumInfo: availableAlbums[index].albumEntity),
|
? const EdgeInsets.only(left: 16.00)
|
||||||
|
: const EdgeInsets.all(0),
|
||||||
|
child: AlbumInfoCard(
|
||||||
|
imageData: thumbnailData,
|
||||||
|
albumInfo: availableAlbums[index].albumEntity,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -51,7 +60,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1) {
|
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1) {
|
||||||
ImmichToast.show(
|
ImmichToast.show(
|
||||||
context: context,
|
context: context,
|
||||||
msg: "Cannot remove the only album",
|
msg: "backup_err_only_album".tr(),
|
||||||
toastType: ToastType.error,
|
toastType: ToastType.error,
|
||||||
gravity: ToastGravity.BOTTOM,
|
gravity: ToastGravity.BOTTOM,
|
||||||
);
|
);
|
||||||
@@ -67,10 +76,16 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
onTap: removeSelection,
|
onTap: removeSelection,
|
||||||
child: Chip(
|
child: Chip(
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
label: Text(
|
label: Text(
|
||||||
album.name,
|
album.name,
|
||||||
style: const TextStyle(fontSize: 10, color: Colors.white, fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
deleteIconColor: Colors.white,
|
deleteIconColor: Colors.white,
|
||||||
@@ -88,7 +103,9 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
_buildExcludedAlbumNameChip() {
|
_buildExcludedAlbumNameChip() {
|
||||||
return excludedBackupAlbums.map((album) {
|
return excludedBackupAlbums.map((album) {
|
||||||
void removeSelection() {
|
void removeSelection() {
|
||||||
ref.watch(backupProvider.notifier).removeExcludedAlbumForBackup(album);
|
ref
|
||||||
|
.watch(backupProvider.notifier)
|
||||||
|
.removeExcludedAlbumForBackup(album);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@@ -97,10 +114,16 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
padding: const EdgeInsets.only(right: 8.0),
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
child: Chip(
|
child: Chip(
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
label: Text(
|
label: Text(
|
||||||
album.name,
|
album.name,
|
||||||
style: const TextStyle(fontSize: 10, color: Colors.white, fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.red[300],
|
backgroundColor: Colors.red[300],
|
||||||
deleteIconColor: Colors.white,
|
deleteIconColor: Colors.white,
|
||||||
@@ -122,27 +145,31 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
title: const Text(
|
title: const Text(
|
||||||
"Select Albums",
|
"backup_album_selection_page_select_albums",
|
||||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
),
|
).tr(),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
children: [
|
children: [
|
||||||
const Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
padding:
|
||||||
child: Text(
|
const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
"Selection Info",
|
child: const Text(
|
||||||
|
"backup_album_selection_page_selection_info",
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||||
),
|
).tr(),
|
||||||
),
|
),
|
||||||
// Selected Album Chips
|
// Selected Album Chips
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
children: [..._buildSelectedAlbumNameChip(), ..._buildExcludedAlbumNameChip()],
|
children: [
|
||||||
|
..._buildSelectedAlbumNameChip(),
|
||||||
|
..._buildExcludedAlbumNameChip()
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -164,11 +191,19 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
ListTile(
|
ListTile(
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
title: Text(
|
title: Text(
|
||||||
"Total unique assets",
|
"backup_album_selection_page_total_assets",
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Colors.grey[700]),
|
style: TextStyle(
|
||||||
),
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey[700],
|
||||||
|
),
|
||||||
|
).tr(),
|
||||||
trailing: Text(
|
trailing: Text(
|
||||||
ref.watch(backupProvider).allUniqueAssets.length.toString(),
|
ref
|
||||||
|
.watch(backupProvider)
|
||||||
|
.allUniqueAssets
|
||||||
|
.length
|
||||||
|
.toString(),
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -179,19 +214,20 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
|
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
"Albums on device (${availableAlbums.length.toString()})",
|
"backup_album_selection_page_albums_device"
|
||||||
|
.tr(args: [availableAlbums.length.toString()]),
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||||
),
|
),
|
||||||
subtitle: Padding(
|
subtitle: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Tap to include, double tap to exclude",
|
"backup_album_selection_page_albums_tap",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
).tr(),
|
||||||
),
|
),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
splashRadius: 16,
|
splashRadius: 16,
|
||||||
@@ -206,23 +242,28 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
elevation: 5,
|
elevation: 5,
|
||||||
title: Text(
|
title: Text(
|
||||||
'Selection Info',
|
'backup_album_selection_page_selection_info',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
),
|
),
|
||||||
),
|
).tr(),
|
||||||
content: SingleChildScrollView(
|
content: SingleChildScrollView(
|
||||||
child: ListBody(
|
child: ListBody(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Assets can scatter across multiple albums. Thus, albums can be included or excluded during the backup process.',
|
'backup_album_selection_page_assets_scatter',
|
||||||
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
|
style: TextStyle(
|
||||||
),
|
fontSize: 14,
|
||||||
|
color: Colors.grey[700],
|
||||||
|
),
|
||||||
|
).tr(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||