Skip to content

Commit

Permalink
Cleaned up dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmer committed Oct 25, 2024
1 parent bcd999d commit 71fd9b0
Show file tree
Hide file tree
Showing 87 changed files with 327 additions and 557 deletions.
10 changes: 5 additions & 5 deletions lib/api/privacy_idea_container_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:cryptography/cryptography.dart';
import 'package:http/http.dart';
import 'package:privacyidea_authenticator/l10n/app_localizations_en.dart';
import 'package:privacyidea_authenticator/model/extensions/token_folder_extension.dart';
import 'package:privacyidea_authenticator/processors/scheme_processors/token_import_scheme_processors/otp_auth_processor.dart';
import 'package:privacyidea_authenticator/utils/ecc_utils.dart';
import 'package:privacyidea_authenticator/utils/privacyidea_io_client.dart';

import '../../../../../../../l10n/app_localizations_en.dart';
import '../../../../../../../model/extensions/token_folder_extension.dart';
import '../../../../../../../processors/scheme_processors/token_import_scheme_processors/otp_auth_processor.dart';
import '../../../../../../../utils/ecc_utils.dart';
import '../../../../../../../utils/privacyidea_io_client.dart';
import '../model/api_results/pi_server_results/pi_server_result_value.dart';
import '../model/exception_errors/localized_exception.dart';
import '../model/exception_errors/response_error.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/interfaces/repo/token_folder_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'package:privacyidea_authenticator/model/riverpod_states/token_folder_state.dart';
import '../../../../../../../model/riverpod_states/token_folder_state.dart';

abstract class TokenFolderRepository {
/// Overwrite the current state with the new folders
Expand Down
2 changes: 1 addition & 1 deletion lib/mains/main_customizer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import 'package:easy_dynamic_theme/easy_dynamic_theme.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:privacyidea_authenticator/utils/customization/application_customization.dart';

import '../../../../../../../utils/customization/application_customization.dart';
import '../l10n/app_localizations.dart';
import '../model/enums/app_feature.dart';
import '../model/riverpod_states/settings_state.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/mains/main_netknights.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import 'package:easy_dynamic_theme/easy_dynamic_theme.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:privacyidea_authenticator/model/riverpod_states/settings_state.dart';

import '../../../../../../../model/riverpod_states/settings_state.dart';
import '../firebase_options/default_firebase_options.dart';
import '../l10n/app_localizations.dart';
import '../model/enums/app_feature.dart';
Expand Down
5 changes: 2 additions & 3 deletions lib/model/extensions/enums/rollout_state_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
* limitations under the License.
*/

import 'package:privacyidea_authenticator/l10n/app_localizations.dart';
import 'package:privacyidea_authenticator/l10n/app_localizations_en.dart';

import '../../../../../../../l10n/app_localizations.dart';
import '../../../../../../../l10n/app_localizations_en.dart';
import '../../enums/rollout_state.dart';

extension RolloutStateX on RolloutState {
Expand Down
3 changes: 1 addition & 2 deletions lib/model/extensions/enums/sync_state_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* limitations under the License.
*/

import 'package:privacyidea_authenticator/l10n/app_localizations.dart';

import '../../../../../../../l10n/app_localizations.dart';
import '../../enums/sync_state.dart';

extension SyncStateX on SyncState {
Expand Down
2 changes: 1 addition & 1 deletion lib/model/processor_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension ListProcessorResult<T> on List<ProcessorResult<T>> {
List<T> getData() {
final results = toList();
if (results.isEmpty) {
showMessage(message: 'No data found in QR code.', duration: const Duration(seconds: 3));
showStatusMessage(message: 'No data found in QR code.');
Logger.warning('No data found in QR code.');
return [];
}
Expand Down
2 changes: 1 addition & 1 deletion lib/model/riverpod_states/token_container_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import 'dart:convert';

import 'package:collection/collection.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:privacyidea_authenticator/model/tokens/token.dart';

import '../../../../../../../model/tokens/token.dart';
import '../enums/sync_state.dart';
import '../token_container.dart';

Expand Down
5 changes: 2 additions & 3 deletions lib/model/riverpod_states/token_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'package:privacyidea_authenticator/model/mixins/sortable_mixin.dart';
import 'package:privacyidea_authenticator/model/token_folder.dart';

import '../../../../../../../model/mixins/sortable_mixin.dart';
import '../../../../../../../model/token_folder.dart';
import '../tokens/push_token.dart';
import '../tokens/token.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/model/riverpod_states/token_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:privacyidea_authenticator/model/extensions/token_folder_extension.dart';

import '../../../../../../../model/extensions/token_folder_extension.dart';
import '../../utils/logger.dart';
import '../enums/push_token_rollout_state.dart';
import '../token_folder.dart';
Expand Down
8 changes: 4 additions & 4 deletions lib/model/token_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

import 'package:basic_utils/basic_utils.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:privacyidea_authenticator/model/enums/algorithms.dart';
import 'package:privacyidea_authenticator/model/extensions/enums/ec_key_algorithm_extension.dart';
import 'package:privacyidea_authenticator/model/tokens/token.dart';
import 'package:privacyidea_authenticator/utils/identifiers.dart';

import '../../../../../../../model/enums/algorithms.dart';
import '../../../../../../../model/extensions/enums/ec_key_algorithm_extension.dart';
import '../../../../../../../model/tokens/token.dart';
import '../../../../../../../utils/identifiers.dart';
import '../utils/ecc_utils.dart';
import '../utils/logger.dart';
import '../utils/object_validator.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/model/token_import/token_origin_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
* limitations under the License.
*/
import 'package:json_annotation/json_annotation.dart';
import 'package:privacyidea_authenticator/model/token_container.dart';

import '../../../../../../../model/token_container.dart';
import '../enums/token_origin_source_type.dart';
import '../version.dart';

Expand Down
8 changes: 4 additions & 4 deletions lib/model/token_template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:privacyidea_authenticator/model/enums/token_origin_source_type.dart';
import 'package:privacyidea_authenticator/model/token_container.dart';
import 'package:privacyidea_authenticator/model/tokens/otp_token.dart';
import 'package:privacyidea_authenticator/utils/identifiers.dart';

import '../../../../../../../model/enums/token_origin_source_type.dart';
import '../../../../../../../model/token_container.dart';
import '../../../../../../../model/tokens/otp_token.dart';
import '../../../../../../../utils/identifiers.dart';
import '../utils/object_validator.dart';
import 'token_import/token_origin_data.dart';
import 'tokens/token.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/model/tokens/push_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
*/
import 'package:json_annotation/json_annotation.dart';
import 'package:pointycastle/asymmetric/api.dart';
import 'package:privacyidea_authenticator/model/token_template.dart';
import 'package:uuid/uuid.dart';

import '../../../../../../../model/token_template.dart';
import '../../utils/custom_int_buffer.dart';
import '../../utils/identifiers.dart';
import '../../utils/object_validator.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/model/tokens/steam_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import 'package:base32/base32.dart';
import 'package:crypto/crypto.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:privacyidea_authenticator/model/token_template.dart';
import 'package:uuid/uuid.dart';

import '../../../../../../../model/token_template.dart';
import '../../utils/identifiers.dart';
import '../../utils/object_validator.dart';
import '../enums/algorithms.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/model/tokens/token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* limitations under the License.
*/
import 'package:flutter/material.dart';
import 'package:privacyidea_authenticator/model/token_container.dart';

import '../../../../../../../model/token_container.dart';
import '../../utils/identifiers.dart';
import '../../utils/object_validator.dart';
import '../enums/token_types.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/model/widget_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:privacyidea_authenticator/model/extensions/enums/image_file_type_extension.dart';

import '../../../../../../../model/extensions/enums/image_file_type_extension.dart';
import '../utils/logger.dart';
import 'enums/image_file_type.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'package:privacyidea_authenticator/model/processor_result.dart';

import '../../../../../../../model/processor_result.dart';
import '../../utils/logger.dart';
import 'home_widget_processor.dart';
import 'navigation_scheme_processors/navigation_scheme_processor_interface.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'package:privacyidea_authenticator/l10n/app_localizations.dart';
import 'package:privacyidea_authenticator/model/exception_errors/localized_argument_error.dart';
import 'package:privacyidea_authenticator/utils/globals.dart';

import '../../../../../../../l10n/app_localizations.dart';
import '../../../../../../../model/exception_errors/localized_argument_error.dart';
import '../../../../../../../utils/globals.dart';
import '../../model/processor_result.dart';
import '../../model/token_container.dart';
import '../../utils/logger.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import 'package:pointycastle/export.dart';
import '../../l10n/app_localizations.dart';
import '../../model/enums/encodings.dart';
import '../../model/enums/token_origin_source_type.dart';
import '../../model/exception_errors/localized_argument_error.dart';
import '../../model/exception_errors/localized_exception.dart';
import '../../model/extensions/enums/encodings_extension.dart';
import '../../model/extensions/enums/token_origin_source_type.dart';
import '../../model/processor_result.dart';
import '../../model/tokens/token.dart';
import '../../model/exception_errors/localized_argument_error.dart';
import '../../utils/globals.dart';
import '../../utils/identifiers.dart';
import '../../utils/logger.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import 'dart:convert';
import 'dart:typed_data';

import 'package:file_selector/file_selector.dart';
import 'package:privacyidea_authenticator/model/enums/encodings.dart';
import 'package:privacyidea_authenticator/model/extensions/enums/encodings_extension.dart';

import '../../../../../../../model/enums/encodings.dart';
import '../../../../../../../model/extensions/enums/encodings_extension.dart';
import '../../l10n/app_localizations.dart';
import '../../model/enums/token_origin_source_type.dart';
import '../../model/exception_errors/localized_exception.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/customization/theme_customization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:privacyidea_authenticator/model/extensions/color_extension.dart';

import '../../../../../../../model/extensions/color_extension.dart';
import 'theme_extentions/action_theme.dart';
import 'theme_extentions/elevated_delete_button_theme.dart';
import 'theme_extentions/extended_text_theme.dart';
Expand Down
5 changes: 3 additions & 2 deletions lib/utils/ecc_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import 'dart:typed_data';

import 'package:basic_utils/basic_utils.dart';
import 'package:privacyidea_authenticator/model/enums/ec_key_algorithm.dart';
import 'package:privacyidea_authenticator/model/extensions/enums/ec_key_algorithm_extension.dart';

import '../../../../../../../model/enums/ec_key_algorithm.dart';
import '../../../../../../../model/extensions/enums/ec_key_algorithm_extension.dart';

class EccUtils {
const EccUtils();
Expand Down
98 changes: 38 additions & 60 deletions lib/utils/firebase_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import 'dart:io';

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:mutex/mutex.dart';

import 'globals.dart';
import '../../../../../../../utils/view_utils.dart';
import 'identifiers.dart';
import 'logger.dart';

Expand All @@ -54,24 +53,24 @@ class FirebaseUtils {
_initialized = true;
Logger.info('Initializing Firebase');

try {
// await FirebaseMessaging.instance.requestPermission();
} on FirebaseException catch (e, s) {
Logger.warning(
'e.code: ${e.code}, '
'e.message: ${e.message}, '
'e.plugin: ${e.plugin},',
error: e,
stackTrace: s,
);
String errorMessage = e.message ?? 'no error message';
final SnackBar snackBar = SnackBar(
behavior: SnackBarBehavior.floating,
content: Text(
"Firebase notification permission error! ($errorMessage: ${e.code}",
));
globalSnackbarKey.currentState?.showSnackBar(snackBar);
}
// try {
// // await FirebaseMessaging.instance.requestPermission();
// } on FirebaseException catch (e, s) {
// Logger.warning(
// 'e.code: ${e.code}, '
// 'e.message: ${e.message}, '
// 'e.plugin: ${e.plugin},',
// error: e,
// stackTrace: s,
// );
// String errorMessage = e.message ?? 'no error message';
// final SnackBar snackBar = SnackBar(
// behavior: SnackBarBehavior.floating,
// content: Text(
// "Firebase notification permission error! ($errorMessage: ${e.code}",
// ));
// globalSnackbarKey.currentState?.showSnackBar(snackBar);
// }

FirebaseMessaging.onMessage.listen(foregroundHandler);
FirebaseMessaging.onBackgroundMessage(backgroundHandler);
Expand All @@ -82,38 +81,24 @@ class FirebaseUtils {
if (firebaseToken != await getCurrentFirebaseToken() && firebaseToken != null) {
updateFirebaseToken(firebaseToken);
}
} on PlatformException catch (error) {
if (error.code == FIREBASE_TOKEN_ERROR_CODE) {
// ignore
} else {
String errorMessage = error.message ?? 'no error message';
final SnackBar snackBar = SnackBar(
behavior: SnackBarBehavior.floating,
content: Text(
'Push cant be initialized, restart the app and try again. ${error.code}: $errorMessage',
overflow: TextOverflow.fade,
softWrap: false,
));
globalSnackbarKey.currentState?.showSnackBar(snackBar);
} catch (error, stackTrace) {
String? errorMessage;
String? subMessage;
if (error is PlatformException) {
if (error.code == FIREBASE_TOKEN_ERROR_CODE) return; // ignore
errorMessage = 'Push cant be initialized, restart the app and try again.';
subMessage = '${error.code}: ${error.message ?? 'no error message'}';
}
if (error is FirebaseException) {
if (error.code == FIREBASE_TOKEN_ERROR_CODE) return; // ignore
errorMessage = 'Push cant be initialized, restart the app and try again.';
subMessage = '${error.code}: ${error.message ?? 'no error message'}';
}
if (errorMessage != null) {
showStatusMessage(message: errorMessage, subMessage: subMessage);
return;
}
} on FirebaseException catch (error) {
final SnackBar snackBar = SnackBar(
behavior: SnackBarBehavior.floating,
content: Text(
"Push cant be initialized, restart the app and try again$error",
overflow: TextOverflow.fade,
softWrap: false,
));
globalSnackbarKey.currentState?.showSnackBar(snackBar);
} catch (error) {
final SnackBar snackBar = SnackBar(
behavior: SnackBarBehavior.floating,
content: Text(
"Unknown error: $error",
overflow: TextOverflow.fade,
softWrap: false,
));
globalSnackbarKey.currentState?.showSnackBar(snackBar);
Logger.error('Unknown Firebase error', error: error, stackTrace: stackTrace);
}

FirebaseMessaging.instance.onTokenRefresh.listen((String newToken) async {
Expand All @@ -122,15 +107,8 @@ class FirebaseUtils {
// TODO what if this fails, when should a retry be attempted?
try {
updateFirebaseToken(newToken);
} catch (error) {
final SnackBar snackBar = SnackBar(
behavior: SnackBarBehavior.floating,
content: Text(
"Unknown error: $error",
overflow: TextOverflow.fade,
softWrap: false,
));
globalSnackbarKey.currentState?.showSnackBar(snackBar);
} catch (error, stackTrace) {
Logger.error('Error updating firebase token', error: error, stackTrace: stackTrace);
}
}
});
Expand Down
Loading

0 comments on commit 71fd9b0

Please sign in to comment.