From ad1fe3a19c11494b381020409ed7069c7f81e2a0 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 16 Oct 2024 08:24:49 -0700 Subject: [PATCH 01/26] use flutter distributor to package windows app --- .github/workflows/build-windows.yml | 182 ++++------------------ Makefile | 30 ++-- lib/app.dart | 4 +- lib/features/window/window_container.dart | 26 ++-- lib/main.dart | 3 +- 5 files changed, 58 insertions(+), 187 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 304d63520..911cb10da 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -29,106 +29,24 @@ env: GOPRIVATE: github.com/getlantern S3_BUCKET: lantern jobs: - build-desktop: + build-windows: permissions: contents: "read" id-token: "write" env: version: ${{ inputs.version }} prefix: ${{ inputs.prefix }} - runs-on: ubuntu-20.04 + runs-on: windows-latest steps: - uses: actions/checkout@v4 with: lfs: true - - name: Pull LFS objects - run: git lfs pull - - name: Setup Go uses: actions/setup-go@v5 with: go-version-file: "go.mod" - - name: Granting private modules access - run: | - git config --global url."https://${{ secrets.GH_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/" - - - name: Repo access - run: | - mkdir /tmp/cache - echo "machine github.com login ${{ secrets.GH_TOKEN }} password x-oauth-basic" > /tmp/cache/.netrc - chmod 600 /tmp/cache/.netrc - - - name: Setup Sentry CLI - uses: mathieu-bour/setup-sentry-cli@v2 - with: - version: latest - token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets - organization: getlantern - project: android - - - name: Install dependencies - run: | - sudo apt-get install -y file build-essential pkg-config - sudo apt-get install -y mingw-w64 nsis - - - name: Build liblantern.dll - if: ${{inputs.update-suffix == '386'}} - run: | - make windows - - - name: Build liblantern.dll - if: ${{inputs.update-suffix == 'x64'}} - env: - SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" - VERSION: "${{ env.version }}" - run: | - make windows64 - - - uses: actions/upload-artifact@v4 - with: - name: libgo-windows-${{inputs.update-suffix}}-build - if-no-files-found: error - path: | - liblantern.dll - - - uses: actions/upload-artifact@v4 - with: - name: libgo-windows-${{inputs.update-suffix}}-header - if-no-files-found: error - path: | - liblantern.h - - - uses: actions/setup-python@v4 - with: - python-version: "3.12" - - - name: Install s3cmd - run: pip install s3cmd - - - name: Set s3cmd permissions - run: | - echo "[default]" > "$HOME/.s3cfg" - echo "access_key = ${{ secrets.AWS_ACCESS_KEY }}" >> "$HOME/.s3cfg" - echo "secret_key = ${{ secrets.AWS_SECRET_KEY }}" >> "$HOME/.s3cfg" - - - name: Push libgo to S3 - run: s3cmd put --acl-public liblantern.dll "s3://lantern/liblantern-${{inputs.update-suffix}}.dll" - - build-windows: - needs: build-desktop - permissions: - contents: "read" - id-token: "write" - env: - version: ${{ inputs.version }} - prefix: ${{ inputs.prefix }} - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - with: - lfs: true # Install Flutter - uses: subosito/flutter-action@v2 with: @@ -141,26 +59,16 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Activate protoc-gen-dart plugin + - name: Build Lantern Library run: | - dart pub global activate protoc_plugin - - - name: Download the win build output - uses: actions/download-artifact@v4 - with: - name: libgo-windows-${{inputs.update-suffix}}-build + touch app.env + mkdir -p "build/windows/${{inputs.arch}}/runner/Release" + make build-windows + mv liblantern.dll "build/windows/${{inputs.arch}}/runner/Release" - - name: Download the win build output - uses: actions/download-artifact@v4 - with: - name: libgo-windows-${{inputs.update-suffix}}-header - - - run: make ffigen - - - run: touch app.env - - - name: Build Flutter app - run: flutter build windows + - name: Activate plugins + run: | + dart pub global activate protoc_plugin flutter_distributor - name: Sign liblantern.dll with Azure Code Signing uses: getlantern/trusted-signing-action@main @@ -177,62 +85,31 @@ jobs: timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: windows${{inputs.build-suffix}}-build-signed - path: | - liblantern.dll + - name: Build Flutter app + run: make windows-release + env: + SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" + VERSION: "${{ env.version }}" - - name: Create archive + - name: Extract version from pubspec.yaml run: | - ls build/windows - cp liblantern.dll "build/windows/${{inputs.arch}}/runner/Release" - Compress-Archive "build/windows/${{inputs.arch}}/runner/Release" lantern.zip + VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') + echo "VERSION_PUBSPEC=$VERSION" >> $GITHUB_ENV - - uses: actions/upload-artifact@v4 + - name: Upload EXE artifact + uses: actions/upload-artifact@v4 with: - if-no-files-found: error - name: windows${{inputs.build-suffix}}-build - path: lantern.zip + name: windows${{inputs.build-suffix}}-exe-build + path: dist/${{ env.VERSION_PUBSPEC }}/windows/app-${{ env.VERSION_PUBSPEC }}.exe - build-installer: - needs: build-windows - permissions: - contents: "read" - id-token: "write" - env: - version: ${{ inputs.version }} - prefix: ${{ inputs.prefix }} - runs-on: ubuntu-20.04 - - steps: - - name: Install dependencies - run: | - sudo apt-get install -y file build-essential pkg-config - sudo apt-get install -y mingw-w64 nsis - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Upload MSIX artifact + uses: actions/upload-artifact@v4 with: - name: windows${{inputs.build-suffix}}-build - - name: Make installer - run: | - pwd - unzip lantern.zip - cp installer-resources-lantern/.packaged-lantern.yaml installer-resources-lantern/windows/.packaged-lantern.yaml - cp installer-resources-lantern/lantern.yaml installer-resources-lantern/windows/lantern.yaml - cp -r Release/* installer-resources-lantern/windows - makensis -V1 -DVERSION=${{ inputs.version }} -DAPP_NAME=lantern.exe -DOUT_FILE="lantern-installer${{inputs.installer-suffix}}.exe" installer-resources-lantern/windows/lantern.nsi - mv installer-resources-lantern/windows/lantern-installer${{inputs.installer-suffix}}.exe lantern-installer${{inputs.installer-suffix}}.exe - - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: windows${{inputs.build-suffix}}-installer-unsigned - path: lantern-installer${{inputs.installer-suffix}}.exe + name: windows${{inputs.build-suffix}}-msix-build + path: dist/${{ env.VERSION_PUBSPEC }}/windows/app-${{ env.VERSION_PUBSPEC }}.msix sign-installer: - needs: build-installer + needs: build-windows permissions: contents: "read" id-token: "write" @@ -244,7 +121,8 @@ jobs: - name: Download the win build output uses: actions/download-artifact@v4 with: - name: windows${{inputs.build-suffix}}-installer-unsigned + name: windows${{inputs.build-suffix}}-exe-build + destination: lantern-installer${{inputs.installer-suffix}}.exe - name: Sign EXE with Azure Code Signing uses: getlantern/trusted-signing-action@main @@ -275,7 +153,7 @@ jobs: env: version: ${{ inputs.version }} prefix: ${{ inputs.prefix }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Download the artifact diff --git a/Makefile b/Makefile index 9dbec78e0..859f67534 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,6 @@ GENERATED_PROTO_SOURCES = $(shell echo "$(PROTO_SOURCES)" | sed 's/\.proto/\.pb\ GO_SOURCES := $(GENERATED_PROTO_SOURCES) go.mod go.sum $(shell find internalsdk -type f -name "*.go") MOBILE_SOURCES := $(shell find Makefile android assets go.mod go.sum lib protos* -type f -not -path "*/libs/$(ANDROID_LIB_BASE)*" -not -iname "router.gr.dart") - .PHONY: dumpvars packages vendor android-debug do-android-release android-release do-android-bundle android-bundle android-debug-install android-release-install android-test android-cloud-test package-android # dumpvars prints out all variables defined in the Makefile, useful for debugging environment @@ -444,15 +443,6 @@ ios-release:set-version guard-SENTRY_AUTH_TOKEN guard-SENTRY_ORG guard-SENTRY_PR echo "iOS IPA generated under: $$IPA_PATH"; \ open "$$IPA_PATH" -## Mocks -MOCKERY=mockery -MOCKERY_FLAGS=--case=underscore --output=internalsdk/mocks --outpkg=mocks - -.PHONY: mocks -mocks: - @$(MOCKERY) --name=AdProvider --name=AdSettings --name=Session --dir=./internalsdk $(MOCKERY_FLAGS) - @$(MOCKERY) --name=ProClient --dir=./internalsdk/pro $(MOCKERY_FLAGS) - .PHONY: echo-build-tags echo-build-tags: ## Prints build tags and extra ldflags. Run this with `REPLICA=1 make echo-build-tags` for example to see how it changes @if [[ -z "$$VERSION" ]]; then \ @@ -504,23 +494,20 @@ linux-arm64: desktop-lib ## Build lantern for linux-arm64 package-linux: flutter_distributor package --skip-clean --platform linux --targets "deb,rpm" --flutter-build-args=verbose -.PHONY: windows -windows: require-mingw $(WINDOWS_LIB_NAME) ## Build lantern for windows -$(WINDOWS_LIB_NAME): export CXX = i686-w64-mingw32-g++ -$(WINDOWS_LIB_NAME): export CC = i686-w64-mingw32-gcc -$(WINDOWS_LIB_NAME): export CGO_LDFLAGS = -static +## Windows +.PHONY: windows-lib +windows-lib: $(WINDOWS_LIB_NAME) ## Build lantern for windows $(WINDOWS_LIB_NAME): export GOOS = windows -$(WINDOWS_LIB_NAME): export GOARCH = 386 $(WINDOWS_LIB_NAME): export LIB_NAME = $(WINDOWS_LIB_NAME) $(WINDOWS_LIB_NAME): export BUILD_TAGS += walk_use_cgo $(WINDOWS_LIB_NAME): export EXTRA_LDFLAGS += -$(WINDOWS_LIB_NAME): export GO_BUILD_FLAGS += -a -buildmode=c-shared +$(WINDOWS_LIB_NAME): export GO_BUILD_FLAGS += -buildmode=c-shared $(WINDOWS_LIB_NAME): export BUILD_RACE = $(WINDOWS_LIB_NAME): export Environment = production $(WINDOWS_LIB_NAME): desktop-lib .PHONY: windows64 -windows64: require-mingw $(WINDOWS64_LIB_NAME) ## Build lantern for windows +windows-lib64: require-mingw $(WINDOWS64_LIB_NAME) ## Build lantern for windows $(WINDOWS64_LIB_NAME): export CXX = x86_64-w64-mingw32-g++ $(WINDOWS64_LIB_NAME): export CC = x86_64-w64-mingw32-gcc $(WINDOWS64_LIB_NAME): export CGO_LDFLAGS = -static @@ -533,6 +520,13 @@ $(WINDOWS64_LIB_NAME): export GO_BUILD_FLAGS += -a -buildmode=c-shared $(WINDOWS64_LIB_NAME): export BUILD_RACE = $(WINDOWS64_LIB_NAME): desktop-lib +.PHONY: build-windows windows-release +build-windows: windows-lib ffigen + +# Build the Windows app using Flutter Distributor +windows-release: ffigen + @flutter_distributor package --flutter-build-args=verbose --platform windows --targets exe,msix --build-target lib/main.dart + ## Darwin .PHONY: darwin-amd64 darwin-amd64: $(DARWIN_LIB_AMD64) diff --git a/lib/app.dart b/lib/app.dart index 35fba9a74..60e017790 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -158,7 +158,9 @@ class _LanternAppState extends State ], ); if (isDesktop()) { - return WindowContainer(TrayContainer(app)); + return WindowContainer( + TrayContainer(app), + ); } return app; } diff --git a/lib/features/window/window_container.dart b/lib/features/window/window_container.dart index 88ea6f6d4..f6048f49e 100644 --- a/lib/features/window/window_container.dart +++ b/lib/features/window/window_container.dart @@ -23,17 +23,15 @@ class _WindowContainerState extends State with WindowListener { super.initState(); if (isDesktop()) { windowManager.addListener(this); - _initializeWindow(); WidgetsBinding.instance.addPostFrameCallback((_) async { - await windowManager.setPreventClose(true); - await _setWindowResizable(); + await _initializeWindow(); }); } } Future _initializeWindow() async { - await windowManager.ensureInitialized(); - await windowManager.setSize(const Size(360, 712)); + await windowManager.setPreventClose(true); + await _setWindowResizable(); await windowManager.show(); await windowManager.focus(); } @@ -45,23 +43,21 @@ class _WindowContainerState extends State with WindowListener { } Future _setWindowResizable() async { - if (!Platform.isWindows) { + /*if (!Platform.isWindows) { await windowManager.setResizable(false); return; - } + }*/ // temporary workaround for distorted layout on Windows. The problem goes away // after the window is resized. // See https://github.com/leanflutter/window_manager/issues/464 // and https://github.com/KRTirtho/spotube/issues/1553 - await Future.delayed(const Duration(milliseconds: 100), () async { - windowManager.getSize().then((Size value) { - windowManager - .setSize( - Size(value.width + 1, value.height + 1), - ) - .then((_) => setState(() => {})); - }); + Future.delayed(const Duration(seconds: 2), () async { + final size = await windowManager.getSize(); + await windowManager.setSize( + Size(size.width + 1, size.height + 1), + ); await windowManager.setResizable(false); + setState(() => {}); }); } diff --git a/lib/main.dart b/lib/main.dart index 0e8af2c47..c1c07e6fd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -31,7 +31,8 @@ Future main() async { } if (isDesktop()) { - // start backend services before setting up window + await windowManager.ensureInitialized(); + await windowManager.setSize(const ui.Size(360, 712)); LanternFFI.startDesktopService(); await WebsocketSubscriber().connect(); } else { From 316114b252ad34ce00bb37f5a34c4bd43bf362bf Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 16 Oct 2024 08:33:54 -0700 Subject: [PATCH 02/26] update windows release target --- .github/workflows/build-windows.yml | 3 ++- Makefile | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 911cb10da..987b54ed5 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -68,7 +68,8 @@ jobs: - name: Activate plugins run: | - dart pub global activate protoc_plugin flutter_distributor + dart pub global activate protoc_plugin + dart pub global activate flutter_distributor - name: Sign liblantern.dll with Azure Code Signing uses: getlantern/trusted-signing-action@main diff --git a/Makefile b/Makefile index 859f67534..f2691a69f 100644 --- a/Makefile +++ b/Makefile @@ -207,6 +207,7 @@ GENERATED_PROTO_SOURCES = $(shell echo "$(PROTO_SOURCES)" | sed 's/\.proto/\.pb\ GO_SOURCES := $(GENERATED_PROTO_SOURCES) go.mod go.sum $(shell find internalsdk -type f -name "*.go") MOBILE_SOURCES := $(shell find Makefile android assets go.mod go.sum lib protos* -type f -not -path "*/libs/$(ANDROID_LIB_BASE)*" -not -iname "router.gr.dart") + .PHONY: dumpvars packages vendor android-debug do-android-release android-release do-android-bundle android-bundle android-debug-install android-release-install android-test android-cloud-test package-android # dumpvars prints out all variables defined in the Makefile, useful for debugging environment @@ -443,6 +444,15 @@ ios-release:set-version guard-SENTRY_AUTH_TOKEN guard-SENTRY_ORG guard-SENTRY_PR echo "iOS IPA generated under: $$IPA_PATH"; \ open "$$IPA_PATH" +## Mocks +MOCKERY=mockery +MOCKERY_FLAGS=--case=underscore --output=internalsdk/mocks --outpkg=mocks + +.PHONY: mocks +mocks: + @$(MOCKERY) --name=AdProvider --name=AdSettings --name=Session --dir=./internalsdk $(MOCKERY_FLAGS) + @$(MOCKERY) --name=ProClient --dir=./internalsdk/pro $(MOCKERY_FLAGS) + .PHONY: echo-build-tags echo-build-tags: ## Prints build tags and extra ldflags. Run this with `REPLICA=1 make echo-build-tags` for example to see how it changes @if [[ -z "$$VERSION" ]]; then \ @@ -494,20 +504,23 @@ linux-arm64: desktop-lib ## Build lantern for linux-arm64 package-linux: flutter_distributor package --skip-clean --platform linux --targets "deb,rpm" --flutter-build-args=verbose -## Windows -.PHONY: windows-lib -windows-lib: $(WINDOWS_LIB_NAME) ## Build lantern for windows +.PHONY: windows +windows: require-mingw $(WINDOWS_LIB_NAME) ## Build lantern for windows +$(WINDOWS_LIB_NAME): export CXX = i686-w64-mingw32-g++ +$(WINDOWS_LIB_NAME): export CC = i686-w64-mingw32-gcc +$(WINDOWS_LIB_NAME): export CGO_LDFLAGS = -static $(WINDOWS_LIB_NAME): export GOOS = windows +$(WINDOWS_LIB_NAME): export GOARCH = 386 $(WINDOWS_LIB_NAME): export LIB_NAME = $(WINDOWS_LIB_NAME) $(WINDOWS_LIB_NAME): export BUILD_TAGS += walk_use_cgo $(WINDOWS_LIB_NAME): export EXTRA_LDFLAGS += -$(WINDOWS_LIB_NAME): export GO_BUILD_FLAGS += -buildmode=c-shared +$(WINDOWS_LIB_NAME): export GO_BUILD_FLAGS += -a -buildmode=c-shared $(WINDOWS_LIB_NAME): export BUILD_RACE = $(WINDOWS_LIB_NAME): export Environment = production $(WINDOWS_LIB_NAME): desktop-lib .PHONY: windows64 -windows-lib64: require-mingw $(WINDOWS64_LIB_NAME) ## Build lantern for windows +windows64: require-mingw $(WINDOWS64_LIB_NAME) ## Build lantern for windows $(WINDOWS64_LIB_NAME): export CXX = x86_64-w64-mingw32-g++ $(WINDOWS64_LIB_NAME): export CC = x86_64-w64-mingw32-gcc $(WINDOWS64_LIB_NAME): export CGO_LDFLAGS = -static From 983e470fd506f8984a7011bb9a4302eadf7059a6 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 16 Oct 2024 08:41:34 -0700 Subject: [PATCH 03/26] clean-ups --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f2691a69f..8d6fa0b86 100644 --- a/Makefile +++ b/Makefile @@ -538,7 +538,7 @@ build-windows: windows-lib ffigen # Build the Windows app using Flutter Distributor windows-release: ffigen - @flutter_distributor package --flutter-build-args=verbose --platform windows --targets exe,msix --build-target lib/main.dart + flutter_distributor package --skip-clean --platform windows --targets "exe,msix" --flutter-build-args=verbose ## Darwin .PHONY: darwin-amd64 From 8f06ed4e5eb1353985dc9352c7d230eac869f6a3 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 16 Oct 2024 08:53:51 -0700 Subject: [PATCH 04/26] clean-ups --- .github/workflows/build-windows.yml | 2 +- Makefile | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 987b54ed5..dbd34f17f 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -63,7 +63,7 @@ jobs: run: | touch app.env mkdir -p "build/windows/${{inputs.arch}}/runner/Release" - make build-windows + make windows mv liblantern.dll "build/windows/${{inputs.arch}}/runner/Release" - name: Activate plugins diff --git a/Makefile b/Makefile index 8d6fa0b86..f97004e22 100644 --- a/Makefile +++ b/Makefile @@ -533,10 +533,8 @@ $(WINDOWS64_LIB_NAME): export GO_BUILD_FLAGS += -a -buildmode=c-shared $(WINDOWS64_LIB_NAME): export BUILD_RACE = $(WINDOWS64_LIB_NAME): desktop-lib -.PHONY: build-windows windows-release -build-windows: windows-lib ffigen +.PHONY: windows-release -# Build the Windows app using Flutter Distributor windows-release: ffigen flutter_distributor package --skip-clean --platform windows --targets "exe,msix" --flutter-build-args=verbose From a70fd376f25d4fa6f32de2660b661b733f8e18f7 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 16 Oct 2024 08:58:27 -0700 Subject: [PATCH 05/26] Add if-no-files-found: error --- .github/workflows/build-linux.yml | 9 +++++++-- .github/workflows/build-windows.yml | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 638691d82..45de5cc2c 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -87,6 +87,11 @@ jobs: - run: touch app.env + - name: Extract app version from pubspec.yaml + run: | + VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') + echo "APP_VERSION=$VERSION" >> $GITHUB_ENV + - name: Build Flutter app run: flutter build linux @@ -94,8 +99,8 @@ jobs: run: | cp liblantern.so "build/linux/${{inputs.dist-suffix}}/release/bundle" make package-linux - mv dist/1.0.0+1/lantern-1.0.0+1-linux.deb lantern_${{inputs.version}}_x64.deb - mv dist/1.0.0+1/lantern-1.0.0+1-linux.rpm lantern_${{inputs.version}}_x64.rpm + mv dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-linux.deb lantern_${{inputs.version}}_x64.deb + mv dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-linux.rpm lantern_${{inputs.version}}_x64.rpm - uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index dbd34f17f..b413786b0 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -92,22 +92,24 @@ jobs: SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" VERSION: "${{ env.version }}" - - name: Extract version from pubspec.yaml + - name: Extract app version from pubspec.yaml run: | VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') - echo "VERSION_PUBSPEC=$VERSION" >> $GITHUB_ENV + echo "APP_VERSION=$VERSION" >> $GITHUB_ENV - name: Upload EXE artifact uses: actions/upload-artifact@v4 with: + if-no-files-found: error name: windows${{inputs.build-suffix}}-exe-build - path: dist/${{ env.VERSION_PUBSPEC }}/windows/app-${{ env.VERSION_PUBSPEC }}.exe + path: dist/${{ env.APP_VERSION }}/windows/lantern-${{ env.APP_VERSION }}.exe - name: Upload MSIX artifact uses: actions/upload-artifact@v4 with: + if-no-files-found: error name: windows${{inputs.build-suffix}}-msix-build - path: dist/${{ env.VERSION_PUBSPEC }}/windows/app-${{ env.VERSION_PUBSPEC }}.msix + path: dist/${{ env.APP_VERSION }}/windows/lantern-${{ env.APP_VERSION }}.msix sign-installer: needs: build-windows From 3a6afacc133fcfbb2cc9ee5322f7f605fda29e62 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 16 Oct 2024 09:04:10 -0700 Subject: [PATCH 06/26] Set up MinGW before building library --- .github/workflows/build-windows.yml | 8 ++++++++ Makefile | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index b413786b0..a80dd435f 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -47,6 +47,14 @@ jobs: with: go-version-file: "go.mod" + - name: Chocolatey Action + uses: crazy-max/ghaction-chocolatey@v3.0.0 + + - name: Set up MinGW + uses: egor-tensin/setup-mingw@v2 + with: + platform: x64 + # Install Flutter - uses: subosito/flutter-action@v2 with: diff --git a/Makefile b/Makefile index f97004e22..b791d904f 100644 --- a/Makefile +++ b/Makefile @@ -505,7 +505,7 @@ package-linux: flutter_distributor package --skip-clean --platform linux --targets "deb,rpm" --flutter-build-args=verbose .PHONY: windows -windows: require-mingw $(WINDOWS_LIB_NAME) ## Build lantern for windows +windows: $(WINDOWS_LIB_NAME) ## Build lantern for windows $(WINDOWS_LIB_NAME): export CXX = i686-w64-mingw32-g++ $(WINDOWS_LIB_NAME): export CC = i686-w64-mingw32-gcc $(WINDOWS_LIB_NAME): export CGO_LDFLAGS = -static From ed452a66e2d4a2a9f9e5d9942a56d0cd45f68447 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 16 Oct 2024 09:09:09 -0700 Subject: [PATCH 07/26] Add required input args --- .github/workflows/build-windows.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index a80dd435f..c516bc6ef 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -49,6 +49,8 @@ jobs: - name: Chocolatey Action uses: crazy-max/ghaction-chocolatey@v3.0.0 + with: + args: -h - name: Set up MinGW uses: egor-tensin/setup-mingw@v2 From ae520da4b118b5a675c5ebf496f5426fc30aa4ce Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 16 Oct 2024 09:15:45 -0700 Subject: [PATCH 08/26] update how MinGW is installed --- .github/workflows/build-windows.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index c516bc6ef..8a2e1c879 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -53,9 +53,7 @@ jobs: args: -h - name: Set up MinGW - uses: egor-tensin/setup-mingw@v2 - with: - platform: x64 + run: choco install mingw -y # Install Flutter - uses: subosito/flutter-action@v2 From ed0f28e096c3d151b442ca234ca616bd196838ef Mon Sep 17 00:00:00 2001 From: atavism Date: Tue, 22 Oct 2024 14:35:56 -0700 Subject: [PATCH 09/26] merge latest and updates to build installer --- .github/workflows/build-windows.yml | 35 +++-------------------------- Makefile | 6 ++++- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 8a2e1c879..70ac8f784 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -71,13 +71,12 @@ jobs: run: | touch app.env mkdir -p "build/windows/${{inputs.arch}}/runner/Release" - make windows + make windows64 mv liblantern.dll "build/windows/${{inputs.arch}}/runner/Release" - name: Activate plugins run: | dart pub global activate protoc_plugin - dart pub global activate flutter_distributor - name: Sign liblantern.dll with Azure Code Signing uses: getlantern/trusted-signing-action@main @@ -100,40 +99,12 @@ jobs: SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" VERSION: "${{ env.version }}" - - name: Extract app version from pubspec.yaml - run: | - VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') - echo "APP_VERSION=$VERSION" >> $GITHUB_ENV - - name: Upload EXE artifact uses: actions/upload-artifact@v4 with: if-no-files-found: error name: windows${{inputs.build-suffix}}-exe-build - path: dist/${{ env.APP_VERSION }}/windows/lantern-${{ env.APP_VERSION }}.exe - - - name: Upload MSIX artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: windows${{inputs.build-suffix}}-msix-build - path: dist/${{ env.APP_VERSION }}/windows/lantern-${{ env.APP_VERSION }}.msix - - sign-installer: - needs: build-windows - permissions: - contents: "read" - id-token: "write" - env: - version: ${{ inputs.version }} - prefix: ${{ inputs.prefix }} - runs-on: windows-latest - steps: - - name: Download the win build output - uses: actions/download-artifact@v4 - with: - name: windows${{inputs.build-suffix}}-exe-build - destination: lantern-installer${{inputs.installer-suffix}}.exe + path: lantern-installer-x64.exe - name: Sign EXE with Azure Code Signing uses: getlantern/trusted-signing-action@main @@ -157,7 +128,7 @@ jobs: lantern-installer${{inputs.installer-suffix}}.exe upload-windows: - needs: sign-installer + needs: build-windows permissions: contents: "read" id-token: "write" diff --git a/Makefile b/Makefile index 5c4584483..df6436d13 100644 --- a/Makefile +++ b/Makefile @@ -482,6 +482,9 @@ lantern: ## Build lantern without REPLICA enabled ffigen: dart run ffigen --config ffigen.yaml +## APP_VERSION is the version defined in pubspec.yaml +APP_VERSION := $(shell grep '^version:' pubspec.yaml | sed 's/version: //') + .PHONY: linux-amd64 linux-amd64: export GOOS = linux linux-amd64: export GOARCH = amd64 @@ -536,7 +539,8 @@ $(WINDOWS64_LIB_NAME): desktop-lib .PHONY: windows-release windows-release: ffigen - flutter_distributor package --skip-clean --platform windows --targets "exe,msix" --flutter-build-args=verbose + flutter build windows + mv dist/$(APP_VERSION)/lantern-$(APP_VERSION).exe lantern-installer-x64.exe ## Darwin .PHONY: darwin-amd64 From ce086b2ee3f55e33a97938b37b173c39319fd6ca Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 18:45:21 -0700 Subject: [PATCH 10/26] updates to webview settings and add new packaging configs --- .github/workflows/build-windows.yml | 67 +++++-- Makefile | 13 +- distribute_options.yaml | 8 +- lib/core/app/app_webview.dart | 254 ++++++++++++++++++++++--- lib/main.dart | 22 +++ pubspec.lock | 96 ---------- pubspec.yaml | 1 - windows/packaging/exe/make_config.yaml | 14 ++ 8 files changed, 334 insertions(+), 141 deletions(-) create mode 100644 windows/packaging/exe/make_config.yaml diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 70ac8f784..2ca586e85 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -47,16 +47,17 @@ jobs: with: go-version-file: "go.mod" - - name: Chocolatey Action - uses: crazy-max/ghaction-chocolatey@v3.0.0 - with: - args: -h + - name: Install WebView2 Runtime + shell: pwsh + run: | + Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "MicrosoftEdgeWebView2Setup.exe" + Start-Process -FilePath ".\MicrosoftEdgeWebView2Setup.exe" -ArgumentList "/silent", "/install" -Wait - name: Set up MinGW run: choco install mingw -y - # Install Flutter - - uses: subosito/flutter-action@v2 + - name: Install Flutter + uses: subosito/flutter-action@v2 with: channel: "stable" @@ -67,16 +68,18 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build Lantern Library + shell: bash run: | touch app.env mkdir -p "build/windows/${{inputs.arch}}/runner/Release" make windows64 - mv liblantern.dll "build/windows/${{inputs.arch}}/runner/Release" - name: Activate plugins run: | dart pub global activate protoc_plugin + dart pub global activate flutter_distributor - name: Sign liblantern.dll with Azure Code Signing uses: getlantern/trusted-signing-action@main @@ -93,18 +96,43 @@ jobs: timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 + - name: Move liblantern.dll to release directory + shell: bash + run: | + mv liblantern_x64.dll "build/windows/${{inputs.arch}}/runner/Release" + + - name: Extract app version from pubspec.yaml + id: extract_version + shell: bash + run: | + APP_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') + echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV + - name: Build Flutter app - run: make windows-release + run: | + Get-FileHash "build/windows/${{inputs.arch}}/runner/Release/liblantern_x64.dll" -Algorithm SHA256 + New-Item -Path "./dist/${{ env.APP_VERSION }}" -ItemType Directory -Force + flutter_distributor package --platform windows --targets exe --skip-clean env: SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" VERSION: "${{ env.version }}" - - name: Upload EXE artifact + - name: Upload Windows artifacts uses: actions/upload-artifact@v4 with: - if-no-files-found: error - name: windows${{inputs.build-suffix}}-exe-build - path: lantern-installer-x64.exe + name: windows + path: | + dist/*/*.msix + dist/*/*.zip + + - name: Rename installer + shell: bash + run: | + ls -ltr ./dist + ls -ltr "build/windows/${{inputs.arch}}/runner" + ls -ltr "build/windows/${{inputs.arch}}/runner/Release" + mv "dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-windows-setup.exe" lantern-installer${{inputs.installer-suffix}}.exe + # mv "dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-windows.msix" lantern-installer${{inputs.installer-suffix}}.msix - name: Sign EXE with Azure Code Signing uses: getlantern/trusted-signing-action@main @@ -115,18 +143,27 @@ jobs: endpoint: https://wus2.codesigning.azure.net/ code-signing-account-name: code-signing certificate-profile-name: Lantern - files-folder: ${{ github.workspace }}\ - files-folder-filter: exe + files-folder: ${{ github.workspace }}/ + files-folder-filter: exe,dll,msix file-digest: SHA256 timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 - - uses: actions/upload-artifact@v4 + - name: Upload EXE artifact + uses: actions/upload-artifact@v4 with: name: windows${{inputs.build-suffix}}-installer-signed path: | lantern-installer${{inputs.installer-suffix}}.exe + # - name: Upload msix artifact + # uses: actions/upload-artifact@v4 + # with: + # name: windows${{inputs.build-suffix}}-installer-msix + # path: | + # lantern-installer${{inputs.installer-suffix}}.msix + + upload-windows: needs: build-windows permissions: diff --git a/Makefile b/Makefile index df6436d13..bb204a8d6 100644 --- a/Makefile +++ b/Makefile @@ -137,7 +137,7 @@ INSTALLER_RESOURCES ?= installer-resources-$(APP) INSTALLER_NAME ?= $(APP)-installer WINDOWS_LIB_NAME ?= $(DESKTOP_LIB_NAME).dll WINDOWS_APP_NAME ?= $(APP).exe -WINDOWS64_LIB_NAME ?= $(DESKTOP_LIB_NAME).dll +WINDOWS64_LIB_NAME ?= $(DESKTOP_LIB_NAME)_x64.dll WINDOWS64_APP_NAME ?= $(APP)_x64.exe LINUX_LIB_NAME ?= $(DESKTOP_LIB_NAME).so @@ -470,7 +470,8 @@ echo-build-tags: ## Prints build tags and extra ldflags. Run this with `REPLICA= desktop-lib: export GOPRIVATE = github.com/getlantern desktop-lib: echo-build-tags - CGO_ENABLED=1 go build -trimpath $(GO_BUILD_FLAGS) -o "$(LIB_NAME)" -tags="$(BUILD_TAGS)" -ldflags="$(LDFLAGS) $(EXTRA_LDFLAGS)" desktop/*.go + go mod download + CGO_ENABLED=1 go build -v -trimpath $(GO_BUILD_FLAGS) -o "$(LIB_NAME)" -tags="$(BUILD_TAGS)" -ldflags="$(LDFLAGS) $(EXTRA_LDFLAGS)" desktop/*.go # This runs a development build for lantern. For production builds, see # 'lantern-prod' target @@ -523,7 +524,7 @@ $(WINDOWS_LIB_NAME): export Environment = production $(WINDOWS_LIB_NAME): desktop-lib .PHONY: windows64 -windows64: require-mingw $(WINDOWS64_LIB_NAME) ## Build lantern for windows +windows64: $(WINDOWS64_LIB_NAME) ## Build lantern for windows $(WINDOWS64_LIB_NAME): export CXX = x86_64-w64-mingw32-g++ $(WINDOWS64_LIB_NAME): export CC = x86_64-w64-mingw32-gcc $(WINDOWS64_LIB_NAME): export CGO_LDFLAGS = -static @@ -536,10 +537,12 @@ $(WINDOWS64_LIB_NAME): export GO_BUILD_FLAGS += -a -buildmode=c-shared $(WINDOWS64_LIB_NAME): export BUILD_RACE = $(WINDOWS64_LIB_NAME): desktop-lib -.PHONY: windows-release +## APP_VERSION is the version defined in pubspec.yaml +APP_VERSION := $(shell grep '^version:' pubspec.yaml | sed 's/version: //') +.PHONY: windows-release windows-release: ffigen - flutter build windows + flutter_distributor package --flutter-build-args=verbose --platform windows --targets "msix,exe" mv dist/$(APP_VERSION)/lantern-$(APP_VERSION).exe lantern-installer-x64.exe ## Darwin diff --git a/distribute_options.yaml b/distribute_options.yaml index afb4fa714..6996108e7 100644 --- a/distribute_options.yaml +++ b/distribute_options.yaml @@ -1,2 +1,8 @@ -app_name: 'Lantern' output: 'dist/' +releases: + - name: production + jobs: + - name: release-windows-exe + package: + platform: windows + target: exe \ No newline at end of file diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index 99a9f0dbf..b43e7f1d2 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -1,7 +1,10 @@ -import 'package:desktop_webview_window/desktop_webview_window.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:lantern/app.dart'; import 'package:lantern/core/utils/common.dart'; +import 'package:lantern/main.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:webview_windows/webview_windows.dart'; +import 'package:window_manager/window_manager.dart'; @RoutePage(name: 'AppWebview') class AppWebView extends StatefulWidget { @@ -19,27 +22,69 @@ class AppWebView extends StatefulWidget { } class _AppWebViewState extends State { + late InAppWebViewController webViewController; + + void showErrorDialog(String title, String message) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text(title), + content: Text(message), + actions: [ + TextButton( + child: Text("OK"), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } + @override Widget build(BuildContext context) { + /*if (Platform.isWindows) { + return _DesktopWebView(url: widget.url, title: widget.title); + }*/ + return BaseScreen( title: widget.title, - showAppBar: true, body: InAppWebView( initialUrlRequest: URLRequest(url: WebUri(widget.url)), + onWebViewCreated: (controller) { + webViewController = controller; + }, + webViewEnvironment: webViewEnvironment, + /*onLoadStop: (controller, url) async { + _showWebViewUrl(); + },*/ + onReceivedHttpError: (controller, request, response) { + print("HTTP error: ${response.statusCode} for ${request.url}"); + showErrorDialog("HTTP Error", + "Status code: ${response.statusCode}\nDescription: ${response.reasonPhrase ?? ''}"); + }, + onReceivedError: (controller, request, error) => + showErrorDialog("Failed to load", error.description), initialSettings: InAppWebViewSettings( - isInspectable: kDebugMode, + isInspectable: true, javaScriptEnabled: true, supportZoom: true, - useWideViewPort: true, - loadWithOverviewMode: true, - builtInZoomControls: true, + domStorageEnabled: true, + allowFileAccess: true, + useWideViewPort: !isDesktop(), + loadWithOverviewMode: !isDesktop(), + clearCache: true, + javaScriptCanOpenWindowsAutomatically: true, + supportMultipleWindows: true, + mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW, + builtInZoomControls: Platform.isAndroid, displayZoomControls: false, mediaPlaybackRequiresUserGesture: false, - allowsInlineMediaPlayback: false, + allowsInlineMediaPlayback: Platform.isIOS, underPageBackgroundColor: Colors.white, - allowBackgroundAudioPlaying: false, - allowFileAccessFromFileURLs: true, - preferredContentMode: UserPreferredContentMode.MOBILE, ), onProgressChanged: (controller, progress) { appLogger.i("Loading progress: $progress%"); @@ -47,6 +92,51 @@ class _AppWebViewState extends State { ), ); } + + Future _showWebViewUrl() async { + try { + // Get the current URL from the WebView + var currentUrl = await webViewController.getUrl(); + String urlToShow = + currentUrl != null ? currentUrl.toString() : "No URL loaded"; + + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text("Current WebView URL"), + content: Text(urlToShow), + actions: [ + TextButton( + child: const Text("OK"), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } catch (e) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text("Error"), + content: Text("Failed to get URL: $e"), + actions: [ + TextButton( + child: const Text("OK"), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } + } } class AppBrowser extends InAppBrowser { @@ -143,13 +233,14 @@ class AppBrowser extends InAppBrowser { } // navigateWebview navigates to the webview route and displays the given url - static Future navigateWebview(BuildContext context, String url) async => - await context.pushRoute( - AppWebview( - url: url, - title: 'lantern_pro_checkout'.i18n, - ), - ); + static Future navigateWebview(BuildContext context, String url) async { + await context.pushRoute( + AppWebview( + url: url, + title: 'lantern_pro_checkout'.i18n, + ), + ); + } // openWithSystemBrowser opens a URL in the browser static Future openWithSystemBrowser(String url) async => @@ -161,15 +252,11 @@ class AppBrowser extends InAppBrowser { await navigateWebview(context, url); break; case 'linux': - try { - final webview = await WebviewWindow.create(); - webview.launch(url); - } catch (e) { - mainLogger.e("Error opening linux webview: $e"); - } + await navigateWebview(context, url); break; case 'macos': await openWithSystemBrowser(url); + break; case 'ios': await openWithSystemBrowser(url); break; @@ -188,3 +275,124 @@ class AppBrowser extends InAppBrowser { ); } } + +class _DesktopWebView extends StatefulWidget { + final String url; + final String title; + + const _DesktopWebView({ + required this.url, + required this.title, + }); + + @override + _DesktopWebViewState createState() => _DesktopWebViewState(); +} + +class _DesktopWebViewState extends State<_DesktopWebView> { + late WebviewController _controller; + final List _subscriptions = []; + + @override + void initState() { + super.initState(); + if (Platform.isWindows) { + _initWindowsWebview(); + } + } + + Future _initWindowsWebview() async { + try { + _controller = WebviewController(); + await _controller.initialize(); + + _subscriptions + .add(_controller.containsFullScreenElementChanged.listen((flag) { + windowManager.setFullScreen(flag); + })); + await _controller.setBackgroundColor(Colors.transparent); + await _controller.setPopupWindowPolicy(WebviewPopupWindowPolicy.deny); + await _controller.loadUrl(widget.url); + if (mounted) setState(() {}); + } on PlatformException catch (e) { + WidgetsBinding.instance.addPostFrameCallback((_) { + showDialog( + context: context, + builder: (_) => AlertDialog( + title: Text('Error'), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Code: ${e.code}'), + Text('Message: ${e.message}'), + ], + ), + actions: [ + TextButton( + child: Text('Continue'), + onPressed: () { + Navigator.of(context).pop(); + }, + ) + ], + )); + }); + } + } + + @override + void dispose() { + for (var s in _subscriptions) { + s.cancel(); + } + _controller.dispose(); + super.dispose(); + } + + Future _onPermissionRequested( + String url, WebviewPermissionKind kind, bool isUserInitiated) async { + final decision = await showDialog( + context: globalRouter.navigatorKey.currentContext!, + builder: (BuildContext context) => AlertDialog( + title: const Text('WebView permission requested'), + content: Text('WebView has requested permission \'$kind\''), + actions: [ + TextButton( + onPressed: () => + Navigator.pop(context, WebviewPermissionDecision.deny), + child: const Text('Deny'), + ), + TextButton( + onPressed: () => + Navigator.pop(context, WebviewPermissionDecision.allow), + child: const Text('Allow'), + ), + ], + ), + ); + + return decision ?? WebviewPermissionDecision.none; + } + + @override + Widget build(BuildContext context) { + return BaseScreen( + title: widget.title, + body: _controller.value.isInitialized + ? Webview( + _controller, + permissionRequested: _onPermissionRequested, + ) + : const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Center( + child: CircularProgressIndicator(), + ), + ], + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index c1c07e6fd..cf9d5cbf9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,15 +2,19 @@ import 'dart:ui' as ui; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_driver/driver_extension.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import 'package:lantern/app.dart'; import 'package:lantern/core/utils/common.dart'; import 'package:lantern/core/utils/common_desktop.dart'; import 'package:lantern/core/service/app_purchase.dart'; import 'package:lantern/features/replica/ui/utils.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:window_manager/window_manager.dart'; +WebViewEnvironment? webViewEnvironment; + // IOS issue // https://github.com/flutter/flutter/issues/133465 Future main() async { @@ -31,6 +35,7 @@ Future main() async { } if (isDesktop()) { + await initializeWebViewEnvironment(); await windowManager.ensureInitialized(); await windowManager.setSize(const ui.Size(360, 712)); LanternFFI.startDesktopService(); @@ -65,3 +70,20 @@ Future _initGoogleMobileAds() async { await MobileAds.instance.initialize(); // await MobileAds.instance.setAppMuted(true); } + +Future initializeWebViewEnvironment() async { + if (!isDesktop()) return; + final directory = await getApplicationDocumentsDirectory(); + final localAppDataPath = directory.path; + + // Ensure WebView2 runtime is available + final availableVersion = await WebViewEnvironment.getAvailableVersion(); + assert(availableVersion != null, + 'Failed to find an installed WebView2 Runtime or non-stable Microsoft Edge installation.'); + + webViewEnvironment = await WebViewEnvironment.create( + settings: WebViewEnvironmentSettings( + userDataFolder: '$localAppDataPath\\Lantern\\WebView2', + ), + ); +} diff --git a/pubspec.lock b/pubspec.lock index 9f4b11e59..655ab6e54 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -65,78 +65,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" - app_package_maker: - dependency: transitive - description: - name: app_package_maker - sha256: "0dc1949e09a60ec2d0b79b43c5237734e6d03f7a022919bdfe1b4789f4c3bfb0" - url: "https://pub.dev" - source: hosted - version: "0.0.9" - app_package_maker_aab: - dependency: transitive - description: - name: app_package_maker_aab - sha256: "44810e77dff3b3b54011270b01a42876e838766d6e85c98f9a33bfe61db51651" - url: "https://pub.dev" - source: hosted - version: "0.0.9" - app_package_maker_apk: - dependency: transitive - description: - name: app_package_maker_apk - sha256: "974e639cda26c2e18fffaba18f88797523731f5b5457056b25e92243c9191f61" - url: "https://pub.dev" - source: hosted - version: "0.0.9" - app_package_maker_deb: - dependency: transitive - description: - name: app_package_maker_deb - sha256: dcd4047cb67648e53afd61079a8baa3c8ea383668f068e3ce8da841f3728eb29 - url: "https://pub.dev" - source: hosted - version: "0.0.9" - app_package_maker_dmg: - dependency: transitive - description: - name: app_package_maker_dmg - sha256: e0410a51304f3fff3e3850696c8e56f53f71c990e097f1c325126ebe90d242c4 - url: "https://pub.dev" - source: hosted - version: "0.0.9" - app_package_maker_exe: - dependency: transitive - description: - name: app_package_maker_exe - sha256: "07e3899a3ae12e8b6cd80efc7281ccca6c9050d2810e0fdc0e7e614cf4bd8a02" - url: "https://pub.dev" - source: hosted - version: "0.0.9" - app_package_maker_ipa: - dependency: transitive - description: - name: app_package_maker_ipa - sha256: "1a11498506ba975d02a4715650701981a382a2161c81481911517b50b378cd65" - url: "https://pub.dev" - source: hosted - version: "0.0.9" - app_package_maker_zip: - dependency: transitive - description: - name: app_package_maker_zip - sha256: cef07a47c589036a4762fdc9e61b9022f0a2a2a9f69538109a0a952a7e668306 - url: "https://pub.dev" - source: hosted - version: "0.0.9" - archive: - dependency: transitive - description: - name: archive - sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d - url: "https://pub.dev" - source: hosted - version: "3.6.1" args: dependency: transitive description: @@ -638,22 +566,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.0" - flutter_app_builder: - dependency: transitive - description: - name: flutter_app_builder - sha256: "9e5527919f62424f0fafaa3e8dfda8469caf63e465862e9866a0d60a37c00fcf" - url: "https://pub.dev" - source: hosted - version: "0.0.9" - flutter_app_packager: - dependency: transitive - description: - name: flutter_app_packager - sha256: b5bfb7113b49710c004c5f1ab6f08ac121418540d49e14825dd75e99810fa695 - url: "https://pub.dev" - source: hosted - version: "0.0.9" flutter_cache_manager: dependency: "direct main" description: @@ -662,14 +574,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.4.1" - flutter_distributor: - dependency: "direct main" - description: - name: flutter_distributor - sha256: "50d56df265e97396427ec42cc02374b72d08c71b3442d662b97fc089bd1705ea" - url: "https://pub.dev" - source: hosted - version: "0.0.2" flutter_dotenv: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index a37bf3da8..95c9ce0b5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -102,7 +102,6 @@ dependencies: # Desktop window_manager: ^0.4.2 tray_manager: ^0.2.4 - flutter_distributor: ^0.0.2 flutter_dotenv: ^5.1.0 diff --git a/windows/packaging/exe/make_config.yaml b/windows/packaging/exe/make_config.yaml new file mode 100644 index 000000000..b40244922 --- /dev/null +++ b/windows/packaging/exe/make_config.yaml @@ -0,0 +1,14 @@ +# The value of AppId uniquely identifies this application. +# Do not use the same AppId value in installers for other applications. +# TODO: Update this to add Lantern to Windows app store +app_id: 5B599538-42C1-4026-A579-AF079F21A65E +display_name: Lantern +#app_name: Lantern +publisher: getlantern +publisher_url: https://github.com/getlantern/lantern-client +executable_name: lantern.exe +output_base_file_name: lantern.exe +create_desktop_icon: true +install_dir_name: Lantern +#script_template: inno_setup.iss +#setup_icon_file: ..\windows\runner\resources\app_icon.ico \ No newline at end of file From 4bc80f2b6be42ab1e599de3f0a721ab2d3921423 Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 18:46:26 -0700 Subject: [PATCH 11/26] updates to webview settings and add new packaging configs --- pubspec.yaml | 2 +- windows/CMakeLists.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 95c9ce0b5..3a9dc3777 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -96,7 +96,7 @@ dependencies: # URL & Sharing utilities url_launcher: ^6.3.0 share_plus: ^10.0.2 - flutter_inappwebview: ^6.1.3 + flutter_inappwebview: ^6.1.5 desktop_webview_window: ^0.2.3 # Desktop diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 6cf6d6591..d7dc3d0c8 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -87,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES) COMPONENT Runtime) endif() +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") From e05d2b9c3004ff88ecb4bed8331c844cd454d41e Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 18:47:26 -0700 Subject: [PATCH 12/26] updates to webview settings and add new packaging configs --- pubspec.lock | 28 +++++------ windows/packaging/exe/inno_setup.iss | 65 +++++++++++++++++++++++++ windows/packaging/msix/make_config.yaml | 7 +++ 3 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 windows/packaging/exe/inno_setup.iss create mode 100644 windows/packaging/msix/make_config.yaml diff --git a/pubspec.lock b/pubspec.lock index 655ab6e54..8125c1ce9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -639,18 +639,18 @@ packages: dependency: "direct main" description: name: flutter_inappwebview - sha256: "274edbb07196944e316722d9f6f641c77d0e71261200869887e10f59614c0458" + sha256: "80092d13d3e29b6227e25b67973c67c7210bd5e35c4b747ca908e31eb71a46d5" url: "https://pub.dev" source: hosted - version: "6.1.3" + version: "6.1.5" flutter_inappwebview_android: dependency: transitive description: name: flutter_inappwebview_android - sha256: f48203a11c5eb0c23dd5a3cb3638ae678056b6ceae22819373e36c6cb4f1d46a + sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.3" flutter_inappwebview_internal_annotations: dependency: transitive description: @@ -663,42 +663,42 @@ packages: dependency: transitive description: name: flutter_inappwebview_ios - sha256: f6f88d464b38f2fc1c5f2ae74024498115eb1470715bd8b40f902dd4ac99ccc8 + sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" flutter_inappwebview_macos: dependency: transitive description: name: flutter_inappwebview_macos - sha256: "68e0c3785d8d789710cda7d7efe6effa337c91bf300dd28af7efc2d358fa1a98" + sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1 url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" flutter_inappwebview_platform_interface: dependency: transitive description: name: flutter_inappwebview_platform_interface - sha256: "97b4ab116d949ede20c90c7e3d15d24afaf1b706cc0af96b060770293cd6c49d" + sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0+1" flutter_inappwebview_web: dependency: transitive description: name: flutter_inappwebview_web - sha256: f7f97b6faa39416e4e86da1184edd4de6c27b271d036f0838ea3ff9a250a1de2 + sha256: "55f89c83b0a0d3b7893306b3bb545ba4770a4df018204917148ebb42dc14a598" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" flutter_inappwebview_windows: dependency: transitive description: name: flutter_inappwebview_windows - sha256: "86702d2109384311f8ea634855e90ee143b9bfabddd3858696d905a2c28808aa" + sha256: "8b4d3a46078a2cdc636c4a3d10d10f2a16882f6be607962dbfff8874d1642055" url: "https://pub.dev" source: hosted - version: "0.4.0" + version: "0.6.0" flutter_keyboard_visibility: dependency: "direct main" description: diff --git a/windows/packaging/exe/inno_setup.iss b/windows/packaging/exe/inno_setup.iss new file mode 100644 index 000000000..2211bb946 --- /dev/null +++ b/windows/packaging/exe/inno_setup.iss @@ -0,0 +1,65 @@ +[Setup] +AppId={{APP_ID}} +AppVersion={{APP_VERSION}} +AppName={{DISPLAY_NAME}} +AppPublisher={{PUBLISHER_NAME}} +AppPublisherURL={{PUBLISHER_URL}} +AppSupportURL={{PUBLISHER_URL}} +AppUpdatesURL={{PUBLISHER_URL}} +DefaultDirName={autopf}\{{DISPLAY_NAME}} +DisableProgramGroupPage=yes +OutputDir=. +OutputBaseFilename={{OUTPUT_BASE_FILENAME}} +Compression=lzma +SolidCompression=yes +WizardStyle=modern +PrivilegesRequired={{PRIVILEGES_REQUIRED}} +ArchitecturesAllowed=x64 +ArchitecturesInstallIn64BitMode=x64 + +[Languages] +{% for locale in LOCALES %} +{% if locale == 'en' %}Name: "english"; MessagesFile: "compiler:Default.isl"{% endif %} +{% if locale == 'zh' %}Name: "chinesesimplified"; MessagesFile: "compiler:Languages\\ChineseSimplified.isl"{% endif %} +{% if locale == 'ja' %}Name: "japanese"; MessagesFile: "compiler:Languages\\Japanese.isl"{% endif %} +{% endfor %} + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: {% if CREATE_DESKTOP_ICON != true %}unchecked{% else %}checkedonce{% endif %} +Name: "launchAtStartup"; Description: "{cm:AutoStartProgram,{{DISPLAY_NAME}}}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: {% if LAUNCH_AT_STARTUP != true %}unchecked{% else %}checkedonce{% endif %} + +[Files] +Source: "{{SOURCE_DIR}}\\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{autoprograms}\\{{APP_NAME}}"; Filename: "{app}\\{{EXECUTABLE_NAME}}" +Name: "{autodesktop}\\{{APP_NAME}}"; Filename: "{app}\\{{EXECUTABLE_NAME}}"; Tasks: desktopicon +Name: "{userstartup}\\{{APP_NAME}}"; Filename: "{app}\\{{EXECUTABLE_NAME}}"; WorkingDir: "{app}"; Tasks: launchAtStartup + +[Dirs] +; Create WebView2 data directory in AppData +Name: "{app}\{{APP_NAME}}\WebView2"; Permissions: everyone-modify + +[Downloads] +Source: "https://go.microsoft.com/fwlink/p/?LinkId=2124703"; DestFile: "{tmp}\MicrosoftEdgeWebView2Setup.exe"; Flags: external + +[Run] +Filename: "{tmp}\MicrosoftEdgeWebView2Setup.exe"; Parameters: "/silent /install"; StatusMsg: "Installing WebView2 Runtime..."; Check: NeedsWebView2Runtime and FileExists(ExpandConstant('{tmp}\MicrosoftEdgeWebView2Setup.exe')) +; Launch the app after WebView2 has been installed +Filename: "{app}\\{{EXECUTABLE_NAME}}"; Description: "{cm:LaunchProgram,{{DISPLAY_NAME}}}"; Flags: {% if PRIVILEGES_REQUIRED == 'admin' %}runascurrentuser{% endif %} nowait postinstall skipifsilent + +[Code] +function NeedsWebView2Runtime(): Boolean; +var + EdgeVersion: string; +begin + if RegQueryStringValue(HKLM64, 'Software\Microsoft\EdgeUpdate\Clients\{F2C8B2F8-5A81-41D0-873A-D1D9F4922A3A}', 'pv', EdgeVersion) then + begin + Result := False; + end + else + begin + Result := True; // WebView2 is not installed + end; +end; diff --git a/windows/packaging/msix/make_config.yaml b/windows/packaging/msix/make_config.yaml new file mode 100644 index 000000000..d3ab30c37 --- /dev/null +++ b/windows/packaging/msix/make_config.yaml @@ -0,0 +1,7 @@ +display_name: Lantern +msix_version: 2.1.5.0 +publisher_display_name: lantern +identity_name: org.getlantern.lantern +logo_path: windows/runner/resources/app_icon.ico +capabilities: internetClient, internetClientServer, privateNetworkClientServer +install_certificate: "false" \ No newline at end of file From 9d7c84287d7b0864ee0d12d2ace408624c14330d Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 18:51:48 -0700 Subject: [PATCH 13/26] clean-ups --- lib/core/app/app_webview.dart | 180 +--------------------------------- 1 file changed, 2 insertions(+), 178 deletions(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index b43e7f1d2..4e3251f3c 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -1,10 +1,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; -import 'package:lantern/app.dart'; import 'package:lantern/core/utils/common.dart'; import 'package:lantern/main.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:webview_windows/webview_windows.dart'; -import 'package:window_manager/window_manager.dart'; @RoutePage(name: 'AppWebview') class AppWebView extends StatefulWidget { @@ -33,7 +30,7 @@ class _AppWebViewState extends State { content: Text(message), actions: [ TextButton( - child: Text("OK"), + child: Text('continue'.i18n), onPressed: () { Navigator.of(context).pop(); }, @@ -46,10 +43,6 @@ class _AppWebViewState extends State { @override Widget build(BuildContext context) { - /*if (Platform.isWindows) { - return _DesktopWebView(url: widget.url, title: widget.title); - }*/ - return BaseScreen( title: widget.title, body: InAppWebView( @@ -58,11 +51,8 @@ class _AppWebViewState extends State { webViewController = controller; }, webViewEnvironment: webViewEnvironment, - /*onLoadStop: (controller, url) async { - _showWebViewUrl(); - },*/ onReceivedHttpError: (controller, request, response) { - print("HTTP error: ${response.statusCode} for ${request.url}"); + appLogger.i("HTTP error: ${response.statusCode} for ${request.url}"); showErrorDialog("HTTP Error", "Status code: ${response.statusCode}\nDescription: ${response.reasonPhrase ?? ''}"); }, @@ -92,51 +82,6 @@ class _AppWebViewState extends State { ), ); } - - Future _showWebViewUrl() async { - try { - // Get the current URL from the WebView - var currentUrl = await webViewController.getUrl(); - String urlToShow = - currentUrl != null ? currentUrl.toString() : "No URL loaded"; - - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: const Text("Current WebView URL"), - content: Text(urlToShow), - actions: [ - TextButton( - child: const Text("OK"), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); - } catch (e) { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: const Text("Error"), - content: Text("Failed to get URL: $e"), - actions: [ - TextButton( - child: const Text("OK"), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); - } - } } class AppBrowser extends InAppBrowser { @@ -275,124 +220,3 @@ class AppBrowser extends InAppBrowser { ); } } - -class _DesktopWebView extends StatefulWidget { - final String url; - final String title; - - const _DesktopWebView({ - required this.url, - required this.title, - }); - - @override - _DesktopWebViewState createState() => _DesktopWebViewState(); -} - -class _DesktopWebViewState extends State<_DesktopWebView> { - late WebviewController _controller; - final List _subscriptions = []; - - @override - void initState() { - super.initState(); - if (Platform.isWindows) { - _initWindowsWebview(); - } - } - - Future _initWindowsWebview() async { - try { - _controller = WebviewController(); - await _controller.initialize(); - - _subscriptions - .add(_controller.containsFullScreenElementChanged.listen((flag) { - windowManager.setFullScreen(flag); - })); - await _controller.setBackgroundColor(Colors.transparent); - await _controller.setPopupWindowPolicy(WebviewPopupWindowPolicy.deny); - await _controller.loadUrl(widget.url); - if (mounted) setState(() {}); - } on PlatformException catch (e) { - WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( - context: context, - builder: (_) => AlertDialog( - title: Text('Error'), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('Code: ${e.code}'), - Text('Message: ${e.message}'), - ], - ), - actions: [ - TextButton( - child: Text('Continue'), - onPressed: () { - Navigator.of(context).pop(); - }, - ) - ], - )); - }); - } - } - - @override - void dispose() { - for (var s in _subscriptions) { - s.cancel(); - } - _controller.dispose(); - super.dispose(); - } - - Future _onPermissionRequested( - String url, WebviewPermissionKind kind, bool isUserInitiated) async { - final decision = await showDialog( - context: globalRouter.navigatorKey.currentContext!, - builder: (BuildContext context) => AlertDialog( - title: const Text('WebView permission requested'), - content: Text('WebView has requested permission \'$kind\''), - actions: [ - TextButton( - onPressed: () => - Navigator.pop(context, WebviewPermissionDecision.deny), - child: const Text('Deny'), - ), - TextButton( - onPressed: () => - Navigator.pop(context, WebviewPermissionDecision.allow), - child: const Text('Allow'), - ), - ], - ), - ); - - return decision ?? WebviewPermissionDecision.none; - } - - @override - Widget build(BuildContext context) { - return BaseScreen( - title: widget.title, - body: _controller.value.isInitialized - ? Webview( - _controller, - permissionRequested: _onPermissionRequested, - ) - : const Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Center( - child: CircularProgressIndicator(), - ), - ], - ), - ); - } -} From 12fbf63a0145993bd8783450e50f7195c99a1cc7 Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 19:09:38 -0700 Subject: [PATCH 14/26] clean-ups --- .github/workflows/build-windows.yml | 23 +---------------------- Makefile | 1 - 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 2ca586e85..5049bc14f 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -99,7 +99,7 @@ jobs: - name: Move liblantern.dll to release directory shell: bash run: | - mv liblantern_x64.dll "build/windows/${{inputs.arch}}/runner/Release" + mv liblantern.dll "build/windows/${{inputs.arch}}/runner/Release" - name: Extract app version from pubspec.yaml id: extract_version @@ -110,29 +110,16 @@ jobs: - name: Build Flutter app run: | - Get-FileHash "build/windows/${{inputs.arch}}/runner/Release/liblantern_x64.dll" -Algorithm SHA256 New-Item -Path "./dist/${{ env.APP_VERSION }}" -ItemType Directory -Force flutter_distributor package --platform windows --targets exe --skip-clean env: SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" VERSION: "${{ env.version }}" - - name: Upload Windows artifacts - uses: actions/upload-artifact@v4 - with: - name: windows - path: | - dist/*/*.msix - dist/*/*.zip - - name: Rename installer shell: bash run: | - ls -ltr ./dist - ls -ltr "build/windows/${{inputs.arch}}/runner" - ls -ltr "build/windows/${{inputs.arch}}/runner/Release" mv "dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-windows-setup.exe" lantern-installer${{inputs.installer-suffix}}.exe - # mv "dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-windows.msix" lantern-installer${{inputs.installer-suffix}}.msix - name: Sign EXE with Azure Code Signing uses: getlantern/trusted-signing-action@main @@ -156,14 +143,6 @@ jobs: path: | lantern-installer${{inputs.installer-suffix}}.exe - # - name: Upload msix artifact - # uses: actions/upload-artifact@v4 - # with: - # name: windows${{inputs.build-suffix}}-installer-msix - # path: | - # lantern-installer${{inputs.installer-suffix}}.msix - - upload-windows: needs: build-windows permissions: diff --git a/Makefile b/Makefile index bb204a8d6..4ab8fb290 100644 --- a/Makefile +++ b/Makefile @@ -470,7 +470,6 @@ echo-build-tags: ## Prints build tags and extra ldflags. Run this with `REPLICA= desktop-lib: export GOPRIVATE = github.com/getlantern desktop-lib: echo-build-tags - go mod download CGO_ENABLED=1 go build -v -trimpath $(GO_BUILD_FLAGS) -o "$(LIB_NAME)" -tags="$(BUILD_TAGS)" -ldflags="$(LDFLAGS) $(EXTRA_LDFLAGS)" desktop/*.go # This runs a development build for lantern. For production builds, see From 94f9e4b5d505ff8e999f990d500bd7a7844ddeee Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 19:24:38 -0700 Subject: [PATCH 15/26] clean-ups --- lib/core/app/app_webview.dart | 29 +++++++++++++++++++++++++---- lib/main.dart | 21 +-------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index 4e3251f3c..444da0ca2 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -1,6 +1,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:lantern/core/utils/common.dart'; import 'package:lantern/main.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:url_launcher/url_launcher.dart'; @RoutePage(name: 'AppWebview') @@ -59,7 +60,7 @@ class _AppWebViewState extends State { onReceivedError: (controller, request, error) => showErrorDialog("Failed to load", error.description), initialSettings: InAppWebViewSettings( - isInspectable: true, + isInspectable: kDebugMode, javaScriptEnabled: true, supportZoom: true, domStorageEnabled: true, @@ -67,14 +68,15 @@ class _AppWebViewState extends State { useWideViewPort: !isDesktop(), loadWithOverviewMode: !isDesktop(), clearCache: true, - javaScriptCanOpenWindowsAutomatically: true, - supportMultipleWindows: true, mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW, builtInZoomControls: Platform.isAndroid, displayZoomControls: false, mediaPlaybackRequiresUserGesture: false, - allowsInlineMediaPlayback: Platform.isIOS, + allowsInlineMediaPlayback: false, underPageBackgroundColor: Colors.white, + transparentBackground: true, + allowFileAccessFromFileURLs: true, + preferredContentMode: UserPreferredContentMode.MOBILE, ), onProgressChanged: (controller, progress) { appLogger.i("Loading progress: $progress%"); @@ -220,3 +222,22 @@ class AppBrowser extends InAppBrowser { ); } } + +WebViewEnvironment? webViewEnvironment; + +Future initializeWebViewEnvironment() async { + if (!isDesktop()) return; + final directory = await getApplicationDocumentsDirectory(); + final localAppDataPath = directory.path; + + // Ensure WebView2 runtime is available + final availableVersion = await WebViewEnvironment.getAvailableVersion(); + assert(availableVersion != null, + 'Failed to find WebView2 Runtime or non-stable Microsoft Edge installation.'); + + webViewEnvironment = await WebViewEnvironment.create( + settings: WebViewEnvironmentSettings( + userDataFolder: '$localAppDataPath\\Lantern\\WebView2', + ), + ); +} diff --git a/lib/main.dart b/lib/main.dart index cf9d5cbf9..a9470117a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -13,8 +13,6 @@ import 'package:path_provider/path_provider.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:window_manager/window_manager.dart'; -WebViewEnvironment? webViewEnvironment; - // IOS issue // https://github.com/flutter/flutter/issues/133465 Future main() async { @@ -35,7 +33,7 @@ Future main() async { } if (isDesktop()) { - await initializeWebViewEnvironment(); + if (Platform.isWindows) await initializeWebViewEnvironment(); await windowManager.ensureInitialized(); await windowManager.setSize(const ui.Size(360, 712)); LanternFFI.startDesktopService(); @@ -70,20 +68,3 @@ Future _initGoogleMobileAds() async { await MobileAds.instance.initialize(); // await MobileAds.instance.setAppMuted(true); } - -Future initializeWebViewEnvironment() async { - if (!isDesktop()) return; - final directory = await getApplicationDocumentsDirectory(); - final localAppDataPath = directory.path; - - // Ensure WebView2 runtime is available - final availableVersion = await WebViewEnvironment.getAvailableVersion(); - assert(availableVersion != null, - 'Failed to find an installed WebView2 Runtime or non-stable Microsoft Edge installation.'); - - webViewEnvironment = await WebViewEnvironment.create( - settings: WebViewEnvironmentSettings( - userDataFolder: '$localAppDataPath\\Lantern\\WebView2', - ), - ); -} From 0792a6fa64dffe2c4c51a692f47ee869ac57986c Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 19:42:19 -0700 Subject: [PATCH 16/26] revert test change --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4ab8fb290..7cc57f63b 100644 --- a/Makefile +++ b/Makefile @@ -137,7 +137,7 @@ INSTALLER_RESOURCES ?= installer-resources-$(APP) INSTALLER_NAME ?= $(APP)-installer WINDOWS_LIB_NAME ?= $(DESKTOP_LIB_NAME).dll WINDOWS_APP_NAME ?= $(APP).exe -WINDOWS64_LIB_NAME ?= $(DESKTOP_LIB_NAME)_x64.dll +WINDOWS64_LIB_NAME ?= $(DESKTOP_LIB_NAME).dll WINDOWS64_APP_NAME ?= $(APP)_x64.exe LINUX_LIB_NAME ?= $(DESKTOP_LIB_NAME).so From 0b82daaa18ce4046f9c26e37d820673a880f4b90 Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 19:52:29 -0700 Subject: [PATCH 17/26] revert test change --- lib/core/app/app_webview.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index 444da0ca2..d8ff0258a 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -1,6 +1,6 @@ +import 'package:desktop_webview_window/desktop_webview_window.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:lantern/core/utils/common.dart'; -import 'package:lantern/main.dart'; import 'package:path_provider/path_provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -199,7 +199,12 @@ class AppBrowser extends InAppBrowser { await navigateWebview(context, url); break; case 'linux': - await navigateWebview(context, url); + try { + final webview = await WebviewWindow.create(); + webview.launch(url); + } catch (e) { + mainLogger.e("Error opening linux webview: $e"); + } break; case 'macos': await openWithSystemBrowser(url); From 34fe3de435c535e6e9684fd7c403693dcd7eb549 Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 19:53:39 -0700 Subject: [PATCH 18/26] revert test change --- windows/packaging/exe/make_config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/packaging/exe/make_config.yaml b/windows/packaging/exe/make_config.yaml index b40244922..5c595c78c 100644 --- a/windows/packaging/exe/make_config.yaml +++ b/windows/packaging/exe/make_config.yaml @@ -10,5 +10,5 @@ executable_name: lantern.exe output_base_file_name: lantern.exe create_desktop_icon: true install_dir_name: Lantern -#script_template: inno_setup.iss +script_template: inno_setup.iss #setup_icon_file: ..\windows\runner\resources\app_icon.ico \ No newline at end of file From cfc294821ea145584b64f6e75dd098263fa43d99 Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 24 Oct 2024 19:59:36 -0700 Subject: [PATCH 19/26] clean-ups --- lib/core/app/app_webview.dart | 15 +++++++-------- lib/features/window/window_container.dart | 6 +++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index d8ff0258a..1e8492aec 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -180,14 +180,13 @@ class AppBrowser extends InAppBrowser { } // navigateWebview navigates to the webview route and displays the given url - static Future navigateWebview(BuildContext context, String url) async { - await context.pushRoute( - AppWebview( - url: url, - title: 'lantern_pro_checkout'.i18n, - ), - ); - } + static Future navigateWebview(BuildContext context, String url) async => + await context.pushRoute( + AppWebview( + url: url, + title: 'lantern_pro_checkout'.i18n, + ), + ); // openWithSystemBrowser opens a URL in the browser static Future openWithSystemBrowser(String url) async => diff --git a/lib/features/window/window_container.dart b/lib/features/window/window_container.dart index f6048f49e..41e801bec 100644 --- a/lib/features/window/window_container.dart +++ b/lib/features/window/window_container.dart @@ -43,15 +43,15 @@ class _WindowContainerState extends State with WindowListener { } Future _setWindowResizable() async { - /*if (!Platform.isWindows) { + if (!Platform.isWindows) { await windowManager.setResizable(false); return; - }*/ + } // temporary workaround for distorted layout on Windows. The problem goes away // after the window is resized. // See https://github.com/leanflutter/window_manager/issues/464 // and https://github.com/KRTirtho/spotube/issues/1553 - Future.delayed(const Duration(seconds: 2), () async { + Future.delayed(const Duration(milliseconds: 100), () async { final size = await windowManager.getSize(); await windowManager.setSize( Size(size.width + 1, size.height + 1), From d6e5274762de7c3be83f5c2e36bd2cf4453e0c88 Mon Sep 17 00:00:00 2001 From: atavism Date: Sat, 26 Oct 2024 13:40:37 -0700 Subject: [PATCH 20/26] use getApplicationSupportDirectory and check the platform is windows --- lib/core/app/app_webview.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index 1e8492aec..e64e4ecf7 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -230,8 +230,8 @@ class AppBrowser extends InAppBrowser { WebViewEnvironment? webViewEnvironment; Future initializeWebViewEnvironment() async { - if (!isDesktop()) return; - final directory = await getApplicationDocumentsDirectory(); + if (!Platform.isWindows) return; + final directory = await getApplicationSupportDirectory(); final localAppDataPath = directory.path; // Ensure WebView2 runtime is available From fee38d1a944a1a5d2613f407290c5425ec21e092 Mon Sep 17 00:00:00 2001 From: atavism Date: Sat, 26 Oct 2024 14:33:36 -0700 Subject: [PATCH 21/26] simplify webview code further --- lib/core/app/app_webview.dart | 258 ++++++++------------- lib/core/utils/utils.dart | 16 -- lib/features/account/follow_us.dart | 2 +- lib/features/account/settings.dart | 2 +- lib/features/account/support.dart | 4 +- lib/features/checkout/checkout.dart | 8 +- lib/features/checkout/checkout_legacy.dart | 16 +- 7 files changed, 105 insertions(+), 201 deletions(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index e64e4ecf7..e14987283 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -21,6 +21,7 @@ class AppWebView extends StatefulWidget { class _AppWebViewState extends State { late InAppWebViewController webViewController; + bool isLoading = true; void showErrorDialog(String title, String message) { showDialog( @@ -42,121 +43,31 @@ class _AppWebViewState extends State { ); } - @override - Widget build(BuildContext context) { - return BaseScreen( - title: widget.title, - body: InAppWebView( - initialUrlRequest: URLRequest(url: WebUri(widget.url)), - onWebViewCreated: (controller) { - webViewController = controller; - }, - webViewEnvironment: webViewEnvironment, - onReceivedHttpError: (controller, request, response) { - appLogger.i("HTTP error: ${response.statusCode} for ${request.url}"); - showErrorDialog("HTTP Error", - "Status code: ${response.statusCode}\nDescription: ${response.reasonPhrase ?? ''}"); - }, - onReceivedError: (controller, request, error) => - showErrorDialog("Failed to load", error.description), - initialSettings: InAppWebViewSettings( - isInspectable: kDebugMode, - javaScriptEnabled: true, - supportZoom: true, - domStorageEnabled: true, - allowFileAccess: true, - useWideViewPort: !isDesktop(), - loadWithOverviewMode: !isDesktop(), - clearCache: true, - mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW, - builtInZoomControls: Platform.isAndroid, - displayZoomControls: false, - mediaPlaybackRequiresUserGesture: false, - allowsInlineMediaPlayback: false, - underPageBackgroundColor: Colors.white, - transparentBackground: true, - allowFileAccessFromFileURLs: true, - preferredContentMode: UserPreferredContentMode.MOBILE, - ), - onProgressChanged: (controller, progress) { - appLogger.i("Loading progress: $progress%"); - }, - ), - ); - } -} - -class AppBrowser extends InAppBrowser { - final VoidCallback? onClose; - - static final InAppBrowserClassSettings settings = InAppBrowserClassSettings( - browserSettings: InAppBrowserSettings( - hideTitleBar: false, - hideToolbarBottom: false, - hideCloseButton: false, - hideUrlBar: true, - hidden: false, - presentationStyle: ModalPresentationStyle.FULL_SCREEN, - ), - webViewSettings: InAppWebViewSettings( - sharedCookiesEnabled: true, - javaScriptEnabled: true, - useOnDownloadStart: true, - useShouldOverrideUrlLoading: true, - isInspectable: kDebugMode, - ), - ); - - AppBrowser({ - this.onClose, - }); - - static Future setProxyAddr() async { + Future setProxyAddr() async { try { var proxyAvailable = await WebViewFeature.isFeatureSupported( WebViewFeature.PROXY_OVERRIDE); if (proxyAvailable) { - ProxyController proxyController = ProxyController.instance(); final proxyAddr = await sessionModel.proxyAddr(); - if (proxyAddr.isEmpty) { - return; + if (proxyAddr.isNotEmpty) { + ProxyController.instance() + ..clearProxyOverride() + ..setProxyOverride( + settings: ProxySettings( + proxyRules: [ProxyRule(url: "http://$proxyAddr")], + bypassRules: [], + )); + appLogger.i("Proxy set as: http://$proxyAddr"); } - await proxyController.clearProxyOverride(); - await proxyController.setProxyOverride( - settings: ProxySettings( - proxyRules: [ProxyRule(url: "http://$proxyAddr")], - bypassRules: [], - )); - appLogger.e("Proxy set as :http://$proxyAddr"); } } catch (e) { appLogger.e("Error setting proxy address: $e"); } } - @override - Future onBrowserCreated() async { - appLogger.i("Browser created"); - } - - @override - Future onLoadStart(url) async { - appLogger.i("Started displaying $url"); - } - - @override - Future onLoadStop(url) async { - appLogger.i("Stopped displaying $url"); - } - - @override - void onReceivedError(WebResourceRequest request, WebResourceError error) => - appLogger.e("Can't load ${request.url}.. Error: ${error.description}", - error: error); - - @override Future shouldOverrideUrlLoading( - navigationAction) async { + InAppWebViewController controller, + NavigationAction navigationAction) async { final url = navigationAction.request.url!; if (url.scheme.startsWith("alipay")) { launchUrl( @@ -169,79 +80,104 @@ class AppBrowser extends InAppBrowser { } @override - void onProgressChanged(progress) { - appLogger.i("Progress: $progress"); + Widget build(BuildContext context) { + return BaseScreen( + title: widget.title, + body: Stack( + children: [ + InAppWebView( + initialUrlRequest: URLRequest(url: WebUri(widget.url)), + onWebViewCreated: (controller) { + webViewController = controller; + setProxyAddr(); + }, + webViewEnvironment: webViewEnvironment, + onReceivedHttpError: (controller, request, response) { + appLogger + .i("HTTP error: ${response.statusCode} for ${request.url}"); + showErrorDialog("HTTP Error", + "Status code: ${response.statusCode}\nDescription: ${response.reasonPhrase ?? ''}"); + }, + shouldOverrideUrlLoading: shouldOverrideUrlLoading, + onReceivedError: (controller, request, error) => + showErrorDialog("Failed to load", error.description), + initialSettings: InAppWebViewSettings( + isInspectable: kDebugMode, + javaScriptEnabled: true, + supportZoom: true, + domStorageEnabled: true, + allowFileAccess: true, + useWideViewPort: !isDesktop(), + loadWithOverviewMode: !isDesktop(), + clearCache: true, + mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW, + builtInZoomControls: Platform.isAndroid, + displayZoomControls: false, + mediaPlaybackRequiresUserGesture: false, + allowsInlineMediaPlayback: false, + underPageBackgroundColor: Colors.white, + transparentBackground: true, + allowFileAccessFromFileURLs: true, + preferredContentMode: isMobile() + ? UserPreferredContentMode.MOBILE + : UserPreferredContentMode.RECOMMENDED, + ), + onProgressChanged: (controller, progress) { + setState(() => isLoading = progress < 100); + appLogger.i("Loading progress: $progress%"); + }, + ), + if (isLoading) const Center(child: CircularProgressIndicator()), + ], + ), + ); } +} - @override - Future onExit() async { - appLogger.i("Browser closed"); - onClose?.call(); - } +WebViewEnvironment? webViewEnvironment; - // navigateWebview navigates to the webview route and displays the given url - static Future navigateWebview(BuildContext context, String url) async => - await context.pushRoute( - AppWebview( - url: url, - title: 'lantern_pro_checkout'.i18n, - ), - ); +Future initializeWebViewEnvironment() async { + if (Platform.isWindows) { + final directory = await getApplicationSupportDirectory(); + final localAppDataPath = directory.path; + + // Ensure WebView2 runtime is available + final availableVersion = await WebViewEnvironment.getAvailableVersion(); + assert(availableVersion != null, + 'Failed to find WebView2 Runtime or non-stable Microsoft Edge installation.'); + + webViewEnvironment = await WebViewEnvironment.create( + settings: WebViewEnvironmentSettings( + userDataFolder: '$localAppDataPath\\Lantern\\WebView2', + ), + ); + } +} - // openWithSystemBrowser opens a URL in the browser - static Future openWithSystemBrowser(String url) async => - await InAppBrowser.openWithSystemBrowser(url: WebUri(url)); +// openWithSystemBrowser opens a URL in the browser +Future openWithSystemBrowser(String url) async => + await InAppBrowser.openWithSystemBrowser(url: WebUri(url)); - static Future openWebview(BuildContext context, String url) async { +Future openWebview(BuildContext context, String url) async { + try { switch (Platform.operatingSystem) { + case 'android': + case 'macos': case 'windows': - await navigateWebview(context, url); + await context.pushRoute( + AppWebview(url: url, title: 'lantern_pro_checkout'.i18n)); break; case 'linux': - try { - final webview = await WebviewWindow.create(); - webview.launch(url); - } catch (e) { - mainLogger.e("Error opening linux webview: $e"); - } - break; - case 'macos': - await openWithSystemBrowser(url); + final webview = await WebviewWindow.create(); + webview.launch(url); break; case 'ios': await openWithSystemBrowser(url); break; default: - await setProxyAddr(); - await _openUrlRequest(url); - break; + throw UnsupportedError('Platform not supported'); } + } catch (e) { + appLogger.e("Failed to open webview: $e"); } - - static Future _openUrlRequest(String url) async { - final instance = AppBrowser(); - await instance.openUrlRequest( - urlRequest: URLRequest(url: WebUri(url), allowsCellularAccess: true), - settings: settings, - ); - } -} - -WebViewEnvironment? webViewEnvironment; - -Future initializeWebViewEnvironment() async { - if (!Platform.isWindows) return; - final directory = await getApplicationSupportDirectory(); - final localAppDataPath = directory.path; - - // Ensure WebView2 runtime is available - final availableVersion = await WebViewEnvironment.getAvailableVersion(); - assert(availableVersion != null, - 'Failed to find WebView2 Runtime or non-stable Microsoft Edge installation.'); - - webViewEnvironment = await WebViewEnvironment.create( - settings: WebViewEnvironmentSettings( - userDataFolder: '$localAppDataPath\\Lantern\\WebView2', - ), - ); } diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index cee1fadef..9d16ed46a 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -14,7 +14,6 @@ bool isProdPlay() { return false; } - String getPlanDisplayName(String plan) { if (Platform.isIOS) { if (plan == '1y') { @@ -155,21 +154,6 @@ extension PlansExtension on Plan { } } -Future openDesktopPaymentWebview( - {required BuildContext context, - required String redirectUrl, - required Providers provider, - VoidCallback? onClose}) async { - switch (Platform.operatingSystem) { - case 'macos': - case 'windows': - await AppBrowser.navigateWebview(context, redirectUrl); - break; - default: - await AppBrowser.openWebview(context, redirectUrl); - } -} - List> sortProviders( Iterable> paymentMethods, ) => diff --git a/lib/features/account/follow_us.dart b/lib/features/account/follow_us.dart index ff40be8d4..a78b99fd2 100644 --- a/lib/features/account/follow_us.dart +++ b/lib/features/account/follow_us.dart @@ -134,6 +134,6 @@ class _FollowUsState extends State { duration: const Duration(seconds: 2)); return; } - await AppBrowser.openWithSystemBrowser(url); + await openWithSystemBrowser(url); } } diff --git a/lib/features/account/settings.dart b/lib/features/account/settings.dart index c3ccbb141..af583b96d 100644 --- a/lib/features/account/settings.dart +++ b/lib/features/account/settings.dart @@ -31,7 +31,7 @@ class Settings extends StatelessWidget { Future openWebView( String url, BuildContext context, String title) async => - await AppBrowser.openWebview(context, url); + await openWebview(context, url); void openProxySetting(BuildContext context) => context.pushRoute(ProxiesSetting()); diff --git a/lib/features/account/support.dart b/lib/features/account/support.dart index d73864751..aa3311439 100644 --- a/lib/features/account/support.dart +++ b/lib/features/account/support.dart @@ -97,7 +97,7 @@ class Support extends StatelessWidget { Future faqTap(BuildContext context) async { try { - await AppBrowser.openWithSystemBrowser(faqUrl); + await openWithSystemBrowser(faqUrl); } catch (e) { showSnackbar(context: context, content: 'Fail to open link '); } @@ -105,7 +105,7 @@ class Support extends StatelessWidget { Future forumTap(BuildContext context) async { try { - await AppBrowser.openWithSystemBrowser(forumsUrl); + await openWithSystemBrowser(forumsUrl); } catch (e) { showSnackbar(context: context, content: 'Fail to open link '); } diff --git a/lib/features/checkout/checkout.dart b/lib/features/checkout/checkout.dart index 2c7161126..8637aed07 100644 --- a/lib/features/checkout/checkout.dart +++ b/lib/features/checkout/checkout.dart @@ -278,7 +278,7 @@ class _CheckoutState extends State } Future _openWebview(String url) async => - await AppBrowser.openWebview(context, url); + await openWebview(context, url); void _proceedWithBTCPay() async { try { @@ -383,11 +383,7 @@ class _CheckoutState extends State provider, ); context.loaderOverlay.hide(); - openDesktopPaymentWebview( - context: context, - provider: provider, - redirectUrl: redirectUrl, - onClose: checkProUser); + openWebview(context, redirectUrl); // as soon user click we should start polling userData Future.delayed(const Duration(seconds: 2), hasPlansUpdateOrBuy); } catch (error, stackTrace) { diff --git a/lib/features/checkout/checkout_legacy.dart b/lib/features/checkout/checkout_legacy.dart index b9ce840f2..67347da56 100644 --- a/lib/features/checkout/checkout_legacy.dart +++ b/lib/features/checkout/checkout_legacy.dart @@ -284,14 +284,6 @@ class _CheckoutLegacyState extends State } } - void checkProUser() async { - final res = sessionModel.proUserNotifier.value ?? false; - if (!widget.isPro && res) { - // show success dialog if user becomes Pro during browser session - showSuccessDialog(context, widget.isPro); - } - } - Future resolvePaymentMethod() async { final provider = selectedPaymentProvider!; if (isDesktop() && provider != Providers.test) { @@ -334,7 +326,7 @@ class _CheckoutLegacyState extends State } Future _openWebview(String url) async => - await AppBrowser.openWebview(context, url); + await openWebview(context, url); void _proceedWithBTCPay() async { try { @@ -422,11 +414,7 @@ class _CheckoutLegacyState extends State provider, ); context.loaderOverlay.hide(); - openDesktopPaymentWebview( - context: context, - provider: provider, - redirectUrl: redirectUrl, - onClose: checkProUser); + openWebview(context, redirectUrl); // as soon user click we should start polling userData Future.delayed(const Duration(seconds: 2), hasPlansUpdateOrBuy); } catch (error, stackTrace) { From d6571e8666a64711b1edc144c4265472c12e8b97 Mon Sep 17 00:00:00 2001 From: atavism Date: Sat, 26 Oct 2024 14:43:59 -0700 Subject: [PATCH 22/26] clean-ups --- lib/core/app/app_webview.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index e14987283..e3497330b 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -92,6 +92,8 @@ class _AppWebViewState extends State { setProxyAddr(); }, webViewEnvironment: webViewEnvironment, + onLoadStart: (controller, url) => setState(() => isLoading = true), + onLoadStop: (controller, url) => setState(() => isLoading = false), onReceivedHttpError: (controller, request, response) { appLogger .i("HTTP error: ${response.statusCode} for ${request.url}"); @@ -122,10 +124,8 @@ class _AppWebViewState extends State { ? UserPreferredContentMode.MOBILE : UserPreferredContentMode.RECOMMENDED, ), - onProgressChanged: (controller, progress) { - setState(() => isLoading = progress < 100); - appLogger.i("Loading progress: $progress%"); - }, + onProgressChanged: (controller, progress) => + appLogger.i("Loading progress: $progress%"), ), if (isLoading) const Center(child: CircularProgressIndicator()), ], From 3e299abfd39e8b30bee8a96e822b05e214cc77ec Mon Sep 17 00:00:00 2001 From: atavism Date: Sat, 26 Oct 2024 15:09:48 -0700 Subject: [PATCH 23/26] clean-ups --- lib/core/app/app_webview.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index e3497330b..20922cff3 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -178,6 +178,6 @@ Future openWebview(BuildContext context, String url) async { throw UnsupportedError('Platform not supported'); } } catch (e) { - appLogger.e("Failed to open webview: $e"); + appLogger.e("Failed to open webview", error: e); } } From 0d2f981c8011a435f287ff0265361a22d4324566 Mon Sep 17 00:00:00 2001 From: atavism Date: Sun, 27 Oct 2024 13:03:20 -0700 Subject: [PATCH 24/26] Add optional title to openWebview --- lib/core/app/app_webview.dart | 6 +++--- lib/features/checkout/checkout.dart | 2 +- lib/features/checkout/checkout_legacy.dart | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index 20922cff3..db15cde31 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -158,14 +158,14 @@ Future initializeWebViewEnvironment() async { Future openWithSystemBrowser(String url) async => await InAppBrowser.openWithSystemBrowser(url: WebUri(url)); -Future openWebview(BuildContext context, String url) async { +Future openWebview(BuildContext context, String url, + [String? title]) async { try { switch (Platform.operatingSystem) { case 'android': case 'macos': case 'windows': - await context.pushRoute( - AppWebview(url: url, title: 'lantern_pro_checkout'.i18n)); + await context.pushRoute(AppWebview(url: url, title: title ?? '')); break; case 'linux': final webview = await WebviewWindow.create(); diff --git a/lib/features/checkout/checkout.dart b/lib/features/checkout/checkout.dart index 8637aed07..5c10bf4e8 100644 --- a/lib/features/checkout/checkout.dart +++ b/lib/features/checkout/checkout.dart @@ -278,7 +278,7 @@ class _CheckoutState extends State } Future _openWebview(String url) async => - await openWebview(context, url); + await openWebview(context, url, 'lantern_pro_checkout'.i18n); void _proceedWithBTCPay() async { try { diff --git a/lib/features/checkout/checkout_legacy.dart b/lib/features/checkout/checkout_legacy.dart index 67347da56..9e1ca8a30 100644 --- a/lib/features/checkout/checkout_legacy.dart +++ b/lib/features/checkout/checkout_legacy.dart @@ -326,7 +326,7 @@ class _CheckoutLegacyState extends State } Future _openWebview(String url) async => - await openWebview(context, url); + await openWebview(context, url, 'lantern_pro_checkout'.i18n); void _proceedWithBTCPay() async { try { From 58c2a9b163f46c441a8a17fecbfa9c9bb7611047 Mon Sep 17 00:00:00 2001 From: atavism Date: Mon, 18 Nov 2024 02:38:06 -0800 Subject: [PATCH 25/26] Update dependencies to latest possible versions (#1230) * Update Flutter dependencies * update loader_overlay and ffigen * clean-ups, move error check above checking response error * clean-ups * update dependencies * Update more packages. --------- Co-authored-by: Jigar-f --- android/app/build.gradle | 2 +- desktop/lib.go | 13 +- lib/app.dart | 3 +- lib/features/checkout/stripe_checkout.dart | 2 +- lib/features/device_linking/add_device.dart | 3 +- .../contacts/add_contact_number.dart | 2 +- .../messaging/contacts/contact_info.dart | 2 +- .../conversation/audio/audio_widget.dart | 2 +- .../messaging/conversation/conversation.dart | 13 +- .../unaccepted_contact_sticker.dart | 4 +- .../onboarding/chat_number_recovery.dart | 2 +- macos/Flutter/GeneratedPluginRegistrant.swift | 4 +- macos/Podfile.lock | 39 +- pubspec.lock | 389 ++++++++++-------- pubspec.yaml | 34 +- .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 2 +- 17 files changed, 286 insertions(+), 233 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 3b235d4eb..af215c8e8 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,7 +6,7 @@ plugins { id 'org.jlleitschuh.gradle.ktlint' id 'kotlin-parcelize' id 'com.google.protobuf' - id "io.sentry.android.gradle" version "4.11.0" + id "io.sentry.android.gradle" version "4.13.0" } android { diff --git a/desktop/lib.go b/desktop/lib.go index add38e623..7720e2cdb 100644 --- a/desktop/lib.go +++ b/desktop/lib.go @@ -12,7 +12,6 @@ import ( "time" "github.com/getlantern/appdir" - "github.com/getlantern/errors" "github.com/getlantern/flashlight/v7" "github.com/getlantern/flashlight/v7/issue" "github.com/getlantern/flashlight/v7/logging" @@ -287,16 +286,14 @@ func redeemResellerCode(email, currency, deviceName, resellerCode *C.char) *C.ch ResellerCode: C.GoString(resellerCode), Provider: "reseller-code", }) - log.Debugf("DEBUG: redeeming reseller code response: %v", response) - if response.Error != "" { - log.Debugf("DEBUG: error while redeeming reseller code reponse is: %v", response.Error) - return sendError(errors.New("Error while redeeming reseller code: %v", response.Error)) - } if err != nil { - log.Debugf("DEBUG: error while redeeming reseller code: %v", err) + log.Errorf("error redeeming reseller code: %v", err) + return sendError(err) + } else if response.Error != "" { + log.Errorf("error redeeming reseller code: %v", response.Error) return sendError(err) } - log.Debug("DEBUG: redeeming reseller code success") + log.Debug("redeeming reseller code success") return C.CString("true") } diff --git a/lib/app.dart b/lib/app.dart index e8e1e1bbe..3dafd90ee 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -180,9 +180,8 @@ class _LanternAppState extends State (context, lang, child) { Localization.locale = lang.startsWith('en') ? "en_us" : lang; return GlobalLoaderOverlay( - useDefaultLoading: false, overlayColor: Colors.black.withOpacity(0.5), - overlayWidget: Center( + overlayWidgetBuilder: (_) => Center( child: AnimatedLoadingBorder( borderWidth: 5, borderColor: yellow3, diff --git a/lib/features/checkout/stripe_checkout.dart b/lib/features/checkout/stripe_checkout.dart index 740378bf0..4fc10be9c 100644 --- a/lib/features/checkout/stripe_checkout.dart +++ b/lib/features/checkout/stripe_checkout.dart @@ -80,7 +80,7 @@ class _StripeCheckoutState extends State { if (!determineFormIsValid()) { return; } - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); await sessionModel.submitStripePayment( widget.plan.id, widget.email, diff --git a/lib/features/device_linking/add_device.dart b/lib/features/device_linking/add_device.dart index 911073523..3abbb997a 100644 --- a/lib/features/device_linking/add_device.dart +++ b/lib/features/device_linking/add_device.dart @@ -54,7 +54,7 @@ class AddDevice extends StatelessWidget { } Future _onDone(String code, BuildContext context) async { - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); try { await sessionModel.approveDevice(code); pinCodeController.clear(); @@ -82,7 +82,6 @@ class AddDevice extends StatelessWidget { context, description: e.localizedDescription, ); - } } } diff --git a/lib/features/messaging/contacts/add_contact_number.dart b/lib/features/messaging/contacts/add_contact_number.dart index f807a2cfc..32e68c6dc 100644 --- a/lib/features/messaging/contacts/add_contact_number.dart +++ b/lib/features/messaging/contacts/add_contact_number.dart @@ -35,7 +35,7 @@ class _AddViaChatNumberState extends State { chatNumber.number = controller.text.numbersOnly; } else { try { - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); chatNumber = await model .findChatNumberByShortNumber(controller.text.numbersOnly); diff --git a/lib/features/messaging/contacts/contact_info.dart b/lib/features/messaging/contacts/contact_info.dart index 47f5862e3..9e13c9dd8 100644 --- a/lib/features/messaging/contacts/contact_info.dart +++ b/lib/features/messaging/contacts/contact_info.dart @@ -268,7 +268,7 @@ class _ContactInfoState extends State { iconPath: ImagePaths.delete, agreeText: 'delete_contact'.i18n, agreeAction: () async { - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); try { await messagingModel .deleteDirectContact(contact.contactId.id); diff --git a/lib/features/messaging/conversation/audio/audio_widget.dart b/lib/features/messaging/conversation/audio/audio_widget.dart index a0ff60c52..2dc9fc2b8 100644 --- a/lib/features/messaging/conversation/audio/audio_widget.dart +++ b/lib/features/messaging/conversation/audio/audio_widget.dart @@ -79,7 +79,7 @@ class AudioController extends ValueNotifier { return; } - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); try { var bytes = await messagingModel.decryptAttachment(attachment); await _play(bytes); diff --git a/lib/features/messaging/conversation/conversation.dart b/lib/features/messaging/conversation/conversation.dart index 40431e548..b8786fc83 100644 --- a/lib/features/messaging/conversation/conversation.dart +++ b/lib/features/messaging/conversation/conversation.dart @@ -221,7 +221,7 @@ class ConversationState extends State return; } - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); try { // stopWatchTimer.onExecute.add(StopWatchExecute.stop); stopWatchTimer.onStopTimer(); @@ -239,7 +239,7 @@ class ConversationState extends State } Future selectFilesToShare() async { - try { + try { var result = await FilePicker.platform .pickFiles(type: FileType.any, allowMultiple: true); if (result == null || result.files.isEmpty) { @@ -254,7 +254,7 @@ class ConversationState extends State totalSizeBytes / (1024 * 1024); // Convert bytes to megabytes if (totalSizeMB > 100) { - if(!mounted){ + if (!mounted) { return; } CDialog.showInfo( @@ -265,7 +265,7 @@ class ConversationState extends State return; } - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); for (var i = 0; i < result.files.length; i++) { final el = result.files[i]; final fileExtension = @@ -341,7 +341,7 @@ class ConversationState extends State String? replyToId, }) async { if (attachments?.isNotEmpty == true) { - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); } try { await messagingModel.sendToDirectContact( @@ -351,7 +351,8 @@ class ConversationState extends State replyToId: replyToId, replyToSenderId: replyToSenderId, ); - await sessionModel.trackUserAction('User sent message via Lantern Chat', '/message'); + await sessionModel.trackUserAction( + 'User sent message via Lantern Chat', '/message'); newMessage.clear(); setState(() { recording = null; diff --git a/lib/features/messaging/conversation/unaccepted_contact_sticker.dart b/lib/features/messaging/conversation/unaccepted_contact_sticker.dart index e89944633..842a41739 100644 --- a/lib/features/messaging/conversation/unaccepted_contact_sticker.dart +++ b/lib/features/messaging/conversation/unaccepted_contact_sticker.dart @@ -41,7 +41,7 @@ class UnacceptedContactSticker extends StatelessWidget { iconPath: ImagePaths.delete, agreeText: 'delete_contact'.i18n, agreeAction: () async { - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); try { await messagingModel .deleteDirectContact(contact.contactId.id); @@ -78,7 +78,7 @@ class UnacceptedContactSticker extends StatelessWidget { checkboxLabel: 'block_info_checkbox'.i18n, agreeText: 'block'.i18n.toUpperCase(), agreeAction: () async { - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); try { await messagingModel .blockDirectContact(contact.contactId.id); diff --git a/lib/features/messaging/onboarding/chat_number_recovery.dart b/lib/features/messaging/onboarding/chat_number_recovery.dart index 32c13d104..9485da3f2 100644 --- a/lib/features/messaging/onboarding/chat_number_recovery.dart +++ b/lib/features/messaging/onboarding/chat_number_recovery.dart @@ -31,7 +31,7 @@ class _ChatNumberRecoveryState extends State { if (_formKey.currentState?.validate() == true) { if (controller.text.withoutWhitespace.length == 52) { try { - context.loaderOverlay.show(widget: spinner); + context.loaderOverlay.show(); await model.recover(controller.text.withoutWhitespace); await model.markIsOnboarded(); await model.markCopiedRecoveryKey(); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 8c073f5fb..274d97eed 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -21,10 +21,11 @@ import screen_retriever_macos import sentry_flutter import share_plus import shared_preferences_foundation -import sqflite +import sqflite_darwin import tray_manager import url_launcher_macos import video_player_avfoundation +import webview_flutter_wkwebview import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { @@ -48,5 +49,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) + FLTWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "FLTWebViewFlutterPlugin")) WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) } diff --git a/macos/Podfile.lock b/macos/Podfile.lock index f9567becc..03e3ee48b 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -31,17 +31,17 @@ PODS: - FlutterMacOS - screen_retriever_macos (0.0.1): - FlutterMacOS - - Sentry/HybridSDK (8.36.0) - - sentry_flutter (8.9.0): + - Sentry/HybridSDK (8.40.1) + - sentry_flutter (8.10.1): - Flutter - FlutterMacOS - - Sentry/HybridSDK (= 8.36.0) + - Sentry/HybridSDK (= 8.40.1) - share_plus (0.0.1): - FlutterMacOS - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sqflite (0.0.3): + - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS - tray_manager (0.0.1): @@ -51,6 +51,9 @@ PODS: - video_player_avfoundation (0.0.1): - Flutter - FlutterMacOS + - webview_flutter_wkwebview (0.0.1): + - Flutter + - FlutterMacOS - window_manager (0.2.0): - FlutterMacOS @@ -72,10 +75,11 @@ DEPENDENCIES: - sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`) - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`) + - sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`) - tray_manager (from `Flutter/ephemeral/.symlinks/plugins/tray_manager/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`) + - webview_flutter_wkwebview (from `Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin`) - window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`) SPEC REPOS: @@ -118,41 +122,44 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos shared_preferences_foundation: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin - sqflite: - :path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin + sqflite_darwin: + :path: Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin tray_manager: :path: Flutter/ephemeral/.symlinks/plugins/tray_manager/macos url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos video_player_avfoundation: :path: Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin + webview_flutter_wkwebview: + :path: Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin window_manager: :path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos SPEC CHECKSUMS: app_links: 10e0a0ab602ffaf34d142cd4862f29d34b303b2a audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c - connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db + connectivity_plus: 4c41c08fc6d7c91f63bc7aec70ffe3730b04f563 desktop_webview_window: d4365e71bcd4e1aa0c14cf0377aa24db0c16a7e2 - device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720 + device_info_plus: 1b14eed9bf95428983aed283a8d51cce3d8c4215 emoji_picker_flutter: 533634326b1c5de9a181ba14b9758e6dfe967a20 flutter_image_compress_macos: c26c3c13ea0f28ae6dea4e139b3292e7729f99f1 flutter_inappwebview_macos: bdf207b8f4ebd58e86ae06cd96b147de99a67c9b - flutter_local_notifications: 3805ca215b2fb7f397d78b66db91f6a747af52e4 + flutter_local_notifications: 7062189aabf7f50938a7b8b6614ffa97656eb0bf FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 in_app_purchase_storekit: 8c3b0b3eb1b0f04efbff401c3de6266d4258d433 OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94 - package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c + package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 screen_retriever_macos: 776e0fa5d42c6163d2bf772d22478df4b302b161 - Sentry: f8374b5415bc38dfb5645941b3ae31230fbeae57 - sentry_flutter: 0eb93e5279eb41e2392212afe1ccd2fecb4f8cbe - share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf + Sentry: e9215d7b17f7902692b4f8700e061e4f853e3521 + sentry_flutter: 927eed60d66951d1b0f1db37fe94ff5cb7c80231 + share_plus: 1fa619de8392a4398bfaf176d441853922614e89 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 - sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d tray_manager: 9064e219c56d75c476e46b9a21182087930baf90 - url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399 + url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404 video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 + webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4 window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8 PODFILE CHECKSUM: b026caf428aef5db8f45e6734a110a98281273f6 diff --git a/pubspec.lock b/pubspec.lock index 523436717..27536783a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,23 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 url: "https://pub.dev" source: hosted - version: "67.0.0" + version: "72.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.2" analyzer: dependency: transitive description: name: analyzer - sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 url: "https://pub.dev" source: hosted - version: "6.4.1" + version: "6.7.0" animated_loading_border: dependency: "direct main" description: @@ -69,10 +74,10 @@ packages: dependency: transitive description: name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.6.0" async: dependency: transitive description: @@ -85,10 +90,10 @@ packages: dependency: "direct main" description: name: audioplayers - sha256: "752039d6aa752597c98ec212e9759519061759e402e7da59a511f39d43aa07d2" + sha256: c346ba5a39dc208f1bab55fc239855f573d69b0e832402114bf0b793622adc4d url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "6.1.0" audioplayers_android: dependency: transitive description: @@ -157,10 +162,10 @@ packages: dependency: transitive description: name: back_button_interceptor - sha256: e47660f2178a4392eb72001f9594d3fdcb5efde93e59d2819d61fda499e781c8 + sha256: "8354b03320043db546e3f446af171faaa71384100486444113628f7db1e7fe9b" url: "https://pub.dev" source: hosted - version: "6.0.2" + version: "7.0.3" badges: dependency: "direct main" description: @@ -229,18 +234,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: dd09dd4e2b078992f42aac7f1a622f01882a8492fef08486b27ddde929c19f04 + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" url: "https://pub.dev" source: hosted - version: "2.4.12" + version: "2.4.13" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 url: "https://pub.dev" source: hosted - version: "7.3.1" + version: "7.3.2" built_collection: dependency: transitive description: @@ -301,10 +306,10 @@ packages: dependency: transitive description: name: cli_util - sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c url: "https://pub.dev" source: hosted - version: "0.4.1" + version: "0.4.2" clock: dependency: transitive description: @@ -317,10 +322,10 @@ packages: dependency: transitive description: name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" url: "https://pub.dev" source: hosted - version: "4.10.0" + version: "4.10.1" collection: dependency: transitive description: @@ -333,10 +338,10 @@ packages: dependency: transitive description: name: connectivity_plus - sha256: "3e7d1d9dbae40ae82cbe6c23c518f0c4ffe32764ee9749b9a99d32cbac8734f6" + sha256: "876849631b0c7dc20f8b471a2a03142841b482438e3b707955464f5ffca3e4c3" url: "https://pub.dev" source: hosted - version: "6.0.4" + version: "6.1.0" connectivity_plus_platform_interface: dependency: transitive description: @@ -349,10 +354,10 @@ packages: dependency: transitive description: name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" credit_card_type_detector: dependency: transitive description: @@ -381,26 +386,26 @@ packages: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" csslib: dependency: transitive description: name: csslib - sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.2" dart_style: dependency: transitive description: name: dart_style - sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" url: "https://pub.dev" source: hosted - version: "2.3.6" + version: "2.3.7" dbus: dependency: transitive description: @@ -421,10 +426,10 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 + sha256: f545ffbadee826f26f2e1a0f0cbd667ae9a6011cc0f77c0f8f00a969655e6e95 url: "https://pub.dev" source: hosted - version: "10.1.2" + version: "11.1.1" device_info_plus_platform_interface: dependency: transitive description: @@ -445,10 +450,10 @@ packages: dependency: transitive description: name: dio_web_adapter - sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" + sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.0" dotted_border: dependency: "direct main" description: @@ -469,10 +474,10 @@ packages: dependency: "direct main" description: name: emoji_picker_flutter - sha256: "3bf6d4cadc188215570a15c80fd7aeecec312b1cb3168ab08394e0faa4161fcb" + sha256: "08567e6f914d36c32091a96cf2f51d2558c47aa2bd47a590dc4f50e42e0965f6" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.1.0" enum_to_string: dependency: transitive description: @@ -509,10 +514,10 @@ packages: dependency: "direct dev" description: name: ffigen - sha256: "585a852fefda1b796322b45b433e602daae58f92dd8d918b2497db02f1cabf7c" + sha256: e0bdaa4ff30106aab68e7fa19311df4ced2035dc07be30f2e112855e8dcd3259 url: "https://pub.dev" source: hosted - version: "14.0.1" + version: "16.0.0" file: dependency: transitive description: @@ -525,10 +530,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "167bb619cdddaa10ef2907609feb8a79c16dfa479d3afaf960f8e223f754bf12" + sha256: "16dc141db5a2ccc6520ebb6a2eb5945b1b09e95085c021d9f914f8ded7f1465c" url: "https://pub.dev" source: hosted - version: "8.1.2" + version: "8.1.4" filesize: dependency: "direct main" description: @@ -541,10 +546,10 @@ packages: dependency: transitive description: name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" flag: dependency: "direct main" description: @@ -578,10 +583,10 @@ packages: dependency: "direct main" description: name: flutter_dotenv - sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" + sha256: b7c7be5cd9f6ef7a78429cabd2774d3c4af50e79cb2b7593e3d5d763ef95c61b url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.2.1" flutter_driver: dependency: "direct dev" description: flutter @@ -759,26 +764,26 @@ packages: dependency: "direct main" description: name: flutter_local_notifications - sha256: c500d5d9e7e553f06b61877ca6b9c8b92c570a4c8db371038702e8ce57f8a50f + sha256: ef41ae901e7529e52934feba19ed82827b11baa67336829564aeab3129460610 url: "https://pub.dev" source: hosted - version: "17.2.2" + version: "18.0.1" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux - sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af + sha256: "8f685642876742c941b29c32030f6f4f6dacd0e4eaecb3efbb187d6a3812ca01" url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "5.0.0" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface - sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66" + sha256: "6c5b83c86bf819cdb177a9247a3722067dd8cc6313827ce7c77a4b238a26fd52" url: "https://pub.dev" source: hosted - version: "7.2.0" + version: "8.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -788,10 +793,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: e17575ca576a34b46c58c91f9948891117a1bd97815d2e661813c7f90c647a78 + sha256: f0e599ba89c9946c8e051780f0ec99aba4ba15895e0380a7ab68f420046fc44e url: "https://pub.dev" source: hosted - version: "0.7.3+2" + version: "0.7.4+1" flutter_multi_formatter: dependency: "direct main" description: @@ -804,18 +809,18 @@ packages: dependency: "direct main" description: name: flutter_pdfview - sha256: "6b625b32a9102780236554dff42f2d798b4627704ab4a3153c07f2134a52b697" + sha256: "715085f9f2c1ad5129dfe0d31a5f0e5481e2e296ce4e6ce72662de28df5456a6" url: "https://pub.dev" source: hosted - version: "1.3.3" + version: "1.3.4" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "9d98bd47ef9d34e803d438f17fd32b116d31009f534a6fa5ce3a1167f189a6de" + sha256: "9b78450b89f059e96c9ebb355fa6b3df1d6b330436e0b885fb49594c41721398" url: "https://pub.dev" source: hosted - version: "2.0.21" + version: "2.0.23" flutter_staggered_grid_view: dependency: transitive description: @@ -828,10 +833,10 @@ packages: dependency: transitive description: name: flutter_svg - sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + sha256: "578bd8c508144fdaffd4f77b8ef2d8c523602275cd697cc3db284dbd762ef4ce" url: "https://pub.dev" source: hosted - version: "2.0.10+1" + version: "2.0.14" flutter_test: dependency: "direct dev" description: flutter @@ -875,10 +880,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: ff97e5e7b2e82e63c82f5658c6ba2605ea831f0f7489b0d2fb255d817ec4eb5e + sha256: c49895c1ecb0ee2a0ec568d39de882e2c299ba26355aa6744ab1001f98cebd15 url: "https://pub.dev" source: hosted - version: "8.0.0" + version: "8.0.2" gettext_parser: dependency: transitive description: @@ -899,10 +904,10 @@ packages: dependency: "direct main" description: name: google_mobile_ads - sha256: e2d18992d30b2be77cb6976b931112fc3c4612feffb5eb7a8b036bd7a64934da + sha256: "4775006383a27a5d86d46f8fb452bfcb17794fc0a46c732979e49a8eb1c8963f" url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.2.0" graphs: dependency: transitive description: @@ -931,10 +936,10 @@ packages: dependency: transitive description: name: html - sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" url: "https://pub.dev" source: hosted - version: "0.15.4" + version: "0.15.5" http: dependency: transitive description: @@ -963,18 +968,18 @@ packages: dependency: "direct main" description: name: i18n_extension - sha256: "296f7b091b9feb7f682360cece9c335f5b0b35121c31bd1993bbdcf1985c272e" + sha256: "35ec0e5017600c567c39ab21d4e1126baa6dc61bcfc265dafab2b3cd1c062d94" url: "https://pub.dev" source: hosted - version: "12.0.1" + version: "13.0.2" i18n_extension_core: dependency: transitive description: name: i18n_extension_core - sha256: f45157bcd04d4fd88811e8e7c104a66ffbf77d16a6cf8526197c30cb78cbf1c4 + sha256: "5e140a8fb5541bafc6596c2866e92b131b90d8bf759d5f5a7c7c5de5744819db" url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "2.0.7" i18n_extension_importer: dependency: "direct main" description: @@ -995,10 +1000,10 @@ packages: dependency: transitive description: name: in_app_purchase_android - sha256: "4c3f46f736a31902ec5392a75f41ea1ad292f27db00ed51153f3912d076d0efa" + sha256: fa1befc0e25374d16ca532154546503f25a865ed6e7ea5641f4f2b75b092d669 url: "https://pub.dev" source: hosted - version: "0.3.6+5" + version: "0.3.6+12" in_app_purchase_platform_interface: dependency: transitive description: @@ -1011,18 +1016,18 @@ packages: dependency: transitive description: name: in_app_purchase_storekit - sha256: "28a0577d9f4a5bdfb7aad96c347193e1225cc335c8003fbb98b875a67dab34cc" + sha256: a1017ad19ee23fdbabc4ce0c03041c30a3118bcf65e0a4ddd7da2c6d440e51d9 url: "https://pub.dev" source: hosted - version: "0.3.17+3" + version: "0.3.20" infinite_scroll_pagination: dependency: "direct main" description: name: infinite_scroll_pagination - sha256: b68bce20752fcf36c7739e60de4175494f74e99e9a69b4dd2fe3a1dd07a7f16a + sha256: "4047eb8191e8b33573690922a9e995af64c3949dc87efc844f936b039ea279df" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.1.0" integration_test: dependency: "direct dev" description: flutter @@ -1104,26 +1109,34 @@ packages: dependency: "direct main" description: name: loader_overlay - sha256: "74fab08c4f2f686e2cc32887cbc76a90d685afd2ffb79526221fc9e7cf027320" + sha256: bde643b0d3b5c9d9ea9010948d11cb3d17cdcb3f29576b9c47e0047a5b52ae75 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "4.0.3" logger: dependency: "direct main" description: name: logger - sha256: "697d067c60c20999686a0add96cf6aba723b3aa1f83ecf806a8097231529ec32" + sha256: be4b23575aac7ebf01f225a241eb7f6b5641eeaf43c6a8613510fc2f8cf187d1 url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.5.0" logging: dependency: transitive description: name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" + macros: + dependency: transitive + description: + name: macros + sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" + url: "https://pub.dev" + source: hosted + version: "0.1.2-main.4" markdown: dependency: transitive description: @@ -1168,10 +1181,10 @@ packages: dependency: "direct main" description: name: mime - sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "2.0.0" mockito: dependency: "direct dev" description: @@ -1216,10 +1229,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: a75164ade98cb7d24cfd0a13c6408927c6b217fa60dee5a7ff5c116a58f28918 + sha256: da8d9ac8c4b1df253d1a328b7bf01ae77ef132833479ab40763334db13b91cce url: "https://pub.dev" source: hosted - version: "8.0.2" + version: "8.1.1" package_info_plus_platform_interface: dependency: transitive description: @@ -1248,26 +1261,26 @@ packages: dependency: transitive description: name: path_parsing - sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" path_provider: dependency: "direct main" description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.5" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "490539678396d4c3c0b06efdaab75ae60675c3e0c66f72bc04c2e2c1e0e2abeb" + sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a url: "https://pub.dev" source: hosted - version: "2.2.9" + version: "2.2.12" path_provider_foundation: dependency: transitive description: @@ -1312,10 +1325,10 @@ packages: dependency: transitive description: name: permission_handler_android - sha256: b29a799ca03be9f999aa6c39f7de5209482d638e6f857f6b93b0875c618b7e54 + sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1" url: "https://pub.dev" source: hosted - version: "12.0.7" + version: "12.0.13" permission_handler_apple: dependency: transitive description: @@ -1336,10 +1349,10 @@ packages: dependency: transitive description: name: permission_handler_platform_interface - sha256: "48d4fcf201a1dad93ee869ab0d4101d084f49136ec82a8a06ed9cfeacab9fd20" + sha256: e9c8eadee926c4532d0305dff94b85bf961f16759c3af791486613152af4b4f9 url: "https://pub.dev" source: hosted - version: "4.2.1" + version: "4.2.3" permission_handler_windows: dependency: transitive description: @@ -1456,10 +1469,10 @@ packages: dependency: transitive description: name: quiver - sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 + sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "3.2.2" retry: dependency: "direct main" description: @@ -1528,66 +1541,66 @@ packages: dependency: transitive description: name: sentry - sha256: "033287044a6644a93498969449d57c37907e56f5cedb17b88a3ff20a882261dd" + sha256: "2440763ae96fa8fd1bcdfc224f5232e1b7a09af76a72f4e626ee313a261faf6f" url: "https://pub.dev" source: hosted - version: "8.9.0" + version: "8.10.1" sentry_flutter: dependency: "direct main" description: name: sentry_flutter - sha256: "3780b5a0bb6afd476857cfbc6c7444d969c29a4d9bd1aa5b6960aa76c65b737a" + sha256: "3b30038b3b9303540a8b2c8b1c8f0bb93a207f8e4b25691c59d969ddeb4734fd" url: "https://pub.dev" source: hosted - version: "8.9.0" + version: "8.10.1" share_plus: dependency: "direct main" description: name: share_plus - sha256: "468c43f285207c84bcabf5737f33b914ceb8eb38398b91e5e3ad1698d1b72a52" + sha256: "9c9bafd4060728d7cdb2464c341743adbd79d327cb067ec7afb64583540b47c8" url: "https://pub.dev" source: hosted - version: "10.0.2" + version: "10.1.2" share_plus_platform_interface: dependency: transitive description: name: share_plus_platform_interface - sha256: "6ababf341050edff57da8b6990f11f4e99eaba837865e2e6defe16d039619db5" + sha256: c57c0bbfec7142e3a0f55633be504b796af72e60e3c791b44d5a017b985f7a48 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.0.1" shared_preferences: dependency: transitive description: name: shared_preferences - sha256: c272f9cabca5a81adc9b0894381e9c1def363e980f960fa903c604c471b22f68 + sha256: "95f9997ca1fb9799d494d0cb2a780fd7be075818d59f00c43832ed112b158a82" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.3" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "041be4d9d2dc6079cf342bc8b761b03787e3b71192d658220a56cac9c04a0294" + sha256: "3b9febd815c9ca29c9e3520d50ec32f49157711e143b7a4ca039eb87e8ade5ab" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.3" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "671e7a931f55a08aa45be2a13fe7247f2a41237897df434b30d2012388191833" + sha256: "07e050c7cd39bad516f8d64c455f04508d09df104be326d8c02551590a0d513d" url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.5.3" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "2ba0510d3017f91655b7543e9ee46d48619de2a2af38e5c790423f7007c7ccc1" + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: @@ -1600,18 +1613,18 @@ packages: dependency: transitive description: name: shared_preferences_web - sha256: "59dc807b94d29d52ddbb1b3c0d3b9d0a67fc535a64e62a5542c8db0513fcb6c2" + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "398084b47b7f92110683cac45c6dc4aae853db47e470e5ddcd52cab7f7196ab2" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.1" shelf: dependency: transitive description: @@ -1624,10 +1637,10 @@ packages: dependency: transitive description: name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "2.0.0" shimmer: dependency: "direct main" description: @@ -1685,18 +1698,42 @@ packages: dependency: transitive description: name: sqflite - sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d + sha256: "2d7299468485dca85efeeadf5d38986909c5eb0cd71fd3db2c2f000e6c9454bb" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: "78f489aab276260cdd26676d2169446c7ecd3484bbd5fead4ca14f3ed4dd9ee3" url: "https://pub.dev" source: hosted - version: "2.3.3+1" + version: "2.4.0" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" + sha256: "4468b24876d673418a7b7147e5a08a715b4998a7ae69227acafaab762e0e5490" + url: "https://pub.dev" + source: hosted + version: "2.5.4+5" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "96a698e2bc82bd770a4d6aab00b42396a7c63d9e33513a56945cbccb594c2474" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" url: "https://pub.dev" source: hosted - version: "2.5.4" + version: "2.4.0" stack_trace: dependency: transitive description: @@ -1757,10 +1794,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" url: "https://pub.dev" source: hosted - version: "3.1.0+1" + version: "3.3.0+3" term_glyph: dependency: transitive description: @@ -1781,10 +1818,10 @@ packages: dependency: transitive description: name: timezone - sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d" + sha256: ffc9d5f4d1193534ef051f9254063fa53d588609418c84299956c3db9383587d url: "https://pub.dev" source: hosted - version: "0.9.4" + version: "0.10.0" timing: dependency: transitive description: @@ -1805,26 +1842,26 @@ packages: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" url_launcher: dependency: "direct main" description: name: url_launcher - sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.1" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "94d8ad05f44c6d4e2ffe5567ab4d741b82d62e3c8e288cc1fcea45965edf47c9" + sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193" url: "https://pub.dev" source: hosted - version: "6.3.8" + version: "6.3.14" url_launcher_ios: dependency: transitive description: @@ -1837,18 +1874,18 @@ packages: dependency: transitive description: name: url_launcher_linux - sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.2.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" + sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.2.1" url_launcher_platform_interface: dependency: transitive description: @@ -1861,50 +1898,50 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: a36e2d7981122fa185006b216eb6b5b97ede3f9a54b7a511bc966971ab98d049 + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" + sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.3" uuid: dependency: "direct main" description: name: uuid - sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90" + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff url: "https://pub.dev" source: hosted - version: "4.4.2" + version: "4.5.1" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + sha256: "773c9522d66d523e1c7b25dfb95cc91c26a1e17b107039cfe147285e92de7878" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.14" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + sha256: "2430b973a4ca3c4dbc9999b62b8c719a160100dcbae5c819bae0cacce32c9cdb" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.12" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + sha256: ab9ff38fc771e9ee1139320adbe3d18a60327370c218c60752068ebee4b49ab1 url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.15" vector_math: dependency: transitive description: @@ -1917,42 +1954,42 @@ packages: dependency: "direct main" description: name: video_player - sha256: e30df0d226c4ef82e2c150ebf6834b3522cf3f654d8e2f9419d376cdc071425d + sha256: "4a8c3492d734f7c39c2588a3206707a05ee80cef52e8c7f3b2078d430c84bc17" url: "https://pub.dev" source: hosted - version: "2.9.1" + version: "2.9.2" video_player_android: dependency: transitive description: name: video_player_android - sha256: "4de50df9ee786f5891d3281e1e633d7b142ef1acf47392592eb91cba5d355849" + sha256: "391e092ba4abe2f93b3e625bd6b6a6ec7d7414279462c1c0ee42b5ab8d0a0898" url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.7.16" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - sha256: d1e9a824f2b324000dc8fb2dcb2a3285b6c1c7c487521c63306cc5b394f68a7c + sha256: cd5ab8a8bc0eab65ab0cea40304097edc46da574c8c1ecdee96f28cd8ef3792f url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "2.6.2" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - sha256: "236454725fafcacf98f0f39af0d7c7ab2ce84762e3b63f2cbb3ef9a7e0550bc6" + sha256: "229d7642ccd9f3dc4aba169609dd6b5f3f443bb4cc15b82f7785fcada5af9bbb" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.2.3" video_player_web: dependency: transitive description: name: video_player_web - sha256: "6dcdd298136523eaf7dfc31abaf0dfba9aa8a8dbc96670e87e9d42b6f2caf774" + sha256: "881b375a934d8ebf868c7fb1423b2bfaa393a0a265fa3f733079a86536064a10" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3" video_thumbnail: dependency: "direct main" description: @@ -1981,18 +2018,26 @@ packages: dependency: transitive description: name: web - sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.1.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "3.0.1" webdriver: dependency: transitive description: @@ -2005,18 +2050,18 @@ packages: dependency: transitive description: name: webview_flutter - sha256: "6869c8786d179f929144b4a1f86e09ac0eddfe475984951ea6c634774c16b522" + sha256: ec81f57aa1611f8ebecf1d2259da4ef052281cb5ad624131c93546c79ccc7736 url: "https://pub.dev" source: hosted - version: "4.8.0" + version: "4.9.0" webview_flutter_android: dependency: transitive description: name: webview_flutter_android - sha256: c66651fba15f9d7ddd31daec42da8d6bce46c85610a7127e3ebcb39a4395c3c9 + sha256: "47a8da40d02befda5b151a26dba71f47df471cddd91dfdb7802d0a87c5442558" url: "https://pub.dev" source: hosted - version: "3.16.6" + version: "3.16.9" webview_flutter_platform_interface: dependency: transitive description: @@ -2029,26 +2074,26 @@ packages: dependency: transitive description: name: webview_flutter_wkwebview - sha256: "9c62cc46fa4f2d41e10ab81014c1de470a6c6f26051a2de32111b2ee55287feb" + sha256: "3be297aa4ca78205abdd284cf55f168c35246c75b3079990ad8ba9d257681a30" url: "https://pub.dev" source: hosted - version: "3.14.0" + version: "3.16.2" win32: dependency: transitive description: name: win32 - sha256: "015002c060f1ae9f41a818f2d5640389cc05283e368be19dc8d77cecb43c40c9" + sha256: "84ba388638ed7a8cb3445a320c8273136ab2631cd5f2c57888335504ddab1bc2" url: "https://pub.dev" source: hosted - version: "5.5.3" + version: "5.8.0" win32_registry: dependency: transitive description: name: win32_registry - sha256: "723b7f851e5724c55409bb3d5a32b203b3afe8587eaf5dafb93a5fed8ecda0d6" + sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852" url: "https://pub.dev" source: hosted - version: "1.1.4" + version: "1.1.5" window_manager: dependency: "direct main" description: @@ -2061,10 +2106,10 @@ packages: dependency: transitive description: name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.1.0" xml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 1091e6240..d40bfd20b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,9 +29,9 @@ dependencies: sdk: flutter # State management and Data handling - provider: ^6.0.5 + provider: ^6.1.2 protobuf: any - uuid: ^4.4.0 + uuid: ^4.5.1 sliver_tools: ^0.2.12 @@ -41,7 +41,7 @@ dependencies: flag: ^7.0.0 #Loogs and crash reporting - sentry_flutter: ^8.9.0 + sentry_flutter: ^8.10.1 badges: ^3.1.2 dotted_border: ^2.1.0 @@ -72,12 +72,12 @@ dependencies: flutter_cache_manager: ^3.4.1 # change this with flutter_downloader flutter_uploader: ^3.0.0-beta.3 - mime: ^1.0.6 + mime: ^2.0.0 flutter_pdfview: ^1.3.3 # Navigation & Localization auto_route: ^9.2.2 - i18n_extension: ^12.0.1 + i18n_extension: ^13.0.2 i18n_extension_importer: ^0.0.6 intl: ^0.19.0 @@ -87,7 +87,7 @@ dependencies: # Timer & Overlay stop_watch_timer: ^3.2.1 - loader_overlay: ^2.3.2 + loader_overlay: ^4.0.3 # Keyboard & Color utilities flutter_keyboard_visibility: ^6.0.0 @@ -95,7 +95,7 @@ dependencies: # URL & Sharing utilities url_launcher: ^6.3.0 - share_plus: ^10.0.2 + share_plus: ^10.1.2 flutter_inappwebview: ^6.1.5 desktop_webview_window: ^0.2.3 @@ -103,28 +103,28 @@ dependencies: window_manager: ^0.4.3 tray_manager: ^0.2.4 - flutter_dotenv: ^5.1.0 + flutter_dotenv: ^5.2.1 # Notifications & Logging - flutter_local_notifications: ^17.2.2 - logger: ^2.4.0 + flutter_local_notifications: ^18.0.1 + logger: ^2.5.0 # Error handling - device_info_plus: ^10.1.2 + device_info_plus: ^11.1.1 # Package information package_info_plus: ^8.0.2 # Path, permission & Markdown handling - path_provider: ^2.1.4 + path_provider: ^2.1.5 permission_handler: ^11.3.1 - flutter_markdown: ^0.7.3+2 + flutter_markdown: ^0.7.4+1 # Purchase in_app_purchase: ^3.2.0 # Ads - google_mobile_ads: ^5.1.0 + google_mobile_ads: ^5.2.0 retry: ^3.1.2 # Generate bindings to native libraries @@ -132,7 +132,7 @@ dependencies: # Deeplink handling app_links: ^6.3.2 # Service Locator - get_it: ^8.0.0 + get_it: ^8.0.2 #Loading animated_loading_border: ^0.0.2 shimmer: ^3.0.0 @@ -144,11 +144,11 @@ dev_dependencies: sdk: flutter flutter_test: sdk: flutter - ffigen: ^14.0.1 + ffigen: ^16.0.0 flutter_lints: ^5.0.0 mockito: ^5.4.4 auto_route_generator: ^9.0.0 - build_runner: ^2.4.12 + build_runner: ^2.4.13 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 18f676275..e1d033fcf 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi")); + SentryFlutterPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SentryFlutterPlugin")); SharePlusWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); TrayManagerPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 379fb529e..2cbe4d799 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -11,6 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_inappwebview_windows permission_handler_windows screen_retriever_windows + sentry_flutter share_plus tray_manager url_launcher_windows @@ -18,7 +19,6 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST - sentry_flutter ) set(PLUGIN_BUNDLED_LIBRARIES) From ccc13cab348e0da5f3d5cb573ed07b16c7ff4566 Mon Sep 17 00:00:00 2001 From: Jigar-f Date: Mon, 18 Nov 2024 17:00:16 +0530 Subject: [PATCH 26/26] Update open system browser method. --- go.sum | 2 +- lib/core/app/app_webview.dart | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/go.sum b/go.sum index 6b19da269..1d07bd8df 100644 --- a/go.sum +++ b/go.sum @@ -293,7 +293,7 @@ github.com/getlantern/fdcount v0.0.0-20210503151800-5decd65b3731/go.mod h1:XZwE+ github.com/getlantern/filepersist v0.0.0-20160317154340-c5f0cd24e799/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8= github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c h1:mcz27xtAkb1OuOLBct/uFfL1p3XxAIcFct82GbT+UZM= github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8= -github.com/getlantern/flashlight/v7 v7.6.136 h1:SlscKLFtKtTk6DgZOhgqiuys+hhLOqVrQwZQIQtlDDs= +github.com/getlantern/flashlight/v7 v7.6.136 h1:t5+Z/rFQ7PZrD5tUH3a1EeYgDgUi1io+nioI602Qp9Q= github.com/getlantern/flashlight/v7 v7.6.136/go.mod h1:PNDmAgH5Y3+Gi7Fnl05f1MW1joM+djK5ukKIaEjJMZA= github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede h1:yrU6Px3ZkvCsDLPryPGi6FN+2iqFPq+JeCb7EFoDBhw= github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede/go.mod h1:nhnoiS6DE6zfe+BaCMU4YI01UpsuiXnDqM5S8jxHuuI= diff --git a/lib/core/app/app_webview.dart b/lib/core/app/app_webview.dart index db15cde31..6538e82be 100644 --- a/lib/core/app/app_webview.dart +++ b/lib/core/app/app_webview.dart @@ -155,8 +155,16 @@ Future initializeWebViewEnvironment() async { } // openWithSystemBrowser opens a URL in the browser -Future openWithSystemBrowser(String url) async => - await InAppBrowser.openWithSystemBrowser(url: WebUri(url)); +Future openWithSystemBrowser(String url) async { + switch (Platform.operatingSystem) { + case 'linux': + final webview = await WebviewWindow.create(); + webview.launch(url); + break; + default: + await InAppBrowser.openWithSystemBrowser(url: WebUri(url)); + } +} Future openWebview(BuildContext context, String url, [String? title]) async {