Skip to content

Commit

Permalink
fix: fix fvm check (#331)
Browse files Browse the repository at this point in the history
* fix: fix fvm check

* refactor(fvm): delete fvm check code

---------

Co-authored-by: Eduardo M. <contact@eduardom.dev>
  • Loading branch information
charles0122 and aguilaair authored Sep 4, 2024
1 parent d928785 commit f5c0ad7
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 42 deletions.
3 changes: 0 additions & 3 deletions lib/src/modules/compatibility_checks/compat.dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,5 @@ String _genCommand(CompatibilityCheck check) {
if (!check.git) {
command += gitInstallCmd;
}
if (!check.fvm) {
command += fvmInstallCmd;
}
return command;
}
13 changes: 2 additions & 11 deletions lib/src/modules/compatibility_checks/compat.dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ class CompatibilityCheck {
/// Git Install Status
bool git;

/// FVM Install Status
bool fvm;

/// Cohocolately Install Status
bool choco;

Expand All @@ -19,7 +16,6 @@ class CompatibilityCheck {
/// Constructor
CompatibilityCheck({
required this.git,
required this.fvm,
required this.choco,
required this.brew,
this.waiting = false,
Expand All @@ -30,7 +26,6 @@ class CompatibilityCheck {
return CompatibilityCheck(
brew: false,
choco: false,
fvm: false,
git: false,
waiting: true,
);
Expand All @@ -49,7 +44,6 @@ class CompatibilityCheck {
}) {
return CompatibilityCheck(
git: git ?? this.git,
fvm: fvm ?? this.fvm,
choco: choco ?? this.choco,
brew: brew ?? this.brew,
);
Expand All @@ -58,7 +52,6 @@ class CompatibilityCheck {
Map<String, dynamic> toMap() {
return {
'git': git,
'fvm': fvm,
'choco': choco,
'brew': brew,
};
Expand All @@ -67,7 +60,6 @@ class CompatibilityCheck {
factory CompatibilityCheck.fromMap(Map<String, dynamic> map) {
return CompatibilityCheck(
git: map['git'] ?? false,
fvm: map['fvm'] ?? false,
choco: map['choco'] ?? false,
brew: map['brew'] ?? false,
);
Expand All @@ -80,7 +72,7 @@ class CompatibilityCheck {

@override
String toString() {
return 'CompatibilityCheck(git: $git, fvm: $fvm, choco: $choco, brew: $brew)';
return 'CompatibilityCheck(git: $git, choco: $choco, brew: $brew)';
}

@override
Expand All @@ -89,13 +81,12 @@ class CompatibilityCheck {

return other is CompatibilityCheck &&
other.git == git &&
other.fvm == fvm &&
other.choco == choco &&
other.brew == brew;
}

@override
int get hashCode {
return git.hashCode ^ fvm.hashCode ^ choco.hashCode ^ brew.hashCode;
return git.hashCode ^ choco.hashCode ^ brew.hashCode;
}
}
2 changes: 0 additions & 2 deletions lib/src/modules/compatibility_checks/compat.provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ class CompatStateNotifier extends StateNotifier<CompatibilityCheck> {
final chocoState = Platform.isWindows ? await isChocoInstalled() : false;
final brewState =
Platform.isLinux || Platform.isMacOS ? await isBrewInstalled() : false;
final fvmState = await isFvmInstalled();
final gitState = await isGitInstalled();
state = CompatibilityCheck(
git: gitState,
fvm: fvmState,
choco: chocoState,
brew: brewState,
);
Expand Down
10 changes: 0 additions & 10 deletions lib/src/modules/compatibility_checks/compat.screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,6 @@ class CompatCheckScreen extends ConsumerWidget {
const SizedBox(
height: 15,
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Heading("FVM"),
Icon(provider.fvm
? Icons.check_circle_outline_rounded
: Icons.error_outline_rounded)
],
),
const SizedBox(
height: 5,
),
Expand Down
13 changes: 1 addition & 12 deletions lib/src/modules/compatibility_checks/compat.utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ Future<bool> isBrewInstalled() async {
return false;
}

Future<bool> isFvmInstalled() async {
final fvmRes = await which("git");
if (fvmRes != null) {
return true;
}
return false;
}

Future<bool> isGitInstalled() async {
final gitRes = await which("git");
Expand All @@ -51,8 +44,4 @@ const chocoInstallCmd =
'Set-ExecutionPolicy AllSigned\nSet-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(\'https://community.chocolatey.org/install.ps1\'))\n';

final gitInstallCmd =
Platform.isWindows ? "choco install git -yf\n" : "brew install git\n";

final fvmInstallCmd = Platform.isWindows
? "choco install fvm -y\n"
: "brew tap leoafarias/fvm\nbrew install fvm\n";
Platform.isWindows ? "choco install git -yf\n" : "brew install git\n";
3 changes: 0 additions & 3 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <screen_retriever/screen_retriever_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <window_manager/window_manager_plugin.h>
#include <window_size/window_size_plugin.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
BitsdojoWindowPluginRegisterWithRegistrar(
Expand All @@ -27,6 +26,4 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
WindowManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowManagerPlugin"));
WindowSizePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowSizePlugin"));
}
1 change: 0 additions & 1 deletion windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
screen_retriever
url_launcher_windows
window_manager
window_size
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down

0 comments on commit f5c0ad7

Please sign in to comment.