Sikander-Changes for IOS.

development
choudhry masood 5 years ago
parent a572a7c592
commit ec3aeef12a

@ -41,5 +41,11 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Need this permission to save tangheem as image on device</string>
<key>NSMicrophoneUsageDescription</key>
<string>Need this permission to record voice</string>
<key>UISupportsDocumentBrowser</key>
<true/>
</dict>
</plist>

@ -86,12 +86,16 @@ class _AyaRecordWidgetState extends State<AyaRecordWidget> {
Future<String> getFilePath() async {
Directory storageDirectory = await getApplicationDocumentsDirectory();
if (Platform.isIOS) {
storageDirectory = await getTemporaryDirectory();
}
String sdPath = storageDirectory.path + "/record";
var d = Directory(sdPath);
if (!d.existsSync()) {
d.createSync(recursive: true);
}
return sdPath + "/test.mp3";
return sdPath + "/temp${DateTime.now().millisecondsSinceEpoch}.mp3";
}
@override
@ -292,8 +296,14 @@ class _AyaRecordWidgetState extends State<AyaRecordWidget> {
void saveToPhoneStorage(String filePath) async {
File file = File(filePath);
Directory storageDirectory = await getExternalStorageDirectory();
Directory storageDirectory;
if (Platform.isAndroid) {
storageDirectory = await getExternalStorageDirectory();
} else if (Platform.isIOS) {
storageDirectory = await getApplicationDocumentsDirectory();
} else {
return;
}
String storagePath = storageDirectory.path;
if (storagePath.contains("/Android/data")) {

Loading…
Cancel
Save