Skip to content

Commit

Permalink
Merge pull request #884 from atsign-foundation/865-publish-new-versio…
Browse files Browse the repository at this point in the history
…ns-of-the-at_widget-packages

chore: at_invitation_flutter updated to 2.0.4
  • Loading branch information
CurtlyCritchlow authored Aug 8, 2024
2 parents 1b04608 + b83147d commit c91ab34
Show file tree
Hide file tree
Showing 17 changed files with 123 additions and 106 deletions.
12 changes: 11 additions & 1 deletion packages/at_invitation_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## 2.0.4:

- **CHORE**: Kotlin version increase to 1.8.20
- **CHORE**: Major version increase of flutter_lints from ^2.0.3 to ^4.0.1
- **CHORE**: Updated dependencies
- **CHORE**: AndroidManifest updated
- **CHORE**: gradle updated
- **FIX**: Lint issues fixed

## 2.0.3:
- **CHORE**: Major version increase of at_commons from ^3.0.55 to ^4.0.1

- **CHORE**: Major version increase of at_commons from ^3.0.55 to ^4.0.0

## 2.0.2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.at_invitation_flutter_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.at_invitation_flutter_example">
<!-- 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"/>
<application android:label="at_invitation_flutter_example" android:icon="@mipmap/ic_launcher">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
6 changes: 3 additions & 3 deletions packages/at_invitation_flutter/example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
4 changes: 2 additions & 2 deletions packages/at_invitation_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ SPEC CHECKSUMS:
at_invitation_flutter: 96015bc9cd2c14148bfea6e6b73151120d701234
at_onboarding_flutter: e8219b6d0bfb236d3837ec3528871aebdcc56e8d
biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de
Expand All @@ -165,7 +165,7 @@ SPEC CHECKSUMS:
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
SDWebImage: fc8f2d48bbfd72ef39d70e981bd24a3f3be53fec
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
Expand Down
2 changes: 1 addition & 1 deletion packages/at_invitation_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dev_dependencies:
# 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: ^2.0.3
flutter_lints: ^4.0.0
flutter_test:
sdk: flutter

Expand Down
49 changes: 13 additions & 36 deletions packages/at_invitation_flutter/lib/services/invitation_service.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// A service to handle invitation needs
import 'dart:async';
import 'dart:convert';
import 'dart:math';
Expand All @@ -12,6 +10,7 @@ import 'package:at_utils/at_logger.dart';
import 'package:flutter/material.dart';
import 'package:uuid/uuid.dart';

/// A service to handle invitation needs
class InvitationService {
InvitationService._();

Expand All @@ -33,10 +32,7 @@ class InvitationService {
GlobalKey<NavigatorState> get navigatorKey => navkey ?? GlobalKey();

/// initialize the invitation service
void initInvitationService(
GlobalKey<NavigatorState>? navkeyFromApp,
String? webPageFromApp,
String rootDomainFromApp,
void initInvitationService(GlobalKey<NavigatorState>? navkeyFromApp, String? webPageFromApp, String rootDomainFromApp,
int rootPortFromApp) async {
navkey = navkeyFromApp;
webPage = webPageFromApp;
Expand All @@ -50,11 +46,7 @@ class InvitationService {
// called again if outbound connection is dropped
Future<bool> startMonitor() async {
if (!hasMonitorStarted) {
AtClientManager.getInstance()
.atClient
.notificationService
.subscribe(shouldDecrypt: true)
.listen((notification) {
AtClientManager.getInstance().atClient.notificationService.subscribe(shouldDecrypt: true).listen((notification) {
_notificationCallback(notification);
});
hasMonitorStarted = true;
Expand Down Expand Up @@ -91,26 +83,21 @@ class InvitationService {

void _processInviteAcknowledgement(String? data, String? fromAtsign) async {
if (data != null && fromAtsign != null) {
MessageShareModel receivedInformation =
MessageShareModel.fromJson(jsonDecode(data));
MessageShareModel receivedInformation = MessageShareModel.fromJson(jsonDecode(data));

// build and fetch self key
AtKey atKey = AtKey()..metadata = Metadata();
atKey.key = '$invitationKey.${receivedInformation.identifier ?? ''}';
atKey.metadata.ttr = -1;
var result = await AtClientManager.getInstance().atClient.get(atKey);
MessageShareModel sentInformation =
MessageShareModel.fromJson(jsonDecode(result.value));
MessageShareModel sentInformation = MessageShareModel.fromJson(jsonDecode(result.value));

var receivedPasscode = receivedInformation.passcode;
var sentPasscode = sentInformation.passcode;

if (sentPasscode == receivedPasscode) {
atKey.sharedWith = fromAtsign;
await AtClientManager.getInstance()
.atClient
.put(atKey, jsonEncode(sentInformation.message))
.catchError((e) {
await AtClientManager.getInstance().atClient.put(atKey, jsonEncode(sentInformation.message)).catchError((e) {
_logger.severe('Error in sharing saved message => $e');
throw e;
});
Expand All @@ -125,16 +112,12 @@ class InvitationService {
int code = Random().nextInt(9999);
String passcode = code.toString().padLeft(4, '0');

MessageShareModel messageContent = MessageShareModel(
passcode: passcode, identifier: keyID, message: jsonData);
MessageShareModel messageContent = MessageShareModel(passcode: passcode, identifier: keyID, message: jsonData);

AtKey atKey = AtKey()..metadata = Metadata();
atKey.key = '$invitationKey.$keyID';
atKey.metadata.ttr = -1;
var result = await AtClientManager.getInstance()
.atClient
.put(atKey, jsonEncode(messageContent))
.catchError((e) {
var result = await AtClientManager.getInstance().atClient.put(atKey, jsonEncode(messageContent)).catchError((e) {
_logger.severe('Error in saving shared data => $e');
throw e;
});
Expand All @@ -145,16 +128,13 @@ class InvitationService {
uniqueID: keyID,
passcode: passcode,
webPageLink: webPage,
currentAtsign:
AtClientManager.getInstance().atClient.getCurrentAtSign() ??
''),
currentAtsign: AtClientManager.getInstance().atClient.getCurrentAtSign() ?? ''),
);
}
}

/// show the OTP dialog and fetch the invite data
Future<void> fetchInviteData(
BuildContext context, String data, String atsign) async {
Future<void> fetchInviteData(BuildContext context, String data, String atsign) async {
String otp = await showDialog(
context: context,
builder: (context) => const OTPDialog(),
Expand All @@ -163,12 +143,9 @@ class InvitationService {
atKey.key = '$invitationAckKey.$data';
atKey.sharedWith = atsign;
atKey.metadata.ttr = -1;
MessageShareModel messageContent = MessageShareModel(
passcode: otp, identifier: data, message: 'invite acknowledgement');
await AtClientManager.getInstance()
.atClient
.put(atKey, jsonEncode(messageContent))
.catchError((e) {
MessageShareModel messageContent =
MessageShareModel(passcode: otp, identifier: data, message: 'invite acknowledgement');
await AtClientManager.getInstance().atClient.put(atKey, jsonEncode(messageContent)).catchError((e) {
_logger.severe('Error in saving acknowledge message => $e');
throw e;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/at_invitation_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
uuid: ^3.0.7

dev_dependencies:
flutter_lints: ^2.0.3
flutter_lints: ^4.0.0
flutter_test:
sdk: flutter

Expand Down
Loading

0 comments on commit c91ab34

Please sign in to comment.