Skip to content

Commit

Permalink
Merge branch 'master' into ci/vcredist-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
iqfareez committed Aug 9, 2024
2 parents 7adc148 + 18fe705 commit f6d23a3
Show file tree
Hide file tree
Showing 28 changed files with 242 additions and 394 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_aab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
Expand Down
128 changes: 7 additions & 121 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,78 +5,12 @@ on:
types: [published]

jobs:
# Read config file to get the Flutter channel and build targets
read_config:
runs-on: ubuntu-latest
outputs:
flutterVer: ${{ steps.flutter-ver.outputs.data }}
buildWindows: ${{ steps.read-build-windows.outputs.data }}
buildWeb: ${{ steps.read-build-web.outputs.data }}
buildAndroid: ${{ steps.read-build-android.outputs.data }}
buildMacos: ${{ steps.read-build-macos.outputs.data }}
steps:
- name: Checkout repo
uses: actions/checkout@v3

- id: read-flutter-ver
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml" # File to read from
key-path: '["flutter_channel"]' # Access the runs key then the using key and retuns the value.

- id: set-flutter-ver
name: Set Flutter version to be built against
run: echo "data=${{ steps.read-flutter-ver.outputs.data }}" >> $GITHUB_OUTPUT

- id: read-build-windows
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml"
key-path: '["build_for", "windows"]'

- id: set-build-windows
run: echo "data=${{ steps.read-build-windows.outputs.data }}" >> $GITHUB_OUTPUT

- id: read-build-web
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml"
key-path: '["build_for", "web"]'

- id: set-build-web
run: echo "data=${{ steps.read-build-web.outputs.data }}" >> $GITHUB_OUTPUT

- id: read-build-android
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml"
key-path: '["build_for", "android"]'

- id: set-build-android
run: echo "data=${{ steps.read-build-android.outputs.data }}" >> $GITHUB_OUTPUT

- id: read-build-macos
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml"
key-path: '["build_for", "macos"]'

- id: set-build-macos
run: echo "data=${{ steps.read-build-macos.outputs.data }}" >> $GITHUB_OUTPUT

build_android:
name: Build for Android
needs: read_config
if: ${{ needs.read_config.outputs.buildAndroid == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/[email protected]
Expand All @@ -87,7 +21,7 @@ jobs:
- name: Setup Flutter
uses: subosito/[email protected]
with:
channel: "${{ needs.read_config.outputs.flutterVer }}"
channel: "stable"

# File can be encoded to base64 on https://base64.guru/converter/encode/file
- name: Decoding android/key.properties
Expand Down Expand Up @@ -133,63 +67,17 @@ jobs:
echo "" >> $GITHUB_STEP_SUMMARY
echo ":blue_heart: Using **`flutter --version`**" >> $GITHUB_STEP_SUMMARY
build_web:
name: Build for web & firebase deploy
needs: read_config
if: ${{ needs.read_config.outputs.buildWeb == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Flutter
uses: subosito/[email protected]
with:
channel: "${{ needs.read_config.outputs.flutterVer }}"

- name: Build release web
run: |
flutter pub get
flutter build web --web-renderer canvaskit
- name: Adding markdown
run: |
echo 'Build **web** :white_check_mark:' >> $GITHUB_STEP_SUMMARY
- name: Determine Hosting channel
uses: haya14busa/action-cond@v1
id: hostingChannel
with:
cond: ${{github.event.release.prerelease}}
if_true: "staging"
if_false: "live" # prod

- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
id: firebaseDeploy
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IIUMSCHEDULE_AF71A }}"
channelId: ${{ steps.hostingChannel.outputs.value }}
projectId: iiumschedule-af71a

- name: Adding markdown
run: |
echo ':rocket: Deployed to Firebase **${{ steps.hostingChannel.outputs.value }} channel**. URL **${{ steps.firebaseDeploy.outputs.details_url }}**' >> $GITHUB_STEP_SUMMARY
build_windows:
name: Build for Windows
needs: read_config
if: ${{ needs.read_config.outputs.buildWindows == 'true' }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/[email protected]
with:
channel: "${{ needs.read_config.outputs.flutterVer }}"
channel: "stable"

- name: Flutter build for Windows
run: |
Expand Down Expand Up @@ -248,17 +136,15 @@ jobs:
build_macos:
name: Build for Mac OS
needs: read_config
if: ${{ needs.read_config.outputs.buildMacos == 'true' }}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: ${{ inputs.flutterChannel }}
channel: "stable"
architecture: x64

- uses: actions/setup-node@v3
Expand Down Expand Up @@ -290,7 +176,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_macos_dmg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/firebase-hosting-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/firebase-hosting-new-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/inno-setup-package-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/msix-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
Expand Down
2 changes: 1 addition & 1 deletion Inno/setup-script.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "IIUM Schedule"
#define MyAppVersion "1.4.3.0"
#define MyAppVersion "1.4.5.0"
#define MyAppPublisher "Muhammad Fareez Iqmal"
#define MyAppURL "https://iiumschedule.iqfareez.com/"
#define MyAppExeName "iium_schedule.exe"
Expand Down
13 changes: 0 additions & 13 deletions ci-config.yml

This file was deleted.

4 changes: 2 additions & 2 deletions lib/constants.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:io';

/// default session/current academic seesion
const String kDefaultSession = '2023/2024';
const String kDefaultSession = '2024/2025';

/// Values must be between 1 and 3 (inclusive)
const int kDefaultSemester = 2;
const int kDefaultSemester = 1;

/// Check if app is running on macos or iphones/ipads
final kIsApple = Platform.isMacOS || Platform.isIOS;
5 changes: 2 additions & 3 deletions lib/features/course browser/browser_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:io';
import 'package:albiruni/albiruni.dart';
import 'package:and/and.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:recase/recase.dart';

Expand Down Expand Up @@ -75,8 +74,8 @@ class _BrowserViewState extends State<BrowserView> {
}

Future<List<Subject>> _getSubjects() async {
var (subjects, _) = await widget.albiruni.fetch(widget.kulliyah,
course: widget.courseCode, page: _page, useProxy: kIsWeb);
var (subjects, _) = await widget.albiruni
.fetch(widget.kulliyah, course: widget.courseCode, page: _page);
return subjects;
}

Expand Down
12 changes: 3 additions & 9 deletions lib/features/course browser/subject_screen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:io';

import 'package:albiruni/albiruni.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
Expand Down Expand Up @@ -223,7 +222,7 @@ class TextBubble extends StatelessWidget {
return GestureDetector(
onLongPress: () {
// for Android, long press to copy
if (!kIsWeb || Platform.isAndroid) {
if (Platform.isAndroid) {
Clipboard.setData(ClipboardData(text: text)).then((_) {
Fluttertoast.showToast(msg: 'Copied');
HapticFeedback.lightImpact();
Expand All @@ -235,16 +234,11 @@ class TextBubble extends StatelessWidget {
child: ActionChip(
onPressed: () {
// on Windows or Web, tap to copy
if (kIsWeb || Platform.isWindows) {
if (Platform.isWindows) {
Clipboard.setData(ClipboardData(text: text)).then((_) {
HapticFeedback.lightImpact();

// handle toast based on platform
if (kIsWeb) {
Fluttertoast.showToast(msg: 'Copied');
} else {
MyFtoast.show(context, 'Copied');
}
MyFtoast.show(context, 'Copied');
});
}
},
Expand Down
13 changes: 1 addition & 12 deletions lib/features/final_exam/views/final_exam_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import '../../../isar_models/final_exam.dart';
Expand Down Expand Up @@ -96,10 +95,7 @@ class _FinalExamPageState extends State<FinalExamPage> {
void _generateIcs() {
if (finalExams == null) return;
// On Windows, default to export as ICS
if (!kIsWeb) {
_showSaveIcsDialog();
return;
}
_showSaveIcsDialog();
}

@override
Expand All @@ -111,13 +107,6 @@ class _FinalExamPageState extends State<FinalExamPage> {
// after the ics file has been generated & saved, a dialog will be shown
// that allow user to share (because finding the file in file explorer) is kinda hard
void _showSaveIcsDialog() async {
// TODO: Check web implementation
if (kIsWeb) {
CalendarIcs.downloadIcsFile(finalExams!.map((e) => e.finalExam).toList());
// maybe show IcsGeneratedDialog but with download button instead
return;
}

late File filePath;
try {
filePath = await CalendarIcs.generateIcsFile(
Expand Down
Loading

0 comments on commit f6d23a3

Please sign in to comment.