A

aurora_intent

A plugin for working with intents in the Aurora OS.

EN | RU

aurora_intent

A plugin for working with intents in the Aurora OS. Aurora OS Intents Documentation

The plugin allows you to:

  • call intents
  • register your own interns

Example :

await AuroraIntent.invokeIntent(
  name: "MyIntent"
);

AuroraIntent.initialize();
await AuroraIntent.registerIntent("X-MyIntent", (_) async {});
await AuroraIntent.startService();

Contents

Installation and build

Add the plugin depending on the target application in the pubspec.yaml file:

dependencies:
  aurora_intent:
    git:
      url: https://developer.auroraos.ru/git/flutter/flutter-community-plugins/aurora_intent

Modify the .spec file:

BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(runtime-manager-qt5)

Add your intents to the desktop file:

Intents=X-MyIntent;X-MyIntent2

You also need to enable Qt support in aurora/main.cpp:

...
#include <flutter/flutter_compatibility_qt.h>  // Add for Qt

int main(int argc, char* argv[]) {
    ...
    aurora::EnableQtCompatibility(); // Add for Qt
    aurora::RegisterPlugins();
    ...
}

And update the dependencies:

flutter-aurora pub get

Detailed description

invokeIntent

Calling an intent in the Aurora OS

Future<Map<String, dynamic>> invokeIntent({required String name, Hints? hints, Map<String, dynamic>? params});

Arguments

  • name - name of the intent:
    • standard AuroraStandartIntents:
      • Start - to start any actions or processes;
      • Openurl - to open a specific URI;
    • custom;
  • hints - hints for the intent service;
  • params - an arbitrary collection of parameters.

Return value

A сollection of return values from the intent handler

Example

Opening the settings app:

await AuroraIntent.invokeIntent(
  name: AuroraStandartIntents.start,
  hints: Hints(
    preferredHandler: "com.jolla.settings",
  ),
);

initialize

Registering background handlers for the plugin

  AuroraIntent.initialize();

registerIntent

It saves the handler for the internet and passes the intents for registration to the Runtime Manager. For a single intent, we save a single handler. When an intent is called, the app will always open and display the GUI.

Future<void> registerIntent(String name, Future<JsonMap?> Function(Map<String, dynamic> params) callback);

Arguments

  • name - invent name, names start with "X-";
  • callback - the intent handler method.

Example

Registering an intent that returns the original parameters:

await AuroraIntent.registerIntent("X-MyIntent", (params) async {
  return {"params": params};
});

startService

It registers the added intents in the Runtime Manager, after which the interns become available for calling by the OS.

Future<void> startService();

Compatibility

The plugin has been working correctly since the 5.2 version of the Aurora OS and Flutter 3.35.0.

The plugin works with restrictions on version 5.1 and Flutter < 3.35.0:

  • you cannot transfer data with more than 1 level of nesting, such as nested json objects;
  • when running the command flutter run, the registration of custom intents does not work. It will only work when the app is launched through the app icon.

Terms of use and participation in development

The source code of the project is provided under license, which allows it to be used in third-party applications.

To participate in the development of the project, please read the participant agreement. If you plan to send your source code for inclusion in the project, you will need to accept the terms of the CLA.

Information about the participants is provided in the [AUTHORS] file(AUTHORS.md ).

Code of Conduct is the current set of rules of the Open Mobile Platform company, which informs about the expectations for interaction between community members when communicating and working on projects.