From 5eb191e93e5fa61400f256594609c6067e0d960e Mon Sep 17 00:00:00 2001 From: sBubshait Date: Thu, 24 Jul 2025 14:19:15 +0300 Subject: [PATCH 1/2] feat: fix gesture back to prevent going bakc to login --- frontend/lib/screens/home_screen.dart | 62 +++++++++++++-------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/frontend/lib/screens/home_screen.dart b/frontend/lib/screens/home_screen.dart index 3e7d29d..e34a34b 100644 --- a/frontend/lib/screens/home_screen.dart +++ b/frontend/lib/screens/home_screen.dart @@ -10,42 +10,38 @@ class HomeScreen extends StatefulWidget { class _HomeScreenState extends State { int _currentIndex = 0; - - final List _pages = [ - FeedPage(), - InvitationsPage(), - ProfilePage(), - ]; + + final List _pages = [FeedPage(), InvitationsPage(), ProfilePage()]; @override Widget build(BuildContext context) { - return Scaffold( - body: _pages[_currentIndex], - bottomNavigationBar: BottomNavigationBar( - currentIndex: _currentIndex, - onTap: (index) { - setState(() { - _currentIndex = index; - }); - }, - type: BottomNavigationBarType.fixed, - selectedItemColor: Color(0xFF6A4C93), - unselectedItemColor: Colors.grey, - items: [ - BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Feed', - ), - BottomNavigationBarItem( - icon: Icon(Icons.mail), - label: 'Invitations', - ), - BottomNavigationBarItem( - icon: Icon(Icons.person), - label: 'Profile', - ), - ], + return WillPopScope( + onWillPop: () async { + // Prevent going back to authentication screens + return false; + }, + child: Scaffold( + body: _pages[_currentIndex], + bottomNavigationBar: BottomNavigationBar( + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + type: BottomNavigationBarType.fixed, + selectedItemColor: Color(0xFF6A4C93), + unselectedItemColor: Colors.grey, + items: [ + BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Feed'), + BottomNavigationBarItem( + icon: Icon(Icons.mail), + label: 'Invitations', + ), + BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Profile'), + ], + ), ), ); } -} \ No newline at end of file +} From d8e9ea9c6efe6b5b145035dcb262032993ec975b Mon Sep 17 00:00:00 2001 From: sBubshait Date: Sun, 27 Jul 2025 09:44:13 +0300 Subject: [PATCH 2/2] feat: CI/CD to user production server --- .github/workflows/deploy-prod.yml | 34 ++++++++++ .github/workflows/firebase-hosting-merge.yml | 68 +++++++++---------- .../firebase-hosting-pull-request.yml | 44 ++++++------ 3 files changed, 90 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/deploy-prod.yml diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml new file mode 100644 index 0000000..a7231d7 --- /dev/null +++ b/.github/workflows/deploy-prod.yml @@ -0,0 +1,34 @@ +name: Deploy to Production +on: + push: + branches: + - main + - master + +jobs: + deploy: + name: Deploy to Production + needs: build_and_push + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' + environment: production + steps: + - name: Deploy to Server + uses: appleboy/ssh-action@v0.1.5 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USERNAME }} + key: ${{ secrets.SERVER_SSH_KEY }} + port: ${{ secrets.SERVER_PORT }} + script: | + whoami + + cd /home/wesal + + git pull origin main + + docker compose down + + docker compose up -d --build + + docker image prune -f \ No newline at end of file diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 00ec87a..ac7cffe 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -1,40 +1,40 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools +# # This file was auto-generated by the Firebase CLI +# # https://github.com/firebase/firebase-tools -name: Deploy to Firebase Hosting on merge -on: - push: - branches: - - main -jobs: - build_and_deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 +# name: Deploy to Firebase Hosting on merge +# on: +# push: +# branches: +# - main +# jobs: +# build_and_deploy: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: '3.32.6' - channel: stable +# - name: Set up Flutter +# uses: subosito/flutter-action@v2 +# with: +# flutter-version: '3.32.6' +# channel: stable - - name: Install dependencies - working-directory: frontend - run: flutter pub get +# - name: Install dependencies +# working-directory: frontend +# run: flutter pub get - # - name: Run tests - # run: flutter test +# # - name: Run tests +# # run: flutter test - - name: Build Flutter Web - working-directory: frontend - run: flutter build web --release +# - name: Build Flutter Web +# working-directory: frontend +# run: flutter build web --release - - name: Deploy to Firebase Hosting - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: ${{ secrets.GITHUB_TOKEN }} - firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WESALAPP_BC676 }} - channelId: live - projectId: wesalapp-bc676 - entryPoint: frontend +# - name: Deploy to Firebase Hosting +# uses: FirebaseExtended/action-hosting-deploy@v0 +# with: +# repoToken: ${{ secrets.GITHUB_TOKEN }} +# firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WESALAPP_BC676 }} +# channelId: live +# projectId: wesalapp-bc676 +# entryPoint: frontend diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index ddb69c2..37dece4 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -1,23 +1,23 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools +# # This file was auto-generated by the Firebase CLI +# # https://github.com/firebase/firebase-tools -name: Deploy to Firebase Hosting on PR -on: pull_request -permissions: - checks: write - contents: read - pull-requests: write -jobs: - build_and_preview: - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: flutter build web - working-directory: frontend - - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: ${{ secrets.GITHUB_TOKEN }} - firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WESALAPP_BC676 }} - projectId: wesalapp-bc676 - entryPoint: frontend +# name: Deploy to Firebase Hosting on PR +# on: pull_request +# permissions: +# checks: write +# contents: read +# pull-requests: write +# jobs: +# build_and_preview: +# if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - run: flutter build web +# working-directory: frontend +# - uses: FirebaseExtended/action-hosting-deploy@v0 +# with: +# repoToken: ${{ secrets.GITHUB_TOKEN }} +# firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WESALAPP_BC676 }} +# projectId: wesalapp-bc676 +# entryPoint: frontend