diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a78c7d0..b595079 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -15,7 +15,7 @@ jobs:
- name: Install & set Flutter version
uses: subosito/flutter-action@v2
with:
- flutter-version: '3.10.4'
+ flutter-version: '3.19.6'
channel: 'stable'
- name: Get package
run: flutter pub get
diff --git a/devtools_options.yaml b/devtools_options.yaml
new file mode 100644
index 0000000..7e7e7f6
--- /dev/null
+++ b/devtools_options.yaml
@@ -0,0 +1 @@
+extensions:
diff --git a/dist/appcast.xml b/dist/appcast.xml
index 791fab8..45c3ff4 100644
--- a/dist/appcast.xml
+++ b/dist/appcast.xml
@@ -5,29 +5,28 @@
en
Dipantau
-
- Version 1.5.0
+ Version 1.6.0
Fitur
- - Update form add manual track agar lebih gampang dipakai.
- - Update form add manual track agar wajib mengisi catatan.
+ - Khusus super admin, buatkan fitur untuk melihat original dari screenshot yang diblur.
+ - Buat fitur download screenshot.
Perbaikan
- - Perbaiki reset timer di system tray setelah user logout.
- - Perbaiki agar user tidak bisa logout jika timer-nya dalam keadaan hidup.
+ - Perbaiki nilai task yang tidak tersimpan ke database lokal.
]]>
- 10
- 1.5.0
+ 11
+ 1.6.0
- Mon, 07 Oct 2023 09:00:00 +0700
+ Sun, 26 Nov 2023 22:00:00 +0700
diff --git a/lib/core/network/network_info.dart b/lib/core/network/network_info.dart
index 2223aa1..e004b87 100644
--- a/lib/core/network/network_info.dart
+++ b/lib/core/network/network_info.dart
@@ -12,6 +12,12 @@ class NetworkInfoImpl implements NetworkInfo {
@override
Future get isConnected async {
final connectivityResult = await connectivity.checkConnectivity();
- return connectivityResult != ConnectivityResult.none;
+ if (connectivityResult.contains(ConnectivityResult.none)) {
+ return false;
+ } else if (connectivityResult.isEmpty) {
+ return false;
+ } else {
+ return true;
+ }
}
}
diff --git a/lib/core/util/helper.dart b/lib/core/util/helper.dart
index 78f8d38..a9eab91 100644
--- a/lib/core/util/helper.dart
+++ b/lib/core/util/helper.dart
@@ -101,4 +101,8 @@ class Helper {
return ConstantErrorMessage().failureUnknown;
}
}
+
+ String removeTrailingSlash(String input) {
+ return input.replaceAll(RegExp(r'/+$'), '');
+ }
}
diff --git a/lib/feature/data/datasource/general/general_remote_data_source.dart b/lib/feature/data/datasource/general/general_remote_data_source.dart
new file mode 100644
index 0000000..0a98915
--- /dev/null
+++ b/lib/feature/data/datasource/general/general_remote_data_source.dart
@@ -0,0 +1,36 @@
+import 'package:dio/dio.dart';
+import 'package:dipantau_desktop_client/config/flavor_config.dart';
+import 'package:dipantau_desktop_client/feature/data/model/general/general_response.dart';
+
+abstract class GeneralRemoteDataSource {
+ /// Panggil endpoint [host]/api/ping
+ ///
+ /// Throws [DioException] untuk semua error kode
+ late String pathPing;
+
+ Future ping(String baseUrl);
+}
+
+class GeneralRemoteDataSourceImpl implements GeneralRemoteDataSource {
+ final Dio dio;
+
+ GeneralRemoteDataSourceImpl({
+ required this.dio,
+ });
+
+ final baseUrl = FlavorConfig.instance.values.baseUrl;
+
+ @override
+ String pathPing = '';
+
+ @override
+ Future ping(String baseUrl) async {
+ pathPing = '$baseUrl/api/ping';
+ final response = await dio.get(pathPing);
+ if (response.statusCode.toString().startsWith('2')) {
+ return GeneralResponse.fromJson(response.data);
+ } else {
+ throw DioException(requestOptions: RequestOptions(path: pathPing));
+ }
+ }
+}
diff --git a/lib/feature/data/repository/general/general_repository_impl.dart b/lib/feature/data/repository/general/general_repository_impl.dart
new file mode 100644
index 0000000..be2ad2e
--- /dev/null
+++ b/lib/feature/data/repository/general/general_repository_impl.dart
@@ -0,0 +1,56 @@
+import 'package:dio/dio.dart';
+import 'package:dipantau_desktop_client/core/error/failure.dart';
+import 'package:dipantau_desktop_client/core/network/network_info.dart';
+import 'package:dipantau_desktop_client/feature/data/datasource/general/general_remote_data_source.dart';
+import 'package:dipantau_desktop_client/feature/data/model/general/general_response.dart';
+import 'package:dipantau_desktop_client/feature/domain/repository/general/general_repository.dart';
+
+class GeneralRepositoryImpl implements GeneralRepository {
+ final GeneralRemoteDataSource remoteDataSource;
+ final NetworkInfo networkInfo;
+
+ GeneralRepositoryImpl({
+ required this.remoteDataSource,
+ required this.networkInfo,
+ });
+
+ String getErrorMessageFromEndpoint(dynamic dynamicErrorMessage, String httpErrorMessage, int? statusCode) {
+ if (dynamicErrorMessage is Map && dynamicErrorMessage.containsKey('message')) {
+ return '$statusCode ${dynamicErrorMessage['message']}';
+ } else if (dynamicErrorMessage is String) {
+ return httpErrorMessage;
+ } else {
+ return httpErrorMessage;
+ }
+ }
+
+ @override
+ Future<({Failure? failure, GeneralResponse? response})> ping(String baseUrl) async {
+ Failure? failure;
+ GeneralResponse? response;
+ final isConnected = await networkInfo.isConnected;
+ if (isConnected) {
+ try {
+ response = await remoteDataSource.ping(baseUrl);
+ } on DioException catch (error) {
+ final message = error.message ?? error.toString();
+ if (error.response == null) {
+ failure = ServerFailure(message);
+ } else {
+ final errorMessage = getErrorMessageFromEndpoint(
+ error.response?.data,
+ message,
+ error.response?.statusCode,
+ );
+ failure = ServerFailure(errorMessage);
+ }
+ } on TypeError catch (error) {
+ final errorMessage = error.toString();
+ failure = ParsingFailure(errorMessage);
+ }
+ } else {
+ failure = ConnectionFailure();
+ }
+ return (failure: failure, response: response);
+ }
+}
diff --git a/lib/feature/domain/repository/general/general_repository.dart b/lib/feature/domain/repository/general/general_repository.dart
new file mode 100644
index 0000000..3b26c36
--- /dev/null
+++ b/lib/feature/domain/repository/general/general_repository.dart
@@ -0,0 +1,6 @@
+import 'package:dipantau_desktop_client/core/error/failure.dart';
+import 'package:dipantau_desktop_client/feature/data/model/general/general_response.dart';
+
+abstract class GeneralRepository {
+ Future<({Failure? failure, GeneralResponse? response})> ping(String baseUrl);
+}
\ No newline at end of file
diff --git a/lib/feature/domain/usecase/ping/ping.dart b/lib/feature/domain/usecase/ping/ping.dart
new file mode 100644
index 0000000..3c28a00
--- /dev/null
+++ b/lib/feature/domain/usecase/ping/ping.dart
@@ -0,0 +1,34 @@
+import 'package:dipantau_desktop_client/core/error/failure.dart';
+import 'package:dipantau_desktop_client/core/usecase/usecase.dart';
+import 'package:dipantau_desktop_client/feature/data/model/general/general_response.dart';
+import 'package:dipantau_desktop_client/feature/domain/repository/general/general_repository.dart';
+import 'package:equatable/equatable.dart';
+
+class Ping implements UseCaseRecords {
+ final GeneralRepository repository;
+
+ Ping({required this.repository});
+
+ @override
+ Future<({Failure? failure, GeneralResponse? response})> call(ParamsPing params) {
+ return repository.ping(params.baseUrl);
+ }
+}
+
+class ParamsPing extends Equatable {
+ final String baseUrl;
+
+ ParamsPing({
+ required this.baseUrl,
+ });
+
+ @override
+ List