Skip to content

Commit

Permalink
Fix Chip in article_info_page for linux-build
Browse files Browse the repository at this point in the history
  • Loading branch information
TaYaKi71751 committed Dec 13, 2023
1 parent c10fc98 commit c0193df
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 93 deletions.
234 changes: 149 additions & 85 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,53 @@ on:
merge_group:

jobs:
ios-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
ref: dev
- uses: subosito/flutter-action@v2
with:
# flutter-version: '2.5.2'
channel: 'stable'
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Preprocess
run: |
# cd lib/server
# wget -q ${{ secrets.SECRET_SALT }}
# wget -q ${{ secrets.SECRET_WSALT }}
# cd ../..
cat << EOF > lib/server/salt.dart
String getValid(foo) {return foo;}
EOF
cat << EOF > lib/server/wsalt.dart
String getValid(foo) {return foo;}
EOF
python3 preprocess-ios.py
- name: Podfile
run: |
cd ios
rm Podfile.lock
flutter clean
flutter pub get
pod install
pod update
cd ..
- name: Build
run: |
flutter build ios --release --no-codesign
mkdir -p Payload
mv ./build/ios/iphoneos/Runner.app Payload
zip -r -y Payload.zip Payload/Runner.app
mv Payload.zip Payload.ipa
- name: Upload IPA
uses: actions/upload-artifact@v2
with:
name: ipa-build
path: Payload.ipa
# ios-build:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v2
# with:
# ref: dev
# - uses: subosito/flutter-action@v2
# with:
# # flutter-version: '2.5.2'
# channel: 'stable'
# - uses: actions/setup-python@v2
# with:
# python-version: '3.8'
# - name: Preprocess
# run: |
# # cd lib/server
# # wget -q ${{ secrets.SECRET_SALT }}
# # wget -q ${{ secrets.SECRET_WSALT }}
# # cd ../..
# cat << EOF > lib/server/salt.dart
# String getValid(foo) {return foo;}
# EOF
# cat << EOF > lib/server/wsalt.dart
# String getValid(foo) {return foo;}
# EOF
# python3 preprocess-ios.py
# - name: Podfile
# run: |
# cd ios
# rm Podfile.lock
# flutter clean
# flutter pub get
# pod install
# pod update
# cd ..
# - name: Build
# run: |
# flutter build ios --release --no-codesign
# mkdir -p Payload
# mv ./build/ios/iphoneos/Runner.app Payload
# zip -r -y Payload.zip Payload/Runner.app
# mv Payload.zip Payload.ipa
# - name: Upload IPA
# uses: actions/upload-artifact@v2
# with:
# name: ipa-build
# path: Payload.ipa

# https://github.com/AppImageCrafters/appimage-builder-flutter-example/blob/main/.github/workflows/appimage.yml
linux-build:
Expand All @@ -69,6 +69,70 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build build-essential pkg-config curl file git unzip xz-utils zip libgtk-3-dev
- name: Clone project-violet/p7zip
run: git clone https://github.com/project-violet/p7zip.git
- name: Build p7zip for linux/armhf
uses: pguyot/arm-runner-action@v2
id: p7zip-armv7-linux-build
with:
base_image: raspios_lite:latest
copy_artifact_path: p7zip/bin/7zr
commands: |
cd p7zip
make 7zr
cd ..
- name: Copy bin
run: |
mkdir -p ./assets/p7zip/linux/armv7/
chmod 777 p7zip/bin/7zr
cp p7zip/bin/7zr ./assets/p7zip/linux/armv7/7zr
- name: Clean up project-violet/p7zip
run: |
cd p7zip
git add -A
git reset --hard HEAD
cd ..
- name: Build p7zip for linux/arm64
uses: pguyot/arm-runner-action@v2
id: p7zip-arm64-linux-build
with:
base_image: raspios_lite_arm64:latest
copy_artifact_path: p7zip/bin/7zr
commands: |
cd p7zip
make 7zr
cd ..
- name: Copy bin
run: |
mkdir -p ./assets/p7zip/linux/armv8/
chmod 777 p7zip/bin/7zr
cp p7zip/bin/7zr ./assets/p7zip/linux/armv8/7zr
- name: Clean up project-violet/p7zip
run: |
cd p7zip
git add -A
git reset --hard HEAD
cd ..
- name: Build p7zip for linux/x86(not yet)
run: |
mkdir -p ./assets/p7zip/linux/x86/
touch ./assets/p7zip/linux/x86/7zr
- name: Build p7zip for linux/x86_64
run: |
cd p7zip
make 7zr
cd ..
- name: Copy bin
run: |
mkdir -p ./assets/p7zip/linux/x86_64/
chmod 777 p7zip/bin/7zr
cp p7zip/bin/7zr ./assets/p7zip/linux/x86_64/7zr
- name: Clean up project-violet/p7zip
run: |
cd p7zip
git add -A
git reset --hard HEAD
cd ..
- name: Build flutter app
run: |
# cd lib/server
Expand Down Expand Up @@ -109,41 +173,41 @@ jobs:
# files: './*.AppImage*'
# repo_token: ${{ secrets.GITHUB_TOKEN }}

android-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: dev
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
# flutter-version: '2.5.2'
channel: 'stable'
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Preprocess
run: |
# cd lib/server
# wget -q ${{ secrets.SECRET_SALT }}
# wget -q ${{ secrets.SECRET_WSALT }}
# cd ../..
cat << EOF > lib/server/salt.dart
String getValid(foo) {return foo;}
EOF
cat << EOF > lib/server/wsalt.dart
String getValid(foo) {return foo;}
EOF
python3 preprocess-android.py
- name: Build
run: |
flutter clean
flutter build apk --release
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: apk-build
path: ./build/app/outputs/apk/release/app-release.apk
# android-build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# ref: dev
# - uses: actions/setup-java@v1
# with:
# java-version: '12.x'
# - uses: subosito/flutter-action@v1
# with:
# # flutter-version: '2.5.2'
# channel: 'stable'
# - uses: actions/setup-python@v2
# with:
# python-version: '3.8'
# - name: Preprocess
# run: |
# # cd lib/server
# # wget -q ${{ secrets.SECRET_SALT }}
# # wget -q ${{ secrets.SECRET_WSALT }}
# # cd ../..
# cat << EOF > lib/server/salt.dart
# String getValid(foo) {return foo;}
# EOF
# cat << EOF > lib/server/wsalt.dart
# String getValid(foo) {return foo;}
# EOF
# python3 preprocess-android.py
# - name: Build
# run: |
# flutter clean
# flutter build apk --release
# - name: Upload APK
# uses: actions/upload-artifact@v2
# with:
# name: apk-build
# path: ./build/app/outputs/apk/release/app-release.apk
2 changes: 1 addition & 1 deletion lib/checker/checker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class VioletChecker {
//
// 0. get database path
//
var dbPath = Platform.isAndroid
var dbPath = (Platform.isAndroid || Platform.isLinux)
? '${(await DefaultPathProvider.getBaseDirectory())}/data/data.db'
: '${(await DefaultPathProvider.getBaseDirectory())}/data.db';

Expand Down
2 changes: 1 addition & 1 deletion lib/database/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DataBaseManager {
if (Platform.environment.containsKey('FLUTTER_TEST')) {
dbPath = join(Directory.current.path, 'test/db/data.db');
} else {
dbPath = Platform.isAndroid
dbPath = (Platform.isAndroid || Platform.isLinux)
? '${(await DefaultPathProvider.getBaseDirectory())}/data/data.db'
: '${(await DefaultPathProvider.getBaseDirectory())}/data.db';
}
Expand Down
12 changes: 10 additions & 2 deletions lib/pages/article_info/article_info_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,11 @@ class MultiChipWidget extends StatelessWidget {
Expanded(
child: Wrap(
spacing: 3.0,
runSpacing: -9.0,
runSpacing: ((){
if(Platform.isAndroid || Platform.isIOS) return -9.0;
if(Platform.isLinux) return 9.0;
return -9.0;
})(),
children: groupName
.map((x) => _Chip(group: x.item1, name: x.item2))
.toList(),
Expand Down Expand Up @@ -1144,7 +1148,11 @@ class _Chip extends StatelessWidget {
);

return SizedBox(
height: 44,
height: ((){
if(Platform.isAndroid || Platform.isIOS) return 44.0;
if(Platform.isLinux) return 44.0;
return 44.0;
})(),
child: FittedBox(child: fc),
);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/database_download/database_download_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {
try {
final prefs = await MultiPreferences.getInstance();
if ((await prefs.getInt('db_exists')) == 1) {
var dbPath = Platform.isAndroid
var dbPath = (Platform.isAndroid || Platform.isLinux)
? '${(await DefaultPathProvider.getBaseDirectory())}/data/data.db'
: '${(await DefaultPathProvider.getBaseDirectory())}/data.db';
if (await File(dbPath).exists()) await File(dbPath).delete();
Expand Down Expand Up @@ -104,9 +104,9 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {

Future<void> downloadFileLinux() async {
try {
await downloadFileLinuxWith('latest', true);
await downloadFileAndroidWith('latest', true);
} catch(e){
await downloadFileLinuxWith('old', false);
await downloadFileAndroidWith('old', false);
}
}

Expand Down
Loading

0 comments on commit c0193df

Please sign in to comment.