Skip to content

Commit

Permalink
fix: android config files for managing storage access
Browse files Browse the repository at this point in the history
  • Loading branch information
saiankit authored and saiankit-hotstar committed Jul 31, 2022
1 parent 16b503c commit f1f6ae3
Show file tree
Hide file tree
Showing 29 changed files with 936 additions and 311 deletions.
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -47,8 +47,8 @@ android {
applicationId "com.example.doxbox"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
minSdkVersion 30
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
9 changes: 8 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.doxbox">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />
<application
android:label="doxbox"
android:requestLegacyExternalStorage="true"
android:label="DoxBox"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">

<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
3 changes: 3 additions & 0 deletions assets/icons/heart_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,26 @@ PODS:
- Toast
- path_provider_ios (0.0.1):
- Flutter
- permission_handler_apple (9.0.4):
- Flutter
- SDWebImage (5.13.2):
- SDWebImage/Core (= 5.13.2)
- SDWebImage/Core (5.13.2)
- share_plus (0.0.1):
- Flutter
- SwiftyGif (5.4.3)
- Toast (4.0.0)
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
trunk:
Expand All @@ -68,6 +77,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluttertoast/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
Expand All @@ -76,9 +91,12 @@ SPEC CHECKSUMS:
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
fluttertoast: 16fbe6039d06a763f3533670197d01fc73459037
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

Expand Down
12 changes: 8 additions & 4 deletions lib/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:doxbox/providers/navBarProvider.dart';
import 'package:doxbox/utilities/colors.dart';
import 'package:doxbox/views/settings/settings_screen.dart';
import 'package:doxbox/views/migrate/settings_screen.dart';
import 'package:doxbox/views/upload/upload_screen.dart';

import 'package:flutter/material.dart';
Expand All @@ -18,15 +18,19 @@ class BottomNavBarScreen extends StatefulWidget {

class _BottomNavBarscreenstate extends State<BottomNavBarScreen> {
static final List<Widget> _widgetOptions = <Widget>[
HomeScreen(),
UploadScreen(),
SettingsScreen(),
const HomeScreen(),
const UploadScreen(),
const SettingsScreen(),
];

@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
),
home: Consumer<BottomNavBarProvider>(
builder: (context, navBarViewModel, _) {
return Scaffold(
Expand Down
26 changes: 12 additions & 14 deletions lib/components/documentCard.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import 'package:clipboard/clipboard.dart';
import 'package:doxbox/models/document.dart';
import 'package:doxbox/models/fakedoc.dart';
import 'package:doxbox/services/database.dart';
import 'package:doxbox/utilities/assets.dart';
import 'package:doxbox/utilities/colors.dart';
import 'package:doxbox/utilities/styles.dart';
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:fluttertoast/fluttertoast.dart';

class DocumentCard extends StatelessWidget {
final Document document;
const DocumentCard({Key? key, required this.document}) : super(key: key);
final int index;
const DocumentCard({Key? key, required this.document, required this.index})
: super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -36,12 +38,12 @@ class DocumentCard extends StatelessWidget {
),
),
IconButton(
onPressed: () {},
icon: Icon(
FeatherIcons.heart,
size: Converts.c16,
color: Colors.white,
),
onPressed: () {
AppDatabase.toggleFavourite(index, document);
},
icon: document.isFavorite
? AppAssets.heartFilled
: AppAssets.heart,
)
],
),
Expand All @@ -68,11 +70,7 @@ class DocumentCard extends StatelessWidget {
fontSize: 16.0),
);
},
icon: Icon(
FeatherIcons.copy,
size: Converts.c24,
color: Colors.white,
),
icon: AppAssets.copy,
)
],
),
Expand Down
2 changes: 2 additions & 0 deletions lib/components/textField.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CustomTextField extends StatelessWidget {
padding: EdgeInsets.symmetric(vertical: Converts.c8),
child: TextField(
controller: nameDetailController,
textInputAction: TextInputAction.next,
style: TextStyles.t16.apply(color: Colors.white),
decoration: InputDecoration(
label: Text(
Expand All @@ -38,6 +39,7 @@ class CustomTextField extends StatelessWidget {
padding: EdgeInsets.symmetric(vertical: Converts.c8),
child: TextField(
controller: contentDetailController,
textInputAction: TextInputAction.done,
style: TextStyles.t16.apply(color: Colors.white),
decoration: InputDecoration(
label: Text(
Expand Down
2 changes: 0 additions & 2 deletions lib/config/size_config.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

Expand Down
8 changes: 2 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ import 'package:doxbox/models/detail.dart';
import 'package:doxbox/models/document.dart';
import 'package:doxbox/utilities/colors.dart';
import 'package:doxbox/utilities/styles.dart';
import 'package:doxbox/views/upload/upload_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';

import 'package:doxbox/views/home/home_screen.dart';
import 'package:hive/hive.dart';

import 'package:path_provider/path_provider.dart' as path_provider;
Expand Down Expand Up @@ -56,11 +52,11 @@ class _MyAppState extends State<MyApp> {
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError)
return Center(
return const Center(
child: Text('Something Went Wrong'),
);
else
return BottomNavBarScreen();
return const BottomNavBarScreen();
}

return MaterialApp(
Expand Down
12 changes: 10 additions & 2 deletions lib/models/document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@ part 'document.g.dart';
@HiveType(typeId: 0)
class Document {
@HiveField(0)
final String title;
final String id;

@HiveField(1)
final Detail primaryDetail;
final String title;

@HiveField(2)
final Detail primaryDetail;

@HiveField(3)
final List<Detail> details;

@HiveField(4)
final bool isFavorite;

Document({
required this.id,
required this.title,
required this.primaryDetail,
required this.details,
required this.isFavorite,
});
}
20 changes: 13 additions & 7 deletions lib/models/document.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 0 additions & 40 deletions lib/models/fakedoc.dart

This file was deleted.

23 changes: 0 additions & 23 deletions lib/providers/database.dart

This file was deleted.

15 changes: 10 additions & 5 deletions lib/providers/fieldsProvider.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import 'package:doxbox/utilities/colors.dart';
import 'package:doxbox/utilities/styles.dart';
import 'package:flutter/material.dart';
import 'package:uuid/uuid.dart';

import 'package:doxbox/components/textField.dart';
import 'package:doxbox/models/detail.dart';
import 'package:doxbox/models/document.dart';
import 'package:doxbox/providers/database.dart';
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:doxbox/services/database.dart';

class FieldsProvider extends ChangeNotifier {
List<List<TextEditingController>> controllers = [];
List<CustomTextField> detailFields = [];
List<dynamic> detailFields = [];

final primaryNameDetailController = TextEditingController();
final primaryContentDetailController = TextEditingController();
Expand All @@ -28,13 +31,15 @@ class FieldsProvider extends ChangeNotifier {

void addDocument() {
final newDocument = Document(
id: const Uuid().v1(),
title: documentDetailController.text,
primaryDetail: Detail(
name: primaryNameDetailController.text,
content: primaryContentDetailController.text),
details: [],
isFavorite: false,
);
for (int i = 0; i < detailFields.length; ++i) {
for (int i = 0; i < detailFields.length - 3; ++i) {
newDocument.details.add(Detail(
name: controllers[i][0].text, content: controllers[i][1].text));
}
Expand Down
Loading

0 comments on commit f1f6ae3

Please sign in to comment.