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

Refactor #183

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 21 additions & 3 deletions example/integration_test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gal/gal.dart';

/// Integration_test is required to test native code,
/// but it is not necessary to build the widget.
Future<void> main() async {
for (var i = 0; i < 2; i++) {
final toAlbum = i == 0 ? false : true;
final album = toAlbum ? 'Album' : null;
for (var i = 0; i < TestCase.values.length; i++) {
final testCase = TestCase.values[i];
final toAlbum = testCase.toAlbum;
final album = testCase.album;

await run('hasAccess(toAlbum: $toAlbum)',
() async => Gal.hasAccess(toAlbum: toAlbum));
Expand Down Expand Up @@ -68,3 +71,18 @@ Future<Uint8List> getBytesData(String path) async {
.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes);
return Uint8List.fromList(uint8List);
}

enum TestCase {
saveToAlbum,
notSaveToAlbum;

bool get toAlbum => switch (this) {
saveToAlbum => true,
notSaveToAlbum => false,
};

String? get album => switch (this) {
saveToAlbum => 'toAlbum',
notSaveToAlbum => null,
};
}
3 changes: 2 additions & 1 deletion lib/src/gal_platform_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import 'dart:typed_data';

import 'gal_method_channel.dart';

/// Plugin Platform Interface
/// Plugin Platform Interface to to allow Non-endorsed federated plugin
/// See: [PR](https://github.com/natsuk4ze/gal/pull/180)
base class GalPlatform {
const GalPlatform();
static GalPlatform instance = MethodChannelGal();
Expand Down