This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,016 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
-keep class androidx.lifecycle.DefaultLifecycleObserver | ||
-keep class androidx.lifecycle.DefaultLifecycleObserver | ||
|
||
## flutter_local_notification | ||
# Gson uses generic type information stored in a class file when working with fields. Proguard | ||
# removes such information by default, so configure it to keep all of it. | ||
-keepattributes Signature | ||
|
||
# For using GSON @Expose annotation | ||
-keepattributes *Annotation* | ||
|
||
# Gson specific classes | ||
-dontwarn sun.misc.** | ||
#-keep class com.google.gson.stream.** { *; } | ||
|
||
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, | ||
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) | ||
-keep class * extends com.google.gson.TypeAdapter | ||
-keep class * implements com.google.gson.TypeAdapterFactory | ||
-keep class * implements com.google.gson.JsonSerializer | ||
-keep class * implements com.google.gson.JsonDeserializer | ||
|
||
# Prevent R8 from leaving Data object members always null | ||
-keepclassmembers,allowobfuscation class * { | ||
@com.google.gson.annotations.SerializedName <fields>; | ||
} | ||
|
||
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher. | ||
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken | ||
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import 'dart:io'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:path/path.dart' as path; | ||
import 'package:file_picker/file_picker.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
import 'package:path_provider/path_provider.dart'; | ||
import 'package:weepy/classes/discover.dart'; | ||
import 'package:weepy/classes/workers/worker_interface.dart'; | ||
import 'package:weepy/models.dart'; | ||
|
||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
var sendingFiles = <File>[]; | ||
var platformFiles = <PlatformFile>[]; | ||
var downloadedFiles = <DbFile>[]; | ||
IsolatedReceiver? receiver; | ||
late Directory subdir; | ||
setUpAll(() async { | ||
final tempDir = await getTemporaryDirectory(); | ||
subdir = tempDir.createTempSync("sending"); | ||
final testImageData = await rootBundle.load("assets/test_image.png"); | ||
final testImageFile = File(path.join(subdir.path, "test_image.png")); | ||
testImageFile.writeAsBytesSync(testImageData.buffer.asInt8List(), | ||
mode: FileMode.writeOnly); | ||
sendingFiles = [ | ||
File(path.join(subdir.path, "deneme 1.txt")), | ||
File(path.join(subdir.path, "deneme 2.txt")), | ||
testImageFile | ||
]; | ||
for (var gidenDosya in sendingFiles) { | ||
if (path.extension(gidenDosya.path) == ".txt") { | ||
gidenDosya.writeAsStringSync("deneme gövdesi", | ||
mode: FileMode.writeOnly); | ||
} | ||
} | ||
platformFiles = List.generate( | ||
sendingFiles.length, | ||
(index) => PlatformFile( | ||
//readStream: sendingFiles[index].openRead(), | ||
size: sendingFiles[index].lengthSync(), | ||
name: path.basename(sendingFiles[index].path), | ||
path: sendingFiles[index].path)); | ||
}); | ||
|
||
final dbStatusVariant = ValueVariant({true, false}); | ||
|
||
testWidgets("Test IsolatedReceiver & IsolatedSender", (_) async { | ||
receiver = IsolatedReceiver( | ||
saveToTemp: true, | ||
useDb: dbStatusVariant.currentValue!, | ||
onAllFilesDownloaded: (files) => downloadedFiles = files, | ||
onDownloadError: (error) => throw error, | ||
progressNotification: true); | ||
final code = await receiver!.listen(); | ||
var allDevices = <Device>[]; | ||
while (allDevices.isEmpty) { | ||
allDevices = await Discover.discover(); | ||
} | ||
final devices = allDevices.where((device) => device.code == code); | ||
expect(devices, isNotEmpty, reason: "Expected to discover itself"); | ||
await IsolatedSender(progressNotification: false).send( | ||
devices.first, platformFiles, | ||
useDb: dbStatusVariant.currentValue!); | ||
for (var i = 0; i < sendingFiles.length; i++) { | ||
final gidenDosya = sendingFiles[i]; | ||
final gelenDosya = File(downloadedFiles[i].path); | ||
expect(gidenDosya.readAsBytesSync(), equals(gelenDosya.readAsBytesSync()), | ||
reason: "All sent files expected to has same content as originals"); | ||
} | ||
}, variant: dbStatusVariant); | ||
tearDown(() { | ||
for (var file in downloadedFiles) { | ||
File(file.path).deleteSync(); | ||
} | ||
downloadedFiles = []; | ||
}); | ||
tearDownAll(() async { | ||
await receiver?.stopListening(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.