Skip to content

Commit

Permalink
Merge branch 'trunk' into feature/enable-user-sharing
Browse files Browse the repository at this point in the history
# Conflicts:
#	pubspec.lock
#	pubspec.yaml
  • Loading branch information
sonle-geekyants committed Apr 20, 2023
2 parents 7284513 + 6b5537c commit a82af81
Show file tree
Hide file tree
Showing 16 changed files with 499 additions and 250 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
android:theme="@style/Theme.AppCompat.NoActionBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:exported="true"
android:windowSoftInputMode="adjustResize">

<intent-filter>
Expand Down
8 changes: 7 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ PODS:
- Flutter
- biometric_storage (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.3):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
Expand Down Expand Up @@ -142,6 +144,7 @@ DEPENDENCIES:
- at_onboarding_flutter (from `.symlinks/plugins/at_onboarding_flutter/ios`)
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- biometric_storage (from `.symlinks/plugins/biometric_storage/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`)
Expand Down Expand Up @@ -199,6 +202,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/audio_session/ios"
biometric_storage:
:path: ".symlinks/plugins/biometric_storage/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
Flutter:
Expand Down Expand Up @@ -257,9 +262,10 @@ SPEC CHECKSUMS:
at_onboarding_flutter: e8219b6d0bfb236d3837ec3528871aebdcc56e8d
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
DKImagePickerController: 72fd378f244cef3d27288e0aebf217a4467e4012
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433
flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721
Expand Down
16 changes: 9 additions & 7 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -284,6 +284,7 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -337,6 +338,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -418,7 +420,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 23;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = 5XUSS6C2DF;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "Share Extension/Info.plist";
Expand Down Expand Up @@ -452,7 +454,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 23;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = 5XUSS6C2DF;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "Share Extension/Info.plist";
Expand Down Expand Up @@ -483,7 +485,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 23;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = 5XUSS6C2DF;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "Share Extension/Info.plist";
Expand Down Expand Up @@ -561,7 +563,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = 5XUSS6C2DF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down Expand Up @@ -694,7 +696,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = 5XUSS6C2DF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand All @@ -721,7 +723,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = 5XUSS6C2DF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down
2 changes: 2 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
<string>Microphone is used for speech to text feature</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Enable atWavi to access your photos to upload the ones you choose in file transfer.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down
29 changes: 26 additions & 3 deletions lib/common_components/custom_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import 'package:url_launcher/url_launcher.dart';
class CustomCard extends StatelessWidget {
final String? title, subtitle;
final bool isUrl;
final String? url;
final bool isEmail;
late bool _isDark;
late ThemeData themeData;
CustomCard(
{this.title,
this.isEmail = false,
this.url,
required this.subtitle,
this.isUrl = false,
required this.themeData});
Expand Down Expand Up @@ -44,16 +48,35 @@ class CustomCard extends StatelessWidget {
subtitle != null
? GestureDetector(
onTap: () async {
if (isEmail) {
Uri emailUrl = Uri(
scheme: "mailto",
path: subtitle,
);
await launchUrl(emailUrl);
return;
}
if (!isUrl) {
return;
}
SetupRoutes.push(context, Routes.WEB_VIEW,
arguments: {'title': title, 'url': subtitle});

if (await canLaunchUrl(Uri.parse(url ?? ""))) {
try {
await launchUrl(Uri.parse(url ?? ""),
mode: LaunchMode.externalApplication);
} catch (e) {
SetupRoutes.push(context, Routes.WEB_VIEW,
arguments: {'title': title, 'url': url});
}
} else {
SetupRoutes.push(context, Routes.WEB_VIEW,
arguments: {'title': title, 'url': url});
}
},
child: HtmlWidget(
subtitle!,
textStyle: TextStyle(
color: isUrl
color: isUrl || isEmail
? ColorConstants.orange
: themeData.primaryColor,
fontSize: 16.toFont,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:at_wavi_app/view_models/user_preview.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../../../model/user.dart';
import 'desktop_edit_basic_detail_model.dart';

class DesktopEditBasicDetailPage extends StatefulWidget {
Expand All @@ -26,6 +27,7 @@ class DesktopEditBasicDetailPage extends StatefulWidget {
class _DesktopEditBasicDetailState extends State<DesktopEditBasicDetailPage> {
final _showHideController = ShowHideController(isShow: null);
late DesktopEditBasicDetailModel _model;
final _formKey = GlobalKey<FormState>();

@override
void initState() {
Expand All @@ -43,6 +45,16 @@ class _DesktopEditBasicDetailState extends State<DesktopEditBasicDetailPage> {
}
}

bool matchRegex(String value, BasicData basicData) {
print(basicData);
if (value.isEmpty) {
return true;
}
var regex = getRegex(basicData.displayingAccountName ?? "");
bool res = regex.hasMatch(value);
return res;
}

@override
Widget build(BuildContext context) {
final appTheme = AppTheme.of(context);
Expand Down Expand Up @@ -70,7 +82,10 @@ class _DesktopEditBasicDetailState extends State<DesktopEditBasicDetailPage> {
),
),
SizedBox(height: DesktopDimens.paddingNormal),
_buildContentWidget(),
Form(
key: _formKey,
child: _buildContentWidget(),
),
SizedBox(height: DesktopDimens.paddingNormal),
Container(
padding: EdgeInsets.only(left: DesktopDimens.paddingNormal),
Expand Down Expand Up @@ -137,6 +152,14 @@ class _DesktopEditBasicDetailState extends State<DesktopEditBasicDetailPage> {
child: DesktopTextField(
controller: data.controller ?? TextEditingController(),
title: data.data.displayingAccountName ?? '',
validator: (value) {
if (Uri.parse(value ?? "").isAbsolute) {
if (!matchRegex(value ?? "", data.data)) {
return "Invalid ${data.data.displayingAccountName} value";
}
}
return null;
},
),
),
Container(
Expand All @@ -161,6 +184,8 @@ class _DesktopEditBasicDetailState extends State<DesktopEditBasicDetailPage> {
}

void _onSaveData() {
_model.saveData(context);
if (_formKey.currentState!.validate()) {
_model.saveData(context);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ class DesktopBasicInfoWidget extends StatelessWidget {
}

Widget _textContent(BuildContext context) {
bool isUrl;
String url;
if(Uri.parse(data.value).isAbsolute) {
isUrl = true;
url = data.value;
}else {
url = getUrl(data.displayingAccountName ?? "", data.value);
isUrl = Uri.parse(url).isAbsolute;
}
bool isEmail = data.displayingAccountName == "Email";
final appTheme = AppTheme.of(context);
return Container(
constraints: BoxConstraints(
Expand All @@ -71,10 +81,27 @@ class DesktopBasicInfoWidget extends StatelessWidget {
),
Expanded(
child: Container(
child: Text(
data.value ?? '',
style: appTheme.textTheme.bodyText2?.copyWith(
color: appTheme.primaryTextColor,
child: GestureDetector(
onTap: () async {
if (isUrl) {
// open link in browser
await launchUrl(Uri.parse(url));
return;
}
if (isEmail) {
Uri emailUrl = Uri(
scheme: "mailto",
path: data.value,
);
await launchUrl(emailUrl);
return;
}
},
child: Text(
data.value ?? '',
style: appTheme.textTheme.bodyText2?.copyWith(
color: isUrl || isEmail ? Colors.blue : appTheme.primaryTextColor,
),
),
),
),
Expand Down
34 changes: 25 additions & 9 deletions lib/screens/edit_persona/edit_category_fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,13 @@ class _EditCategoryFieldsState extends State<EditCategoryFields> {
customFields = [];
}

if (customFields != null) {
setState(() {
customFields!.add(data);
UserPreview()
.user()!
.customFields[widget.category.name] =
customFields;
});
}
setState(() {
customFields!.add(data);
UserPreview()
.user()!
.customFields[widget.category.name] =
customFields;
});

FieldOrderService().addNewField(
widget.category, data.accountName!);
Expand Down Expand Up @@ -404,7 +402,18 @@ class _EditCategoryFieldsState extends State<EditCategoryFields> {
return SizedBox();
}

bool matchRegex(String value, BasicData basicData) {
print(basicData);
if (value.isEmpty) {
return true;
}
var regex = getRegex(basicData.displayingAccountName ?? "");
bool res = regex.hasMatch(value);
return res;
}

Widget inputField(BasicData basicData, {bool isCustomField = false}) {
String error = "error";
return Slidable(
key: UniqueKey(),
actionPane: SlidableDrawerActionPane(),
Expand Down Expand Up @@ -470,6 +479,7 @@ class _EditCategoryFieldsState extends State<EditCategoryFields> {
// setState(() {});
// },
// ),

// ]
// : null,
child: Padding(
Expand All @@ -479,6 +489,7 @@ class _EditCategoryFieldsState extends State<EditCategoryFields> {
children: [
Expanded(
child: TextFormField(
// autovalidateMode: AutovalidateMode.onUserInteraction,
style: TextStyles.lightText(_themeData!.primaryColor),
key: UniqueKey(),
autovalidateMode: isCustomField
Expand All @@ -490,6 +501,11 @@ class _EditCategoryFieldsState extends State<EditCategoryFields> {
if (value == null || value == '' && isCustomField) {
return 'Body is required';
}
if (Uri.parse(value).isAbsolute) {
if (!matchRegex(value, basicData)) {
return "Invalid ${basicData.displayingAccountName} value";
}
}
return null;
},
initialValue: basicData.value,
Expand Down
Loading

0 comments on commit a82af81

Please sign in to comment.