Skip to content

Commit

Permalink
Merge branch 'master' into fix/fix-ios-export-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dipinsonwani authored Oct 24, 2024
2 parents 8c7c0b7 + a473a71 commit 537aef0
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 54 deletions.
9 changes: 5 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ if (keystorePropertiesFile.exists()) {
android {
namespace "software.mdev.bookstracker"
compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
// ndkVersion flutter.ndkVersion
ndkVersion = "25.1.8937393"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_17
}

sourceSets {
Expand Down
11 changes: 11 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ allprojects {
}

rootProject.buildDir = '../build'
subprojects {
afterEvaluate { project ->
if (project.plugins.hasPlugin("com.android.library")) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.application" version "8.3.1" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"
25 changes: 12 additions & 13 deletions lib/core/helpers/backup/backup_export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import 'package:archive/archive.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:shared_storage/shared_storage.dart';
// import 'package:shared_storage/shared_storage.dart'; // TODO: Migrate to another package

import 'package:openreads/core/helpers/backup/backup.dart';
import 'package:openreads/generated/locale_keys.g.dart';
Expand Down Expand Up @@ -44,16 +42,17 @@ class BackupExport {

try {
if (Platform.isAndroid) {
final selectedUriDir = await openDocumentTree();
if (selectedUriDir == null) {
return;
}
createFileAsBytes(
selectedUriDir,
mimeType: '',
displayName: fileName,
bytes: File(tmpBackupPath).readAsBytesSync(),
);
// TODO: Migrate to another package
// final selectedUriDir = await openDocumentTree();
// if (selectedUriDir == null) {
// return;
// }
// createFileAsBytes(
// selectedUriDir,
// mimeType: '',
// displayName: fileName,
// bytes: File(tmpBackupPath).readAsBytesSync(),
// );
} else if (Platform.isIOS) {
final directory = await getApplicationDocumentsDirectory();
String path = '${directory.path}/$fileName';
Expand Down
12 changes: 7 additions & 5 deletions lib/core/helpers/backup/backup_general.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:openreads/ui/settings_screen/download_missing_covers_screen.dart
import 'package:permission_handler/permission_handler.dart';

import 'package:openreads/generated/locale_keys.g.dart';
import 'package:shared_storage/shared_storage.dart';
// import 'package:shared_storage/shared_storage.dart'; // TODO: Migrate to another package

class BackupGeneral {
static showInfoSnackbar(String message) {
Expand Down Expand Up @@ -132,18 +132,20 @@ class BackupGeneral {
}

static Future<Uri?> pickFileAndroid() async {
final selectedUris = await openDocument(multiple: false);
// TODO: Migrate to another package
// final selectedUris = await openDocument(multiple: false);

if (selectedUris == null || selectedUris.isEmpty) return null;
// if (selectedUris == null || selectedUris.isEmpty) return null;

return selectedUris[0];
// return selectedUris[0];
}

static Future<Uint8List?> pickFileAndGetContent() async {
if (Platform.isAndroid) {
final fileLocation = await pickFileAndroid();
if (fileLocation != null) {
return await getDocumentContent(fileLocation);
// TODO: Migrate to another package
// return await getDocumentContent(fileLocation);
}
} else if (Platform.isIOS) {
FilePickerResult? result = await FilePicker.platform.pickFiles();
Expand Down
5 changes: 3 additions & 2 deletions lib/core/helpers/backup/backup_import.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:openreads/core/constants/constants.dart';
import 'package:openreads/logic/cubit/backup_progress_cubit.dart';
import 'package:openreads/ui/books_screen/books_screen.dart';
import 'package:shared_storage/shared_storage.dart';
// import 'package:shared_storage/shared_storage.dart'; // TODO: Migrate to another package
import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart' as path;
import 'package:blurhash_dart/blurhash_dart.dart' as blurhash_dart;
Expand Down Expand Up @@ -89,7 +89,8 @@ class BackupImport {
fileLocation = await BackupGeneral.pickFileAndroid();

if (fileLocation != null) {
backupFile = await getDocumentContent(fileLocation);
// TODO: Migrate to another package
// backupFile = await getDocumentContent(fileLocation);
}
} else if (Platform.isIOS) {
FilePickerResult? result = await FilePicker.platform.pickFiles();
Expand Down
35 changes: 18 additions & 17 deletions lib/core/helpers/backup/csv_export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import 'package:flutter/material.dart';

import 'package:csv/csv.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:shared_storage/shared_storage.dart';
// import 'package:shared_storage/shared_storage.dart'; // TODO: Migrate to another package


import 'package:openreads/core/constants/enums/enums.dart';
import 'package:openreads/core/helpers/backup/backup.dart';
Expand All @@ -28,12 +27,13 @@ class CSVExport {
final filePath = '$exportPath/$fileName';

try {
createFileAsBytes(
Uri(path: filePath),
mimeType: 'text/csv',
displayName: fileName,
bytes: Uint8List.fromList(utf8.encode(csv)),
);
// TODO: Migrate to another package
// createFileAsBytes(
// Uri(path: filePath),
// mimeType: 'text/csv',
// displayName: fileName,
// bytes: Uint8List.fromList(utf8.encode(csv)),
// );

BackupGeneral.showInfoSnackbar(LocaleKeys.export_successful.tr());
} catch (e) {
Expand All @@ -50,16 +50,17 @@ class CSVExport {

try {
if (Platform.isAndroid) {
final selectedUriDir = await openDocumentTree();
// TODO: Migrate to another package
// final selectedUriDir = await openDocumentTree();

if (selectedUriDir == null) return;
// if (selectedUriDir == null) return;

createFileAsBytes(
selectedUriDir,
mimeType: 'text/csv',
displayName: fileName,
bytes: csv,
);
// createFileAsBytes(
// selectedUriDir,
// mimeType: 'text/csv',
// displayName: fileName,
// bytes: csv,
// );
} else if (Platform.isIOS) {
final directory = await getApplicationDocumentsDirectory();
String path = '${directory.path}/$fileName';
Expand Down
8 changes: 0 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1093,14 +1093,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.4.1"
shared_storage:
dependency: "direct main"
description:
name: shared_storage
sha256: cf20428d06af065311b71e09cbfbbfe431e979a3bf9180001c1952129b7c708f
url: "https://pub.dev"
source: hosted
version: "0.8.1"
sky_engine:
dependency: transitive
description: flutter
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ dependencies:
image_fade: ^0.6.2
package_info_plus: ^8.0.0
animated_widgets: ^1.1.0
shared_storage: ^0.8.0
shared_preferences: ^2.2.1
easy_localization: ^3.0.7
flutter_typeahead: ^5.0.1
Expand Down
2 changes: 1 addition & 1 deletion submodules/flutter
Submodule flutter updated 108 files

0 comments on commit 537aef0

Please sign in to comment.