mirror of
https://github.com/zoriya/Aeris.git
synced 2026-06-04 19:26:40 +00:00
Mobile Client: Deeplink 4 android
This commit is contained in:
@@ -1,7 +1,45 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.aeris.mobile">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application
|
||||
android:label="Aeris"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<!-- Deep linking -->
|
||||
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
|
||||
<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http" android:host="aeris.com" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="aeris" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http" android:host="aeris.aera.epi" />
|
||||
<data android:scheme="http" android:host="aeris.com" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="aeris" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
|
||||
@@ -55,10 +55,10 @@
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>aeris.area.epi</string>
|
||||
<string>aeris.com</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>http</string>
|
||||
<string>aeris</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
@@ -53,10 +53,10 @@
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>aeris.com</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>aeris</string>
|
||||
<string>aeris.com</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>aeris</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:aeris/main.dart';
|
||||
import 'package:aeris/src/models/action.dart';
|
||||
import 'package:aeris/src/models/action.dart' as aeris;
|
||||
import 'package:aeris/src/models/action_parameter.dart';
|
||||
import 'package:aeris/src/models/action_template.dart';
|
||||
import 'package:aeris/src/models/pipeline.dart';
|
||||
@@ -12,6 +12,7 @@ import 'package:aeris/src/models/reaction.dart';
|
||||
import 'package:aeris/src/models/service.dart';
|
||||
import 'package:aeris/src/models/trigger.dart';
|
||||
import 'package:aeris/src/providers/action_catalogue_provider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -32,7 +33,16 @@ class AerisAPI {
|
||||
/// JWT token used to request API
|
||||
late String _jwt;
|
||||
|
||||
final String deepLinkRoute = "http://aeris.area.epi";
|
||||
late final String deepLinkRoute;
|
||||
|
||||
AerisAPI() {
|
||||
var scheme = "http";
|
||||
if (Theme.of(Aeris.materialKey.currentContext!).platform ==
|
||||
TargetPlatform.iOS) {
|
||||
scheme = "aeris";
|
||||
}
|
||||
deepLinkRoute = "$scheme://aeris.com";
|
||||
}
|
||||
|
||||
final String baseRoute = "http://10.29.124.174:81"; ///TODO make it modifiable
|
||||
|
||||
@@ -129,7 +139,9 @@ class AerisAPI {
|
||||
}
|
||||
|
||||
String getServiceAuthURL(Service service) {
|
||||
final serviceName = service == const Service.youtube() ? "google" : service.name.toLowerCase();
|
||||
final serviceName = service == const Service.youtube()
|
||||
? "google"
|
||||
: service.name.toLowerCase();
|
||||
return "$baseRoute/auth/$serviceName/url?redirect_uri=$deepLinkRoute/authorization/$serviceName";
|
||||
}
|
||||
|
||||
@@ -177,8 +189,7 @@ class AerisAPI {
|
||||
return res.ok;
|
||||
}
|
||||
|
||||
List<ActionTemplate> getActionsFor(
|
||||
Service service, Action action) {
|
||||
List<ActionTemplate> getActionsFor(Service service, aeris.Action action) {
|
||||
final catalogue = Aeris.materialKey.currentContext?.read<ActionCatalogueProvider>();
|
||||
if (action is Trigger) {
|
||||
return catalogue!.triggerTemplates[service]!;
|
||||
|
||||
@@ -21,8 +21,9 @@ class ServiceProvider extends ChangeNotifier {
|
||||
/// Adds a service into the Provider
|
||||
addService(Service service, String code) async {
|
||||
_connectedServices.add(service);
|
||||
notifyListeners();
|
||||
await GetIt.I<AerisAPI>().connectService(service, code);
|
||||
GetIt.I<AerisAPI>()
|
||||
.connectService(service, code)
|
||||
.then((value) => notifyListeners());
|
||||
}
|
||||
|
||||
/// Refresh services from API
|
||||
|
||||
Reference in New Issue
Block a user