ios build whatsapp

4.4
Serik Uvaissov 2020-07-04 21:38:43 +06:00
parent 4be3bafe92
commit 226fd7e413
7 changed files with 173 additions and 59 deletions

View File

@ -14,6 +14,8 @@ PODS:
- MTBBarcodeScanner (5.0.11)
- path_provider (0.0.1):
- Flutter
- path_provider_linux (0.0.1):
- Flutter
- path_provider_macos (0.0.1):
- Flutter
- shared_preferences (0.0.1):
@ -26,6 +28,12 @@ PODS:
- Flutter
- FMDB (~> 2.7.2)
- SwiftProtobuf (1.9.0)
- url_launcher (0.0.1):
- Flutter
- url_launcher_macos (0.0.1):
- Flutter
- url_launcher_web (0.0.1):
- Flutter
DEPENDENCIES:
- barcode_scan (from `.symlinks/plugins/barcode_scan/ios`)
@ -33,11 +41,15 @@ DEPENDENCIES:
- esys_flutter_share (from `.symlinks/plugins/esys_flutter_share/ios`)
- Flutter (from `Flutter`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`)
- path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`)
- url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)
SPEC REPOS:
trunk:
@ -56,6 +68,8 @@ EXTERNAL SOURCES:
:path: Flutter
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
path_provider_linux:
:path: ".symlinks/plugins/path_provider_linux/ios"
path_provider_macos:
:path: ".symlinks/plugins/path_provider_macos/ios"
shared_preferences:
@ -66,6 +80,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_web/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher:
:path: ".symlinks/plugins/url_launcher/ios"
url_launcher_macos:
:path: ".symlinks/plugins/url_launcher_macos/ios"
url_launcher_web:
:path: ".symlinks/plugins/url_launcher_web/ios"
SPEC CHECKSUMS:
barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479
@ -75,12 +95,16 @@ SPEC CHECKSUMS:
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0
SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313
url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c
PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a

View File

@ -264,6 +264,7 @@
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@ -277,6 +278,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@ -390,7 +392,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = 94BM6VL7L8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -529,7 +531,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = 94BM6VL7L8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -561,7 +563,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = 94BM6VL7L8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (

View File

@ -20,6 +20,10 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>

View File

@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:io';
import 'package:aman_kassa_flutter/core/locator.dart';
import 'package:aman_kassa_flutter/core/models/dialog_models.dart';
import 'package:aman_kassa_flutter/core/services/dialog_service.dart';
@ -8,7 +9,7 @@ import 'package:aman_kassa_flutter/widgets/fields/busy_button.dart';
import 'package:flutter/material.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:esys_flutter_share/esys_flutter_share.dart';
import 'package:flutter_open_whatsapp/flutter_open_whatsapp.dart';
import 'package:url_launcher/url_launcher.dart';
class ImageShowContainer extends StatelessWidget {
final ImageShowModel data;
@ -28,7 +29,6 @@ class ImageShowContainer extends StatelessWidget {
floatingActionButton: MyFloatingActionButton(data),
);
}
}
Padding imageFromBase64String(String base64String) {
@ -77,60 +77,96 @@ class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
Widget build(BuildContext context) {
return showFab
? FloatingActionButton(
child: Icon(Icons.share),
onPressed: () {
var bottomSheetController = showBottomSheet(
context: context,
builder: (bottomSheetContext) => Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0 ),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(15)),
boxShadow: [
BoxShadow(
blurRadius: 10, color: Colors.grey[300], spreadRadius: 5)
]),
//color: Colors.grey[900],
height: 200,
child: Column(
children: <Widget>[
//verticalSpaceSmall,
//BusyButton(title: 'Электронная почта', onPressed: shareFile , mainColor: primaryColor, icon: Icons.mail, enabled: false, ),
verticalSpaceSmall,
BusyButton(title: 'WhatsApp', onPressed: callWhatsApp , mainColor: greenColor, icon: MdiIcons.whatsapp,),
verticalSpaceSmall,
BusyButton(title: '', onPressed: shareFile , mainColor: yellowColor, icon: Icons.share,),
],
)
));
showFoatingActionButton(false);
bottomSheetController.closed.then((value) {
showFoatingActionButton(true);
});
},
): Container() ;
child: Icon(Icons.share),
onPressed: () {
var bottomSheetController = showBottomSheet(
context: context,
builder: (bottomSheetContext) => Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(15)),
boxShadow: [
BoxShadow(
blurRadius: 10,
color: Colors.grey[300],
spreadRadius: 5)
]),
//color: Colors.grey[900],
height: 200,
child: Column(
children: <Widget>[
//verticalSpaceSmall,
//BusyButton(title: 'Электронная почта', onPressed: shareFile , mainColor: primaryColor, icon: Icons.mail, enabled: false, ),
verticalSpaceSmall,
BusyButton(
title: 'WhatsApp',
onPressed: callWhatsApp,
mainColor: greenColor,
icon: MdiIcons.whatsapp,
),
verticalSpaceSmall,
BusyButton(
title: '',
onPressed: shareFile,
mainColor: yellowColor,
icon: Icons.share,
),
],
)));
showFoatingActionButton(false);
bottomSheetController.closed.then((value) {
showFoatingActionButton(true);
});
},
)
: Container();
}
void shareFile() async {
try {
await Share.file(
'Aman Kassa', 'aman_kassa_check.png', base64Decode(widget.data.data),
'image/png');
await Share.file('Aman Kassa', 'aman_kassa_check.png',
base64Decode(widget.data.data), 'image/png');
} catch (e) {
print('error: $e');
}
}
void callWhatsApp() async {
DialogResponse response = await _dialog.showConfirmationDialogInput(
description: 'Номер телефона',
cancelTitle: 'Отмена',
confirmationTitle: 'Отправить',
);
if (response.confirmed) {
String phoneNumber = response.responseText;
FlutterOpenWhatsapp.sendSingleMessage(phoneNumber, "Спасибо что выбераете нас \r\n https://picsum.photos/200/300 ");
}
description: 'Номер телефона',
cancelTitle: 'Отмена',
confirmationTitle: 'Отправить',
);
if (response.confirmed) {
String phoneNumber = response.responseText;
String msg = "Спасибо за покупку! \r\n https://picsum.photos/200/300 ";
launchWhatsApp(phone: phoneNumber, message: msg);
//FlutterOpenWhatsapp.sendSingleMessage(phoneNumber, "Спасибо что выбераете нас \r\n https://picsum.photos/200/300 ");
}
}
void launchWhatsApp({
@required String phone,
@required String message,
}) async {
String url() {
if (Platform.isIOS) {
return "whatsapp://wa.me/$phone/?text=$message";
} else {
return "whatsapp://send?phone=$phone&text=$message";
}
}
if (await canLaunch(url())) {
await launch(url());
} else {
//throw 'Could not launch ${url()}';
_dialog.showDialog(description: 'Отсутсвует приложение WhatsApp');
}
}
void showFoatingActionButton(bool value) {
setState(() {
showFab = value;

View File

@ -40,7 +40,20 @@ class _DialogManagerState extends State<DialogManager> {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(request.title),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
),
actionsPadding: const EdgeInsets.only(right: 15, bottom: 5),
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
request.title,
style: TextStyle(fontWeight: FontWeight.bold),
),
//Divider(),
],
),
content: Text(request.description),
actions: <Widget>[
if (isConfirmationDialog)
@ -88,7 +101,7 @@ class _DialogManagerState extends State<DialogManager> {
//Text(request.description),
TextField(
autofocus: true,
decoration: InputDecoration(labelText: request.description ),
decoration: InputDecoration(labelText: request.description),
controller: controller,
onSubmitted: (value) {
_dialogService

View File

@ -118,13 +118,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_open_whatsapp:
dependency: "direct main"
description:
name: flutter_open_whatsapp
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
flutter_redux:
dependency: "direct main"
description:
@ -275,6 +268,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
platform_detect:
dependency: transitive
description:
name: platform_detect
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
plugin_platform_interface:
dependency: transitive
description:
@ -303,6 +303,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.3"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
quiver:
dependency: transitive
description:
@ -448,6 +455,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.4.11"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+7"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.7"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
vector_math:
dependency: transitive
description:

View File

@ -1,6 +1,6 @@
name: aman_kassa_flutter
description: A new Flutter project.
version: 1.0.0+3
version: 1.0.0+5
environment:
sdk: '>=2.3.0 <3.0.0'
dependencies:
@ -27,7 +27,7 @@ dependencies:
device_info: ^0.4.2+4
esys_flutter_share: ^1.0.2
auto_size_text: ^2.1.0
flutter_open_whatsapp: ^0.1.2
url_launcher: ^5.4.11
dev_dependencies:
flutter_test:
sdk: flutter