Skip to content

Commit

Permalink
Merge pull request #109 from prateekmedia/next
Browse files Browse the repository at this point in the history
[FEAT] Various Fixes for V3
  • Loading branch information
prateekmedia authored Mar 30, 2024
2 parents f507b69 + 37ddb48 commit 0552e69
Show file tree
Hide file tree
Showing 39 changed files with 697 additions and 619 deletions.
184 changes: 87 additions & 97 deletions .github/workflows/flutterci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ name: FlutterCI

on:
push:
branches:
- main
- next
paths-ignore:
- "README.md"
- "docs/**"
workflow_dispatch:
release:
types:
- created
- edited
tags:
- '*'

env:
FLUTTER_VERSION: "3.19.5"

jobs:
build-android:
Expand All @@ -31,6 +25,11 @@ jobs:
uses: subosito/flutter-action@master
with:
channel: stable
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Create artifacts directory
run: mkdir artifacts

- name: Generate android keystore
id: android_keystore
Expand All @@ -47,21 +46,17 @@ jobs:
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
- name: Build Flutter app
run: flutter build apk

- name: Rename app
if: ${{ github.event_name != 'release' }}
run: mv build/app/outputs/apk/release/pstube-* build/app/outputs/apk/release/pstube-android-continuous.apk
run: |
flutter build apk
mv build/app/outputs/apk/release/pstube-* artifacts/pstube-android-${{ github.ref_name }}.apk
- uses: svenstaro/upload-release-action@latest
- name: Create a draft GitHub release
uses: ncipollo/release-action@v1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/app/outputs/apk/release/pstube-*
file_glob: true
prerelease: ${{ github.event_name != 'release' }}
release_name: ${{ github.event_name == 'release' && github.event.release.name || 'Development Build' }}
tag: ${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}
overwrite: true
artifacts: "artifacts/*"
draft: true
allowUpdates: true
updateOnlyUnreleased: true

build-linux:
name: Linux
Expand All @@ -74,68 +69,46 @@ jobs:
uses: subosito/flutter-action@master
with:
channel: stable
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Create artifacts directory
run: mkdir artifacts

- name: Install dependencies
run: sudo apt-get update -y && sudo apt-get install -y libfuse2 libmpv-dev ninja-build libgtk-3-dev dpkg-dev pkg-config rpm

- name: Enable desktop support
run: flutter config --enable-linux-desktop

- name: Build Flutter app
run: flutter build linux

- name: Bump versions
- name: Install appimagetool
run: |
version=$(grep "^version" pubspec.yaml | awk '{print $2}')
sed -i "s:VERSION:$(echo $version):" linux/packaging/rpm/pstube.spec
sed -i "s:VERSION:$(echo $version):" linux/packaging/deb/DEBIAN/control
- name: Build RPM Package
run: |
cp -fr build/linux/x64/release/bundle linux/packaging/deb/usr/share/pstube
mkdir linux/packaging/deb/usr/bin
ln -sr linux/packaging/deb/usr/share/pstube/pstube linux/packaging/deb/usr/bin/pstube
sed -i "s:cp -rf :cp -rf $(pwd)/:" linux/packaging/rpm/pstube.spec
cd linux/packaging/deb
sed -i "s:FILES_HERE:$(find usr \( -type l -o -type f \) -follow -print | awk '{printf "/%s\\n", $0}'):" ../rpm/pstube.spec
cd ../../../
rpmbuild -bb linux/packaging/rpm/pstube.spec -D "_topdir $(pwd)/rpmbuild"
cp rpmbuild/RPMS/x86_64/*.rpm pstube-linux-${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}-x86_64.rpm
rm -rf linux/packaging/rpm
- name: Build DEB Package
run: |
dpkg-deb --build --root-owner-group linux/packaging/deb
cp linux/packaging/*.deb pstube-linux-${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}-x86_64.deb
- name: Build Tarball
run: |
mkdir -p AppDir/
cp -r linux/packaging/deb/usr AppDir/
ln -sr AppDir/usr/share/pstube/pstube AppDir/pstube
tar czf pstube-linux-${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}-x86_64.tar.gz -C AppDir/ .
wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x appimagetool
mv appimagetool /usr/local/bin/
- name: Build AppImage
- name: Build desktop app
run: |
echo '#!/bin/sh
cd "$(dirname "$0")"
exec ./pstube' > AppDir/AppRun
chmod +x AppDir/AppRun
ln -sr AppDir/usr/share/icons/hicolor/128x128/apps/pstube.png AppDir/pstube.png
cp AppDir/usr/share/applications/pstube.desktop AppDir/pstube.desktop
curl -L https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -o appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
ARCH=x86_64 ./appimagetool-x86_64.AppImage AppDir/ pstube-linux-${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}-x86_64.AppImage
- uses: svenstaro/upload-release-action@latest
# Init Configuration for Linux Desktop
flutter config --enable-linux-desktop
dart pub global activate flutter_distributor
# Package to different formats
flutter_distributor package --platform=linux --targets=deb --skip-clean
flutter_distributor package --platform=linux --targets=rpm --skip-clean
flutter_distributor package --platform=linux --targets=appimage --skip-clean
flutter_distributor package --platform=linux --targets=zip --skip-clean
# Move artifacts
mv dist/**/*-*-linux.deb artifacts/pstube-${{ github.ref_name }}-x86_64.deb
mv dist/**/*-*-linux.rpm artifacts/pstube-${{ github.ref_name }}-x86_64.rpm
mv dist/**/*-*-linux.AppImage artifacts/pstube-${{ github.ref_name }}-x86_64.AppImage
mv dist/**/*-*-linux.zip artifacts/pstube-${{ github.ref_name }}-x86_64.zip
- name: Create a draft GitHub release
uses: ncipollo/release-action@v1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pstube-linux-*
file_glob: true
prerelease: ${{ github.event_name != 'release' }}
release_name: ${{ github.event_name == 'release' && github.event.release.name || 'Development Build' }}
tag: ${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}
overwrite: true
artifacts: "artifacts/*"
draft: true
allowUpdates: true
updateOnlyUnreleased: true

build_windows:
name: Windows
Expand All @@ -148,28 +121,45 @@ jobs:
uses: subosito/flutter-action@master
with:
channel: stable
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Enable desktop support
run: flutter config --enable-windows-desktop
- name: Create artifacts directory
run: mkdir artifacts

- name: Build Flutter app
run: flutter build windows

- run: cp -r build/windows/runner/Release pstube-windows-exe
- run: tar.exe -a -c -f pstube-windows-${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}.zip pstube-windows-exe
- name: Build Windows installer
run: |
# Init Configuration for Windows
flutter config --enable-windows-desktop
dart pub global activate flutter_distributor
make innoinstall
# Package to exe
flutter_distributor package --platform=windows --targets=exe --skip-clean
mv dist/**/pstube-*-windows-setup.exe artifacts/pstube-${{ github.ref_name }}-installer.exe
- name: Retain Windows EXE and DLLs
run: cp -r build/windows/x64/runner/Release pstube-${{ github.ref_name }}-windows

- name: Code sign Windows installer and EXE
uses: dlemstra/code-sign-action@v1
with:
certificate: "${{ secrets.WINDOWS_CERTIFICATE }}"
password: "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}"
files: |
artifacts/pstube-${{ github.ref_name }}-installer.exe
pstube-${{ github.ref_name }}-windows/pstube.exe
- run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "PsTube_InnoSetup.iss"
shell: cmd
- name: Zip Windows EXE and DLLs
run: tar.exe -a -c -f artifacts/pstube-${{ github.ref_name }}-windows.zip pstube-${{ github.ref_name }}-windows

- run: cp Output/* ./pstube-windows-${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}.exe
- name: Generate checksums
run: sha256sum artifacts/pstube-* > artifacts/sha256sum-windows

- uses: svenstaro/upload-release-action@latest
- name: Create a draft GitHub release
uses: ncipollo/release-action@v1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pstube-windows-*
file_glob: true
prerelease: ${{ github.event_name != 'release' }}
release_name: ${{ github.event_name == 'release' && github.event.release.name || 'Development Build' }}
tag: ${{ github.event_name == 'release' && github.event.release.tag_name || 'continuous' }}
overwrite: true
artifacts: "artifacts/*"
draft: true
allowUpdates: true
updateOnlyUnreleased: true
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: FlutterLint

on:
push:
branches:
- main

env:
FLUTTER_VERSION: "3.19.5"

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup flutter
uses: subosito/flutter-action@master
with:
channel: stable
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Install dependencies
run: flutter pub get

- name: Run lint check
run: flutter analyze --no-fatal-infos
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ android/key.properties
Output/pstube.exe

# FVM file
.fvm/
.fvm/
dist/
50 changes: 0 additions & 50 deletions PsTube_InnoSetup.iss

This file was deleted.

25 changes: 25 additions & 0 deletions distribute_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
output: dist/

releases:
- name: dev
jobs:
- name: release-dev-linux-zip
package:
platform: linux
target: zip
- name: release-dev-linux-deb
package:
platform: linux
target: deb
- name: release-dev-linux-appimage
package:
platform: linux
target: appimage
- name: release-dev-windows-exe
package:
platform: windows
target: exe
# - name: release-dev-macos-dmg
# package:
# platform: macos
# target: dmg
2 changes: 1 addition & 1 deletion lib/config/info/app_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppInfo {
name: 'Prateek Sunal',
url: 'https://github.com/prateekmedia',
description: 'Founder | Lead Developer',
)
),
];

static List<SFInfo> translatorsInfos = <SFInfo>[
Expand Down
9 changes: 5 additions & 4 deletions lib/foundation/controller/internet_connectivity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class InternetConnectivity {

static Future<void> networkStatusService() async {
Connectivity().onConnectivityChanged.listen((status) async {
if (status != ConnectivityResult.none) {
if (!status.contains(ConnectivityResult.none)) {
_networkController.add(NetworkStatus.restored);
await Future<dynamic>.delayed(const Duration(seconds: 5));
if (status != ConnectivityResult.none) {
await Future<dynamic>.delayed(const Duration(seconds: 2));
if (!status.contains(ConnectivityResult.none)) {
_networkController.add(NetworkStatus.online);
}
} else {
Expand All @@ -27,7 +27,8 @@ class InternetConnectivity {
});
_networkController.stream
.listen((dynamic event) => _status = event as NetworkStatus);
if (await Connectivity().checkConnectivity() == ConnectivityResult.none) {
if ((await Connectivity().checkConnectivity())
.contains(ConnectivityResult.none)) {
_networkController.add(NetworkStatus.offline);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/foundation/controller/scrollable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ class CustomScrollBehavior extends MaterialScrollBehavior {
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
PointerDeviceKind.trackpad
PointerDeviceKind.trackpad,
};
}
Loading

0 comments on commit 0552e69

Please sign in to comment.