Skip to content

Commit

Permalink
Merge pull request #200 from osociety/dev
Browse files Browse the repository at this point in the history
Dev -> Main
  • Loading branch information
git-elliot authored Nov 3, 2024
2 parents e4a23c8 + d9aa897 commit 0b16579
Show file tree
Hide file tree
Showing 33 changed files with 1,880 additions and 65 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Vernet - Network Analyzer and Monitoring Tool
[![F-Droid](https://img.shields.io/f-droid/v/org.fsociety.vernet)](https://f-droid.org/packages/org.fsociety.vernet)
[![GitHub release (including pre-releases)](https://img.shields.io/github/v/release/git-elliot/vernet?include_prereleases)](https://github.com/git-elliot/vernet/releases/latest)
![GitHub repo size](https://img.shields.io/github/repo-size/git-elliot/vernet)
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/osociety/vernet/total)
![Liberapay receiving](https://img.shields.io/liberapay/receives/opensociety)

## Features

Expand All @@ -15,9 +17,11 @@ Vernet - Network Analyzer and Monitoring Tool

## Screenshots

|Vernet|Home|Devices|Open Ports|Dark Home|Settings|
|-|-|-|-|-|-|
|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" width = "100">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" width = "100">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" width = "100">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png" width = "100">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/7.png" width = "100">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/8.png" width = "100">|
|Vernet|Home|Devices|Open Ports|
|-|-|-|-|
|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" width = "200">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" width = "200">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" width = "200">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png" width = "200">|
|Ping|DNS|Reverse DNS|Settings|
|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png" width = "200">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/7.png" width = "200">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/8.png" width = "200">|<img src="android/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" width = "200">|

## Download

Expand Down
8 changes: 8 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ android {
targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
Expand Down Expand Up @@ -83,6 +84,7 @@ android {

namespace "org.fsociety.vernet"
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
Expand All @@ -91,6 +93,12 @@ android {
}
}

dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
}

flutter {
source '../..'
}
27 changes: 27 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Gson rules
# 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
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<!-- Add the block below to your manifest file to configure apps with action.VIEW intent filters as visible to your app -->
<queries>
<intent>
Expand Down
Binary file added android/app/src/main/res/drawable/app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions android/app/src/main/res/raw/keep.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/*"/>
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/en-US/changelogs/27.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bug fix for scan for devices not working
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 27 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ PODS:
- Flutter
- flutter_isolate (0.0.1):
- Flutter
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_native_splash (0.0.1):
- Flutter
- flutter_timezone (0.0.1):
- Flutter
- in_app_review (0.2.0):
- Flutter
- isar_flutter_libs (1.0.0):
- Flutter
- network_info_plus (0.0.1):
- Flutter
- nsd_ios (0.0.1):
Expand All @@ -30,7 +38,11 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_icmp_ping (from `.symlinks/plugins/flutter_icmp_ping/ios`)
- flutter_isolate (from `.symlinks/plugins/flutter_isolate/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_timezone (from `.symlinks/plugins/flutter_timezone/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`)
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
- nsd_ios (from `.symlinks/plugins/nsd_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
Expand All @@ -48,8 +60,16 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_icmp_ping/ios"
flutter_isolate:
:path: ".symlinks/plugins/flutter_isolate/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_timezone:
:path: ".symlinks/plugins/flutter_timezone/ios"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
isar_flutter_libs:
:path: ".symlinks/plugins/isar_flutter_libs/ios"
network_info_plus:
:path: ".symlinks/plugins/network_info_plus/ios"
nsd_ios:
Expand All @@ -70,14 +90,18 @@ SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_icmp_ping: 2b159955eee0c487c766ad83fec224ae35e7c935
flutter_isolate: 0edf5081826d071adf21759d1eb10ff5c24503b5
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778
flutter_timezone: ffb07bdad3c6276af8dada0f11978d8a1f8a20bb
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
nsd_ios: 8c37babdc6538e3350dbed3a52674d2edde98173
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

Expand Down
5 changes: 4 additions & 1 deletion ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
Expand Down
52 changes: 33 additions & 19 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:network_info_plus/network_info_plus.dart';
import 'package:network_tools_flutter/network_tools_flutter.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
Expand All @@ -9,10 +8,11 @@ import 'package:vernet/helper/app_settings.dart';
import 'package:vernet/helper/consent_loader.dart';
import 'package:vernet/injection.dart';
import 'package:vernet/pages/home_page.dart';
import 'package:vernet/pages/host_scan_page/host_scan_page.dart';
import 'package:vernet/pages/location_consent_page.dart';
import 'package:vernet/pages/settings_page.dart';
import 'package:vernet/providers/dark_theme_provider.dart';
import 'package:vernet/services/impls/device_scanner_service.dart';
import 'package:vernet/repository/notification_service.dart';

AppSettings appSettings = AppSettings.instance;
Future<void> main() async {
Expand All @@ -27,12 +27,17 @@ Future<void> main() async {
final bool allowed = await ConsentLoader.isConsentPageShown();
await appSettings.load();

await NotificationService.initNotification();

runApp(MyApp(allowed));
FlutterNativeSplash.remove();
}

class MyApp extends StatefulWidget {
const MyApp(this.allowed, {super.key});
static final GlobalKey<NavigatorState> navigatorKey =
GlobalKey<NavigatorState>();
// static const Color mainColor = Colors.deepPurple;

final bool allowed;

Expand All @@ -46,21 +51,8 @@ class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
NotificationService.grantPermissions();
getCurrentAppTheme();
startScanOnStartup();
}

Future<void> startScanOnStartup() async {
if (appSettings.runScanOnStartup) {
final ip = await NetworkInfo().getWifiIP();
final gatewayIp = appSettings.customSubnet.isNotEmpty
? appSettings.customSubnet
: await NetworkInfo().getWifiGatewayIP();
final subnet = gatewayIp!.substring(0, gatewayIp.lastIndexOf('.'));
getIt<DeviceScannerService>()
.startNewScan(subnet, ip!, gatewayIp)
.listen((device) {});
}
}

Future<void> getCurrentAppTheme() async {
Expand All @@ -77,18 +69,40 @@ class _MyAppState extends State<MyApp> {
child: Consumer<DarkThemeProvider>(
builder: (BuildContext context, value, Widget? child) {
return MaterialApp(
navigatorKey: MyApp.navigatorKey,
initialRoute: '/',
onGenerateRoute: (settings) {
switch (settings.name) {
case '/':
return MaterialPageRoute(
builder: (context) => homePage,
);

case '/hostscan':
return MaterialPageRoute(
builder: (context) {
return HostScanPage();
},
);

default:
assert(false, 'Page ${settings.name} not found');
return null;
}
},
title: 'Vernet',
theme: themeChangeProvider.darkTheme
? ThemeData.dark()
: ThemeData.light(),
home: widget.allowed
? const TabBarPage()
: const LocationConsentPage(),
home: homePage,
);
},
),
);
}

Widget get homePage =>
widget.allowed ? const TabBarPage() : const LocationConsentPage();
}

class TabBarPage extends StatefulWidget {
Expand Down
13 changes: 12 additions & 1 deletion lib/models/wifi_info.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
class WifiInfo {
WifiInfo(this._ip, this._bssid, this._name, this.unknown);
WifiInfo(
this._ip,
this._bssid,
this._name,
this.unknown,
this.gatewayIp,
this.isLocationOn,
);

static Set<String> defaultBSSID = {'00:00:00:00:00:00'};
final String? _bssid;
final String? _ip;
final String? _name;
bool unknown;
String get ip => _ip ?? 'x.x.x.x';
int totalDevices = 0;
final String gatewayIp;
final bool isLocationOn;
String get subnet => gatewayIp.substring(0, gatewayIp.lastIndexOf('.'));

static const String noWifiName = 'Wi-Fi';

Expand Down
Loading

0 comments on commit 0b16579

Please sign in to comment.