Skip to content

Commit

Permalink
Increase minSdkVersion to 23
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Jan 7, 2025
1 parent 0207378 commit 704c794
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ android {

defaultConfig {
applicationId "dev.linwood.butterfly"
minSdkVersion 21
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
8 changes: 1 addition & 7 deletions app/lib/api/save.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'dart:io';

import 'package:butterfly/helpers/asset.dart';
import 'package:butterfly_api/butterfly_api.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -77,10 +74,7 @@ Future<void> exportData(BuildContext context, List<int> bytes,
Future<void> writeClipboardData(ClipboardManager clipboardManager,
AssetFileType type, Uint8List data) async {
final clipboard = SystemClipboard.instance;
if (clipboard != null &&
!kIsWeb &&
(!Platform.isAndroid ||
(await DeviceInfoPlugin().androidInfo).version.sdkInt >= 23)) {
if (clipboard != null) {
final item = DataWriterItem();
final format = type.getClipboardFormats().first;
item.add(format(data));
Expand Down
6 changes: 1 addition & 5 deletions app/lib/cubits/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ part 'settings.g.dart';

const kDefaultIceServers = ['stunserver.stunprotocol.org:3478'];

const secureStorage = FlutterSecureStorage(
aOptions: AndroidOptions(
encryptedSharedPreferences: true,
),
);
const secureStorage = FlutterSecureStorage();
const kRecentHistorySize = 5;

enum ToolbarSize {
Expand Down
8 changes: 2 additions & 6 deletions app/lib/services/import.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'dart:ui' as ui;

import 'package:archive/archive.dart';
import 'package:butterfly/api/file_system.dart';
import 'package:butterfly/api/image.dart';
import 'package:butterfly/helpers/asset.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:image/image.dart' as img;
import 'package:butterfly/bloc/document_bloc.dart';
Expand Down Expand Up @@ -174,10 +173,7 @@ class ImportService {
Uint8List? data;
AssetFileType? type;
final clipboard = SystemClipboard.instance;
if (clipboard != null &&
!kIsWeb &&
(!Platform.isAndroid ||
(await DeviceInfoPlugin().androidInfo).version.sdkInt >= 23)) {
if (clipboard != null) {
final reader = await clipboard.read();
final result = AssetFileType.values
.map((e) {
Expand Down
7 changes: 1 addition & 6 deletions app/lib/services/network.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'dart:math';

import 'package:butterfly/bloc/document_bloc.dart';
import 'package:butterfly_api/butterfly_api.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:networker/networker.dart';
Expand All @@ -22,13 +21,9 @@ enum NetworkingSide {
}

enum NetworkingType {
webSocket,
webRtc;
webSocket;

Future<bool> isCompatible() async => switch (this) {
NetworkingType.webRtc => kIsWeb ||
!Platform.isAndroid ||
(await DeviceInfoPlugin().androidInfo).version.sdkInt >= 28,
NetworkingType.webSocket => !kIsWeb,
};
}
Expand Down
10 changes: 2 additions & 8 deletions app/lib/visualizer/tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:butterfly/visualizer/icon.dart';
import 'package:butterfly/visualizer/property.dart';
import 'package:butterfly_api/butterfly_api.dart';
import 'package:butterfly_api/butterfly_models.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -180,14 +179,9 @@ extension ImportTypeVisualizer on ImportType {
};

Future<bool> isAvailable() async {
final androidVersion = !kIsWeb && Platform.isAndroid
? (await DeviceInfoPlugin().androidInfo).version.sdkInt
: 0;
return switch (this) {
ImportType.camera => kIsWeb ||
Platform.isWindows ||
(Platform.isAndroid && androidVersion >= 21) ||
Platform.isIOS,
ImportType.camera =>
kIsWeb || Platform.isWindows || Platform.isAndroid || Platform.isIOS,
_ => true,
};
}
Expand Down
2 changes: 1 addition & 1 deletion app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ packages:
source: hosted
version: "0.7.10"
device_info_plus:
dependency: "direct main"
dependency: transitive
description:
name: device_info_plus
sha256: "4fa68e53e26ab17b70ca39f072c285562cfc1589df5bb1e9295db90f6645f431"
Expand Down
1 change: 0 additions & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ dependencies:
dynamic_color: ^1.7.0
popover: ^0.3.0
markdown: ^7.2.2
device_info_plus: ^11.1.0
image: ^4.1.7
one_dollar_unistroke_recognizer: ^1.2.0
super_clipboard: ^0.9.0-dev.4
Expand Down
3 changes: 2 additions & 1 deletion metadata/en-US/changelogs/129.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* Fix export button in data settings not working
* Fix export button for file view not visible
* Update secure storage dependency
* Use minSdkVersion 23 instead of 21 (The minimum version of android is 6.0 (Marshmallow))

Read more here: https://linwood.dev/butterfly/2.3.0-beta.0
Read more here: https://linwood.dev/butterfly/2.3.0-beta.1

0 comments on commit 704c794

Please sign in to comment.