Skip to content

Commit

Permalink
chore(deps): meet patcher breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ushie committed Mar 3, 2023
1 parent a635e5b commit 6d60541
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 41 deletions.
Expand Up @@ -43,7 +43,6 @@ class MainActivity : FlutterActivity() {
val integrationsPath = call.argument<String>("integrationsPath")
val selectedPatches = call.argument<List<String>>("selectedPatches")
val cacheDirPath = call.argument<String>("cacheDirPath")
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
if (patchBundleFilePath != null &&
originalFilePath != null &&
Expand All @@ -53,7 +52,6 @@ class MainActivity : FlutterActivity() {
integrationsPath != null &&
selectedPatches != null &&
cacheDirPath != null &&
mergeIntegrations != null &&
keyStoreFilePath != null
) {
runPatcher(
Expand All @@ -66,7 +64,6 @@ class MainActivity : FlutterActivity() {
integrationsPath,
selectedPatches,
cacheDirPath,
mergeIntegrations,
keyStoreFilePath
)
} else {
Expand All @@ -88,7 +85,6 @@ class MainActivity : FlutterActivity() {
integrationsPath: String,
selectedPatches: List<String>,
cacheDirPath: String,
mergeIntegrations: Boolean,
keyStoreFilePath: String
) {
val originalFile = File(originalFilePath)
Expand Down Expand Up @@ -139,19 +135,17 @@ class MainActivity : FlutterActivity() {
mapOf("progress" to 0.3, "header" to "", "log" to "")
)
}
if (mergeIntegrations) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.4,
"header" to "Merging integrations...",
"log" to "Merging integrations"
)
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.4,
"header" to "Merging integrations...",
"log" to "Merging integrations"
)
}
patcher.addIntegrations(listOf(integrations)) {}
)
}
patcher.addIntegrations(listOf(integrations)) {}

handler.post {
installerChannel.invokeMethod(
Expand Down
28 changes: 2 additions & 26 deletions lib/services/patcher_api.dart
Expand Up @@ -122,25 +122,6 @@ class PatcherAPI {
.toList();
}

bool dependencyNeedsIntegrations(String name) {
return name.contains('integrations') ||
_patches.any(
(patch) =>
patch.name == name &&
(patch.dependencies.any(
(dep) => dependencyNeedsIntegrations(dep),
)),
);
}

Future<bool> needsIntegrations(List<Patch> selectedPatches) async {
return selectedPatches.any(
(patch) => patch.dependencies.any(
(dep) => dependencyNeedsIntegrations(dep),
),
);
}

Future<bool> needsResourcePatching(List<Patch> selectedPatches) async {
return selectedPatches.any(
(patch) => patch.dependencies.any(
Expand Down Expand Up @@ -181,7 +162,6 @@ class PatcherAPI {
String originalFilePath,
List<Patch> selectedPatches,
) async {
final bool mergeIntegrations = await needsIntegrations(selectedPatches);
final bool includeSettings = await needsSettingsPatch(selectedPatches);
if (includeSettings) {
try {
Expand All @@ -199,10 +179,7 @@ class PatcherAPI {
}
}
final File? patchBundleFile = await _managerAPI.downloadPatches();
File? integrationsFile;
if (mergeIntegrations) {
integrationsFile = await _managerAPI.downloadIntegrations();
}
final File? integrationsFile = await _managerAPI.downloadIntegrations();
if (patchBundleFile != null) {
_dataDir.createSync();
_tmpDir.createSync();
Expand All @@ -224,10 +201,9 @@ class PatcherAPI {
'inputFilePath': inputFile.path,
'patchedFilePath': patchedFile.path,
'outFilePath': _outFile!.path,
'integrationsPath': mergeIntegrations ? integrationsFile!.path : '',
'integrationsPath': integrationsFile!.path,
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
'cacheDirPath': cacheDir.path,
'mergeIntegrations': mergeIntegrations,
'keyStoreFilePath': _keyStoreFile.path,
},
);
Expand Down

0 comments on commit 6d60541

Please sign in to comment.