Skip to content

Commit

Permalink
🎇 Style: Optimized.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynesshely committed Mar 31, 2024
1 parent e5814b7 commit aa68719
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 79 deletions.
13 changes: 0 additions & 13 deletions kitx_mobile/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:7.3.0'
}
}

allprojects {
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion kitx_mobile/lib/instances.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:kitx_mobile/data/local_device_info.dart';
import 'package:kitx_mobile/data/local_network_info.dart';
import 'package:kitx_mobile/services/devices_discovery_service.dart';
import 'package:kitx_mobile/services/devices_service.dart';
import 'package:kitx_mobile/services/notification.dart';
import 'package:kitx_mobile/services/notification_service.dart';
import 'package:kitx_mobile/utils/config.dart';
import 'package:kitx_mobile/utils/handlers/tasks/delayed_task.dart';
import 'package:kitx_mobile/utils/handlers/url_handler.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import 'dart:io';
import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:kitx_mobile/instances.dart';
import 'package:kitx_mobile/services/public/service_status.dart';
import 'package:kitx_mobile/utils/extensions/service_status_to_string.dart';
import 'package:kitx_mobile/instances.dart';
// import 'package:flutter/material.dart';

/// [NotificationService] class
class NotificationService {
Expand All @@ -18,25 +17,24 @@ class NotificationService {

/// Initialize the notification service
Future<void> initAsync() async {
// TODO: Adapt to iOS
AwesomeNotifications().initialize(
'resource://drawable/app_icon',
[
// KitX status channel
NotificationChannel(
channelKey: statusChannelKey,
channelName: 'KitX Status Notifications',
channelDescription: 'KitX status',
locked: true, // Prevents the user from deleting the channel
playSound: false, // Do NOT play sound when the notification is displayed
enableVibration: false, // Do NOT vibrate when the notification is displayed
onlyAlertOnce: true, // Only alert once
// defaultColor: Color(0xFF9D50DD),
// ledColor: Colors.white,
),
],
);
AwesomeNotifications().setListeners(onActionReceivedMethod: onActionReceivedMethod);
// TODO: adapt to iOS
if (Platform.isAndroid) {
AwesomeNotifications().initialize(
'resource://drawable/app_icon',
[
NotificationChannel(
channelKey: statusChannelKey,
channelName: 'KitX Status Notifications',
channelDescription: 'KitX Mobile Status',
locked: true,
playSound: false,
enableVibration: false,
onlyAlertOnce: true,
),
],
);
AwesomeNotifications().setListeners(onActionReceivedMethod: onActionReceivedMethod);
}
}

/// On action received method
Expand All @@ -45,20 +43,17 @@ class NotificationService {
var key = receivedAction.buttonKeyPressed;
if (key == 'action_view_button') {
if (instances.devicesService.serviceStatus == ServiceStatus.running) {
// Stop service
instances.shutdownDevicesServer();
} else {
// Start service
instances.restartDevicesServer();
}
} else if (key == 'action_view_exit') {
// Exit app
instances.shutdownDevicesServer();

// Delete all notifications
AwesomeNotifications().cancelAll();

await SystemNavigator.pop(); // Probably not working on iOS (by Copilot)
await SystemNavigator.pop();

exit(0);
}
}
Expand Down Expand Up @@ -90,6 +85,7 @@ class NotificationService {
label: 'Public_Quit'.tr,
actionType: ActionType.SilentAction,
autoDismissible: false,
isDangerousOption: true,
),
]);
}
Expand Down
78 changes: 39 additions & 39 deletions kitx_mobile/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,50 @@ publish_to: "none"
version: 24.10.63+564

environment:
sdk: ">=3.3.0 <4.0.0"
sdk: ">=3.3.0 <4.0.0"

dependencies:
awesome_notifications: ^0.7.4+1
badges: ^3.1.2 # 徽章
battery_plus: ^5.0.3 # 电池数据
community_material_icon: ^5.9.55 # Material Design Icons 社区贡献
concentric_transition: ^1.0.3 # 同心过渡动画
connectivity_plus: ^5.0.2
crypto: ^3.0.3
device_info_plus: ^9.1.1
f_logs: ^2.0.1
fl_chart: ^0.67.0
flutter:
sdk: flutter
flutter_blue_plus: ^1.31.15
flutter_chat_ui: ^1.6.12
flutter_sharing_intent: ^1.1.1
get: ^4.6.6
kitx_mobile_internal_plugins:
path: ../kitx_mobile_internal_plugins/
kitx_shared_dart: ^3.24.10+6829-patch-1
network_info_plus: ^4.1.0
package_info_plus: ^5.0.1
permission_handler: ^11.3.0
sensors_plus: ^4.0.2
shared_preferences: ^2.2.2
sliding_up_panel: ^2.0.0+1
sound_mode: ^3.0.0
url_launcher: ^6.2.5
vector_math: ^2.1.4
vibration: ^1.8.4
wakelock_plus: ^1.1.4
awesome_notifications: ^0.7.4+1
badges: ^3.1.2
battery_plus: ^5.0.3
community_material_icon: ^5.9.55
concentric_transition: ^1.0.3
connectivity_plus: ^5.0.2
crypto: ^3.0.3
device_info_plus: ^9.1.1
f_logs: ^2.0.1
fl_chart: ^0.67.0
flutter:
sdk: flutter
flutter_blue_plus: ^1.31.15
flutter_chat_ui: ^1.6.12
flutter_sharing_intent: ^1.1.1
get: ^4.6.6
kitx_mobile_internal_plugins:
path: ../kitx_mobile_internal_plugins/
kitx_shared_dart: ^3.24.10+6829-patch-1
network_info_plus: ^4.1.0
package_info_plus: ^5.0.1
permission_handler: ^11.3.0
sensors_plus: ^4.0.2
shared_preferences: ^2.2.2
sliding_up_panel: ^2.0.0+1
sound_mode: ^3.0.0
url_launcher: ^6.2.5
vector_math: ^2.1.4
vibration: ^1.8.4
wakelock_plus: ^1.1.4

dev_dependencies:
flutter_gen: ^5.4.0
flutter_lints: ^3.0.0
flutter_test:
sdk: flutter
flutter_gen: ^5.4.0
flutter_lints: ^3.0.0
flutter_test:
sdk: flutter

flutter:
uses-material-design: true
uses-material-design: true

assets:
- assets/
assets:
- assets/

generate: true #
generate: true

0 comments on commit aa68719

Please sign in to comment.