Skip to content

Commit

Permalink
fix: rename adb to adbEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
yardexx committed Nov 20, 2024
1 parent 6d54a0a commit 42db642
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion example/lib/threat_notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ThreatNotifier extends AutoDisposeNotifier<ThreatState> {
_updateThreat(Threat.secureHardwareNotAvailable),
onSystemVPN: () => _updateThreat(Threat.systemVPN),
onDevMode: () => _updateThreat(Threat.devMode),
onADB: () => _updateThreat(Threat.adb),
onADBEnabled: () => _updateThreat(Threat.adbEnabled),
);

Talsec.instance.attachListener(threatCallback);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/enums/threat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ enum Threat {
/// (Android Debug Bridge).
///
/// Android only
adb,
adbEnabled,
}

/// An extension on the [Threat] enum to provide additional functionality.
Expand Down Expand Up @@ -120,7 +120,7 @@ extension ThreatX on Threat {
case 45291047:
return Threat.devMode;
case 379769839:
return Threat.adb;
return Threat.adbEnabled;
default:
// Unknown data came from native code. This shouldn't normally happen.
exit(127);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/talsec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ class Talsec {
callback.onSystemVPN?.call();
case Threat.devMode:
callback.onDevMode?.call();
case Threat.adb:
callback.onADB?.call();
case Threat.adbEnabled:
callback.onADBEnabled?.call();
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/threat_callback.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ThreatCallback extends TalsecPigeonApi {
this.onSecureHardwareNotAvailable,
this.onSystemVPN,
this.onDevMode,
this.onADB,
this.onADBEnabled,
this.onMalware,
});

Expand Down Expand Up @@ -85,7 +85,7 @@ class ThreatCallback extends TalsecPigeonApi {
final VoidCallback? onDevMode;

/// This method is called when the device has active ADB (Android Debug)
final VoidCallback? onADB;
final VoidCallback? onADBEnabled;

@override
void onMalwareDetected(List<SuspiciousAppInfo> packageInfo) {
Expand Down
4 changes: 2 additions & 2 deletions test/src/enums/threat_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void main() {
expect(threatValues[10], Threat.secureHardwareNotAvailable);
expect(threatValues[11], Threat.systemVPN);
expect(threatValues[12], Threat.devMode);
expect(threatValues[13], Threat.adb);
expect(threatValues[13], Threat.adbEnabled);
});

test(
Expand All @@ -44,7 +44,7 @@ void main() {
expect(ThreatX.fromInt(1564314755), Threat.secureHardwareNotAvailable);
expect(ThreatX.fromInt(659382561), Threat.systemVPN);
expect(ThreatX.fromInt(45291047), Threat.devMode);
expect(ThreatX.fromInt(379769839), Threat.adb);
expect(ThreatX.fromInt(379769839), Threat.adbEnabled);
},
);
}
4 changes: 2 additions & 2 deletions test/test_utils/spy_threat_callback.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class SpyThreatListener {
callback.onSystemVPN?.call();
case Threat.devMode:
callback.onDevMode?.call();
case Threat.adb:
callback.onADB?.call();
case Threat.adbEnabled:
callback.onADBEnabled?.call();
}
}
}

0 comments on commit 42db642

Please sign in to comment.