img
gradient

NLearn Manager – Intelligent LMS Sync Tool for NSBM

Written by Upeksha Indeewara

NLearn Manager

NLearn Manager is a mobile scraping and automation tool built using Flutter that enhances the student experience on NSBM Green University’s LMS (NLearn) — a Moodle-based learning platform. Developed as part of our Mobile Application Development module, the tool reimagines how students interact with the LMS: from manual browsing and downloading to automated scanning, offline-first access, and smart content synchronization.


image

How It Works

NLearn Manager automates the typical student interaction with NSBM’s Moodle-based LMS by mimicking and enhancing the manual process. When a user opens the app, they are prompted to log in using their NLearn credentials. The app sends these credentials to the LMS login endpoint and captures the resulting session cookies upon successful authentication. These cookies are securely stored and reused for all future requests, allowing the app to maintain a logged-in state without requiring the user to re-enter their credentials. If the session expires, the app automatically re-authenticates in the background.

After login, the app begins scanning the student's enrolled courses. It retrieves the course structure, including all modules, sections, and linked resources such as lecture notes, PDFs, and presentations. Using this information, the app builds a local representation of the course hierarchy.

Before downloading any files, the app checks which ones have already been saved to the device. It compares file URLs and names against a locally stored list to detect only the missing content. These files are added to a multi-threaded download queue powered by Dart isolates, allowing for concurrent downloads without affecting the user interface. Downloaded files are saved directly to the internal storage of the device and organized into folders by course and section. This structure allows for simple offline access using any file manager.

In parallel, the app scrapes upcoming assignments, quizzes, and activities from the LMS. These tasks are extracted and displayed in a dedicated to-do list, along with progress percentages indicating the completion status of each course.

For added convenience, users can enable background scanning. Once activated, the app periodically logs in based on a user-defined interval such as every 1 hour, 3 hours, or once a day. It performs a background check for new files or tasks and sends a summary notification if any changes are found. These notifications inform the student about missing files or upcoming deadlines without needing to open the app.

The system is built for performance, reliability, and ease of use. It eliminates repetitive LMS logins, ensures students always have the latest content, and provides organized access to learning material directly from the mobile device.


Key Functionalities

🔐 Secure Login & Session Persistence

  • Credential-based login system using HTTP POST requests to NLearn's authentication endpoint.

  • Session cookies captured and reused across all subsequent requests.

  • Session expiration is handled gracefully with automatic re-authentication.

📥 Smart Downloader Engine

  • Deep scraping mechanism to fetch:

    • Course structure (modules & sections)

    • Resource links (PDFs, PPTs, docs, etc.)

  • Incremental downloader:

    • Maintains a hash map of downloaded file URLs

    • Skips already-downloaded files using persistent local tracking

  • Multi-threaded file download queue using Flutter isolates for performance optimization.

📂 File System Organization

  • Files are stored locally with this structure:
    /storage/emulated/0/NLManager/ <CourseName> / <SectionName> / <FileName>

  • UTF-8 normalization, illegal character removal, and filename truncation handled safely.

🧠 To-Do Aggregation & Progress Tracking

  • Scrapes upcoming assignments, quizzes, and deadlines using structured DOM parsing.

  • Extracted into a unified to-do dashboard with due dates and completion indicators.

  • Course completion percentage parsed from NLearn’s progress bar elements.

🔁 Auto-Login with Background Sync

  • Configurable background task using Flutter plugins (workmanager, android_alarm_manager_plus).

  • Periodic jobs execute silently:

    • Re-authenticate

    • Compare resource list with local state

    • Push concise notifications about new files or pending tasks

  • Sync frequency options: 1hr, 3hrs, 6hrs, 12hrs, 24hrs.

🔔 Notifications

  • Background scans notify the user of:

    • Number of newly added files

    • Count of upcoming tasks

    • Any failed download attempts

    • Scanning and downloading progress with real time progress bars


My Role & Technical Contributions

As the core backend and engine developer, I was responsible for:

✅ Login & Session Management

  • Engineered a reusable SessionManager with automatic cookie refresh and fallback handling.

  • Built interception mechanisms to retry failed requests without breaking the user flow.

✅ Downloader Engine

  • Designed a concurrent download system using isolates to:

    • Scan modules in one thread

    • Fetch files in parallel

    • Update UI without blocking the main thread

  • Developed custom DownloadTask and DownloadQueueManager classes to track and retry tasks.

✅ State Management & Local Sync

  • Implemented an internal state tracker using:

    • Local storage (path_provider, shared_preferences)

    • In-memory state linked to the active session

  • Optimized sync operations to handle:

    • Network interruptions

    • LMS structure changes (e.g., renamed sections, deleted resources)


Comparison Table: Moodle App vs NLearn Manager

Feature

Moodle App

NLearn Manager

Offline File Access

⚠️ Limited

✅ Full & Structured

Background Sync

✅ Customizable

Incremental File Downloads

Course File Organization

✅ Module & Section-Based

To-Do Tracker

⚠️ Basic

✅ Detailed & Summarized

Progress Scraping

✅ Accurate Extraction

Notifications

⚠️ Minimal

✅ File & To-Do Alerts

Session Reuse & Cookie Handling

✅ Secure & Persistent

Multi-threaded Download Engine

✅ Built-in

Designed for NSBM

❌ Generic Moodle

✅ Tailored Integration


Tech Stack & Libraries

Framework & Language

  • Flutter – Cross-platform UI toolkit for building native Android and iOS apps

  • Dart – Core programming language for Flutter development

Networking & Session Handling

  • http – For making HTTP requests to the LMS

  • http_session – Session-based request management using cookie storage and reuse

  • html – DOM parsing and scraping of Moodle-based LMS content

State Management & Architecture

  • provider – Lightweight dependency injection and state management solution

Data Storage & File Handling

  • hive – Lightweight, NoSQL local database for storing file sync states and user session info

  • hive_flutter – Hive bindings for Flutter apps

  • path_provider – For accessing device directories to store downloaded files

  • permission_handler – Manages storage and background permissions across platforms

Notifications & Background Tasks

  • awesome_notifications – Local notification system to alert users about new files or upcoming to-dos

  • workmanager – Schedules background tasks at user-defined intervals (e.g., 1hr, 3hrs)

Device Utilities

  • device_info_plus – Fetches device information for managing platform-specific logic

Testing & Tooling

  • flutter_test – Built-in Flutter testing framework

  • flutter_launcher_icons – Automates app icon generation

  • flutter_lints – Enforces best practices and clean code standards


Project Artifacts


User Interface (UI)

imageimageimageimageimageimageimageimage


🧑‍💻 Team Contribution

Student ID

Name

GitHub Username

27292

GUI Perera (Group Leader)

@upekshaip

27601

SWKR Pinsiri

@Kavindu-R

27958

MCA Jayasingha

@ChethakaJayasingha

27578

MJM Shaahid

@Shaahidzx

27176

KTN Weerathunga

@Nimdinu-Weerathunga

27177

KTS Weerathunga

@ktsweerathunga

30003

RDK Piumal

@kavinduabc