Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flutter 3.27.1 #206

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8382dec
Merge pull request #93 from guyluz11/dev
guyluz11 May 28, 2024
d0efe67
Merge pull request #94 from guyluz11/dev
guyluz11 May 28, 2024
71dd1f5
Merge pull request #100 from guyluz11/dev
guyluz11 Jun 2, 2024
a70503b
Merge pull request #105 from guyluz11/dev
guyluz11 Jun 2, 2024
23b5876
Merge pull request #116 from guyluz11/dev
guyluz11 Jun 4, 2024
1c9e5f1
Merge pull request #136 from guyluz11/dev
guyluz11 Jun 24, 2024
a4a5f58
Merge pull request #141 from guyluz11/dev
guyluz11 Jun 25, 2024
c85044b
Merge pull request #142 from guyluz11/dev
guyluz11 Jun 25, 2024
5b95e2e
Merge pull request #150 from guyluz11/dev
guyluz11 Jun 27, 2024
5647647
Merge pull request #154 from guyluz11/dev
guyluz11 Jul 5, 2024
cd78904
Merge pull request #156 from guyluz11/dev
guyluz11 Jul 5, 2024
51e17e3
Merge pull request #159 from guyluz11/dev
guyluz11 Jul 7, 2024
5866a04
Merge pull request #161 from guyluz11/dev
guyluz11 Jul 8, 2024
34927fb
Merge pull request #163 from guyluz11/dev
guyluz11 Jul 10, 2024
ffa43d0
Merge pull request #168 from guyluz11/dev
guyluz11 Jul 20, 2024
9832cbb
Merge pull request #171 from guyluz11/dev
guyluz11 Jul 24, 2024
01952a7
Merge pull request #182 from guyluz11/dev
guyluz11 Oct 17, 2024
ad0d471
Merge pull request #184 from guyluz11/dev
guyluz11 Oct 18, 2024
eb8171a
Merge pull request #185 from guyluz11/dev
guyluz11 Oct 19, 2024
677b962
Merge pull request #186 from guyluz11/dev
guyluz11 Nov 7, 2024
7f3a1ef
Merge pull request #188 from guyluz11/dev
guyluz11 Nov 7, 2024
e4f97c3
Merge pull request #192 from guyluz11/dev
guyluz11 Nov 9, 2024
6b9d541
Merge pull request #197 from guyluz11/dev
guyluz11 Nov 20, 2024
e4ef50f
Merge pull request #198 from guyluz11/dev
guyluz11 Nov 22, 2024
9c3c38c
Fix ios link image
guyluz11 Dec 23, 2024
09772ac
Replaced dnd package for app to run
guyluz11 Dec 24, 2024
bd26f71
Replaced vibration package. Fixed analysis warnings
guyluz11 Dec 24, 2024
135d16a
Added flutter analyze to github actions
guyluz11 Dec 24, 2024
4c2ae83
Merge remote-tracking branch 'refs/remotes/origin/main' into support_…
guyluz11 Dec 24, 2024
ef6c55d
Updating jvm and java to 1.8
guyluz11 Dec 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
flutter_channel: 'stable'
flutter_version: '3.22.2'
flutter_version: '3.27.1'

jobs:
build:
Expand All @@ -29,5 +29,7 @@ jobs:
distribution: 'zulu'
- name: Install dependencies
run: flutter pub get
- name: Run Flutter analysis
run: flutter analyze
- name: Run tests
run: flutter test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<img border="0" alt="Android Badge" src="https://user-images.githubusercontent.com/9304740/117003444-8b58a080-aced-11eb-94bc-bfb2505f515d.png" style="width: 250px; height: 83px;">
</a>
<a href="https://apps.apple.com/us/app/infinite-horizons/id6502440548?itsct=apps_box_badge&amp;itscg=30200">
<img alt="Download on the App Store" src="https://tools.applemediaservices.com/api/badges/download-on-the-app-store/black/en-us?size=250x83&amp;releaseDate=1716076800" style="width: 250px; height: 83px;">
<img border="0" alt="Download on the App Store" src="https://toolbox.marketingtools.apple.com/api/badges/download-on-the-app-store/black/en-us?size=250x83&amp;releaseDate=1716076800" style="width: 250px; height: 83px;">
</a>
</div>
</div>
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ android {
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '17'
jvmTarget = "1.8"
}

sourceSets {
Expand Down
6 changes: 0 additions & 6 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
<!-- </intent>-->
<!-- </queries>-->

<!-- <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />-->
<!-- <uses-permission android:name="android.permission.VIBRATE" />-->
<!-- <uses-permission android:name="android.permission.INTERNET" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
<!-- <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />-->
<!-- <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />-->
<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
<!-- <uses-permission android:name="android.permission.health.READ_SLEEP" />-->

Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.android.application" version "8.1.1" apply false
}

include ":app"
6 changes: 5 additions & 1 deletion lib/domain/controllers/dnd_controller.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter_dnd/flutter_dnd.dart';
import 'package:do_not_disturb/do_not_disturb.dart';
import 'package:infinite_horizons/domain/controllers/controllers.dart';
import 'package:universal_io/io.dart';

Expand All @@ -18,4 +18,8 @@ abstract class DndController {
Future<bool> isDnd();

Future<void> disable();

Future<bool> isNotificationPolicyAccessGranted();

Future<void> gotoPolicySettings();
}
2 changes: 1 addition & 1 deletion lib/domain/controllers/permissions_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:async';

import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter_dnd/flutter_dnd.dart';
import 'package:infinite_horizons/domain/controllers/controllers.dart';
import 'package:universal_io/io.dart';

part 'package:infinite_horizons/infrastructure/permissions_repository.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/domain/controllers/vibration_controller.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:universal_io/io.dart';
import 'package:vibration/vibration.dart';

part 'package:infinite_horizons/infrastructure/vibration_repository.dart';

Expand Down
12 changes: 6 additions & 6 deletions lib/domain/objects/tip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ List<Tip> tipsList = [
resourceLinks: [
Resource(
'YouTube video by Andrew Huberman: "Optimizing Workspace for Productivity, Focus, & Creativity"',
"Go to Sleep to keep your sleep circle and brain in good state",
'Go to Sleep to keep your sleep circle and brain in good state',
link: Uri.parse('https://youtu.be/Ze2pc6NwsHQ?si=wXUetxQZKNsk4wXT'),
),
],
Expand Down Expand Up @@ -211,7 +211,7 @@ List<Tip> tipsList = [
resourceLinks: [
Resource(
'YouTube video by Andrew Huberman: "Optimizing Workspace for Productivity, Focus, & Creativity"',
"Getting expose to sun in the first 30m-60m of the day going to facilitate focus, further release of dopamine and norepinephrine and healthy amounts of cortisol.",
'Getting expose to sun in the first 30m-60m of the day going to facilitate focus, further release of dopamine and norepinephrine and healthy amounts of cortisol.',
link: Uri.parse('https://youtu.be/Ze2pc6NwsHQ?si=wXUetxQZKNsk4wXT'),
),
],
Expand All @@ -230,7 +230,7 @@ List<Tip> tipsList = [
resourceLinks: [
Resource(
'YouTube video by Andrew Huberman: "Optimizing Workspace for Productivity, Focus, & Creativity"',
"Work environment with strong light without hurting your eyes in the first 9 hours of wake to increase focus and for releasing dopamine, norepinephrine, and healthy amounts of cortisol",
'Work environment with strong light without hurting your eyes in the first 9 hours of wake to increase focus and for releasing dopamine, norepinephrine, and healthy amounts of cortisol',
link: Uri.parse('https://youtu.be/Ze2pc6NwsHQ?si=wXUetxQZKNsk4wXT'),
),
],
Expand All @@ -249,7 +249,7 @@ List<Tip> tipsList = [
resourceLinks: [
Resource(
'YouTube video by Andrew Huberman: "Optimizing Workspace for Productivity, Focus, & Creativity"',
"After 9 hours of being awake your should reducing over the head light inorder to shift body production from dopamine and norepinephrine to serotonin and other neuromodulators.",
'After 9 hours of being awake your should reducing over the head light inorder to shift body production from dopamine and norepinephrine to serotonin and other neuromodulators.',
link: Uri.parse('https://youtu.be/Ze2pc6NwsHQ?si=wXUetxQZKNsk4wXT'),
),
],
Expand All @@ -267,7 +267,7 @@ List<Tip> tipsList = [
resourceLinks: [
Resource(
'YouTube video by Andrew Huberman: "Optimizing Workspace for Productivity, Focus, & Creativity"',
"After 16 hours of being awake you should keep only the necessary light for the work, more than that will severely deplete your melatonin levels, going to severally shift your circadian clock like traveling to different time zone.",
'After 16 hours of being awake you should keep only the necessary light for the work, more than that will severely deplete your melatonin levels, going to severally shift your circadian clock like traveling to different time zone.',
link: Uri.parse('https://youtu.be/Ze2pc6NwsHQ?si=wXUetxQZKNsk4wXT'),
),
],
Expand Down Expand Up @@ -311,7 +311,7 @@ List<Tip> tipsList = [
resourceLinks: [
Resource(
'YouTube video by Andrew Huberman: "Optimizing Workspace for Productivity, Focus, & Creativity"',
"In the first 9 hours after waking (around 8am-12pm) our brain enters state of high alertness and accurate thinking, which is good for working on analytical and accurate tasks.",
'In the first 9 hours after waking (around 8am-12pm) our brain enters state of high alertness and accurate thinking, which is good for working on analytical and accurate tasks.',
link: Uri.parse('https://www.youtube.com/watch?v=Ze2pc6NwsHQ'),
),
],
Expand Down
38 changes: 29 additions & 9 deletions lib/infrastructure/dnd_repository.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
part of 'package:infinite_horizons/domain/controllers/dnd_controller.dart';

class _DndRepository extends DndController {
// TODO: Switched packages for app to run, code not tested
late DoNotDisturbPlugin dnd;

@override
void init() => supported = Platform.isAndroid;
void init() {
supported = Platform.isAndroid;
if (!supported) {
return;
}
dnd = DoNotDisturbPlugin();
}

@override
Future<void> enable() async {
Expand All @@ -13,9 +22,7 @@ class _DndRepository extends DndController {
if (await PermissionsController.instance
.isNotificationPolicyAccessGranted()) {
// Turn on DND - All notifications are suppressed except priority.
await FlutterDnd.setInterruptionFilter(
FlutterDnd.INTERRUPTION_FILTER_PRIORITY,
);
await dnd.setInterruptionFilter(InterruptionFilter.priority);
} else {
PermissionsController.instance.gotoPolicySettings();
}
Expand All @@ -29,9 +36,7 @@ class _DndRepository extends DndController {

if (await PermissionsController.instance
.isNotificationPolicyAccessGranted()) {
await FlutterDnd.setInterruptionFilter(
FlutterDnd.INTERRUPTION_FILTER_ALL,
);
await dnd.setInterruptionFilter(InterruptionFilter.all);
}
}

Expand All @@ -41,7 +46,22 @@ class _DndRepository extends DndController {
return false;
}

return await FlutterDnd.getCurrentInterruptionFilter() ==
FlutterDnd.INTERRUPTION_FILTER_PRIORITY;
return dnd.isDndEnabled();
}

@override
Future<void> gotoPolicySettings() async {
if (!supported) {
return;
}
await dnd.openNotificationPolicyAccessSettings();
}

@override
Future<bool> isNotificationPolicyAccessGranted() async {
if (!supported) {
return false;
}
return dnd.isNotificationPolicyAccessGranted();
}
}
8 changes: 4 additions & 4 deletions lib/infrastructure/notifications_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,25 @@ class _NotificationsRepository extends NotificationsController {

/// Use this method to detect when the user taps on a notification or action button
/// Also capture when there is a message from firebase messaging
@pragma("vm:entry-point")
@pragma('vm:entry-point')
static Future<void> onActionReceivedMethod(
ReceivedAction receivedAction,
) async {}

/// Use this method to detect when a new notification or a schedule is created
@pragma("vm:entry-point")
@pragma('vm:entry-point')
static Future<void> onNotificationCreatedMethod(
ReceivedNotification receivedNotification,
) async {}

/// Use this method to detect every time that a new notification is displayed
@pragma("vm:entry-point")
@pragma('vm:entry-point')
static Future<void> onNotificationDisplayedMethod(
ReceivedNotification receivedNotification,
) async {}

/// Use this method to detect if the user dismissed a notification
@pragma("vm:entry-point")
@pragma('vm:entry-point')
static Future<void> onDismissActionReceivedMethod(
ReceivedAction receivedAction,
) async {}
Expand Down
7 changes: 3 additions & 4 deletions lib/infrastructure/permissions_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ part of 'package:infinite_horizons/domain/controllers/permissions_controller.dar

class _PermissionsRepository extends PermissionsController {
@override
Future<bool> isNotificationPolicyAccessGranted() async =>
Platform.isAndroid &&
(await FlutterDnd.isNotificationPolicyAccessGranted ?? false);
Future<bool> isNotificationPolicyAccessGranted() =>
DndController.instance.isNotificationPolicyAccessGranted();

@override
void gotoPolicySettings() => FlutterDnd.gotoPolicySettings();
void gotoPolicySettings() => DndController.instance.gotoPolicySettings();

@override
Future generalNotificationPermission() =>
Expand Down
11 changes: 5 additions & 6 deletions lib/infrastructure/vibration_repository.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
part of 'package:infinite_horizons/domain/controllers/vibration_controller.dart';

class _VibrationRepository extends VibrationController {
// TODO: Switched packages for app to run, code not tested
@override
Future init() async => supported = Platform.isAndroid || Platform.isIOS;

Expand All @@ -10,16 +11,14 @@ class _VibrationRepository extends VibrationController {
return;
}

FeedbackType feedbackType;
// TODO: Values are incorrect
switch (type) {
case VibrationType.light:
feedbackType = FeedbackType.success;
Vibration.vibrate(amplitude: 128);
case VibrationType.medium:
feedbackType = FeedbackType.warning;
Vibration.vibrate(duration: 501);
case VibrationType.heavy:
feedbackType = FeedbackType.error;
Vibration.vibrate(duration: 1000);
}

Vibrate.feedback(feedbackType);
}
}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
final TextTheme textTheme = createTextTheme(context, "Arya", "Arya");
final TextTheme textTheme = createTextTheme(context, 'Arya', 'Arya');

final MaterialTheme theme = MaterialTheme(textTheme);
return MaterialApp(
Expand Down
14 changes: 8 additions & 6 deletions lib/presentation/atoms/toggle_switch_atom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,21 @@ class _ToggleSwitchAtomState extends State<ToggleSwitchAtom> {
style: ToggleStyle(
backgroundColor: toggle
? (widget.disable
? colorScheme.onSurface.withOpacity(0.12)
? colorScheme.onSurface.withAlpha((0.12 * 255).toInt())
: colorScheme.primary)
: (widget.disable
? colorScheme.surfaceContainerHighest.withOpacity(0.12)
? colorScheme.surfaceContainerHighest
.withAlpha((0.12 * 255).toInt())
: colorScheme.surfaceContainerHighest),
borderColor: widget.disable
? colorScheme.onSurface
: (toggle ? colorScheme.primary : colorScheme.outline),
indicatorColor: toggle
? (widget.disable
? colorScheme.surface.withOpacity(1)
? colorScheme.surface.withAlpha(1 * 255)
: colorScheme.onPrimary)
: (widget.disable
? colorScheme.onSurface.withOpacity(0.38)
? colorScheme.onSurface.withAlpha((0.38 * 255).toInt())
: colorScheme.outline),
),
current: toggle,
Expand All @@ -73,13 +74,14 @@ class _ToggleSwitchAtomState extends State<ToggleSwitchAtom> {
FaIcon(
widget.offIcon,
color: widget.disable
? colorScheme.surfaceContainerHighest.withOpacity(0.38)
? colorScheme.surfaceContainerHighest
.withAlpha((0.38 * 255).toInt())
: colorScheme.surfaceContainerHighest,
),
FaIcon(
widget.onIcon,
color: widget.disable
? colorScheme.onSurface.withOpacity(0.38)
? colorScheme.onSurface.withAlpha((0.38 * 255).toInt())
: colorScheme.onPrimaryContainer,
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/molecules/pdf_viewer_molecule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _PdfViewerMoleculeState extends State<PdfViewerMolecule>
);
},
errorWidget: (error) => const Center(
child: TextAtom("error_pdf"),
child: TextAtom('error_pdf'),
),
);
}
Expand Down
7 changes: 4 additions & 3 deletions lib/presentation/pages/activity_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ class _ActivityPageState extends State<ActivityPage>
AppLifecycleState currentAppState = AppLifecycleState.resumed;

Future notificationPermissionPopup() async {
final bool notificationPermissionRequested = PreferencesController.instance
.getBool(PreferenceKeys.notificationPermissionRequested) ??
false;
// final bool notificationPermissionRequested =
PreferencesController.instance
.getBool(PreferenceKeys.notificationPermissionRequested);
// ?? false;
final bool notificationGranted =
await NotificationsController.instance.isPermissionGranted();
if (
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/pages/tip_information_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class _TipInformationPageState extends State<TipInformationPage> {
if (link == null) {
SnackBarService().show(
context,
"no_link",
'no_link',
);
return;
}
Expand Down
Loading
Loading