# Project export: Save The Slugs

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: CruzHacks 2024
- Tagline: Save The Slugs: Your SOS app for instant police contact, messages, and discreet audio-visual recording. 24/7 access, one-click help. Navigate safety effortlessly.
- Devpost: https://devpost.com/software/save-the-slugs-ibm05o
- GitHub: https://github.com/Mando8119/SaveOurSlugs
- Team: 2 GitHub contributor(s) — Mando (34 commits), dvdthr5 (1 commits)

## Devpost submission (written by the team)

### Inspiration

Our inspiration pulled from the blue light system located on UC campuses. Students feeling unsafe should have access to emergency from a click of a button without having to located a blue light to be saved.

### What it does

Save Our Slugs (SOS) provides instant access to police contact and messaging, along with discreet audio-visual recording for emergencies.

### How we built it

n Being our first hackathon, we decided to challenge ourselves by learning a new programming language called DART. Utilizing flutter we learned how to create a whole app that utilized permissions and APIs that use SMS data.

### Challenges we ran into

We ran into multiple challenges, we struggled with implementing the SMS system, file management, even setting up Flutter. We continuously had to relearn topics and pull and push thousands of iterations of code. Calling, texting all caused problems that at some point broke all of our code.

### Accomplishments we're proud of

We feel accomplished in learning a new language that can be used on via Android and IOS. We are also proud that the app can access permissions on a device that register data to communicate with the authorities, and/or emergency contact.

### What we learned

We learned that flutter and DART are used to create a multi access OS system that translates DART into Swift and C++. We also learned how to access multiple data files and terminal passage keys to collaborate on a Github repo.

### What's next

for Save Our Slugs As a team, we want to go on forward to create a college event app that allows students to post events and locations to the campus.

## README (from the GitHub repository)

# SaveOurSlugs

This is the emergency SOS app, Save Our Slugs! This was a hackthon project created by 4 UCSC students for the purpose of making our peers feel safer on campus.
With a single button the app will notify emergency services and emergency contacts that you are in danger.
At the same time it will record your location and phone camera in order to gain any meaningful information in the event of a catastrophe. 
Every action completed on this app will also send an incident report email to the phone of the person using the app.



## Detected evidence (automated analysis)

Indexed codebase: 38 recognized source files, 62 KB.
- C (language) — detected in the code
- C++ (language) — detected in the code
- Dart (language) — detected in the code
- HTML (language) — detected in the code
- Kotlin (language) — detected in the code
- Swift (language) — detected in the code

## Codebase structure (from repository index)

### Files (100 of 100)

```
ElevatedButton.1
README.md
sos_app/.gitignore
sos_app/.metadata
sos_app/.vscode/launch.json
sos_app/analysis_options.yaml
sos_app/android/.gitignore
sos_app/android/app/build.gradle
sos_app/android/app/src/debug/AndroidManifest.xml
sos_app/android/app/src/google-services.json
sos_app/android/app/src/main/AndroidManifest.xml
sos_app/android/app/src/main/kotlin/com/example/sos_app/MainActivity.kt
sos_app/android/app/src/main/res/drawable-v21/launch_background.xml
sos_app/android/app/src/main/res/drawable/launch_background.xml
sos_app/android/app/src/main/res/values-night/styles.xml
sos_app/android/app/src/main/res/values/styles.xml
sos_app/android/app/src/profile/AndroidManifest.xml
sos_app/android/build.gradle
sos_app/android/gradle.properties
sos_app/android/gradle/wrapper/gradle-wrapper.properties
sos_app/android/settings.gradle
sos_app/ios/.gitignore
sos_app/ios/Flutter/AppFrameworkInfo.plist
sos_app/ios/Flutter/Debug.xcconfig
sos_app/ios/Flutter/Release.xcconfig
sos_app/ios/Podfile
sos_app/ios/Podfile.lock
sos_app/ios/Runner.xcodeproj/project.pbxproj
sos_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
sos_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
sos_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
sos_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
sos_app/ios/Runner.xcworkspace/contents.xcworkspacedata
sos_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
sos_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
sos_app/ios/Runner/AppDelegate.swift
sos_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
sos_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
sos_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
sos_app/ios/Runner/Base.lproj/LaunchScreen.storyboard
sos_app/ios/Runner/Base.lproj/Main.storyboard
sos_app/ios/Runner/Info.plist
sos_app/ios/Runner/Runner-Bridging-Header.h
sos_app/ios/RunnerTests/RunnerTests.swift
sos_app/lib/main.dart
sos_app/linux/.gitignore
sos_app/linux/CMakeLists.txt
sos_app/linux/flutter/CMakeLists.txt
sos_app/linux/flutter/generated_plugin_registrant.cc
sos_app/linux/flutter/generated_plugin_registrant.h
sos_app/linux/flutter/generated_plugins.cmake
sos_app/linux/main.cc
sos_app/linux/my_application.cc
sos_app/linux/my_application.h
sos_app/macos/.gitignore
sos_app/macos/Flutter/Flutter-Debug.xcconfig
sos_app/macos/Flutter/Flutter-Release.xcconfig
sos_app/macos/Flutter/GeneratedPluginRegistrant.swift
sos_app/macos/Podfile
sos_app/macos/Podfile.lock
sos_app/macos/Runner.xcodeproj/project.pbxproj
sos_app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
sos_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
sos_app/macos/Runner.xcworkspace/contents.xcworkspacedata
sos_app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
sos_app/macos/Runner/AppDelegate.swift
sos_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
sos_app/macos/Runner/Base.lproj/MainMenu.xib
sos_app/macos/Runner/Configs/AppInfo.xcconfig
sos_app/macos/Runner/Configs/Debug.xcconfig
sos_app/macos/Runner/Configs/Release.xcconfig
sos_app/macos/Runner/Configs/Warnings.xcconfig
sos_app/macos/Runner/DebugProfile.entitlements
sos_app/macos/Runner/Info.plist
sos_app/macos/Runner/MainFlutterWindow.swift
sos_app/macos/Runner/Release.entitlements
sos_app/macos/RunnerTests/RunnerTests.swift
sos_app/pubspec.lock
sos_app/pubspec.yaml
sos_app/README.md
sos_app/test/widget_test.dart
sos_app/web/index.html
sos_app/web/manifest.json
sos_app/windows/.gitignore
sos_app/windows/CMakeLists.txt
sos_app/windows/flutter/CMakeLists.txt
sos_app/windows/flutter/generated_plugin_registrant.cc
sos_app/windows/flutter/generated_plugin_registrant.h
sos_app/windows/flutter/generated_plugins.cmake
sos_app/windows/runner/CMakeLists.txt
sos_app/windows/runner/flutter_window.cpp
sos_app/windows/runner/flutter_window.h
sos_app/windows/runner/main.cpp
sos_app/windows/runner/resource.h
sos_app/windows/runner/runner.exe.manifest
sos_app/windows/runner/Runner.rc
sos_app/windows/runner/utils.cpp
sos_app/windows/runner/utils.h
sos_app/windows/runner/win32_window.cpp
sos_app/windows/runner/win32_window.h
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- Update README.md
- ahhh
- Merge branch 'main' of https://github.com/Mando8119/SaveOurSlugs
- updates
- #gallery
- fixes
- new button
- fixes
- addition
- fixes
- LETS GOO
- fixed comments
- Merge branch 'main' of https://github.com/Mando8119/SaveOurSlugs
- email addition
- m
- p
- p
- vision addition
- fix
- fixes

## Key source files (fetched from GitHub, selected and truncated for size)

### sos_app/analysis_options.yaml

```yaml
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
  # The lint rules applied to this project can be customized in the
  # section below to disable rules from the `package:flutter_lints/flutter.yaml`
  # included above or to enable additional rules. A list of all available lints
  # and their documentation is published at https://dart.dev/lints.
  #
  # Instead of disabling a lint rule for the entire project in the
  # section below, it can also be suppressed for a single line of code
  # or a specific dart file by using the `// ignore: name_of_lint` and
  # `// ignore_for_file: name_of_lint` syntax on the line or in the file
  # producing the lint.
  rules:
    # avoid_print: false  # Uncomment to disable the `avoid_print` rule
    # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

```

### sos_app/pubspec.yaml

```yaml
name: sos_app
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

environment:
  sdk: '>=3.2.5 <4.0.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter

  
  
  ussd_phone_call_sms: ^0.0.3

  permission_handler: ^11.2.0

  mailer: ^6.0.1

  google_sign_in: ^5.0.4

  http: ^0.13.3

  flutter_secure_storage: ^9.0.0

  gallery_saver: ^2.1.1

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  flutter_background_video_recorder: ^0.0.9+1
  

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^3.0.1

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  assets:
    - assets/images/SOS.png
    - assets/images/1.png
    - assets/images/2.png
    - assets/images/3.png
    - assets/images/4.png

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

```

### sos_app/linux/main.cc

```c++
#include "my_application.h"

int main(int argc, char** argv) {
  g_autoptr(MyApplication) app = my_application_new();
  return g_application_run(G_APPLICATION(app), argc, argv);
}

```

### sos_app/linux/my_application.h

```c
#ifndef FLUTTER_MY_APPLICATION_H_
#define FLUTTER_MY_APPLICATION_H_

#include <gtk/gtk.h>

G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
                     GtkApplication)

/**
 * my_application_new:
 *
 * Creates a new Flutter-based application.
 *
 * Returns: a new #MyApplication.
 */
MyApplication* my_application_new();

#endif  // FLUTTER_MY_APPLICATION_H_

```

### sos_app/test/widget_test.dart

```dart
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:sos_app/main.dart';

void main() {
  testWidgets('Counter increments smoke test', (WidgetTester tester) async {
    // Build our app and trigger a frame.
    await tester.pumpWidget(const MyApp());

    // Verify that our counter starts at 0.
    expect(find.text('0'), findsOneWidget);
    expect(find.text('1'), findsNothing);

    // Tap the '+' icon and trigger a frame.
    await tester.tap(find.byIcon(Icons.add));
    await tester.pump();

    // Verify that our counter has incremented.
    expect(find.text('0'), findsNothing);
    expect(find.text('1'), findsOneWidget);
  });
}

```

### sos_app/web/index.html

```html
<!DOCTYPE html>
<html>
<head>
  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    For more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

    This is a placeholder for base href that will be replaced by the value of
    the `--base-href` argument provided to `flutter build`.
  -->
  <base href="$FLUTTER_BASE_HREF">

  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="A new Flutter project.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="sos_app">
  <link rel="apple-touch-icon" href="icons/Icon-192.png">

  <!-- Favicon -->
  <link rel="icon" type="image/png" href="favicon.png"/>

  <title>sos_app</title>
  <link rel="manifest" href="manifest.json">

  <script>
    // The value below is injected by flutter build, do not touch.
    const serviceWorkerVersion = null;
  </script>
  <!-- This script adds the flutter initialization JS code -->
  <script src="flutter.js" defer></script>
</head>
<body>
  <script>
    window.addEventListener('load', function(ev) {
      // Download main.dart.js
      _flutter.loader.loadEntrypoint({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        },
        onEntrypointLoaded: function(engineInitializer) {
          engineInitializer.initializeEngine().then(function(appRunner) {
            appRunner.runApp();
          });
        }
      });
    });
  </script>
</body>
</html>

```

### sos_app/linux/my_application.cc

```c++
#include "my_application.h"

#include <flutter_linux/flutter_linux.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif

#include "flutter/generated_plugin_registrant.h"

struct _MyApplication {
  GtkApplication parent_instance;
  char** dart_entrypoint_arguments;
};

G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)

// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
  MyApplication* self = MY_APPLICATION(application);
  GtkWindow* window =
      GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));

  // Use a header bar when running in GNOME as this is the common style used
  // by applications and is the setup most users will be using (e.g. Ubuntu
  // desktop).
  // If running on X and not using GNOME then just use a traditional title bar
  // in case the window manager does more exotic layout, e.g. tiling.
  // If running on Wayland assume the header bar will work (may need changing
  // if future cases occur).
  gboolean use_header_bar = TRUE;
#ifdef GDK_WINDOWING_X11
  GdkScreen* screen = gtk_window_get_screen(window);
  if (GDK_IS_X11_SCREEN(screen)) {
    const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
    if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
      use_header_bar = FALSE;
    }
  }
#endif
  if (use_header_bar) {
    GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
    gtk_widget_show(GTK_WIDGET(header_bar));
    gtk_header_bar_set_title(header_bar, "sos_app");
    gtk_header_bar_set_show_close_button(header_bar, TRUE);
    gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
  } else {
    gtk_window_set_title(window, "sos_app");
  }

  gtk_window_set_default_size(window, 1280, 720);
  gtk_widget_show(GTK_WIDGET(window));

  g_autoptr(FlDartProject) project = fl_dart_project_new();
  fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);

  FlView* view = fl_view_new(project);
  gtk_widget_show(GTK_WIDGET(view));
  gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));

  fl_register_plugins(FL_PLUGIN_REGISTRY(view));

  gtk_widget_grab_focus(GTK_WIDGET(view));
}

// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
  MyApplication* self = MY_APPLICATION(application);
  // Strip out the first argument as it is the binary name.
  self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);

  g_autoptr(GError) error = nullptr;
  if (!g_application_register(application, nullptr, &error)) {
     g_warning("Failed to register: %s", error->message);
     *exit_status = 1;
     return TRUE;
  }

  g_application_activate(application);
  *exit_status = 0;

  return TRUE;
}

// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
  MyApplication* self = MY_APPLICATION(object);
  g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
  G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}

static void my_application_class_init(MyApplicationClass* klass) {
  G_APPLICATION_CLASS(klass)->activate = my_application_activate;
  G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
  G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}

static void my_application_init(MyApplication* self) {}

MyApplication* my_application_new() {
  return MY_APPLICATION(g_object_new(my_application_get_type(),
                                     "application-id", APPLICATION_ID,
                                     "flags", G_APPLICATION_NON_UNIQUE,
                                     nullptr));
}

```

### sos_app/lib/main.dart

```dart
import 'package:flutter/material.dart';
import 'package:flutter_background_video_recorder/flutter_bvr_channel.dart';
import 'package:flutter_background_video_recorder/flutter_bvr_platform_interface.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:mailer/smtp_server.dart';
import 'package:mailer/smtp_server/gmail.dart';
import 'package:ussd_phone_call_sms/ussd_phone_call_sms.dart';
import 'package:permission_handler/permission_handler.dart';
import 'dart:async';
import 'dart:io';
import 'package:flutter_background_video_recorder/flutter_bvr.dart';
import 'package:mailer/mailer.dart';
import 'package:gallery_saver/gallery_saver.dart';


void main() {
  runApp(const MyApp());

  }



class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Save Our Slugs',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 27, 66, 196)),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'SaveOurSlugs'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}
class GoogleAuthApi {
  static final _googleSignIn = GoogleSignIn(scopes: ['https://mail.google.com/']);

  static Future<GoogleSignInAccount?> signIn() async {
    return await _googleSignIn.signIn();
  }
}

class _MyHomePageState extends State<MyHomePage> {

  int counter = 0;
  String place = 'even';

  bool _isRecording = false;
  bool _recorderBusy = false;
  StreamSubscription<int?>? _streamSubscription;
  final _flutterBackgroundVideoRecorderPlugin = FlutterBackgroundVideoRecorder();
  // ignore: unused_element
  void _incrementCounter() {
    setState(() {
      counter++;
      if (counter % 2 == 0){
        place = 'even';
      }else{place = 'odd';}
    });
  }

@override
  void initState() {
    super.initState();
    getInitialRecordingStatus();
    listenRecordingState();
  }

  @override
  void dispose() {
    _streamSubscription?.cancel();
    super.dispose();
  }

  Future<void> getInitialRecordingStatus() async {
    _isRecording = await _flutterBackgroundVideoRecorderPlugin.getVideoRecordingStatus() == 1;
  }

  void listenRecordingState() {
    _streamSubscription = _flutterBackgroundVideoRecorderPlugin.recorderState.listen((event) {
      setState(() {
        switch (event) {
          case 1:
            _isRecording = true;
            _recorderBusy = true;
            break;
          case 2:
            _isRecording = false;
            _recorderBusy = false;
            break;
          case 3:
            _recorderBusy = true;
            break;
          case -1:
            _isRecording = false;
            _recorderBusy = false;
            break;
          default:
            break;
        }
      });
    });
  }

  Future<void> startRecording() async {
    if (!_isRecording && !_recorderBusy) {
      await _flutterBackgroundVideoRecorderPlugin.startVideoRecording(
        folderName: "Example Recorder",
        cameraFacing: CameraFacing.frontCamera,
        notificationTitle: "Example Notification Title",
        notificationText: "Example Notification Text",
        showToast: false
      );
    }
  }

  Future<void> stopRecording() async {
    if (_isRecording) {
      String filePath = await _flutterBackgroundVideoRecorderPlugin.stopVideoRecording() ?? "None";
      debugPrint(filePath);

    // Save the recorded file to the gallery
    try {
      bool success = (await GallerySaver.saveVideo(filePath)) ?? false;
      print("Video saved to gallery: $success");
    } catch (e) {
      // ignore: avoid_print
      print('Error sending video: $e');
    }
  }
}
Future<void> _requestAllPermissions() async {
    Map<Permission, PermissionStatus> statuses = await [
      Permission.sms,
      Permission.phone,
      Permission.location,
      Permission.videos,
      Permission.microphone,
      Permission.camera,
      Permission.storage,
      // Add other permissions you need here
    ].request();

    // Handle the permission request result
    if (statuses[Permission.sms]!.isGranted && statuses[Permission.phone]!.isGranted) {
      // All requested permissions are granted
      // ignore: avoid_print
      print('All permissions granted');
    } else {
      // Handle the case where permissions are denied
      // ignore: avoid_print
      print('One or more permissions denied');
    }
  }

  Future<void> sendingmail() async{
  final user = await GoogleAuthApi.signIn();

  if (user == null) return;
  final email = user.email;
  final auth = await user.authentication;
  final token = auth.accessToken!;

  final smtpServer = gmailSaslXoauth2(email, token);

  final message = Message()
    ..from = Address(email, 'User')
    ..recipients = [email]
    ..subject = 'Incident Report'
    ..text = 'This report is meant to provide vital information including an attachment of the video feed captured from the incident.';

  try{
    await send(message, smtpServer);
    print('Email sent successfully');
  }on MailerException catch (e) {
    print('Email not successful: $e');
  }
}
  //  THIS METHOD SHOULD ALSO REQUEST GPS LOCATION
void _call() async {
  await _requestAllPermissions();
  startRecording();
  sendingmail();
  var phoneStatus = await Permission.phone.status;
  if (phoneStatus.isGranted) {
    try {
      await UssdPhoneCallSms().phoneCall(phoneNumber: '+18312339795'); //would be 911, however we don't want cops showing up for demonstration
      // ignore: avoid_print
      print('Phone call successful');
    } catch (e) {
      // ignore: avoid_print
      print('Error making phone call: $e');
    }
  } else {
    // ignore: avoid_print
    print('Phone call permission denied');
  }
}

void _sendSMS() async {
  await _requestAllPermissions();
  startRecording();
  sendingmail()
[truncated — 13869 more characters]
```

### sos_app/ios/Runner/Runner-Bridging-Header.h

```c
#import "GeneratedPluginRegistrant.h"

```

### sos_app/macos/Runner/AppDelegate.swift

```swift
import Cocoa
import FlutterMacOS

@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
  override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
    return true
  }
}

```

[25 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]