Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/theme_issues_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sardar1208 committed Feb 1, 2024
2 parents 6c672c6 + 53da450 commit 93feb5d
Show file tree
Hide file tree
Showing 74 changed files with 466 additions and 281 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: 'Dependency Review'
uses: actions/dependency-review-action@01bc87099ba56df1e897b6874784491ea6309bc4 # v3.1.4
uses: actions/dependency-review-action@4901385134134e04cec5fbe5ddfe3b2c5bd5d976 # v4.0.0
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: SARIF file
path: results.sarif
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ jobs:
fail-fast: false
matrix:
package:
# at_backupkey_flutter
#- at_chat_flutter
- at_backupkey_flutter
- at_chat_flutter
- at_common_flutter
- at_contacts_flutter
- at_contacts_group_flutter
- at_events_flutter
#- at_follows_flutter
#- at_invitation_flutter
#- at_location_flutter
#- at_login_flutter
- at_follows_flutter
- at_invitation_flutter
- at_location_flutter
- at_login_flutter
- at_notify_flutter
- at_onboarding_flutter
#- at_sync_ui_flutter
- at_sync_ui_flutter
- at_theme_flutter

steps:
Expand Down
4 changes: 4 additions & 0 deletions packages/at_backupkey_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.12:
- **CHORE**: Updated dependencies
- **CHORE**: Lint fixes

## 4.0.11:
- **CHORE**: Bumped all dependency versions
- Major version increase of permission_handler from ^10.4.1 to ^11.0.0
Expand Down
11 changes: 6 additions & 5 deletions packages/at_backupkey_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class _MyAppState extends State<MyApp> {
Future<AtClientPreference> futurePreference = loadAtClientPreference();
AtClientPreference? atClientPreference;


@override
Widget build(BuildContext context) {
return StreamBuilder<ThemeMode>(
Expand All @@ -55,17 +54,17 @@ class _MyAppState extends State<MyApp> {
primaryColor: const Color(0xFFf4533d),
colorScheme: ThemeData.light().colorScheme.copyWith(
primary: const Color(0xFFf4533d),
background: Colors.white,
),
backgroundColor: Colors.white,
scaffoldBackgroundColor: Colors.white,
),
darkTheme: ThemeData().copyWith(
brightness: Brightness.dark,
primaryColor: Colors.blue,
colorScheme: ThemeData.dark().colorScheme.copyWith(
primary: Colors.blue,
background: Colors.grey[850],
),
backgroundColor: Colors.grey[850],
scaffoldBackgroundColor: Colors.grey[850],
),
themeMode: themeMode,
Expand Down Expand Up @@ -188,15 +187,17 @@ class _HomeScreenState extends State<HomeScreen> {
/// Use the AtClientManager instance to get the current atsign
Text(
'Current @sign: ${atClientManager.atClient.getCurrentAtSign()}'),

ElevatedButton.icon(
icon: const Icon(
Icons.file_copy,
color: Colors.white,
),
label: const Text('Backup your key'),
onPressed: () async {
BackupKeyWidget(atsign: atClientManager.atClient.getCurrentAtSign() ?? '')
BackupKeyWidget(
atsign:
atClientManager.atClient.getCurrentAtSign() ?? '')
.showBackupDialog(context);
},
),
Expand Down
6 changes: 4 additions & 2 deletions packages/at_backupkey_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ environment:

dependencies:
at_app_flutter: ^5.2.0
at_backupkey_flutter:
path: ../
at_client_mobile: ^3.2.12
at_onboarding_flutter: ^6.1.3
cupertino_icons: ^1.0.6
Expand All @@ -24,6 +22,10 @@ dependencies:
dev_dependencies:
flutter_lints: ^2.0.3

dependency_overrides:
at_backupkey_flutter:
path: ../

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
Expand Down
2 changes: 1 addition & 1 deletion packages/at_backupkey_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: at_backupkey_flutter
description: A Flutter plugin project for saving the backup key of any atSign that is being onboarded with atPlatform apps. The backup key can be used to authenticate in other atPlatform apps.
version: 4.0.11
version: 4.0.12
homepage: https://docs.atsign.com/
repository: https://github.com/atsign-foundation/at_widgets/tree/trunk/packages/at_backupkey_flutter
issue_tracker: https://github.com/atsign-foundation/at_widgets/issues
Expand Down
16 changes: 12 additions & 4 deletions packages/at_backupkey_flutter/test/at_backupkey_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized();

setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
return '42';
});
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(
channel,
(MethodCall methodCall) async {
return '42';
},
);
});

tearDown(() {
channel.setMockMethodCallHandler(null);
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(
channel,
null,
);
});
}
31 changes: 17 additions & 14 deletions packages/at_backupkey_flutter/test/backupkey_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@ void main() {

group('Fetching AESKey', () {
test('for registered @sign', () async {
MockDataService _mockDataService = MockDataService(atsign);
String aesKey = _mockDataService.getAESKey;
MockDataService mockDataService = MockDataService(atsign);
String aesKey = mockDataService.getAESKey;
expect(aesKey.length == 44, true);
});

test('for unregistered @sign', () async {
MockDataService _mockDataService = MockDataService(atsign + '123');
String? aesKey = _mockDataService.getAESKey;
MockDataService mockDataService = MockDataService('${atsign}123');
String? aesKey = mockDataService.getAESKey;
expect(aesKey, null);
});
});

group('Fetch EncryptedKeys', () {
test('for registerd @sign', () async {
MockDataService _mockDataService = MockDataService(atsign);
var map = _mockDataService.getEncryptedKeys();
MockDataService mockDataService = MockDataService(atsign);
var map = mockDataService.getEncryptedKeys();
expect(map.length, greaterThan(0));
});

test('for unregisterd @sign', () async {
MockDataService _mockDataService = MockDataService(atsign + '123');
var map = _mockDataService.getEncryptedKeys();
MockDataService mockDataService = MockDataService('${atsign}123');
var map = mockDataService.getEncryptedKeys();
expect(map, {});
});
});

group('generate backupkey file', () {
test('for registered @sign', () async {
MockDataService _mockDataService = MockDataService(atsign);
var aesEncryptedKeys = _mockDataService.getEncryptedKeys();
MockDataService mockDataService = MockDataService(atsign);
var aesEncryptedKeys = mockDataService.getEncryptedKeys();
expect(aesEncryptedKeys.isNotEmpty, true);
var result = await _generateFile(atsign, aesEncryptedKeys);
expect(result, true);
expect(await File('test/backup/${atsign}_key.atKeys').exists(), true);
});

test('for unregistered @sign', () async {
String atSign = atsign + '123';
MockDataService _mockDataService = MockDataService(atSign);
var aesEncryptedKeys = _mockDataService.getEncryptedKeys();
String atSign = '${atsign}123';
MockDataService mockDataService = MockDataService(atSign);
var aesEncryptedKeys = mockDataService.getEncryptedKeys();
expect(aesEncryptedKeys.isNotEmpty, false);
var result = await _generateFile(atSign, aesEncryptedKeys);
expect(result, false);
Expand Down Expand Up @@ -82,7 +82,9 @@ Future<void> setUpFunc(String atsign) async {

// To setup encryption keys
await atClient.getLocalSecondary()!.putValue(
AT_ENCRYPTION_PRIVATE_KEY, demo_data.encryptionPrivateKeyMap[atsign]!);
AtConstants.atEncryptionPrivateKey,
demo_data.encryptionPrivateKeyMap[atsign]!,
);
}

AtClientPreference getAtSignPreference(String atsign) {
Expand Down Expand Up @@ -113,6 +115,7 @@ class MockDataService {
late String atsign;

MockDataService(this.atsign);

get getAESKey => demo_data.aesKeyMap[atsign];

Map<String, String> getEncryptedKeys() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
Widget _wrapWidgetWithMaterialApp({required Widget backupKeyWidget}) {
Widget wrapWidgetWithMaterialApp({required Widget backupKeyWidget}) {
return TestMaterialApp(
home: Builder(
builder: (BuildContext context) {
Expand All @@ -28,31 +28,31 @@ void main() {
// Test case to check backupkey widget is displayed
testWidgets('BackupKey widget is used', (WidgetTester tester) async {
await tester.pumpWidget(
_wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
expect(find.byType(BackupKeyWidget), findsOneWidget);
});
// Test case to identify atsign text
testWidgets("Identify atsign text", (WidgetTester tester) async {
await tester.pumpWidget(
_wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
expect(backupKeyWidget.atsign, 'bluebellrelated86');
});
// Test case to identify button text
testWidgets("Identify button text", (WidgetTester tester) async {
await tester.pumpWidget(
_wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
expect(backupKeyWidget.buttonText, 'Click here');
});
// Test case to check icon Color
testWidgets('Test case to check icon color', (WidgetTester tester) async {
await tester.pumpWidget(
_wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
expect(backupKeyWidget.iconColor, Colors.purple);
});
// Test case to check button Color
testWidgets('Test case to check button color', (WidgetTester tester) async {
await tester.pumpWidget(
_wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget));
expect(backupKeyWidget.buttonColor, Colors.white);
});
});
Expand Down
5 changes: 5 additions & 0 deletions packages/at_chat_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.0.11

- **CHORE**: Updated dependencies
- **CHORE**: Lint fixes

## 3.0.10

- **CHORE**: Bumped all dependency versions
Expand Down
Loading

0 comments on commit 93feb5d

Please sign in to comment.