Skip to content

Commit

Permalink
Release 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Stackflow committed Aug 23, 2024
1 parent d33fb52 commit d5caa5e
Show file tree
Hide file tree
Showing 53 changed files with 731 additions and 612 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ app.*.map.json
cloudotp.db

/assets/fonts/**

/releases/**
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ This is an awesome two-factor authenticator based on Flutter for Android and Win

## Screenshots

<img src="art/lightmode.jpg" alt="Light Mode" style="zoom: 25%;" /><img src="art/darkmode.jpg" alt="Dark Mode" style="zoom: 25%;" /><img src="art/addtoken.jpg" alt="Add Token" style="zoom: 25%;" />
<img src="tools/art/lightmode.jpg" alt="Light Mode" style="zoom: 25%;" /><img src="tools/art/darkmode.jpg" alt="Dark Mode" style="zoom: 25%;" /><img src="tools/art/addtoken.jpg" alt="Add Token" style="zoom: 25%;" />

<img src="art/setting.jpg" alt="Setting" style="zoom: 25%;" /><img src="art/theme.jpg" alt="Theme" style="zoom: 25%;" /><img src="art/lock.jpg" alt="Lock" style="zoom: 25%;" />
<img src="tools/art/setting.jpg" alt="Setting" style="zoom: 25%;" /><img src="tools/art/theme.jpg" alt="Theme" style="zoom: 25%;" /><img src="tools/art/lock.jpg" alt="Lock" style="zoom: 25%;" />

<img src="art/export_import.jpg" alt="Export and Import" style="zoom: 25%;" /><img src="art/dropbox.jpg" alt="Dropbox" style="zoom: 25%;" />
<img src="tools/art/export_import.jpg" alt="Export and Import" style="zoom: 25%;" /><img src="tools/art/dropbox.jpg" alt="Dropbox" style="zoom: 25%;" />
6 changes: 3 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

## Screenshots

<img src="art/lightmode.jpg" alt="Light Mode" style="zoom: 25%;" /><img src="art/darkmode.jpg" alt="Dark Mode" style="zoom: 25%;" /><img src="art/addtoken.jpg" alt="Add Token" style="zoom: 25%;" />
<img src="tools/art/lightmode.jpg" alt="Light Mode" style="zoom: 25%;" /><img src="tools/art/darkmode.jpg" alt="Dark Mode" style="zoom: 25%;" /><img src="tools/art/addtoken.jpg" alt="Add Token" style="zoom: 25%;" />

<img src="art/setting.jpg" alt="Setting" style="zoom: 25%;" /><img src="art/theme.jpg" alt="Theme" style="zoom: 25%;" /><img src="art/lock.jpg" alt="Lock" style="zoom: 25%;" />
<img src="tools/art/setting.jpg" alt="Setting" style="zoom: 25%;" /><img src="tools/art/theme.jpg" alt="Theme" style="zoom: 25%;" /><img src="tools/art/lock.jpg" alt="Lock" style="zoom: 25%;" />

<img src="art/export_import.jpg" alt="Export and Import" style="zoom: 25%;" /><img src="art/dropbox.jpg" alt="Dropbox" style="zoom: 25%;" />
<img src="tools/art/export_import.jpg" alt="Export and Import" style="zoom: 25%;" /><img src="tools/art/dropbox.jpg" alt="Dropbox" style="zoom: 25%;" />
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.interpolator:interpolator:1.0.0"
implementation 'com.google.gms:google-services:4.2.0'
}
Binary file added assets/brand/WPS.png
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/brand/kingsoft.png
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/brand/华为.png
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/brand/腾讯云.png
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/brand/金山.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion devtools_options.yaml

This file was deleted.

21 changes: 15 additions & 6 deletions lib/Models/cloud_service_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:convert';

import 'package:cloudotp/TokenUtils/Cloud/cloud_service.dart';
import 'package:cloudotp/TokenUtils/Cloud/googledrive_cloud_service.dart';
import 'package:cloudotp/Utils/app_provider.dart';
import 'package:cloudotp/Utils/cache_util.dart';

import '../TokenUtils/Cloud/dropbox_cloud_service.dart';
Expand All @@ -18,7 +17,8 @@ enum CloudServiceType {
OneDrive,
GoogleDrive,
Dropbox,
S3Cloud,HuaweiCloud;
S3Cloud,
HuaweiCloud;

String get label {
switch (this) {
Expand All @@ -40,6 +40,15 @@ enum CloudServiceType {
static List<String> toStrings() {
return CloudServiceType.values.map((e) => e.label).toList();
}

static List<String> toEnableStrings() {
return [
CloudServiceType.OneDrive.label,
CloudServiceType.Dropbox.label,
CloudServiceType.Webdav.label,
CloudServiceType.S3Cloud.label,
];
}
}

extension CloudServiceTypeExtensionOnint on int {
Expand Down Expand Up @@ -107,13 +116,13 @@ class CloudServiceConfig {
case CloudServiceType.Webdav:
return WebDavCloudService(this);
case CloudServiceType.GoogleDrive:
return GoogleDriveCloudService(rootContext, this);
return GoogleDriveCloudService(this);
case CloudServiceType.OneDrive:
return OneDriveCloudService(rootContext, this);
return OneDriveCloudService(this);
case CloudServiceType.Dropbox:
return DropboxCloudService(rootContext, this);
return DropboxCloudService(this);
case CloudServiceType.HuaweiCloud:
return HuaweiCloudService(rootContext, this);
return HuaweiCloudService(this);
case CloudServiceType.S3Cloud:
return S3CloudService(this);
}
Expand Down
7 changes: 2 additions & 5 deletions lib/Screens/Backup/cloud_service_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,10 @@ class _CloudServiceScreenState extends State<CloudServiceScreen>
physics: const NeverScrollableScrollPhysics(),
controller: pageController,
children: const [
WebDavServiceScreen(),
OneDriveServiceScreen(),
GoogleDriveServiceScreen(),
DropboxServiceScreen(),
WebDavServiceScreen(),
S3CloudServiceScreen(),
HuaweiCloudServiceScreen(),
],
),
),
Expand All @@ -101,14 +99,13 @@ class _CloudServiceScreenState extends State<CloudServiceScreen>
context: context,
topRadius: true,
bottomRadius: true,
padding: const EdgeInsets.only(right: 10),
child: Column(
children: [
ItemBuilder.buildGroupTile(
context: context,
controller: _typeController,
constraintWidth: false,
buttons: CloudServiceType.toStrings(),
buttons: CloudServiceType.toEnableStrings(),
onSelected: (value, index, isSelected) {
setState(() {
_currentType = index.toCloudServiceType;
Expand Down
8 changes: 5 additions & 3 deletions lib/Screens/Backup/dropbox_service_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class _DropboxServiceScreenState extends State<DropboxServiceScreen>
_accountController.text = _dropboxCloudServiceConfig!.account ?? "";
_emailController.text = _dropboxCloudServiceConfig!.email ?? "";
_dropboxCloudService = DropboxCloudService(
context,
_dropboxCloudServiceConfig!,
onConfigChanged: updateConfig,
);
Expand All @@ -70,7 +69,6 @@ class _DropboxServiceScreenState extends State<DropboxServiceScreen>
CloudServiceConfig.init(type: CloudServiceType.Dropbox);
await CloudServiceConfigDao.insertConfig(_dropboxCloudServiceConfig!);
_dropboxCloudService = DropboxCloudService(
context,
_dropboxCloudServiceConfig!,
onConfigChanged: updateConfig,
);
Expand All @@ -87,7 +85,7 @@ class _DropboxServiceScreenState extends State<DropboxServiceScreen>
updateConfig(_dropboxCloudServiceConfig!);
}
inited = true;
setState(() {});
if (mounted) setState(() {});
}

updateConfig(CloudServiceConfig config) {
Expand Down Expand Up @@ -322,6 +320,8 @@ class _DropboxServiceScreenState extends State<DropboxServiceScreen>
text: S.current.webDavLogout,
fontSizeDelta: 2,
onTap: () async {
CustomLoadingDialog.showLoading(
title: S.current.webDavLoggingOut);
await _dropboxCloudService!.signOut();
setState(() {
_dropboxCloudServiceConfig!.connected = false;
Expand All @@ -332,6 +332,8 @@ class _DropboxServiceScreenState extends State<DropboxServiceScreen>
_dropboxCloudServiceConfig!.usedSize = -1;
updateConfig(_dropboxCloudServiceConfig!);
});
CustomLoadingDialog.dismissLoading();
IToast.show(S.current.webDavLogoutSuccess);
},
),
),
Expand Down
2 changes: 0 additions & 2 deletions lib/Screens/Backup/googledrive_service_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class _GoogleDriveServiceScreenState extends State<GoogleDriveServiceScreen>
_accountController.text = _googledriveCloudServiceConfig!.account ?? "";
_emailController.text = _googledriveCloudServiceConfig!.email ?? "";
_googledriveCloudService = GoogleDriveCloudService(
context,
_googledriveCloudServiceConfig!,
onConfigChanged: updateConfig,
);
Expand All @@ -72,7 +71,6 @@ class _GoogleDriveServiceScreenState extends State<GoogleDriveServiceScreen>
CloudServiceConfig.init(type: CloudServiceType.GoogleDrive);
await CloudServiceConfigDao.insertConfig(_googledriveCloudServiceConfig!);
_googledriveCloudService = GoogleDriveCloudService(
context,
_googledriveCloudServiceConfig!,
onConfigChanged: updateConfig,
);
Expand Down
2 changes: 0 additions & 2 deletions lib/Screens/Backup/huawei_service_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class _HuaweiCloudServiceScreenState extends State<HuaweiCloudServiceScreen>
_sizeController.text = _huaweiCloudCloudServiceConfig!.size;
_accountController.text = _huaweiCloudCloudServiceConfig!.account ?? "";
_huaweiCloudCloudService = HuaweiCloudService(
context,
_huaweiCloudCloudServiceConfig!,
onConfigChanged: updateConfig,
);
Expand All @@ -68,7 +67,6 @@ class _HuaweiCloudServiceScreenState extends State<HuaweiCloudServiceScreen>
CloudServiceConfig.init(type: CloudServiceType.HuaweiCloud);
await CloudServiceConfigDao.insertConfig(_huaweiCloudCloudServiceConfig!);
_huaweiCloudCloudService = HuaweiCloudService(
context,
_huaweiCloudCloudServiceConfig!,
onConfigChanged: updateConfig,
);
Expand Down
5 changes: 3 additions & 2 deletions lib/Screens/Backup/onedrive_service_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class _OneDriveServiceScreenState extends State<OneDriveServiceScreen>
_accountController.text = _oneDriveCloudServiceConfig!.account ?? "";
_emailController.text = _oneDriveCloudServiceConfig!.email ?? "";
_oneDriveCloudService = OneDriveCloudService(
context,
_oneDriveCloudServiceConfig!,
onConfigChanged: updateConfig,
);
Expand All @@ -71,7 +70,6 @@ class _OneDriveServiceScreenState extends State<OneDriveServiceScreen>
CloudServiceConfig.init(type: CloudServiceType.OneDrive);
await CloudServiceConfigDao.insertConfig(_oneDriveCloudServiceConfig!);
_oneDriveCloudService = OneDriveCloudService(
context,
_oneDriveCloudServiceConfig!,
onConfigChanged: updateConfig,
);
Expand Down Expand Up @@ -335,6 +333,7 @@ class _OneDriveServiceScreenState extends State<OneDriveServiceScreen>
text: S.current.webDavLogout,
fontSizeDelta: 2,
onTap: () async {
CustomLoadingDialog.showLoading(title: S.current.webDavLoggingOut);
await _oneDriveCloudService!.signOut();
setState(() {
_oneDriveCloudServiceConfig!.connected = false;
Expand All @@ -345,6 +344,8 @@ class _OneDriveServiceScreenState extends State<OneDriveServiceScreen>
_oneDriveCloudServiceConfig!.usedSize = -1;
updateConfig(_oneDriveCloudServiceConfig!);
});
CustomLoadingDialog.dismissLoading();
IToast.show(S.current.webDavLogoutSuccess);
},
),
),
Expand Down
24 changes: 23 additions & 1 deletion lib/Screens/Setting/about_setting_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,31 @@ class _AboutSettingScreenState extends State<AboutSettingScreen>
UriUtil.launchUrlUri(context, repoUrl);
},
showLeading: true,
bottomRadius: true,
leading: Icons.commit_outlined,
),
ItemBuilder.buildEntryItem(
context: context,
title: S.current.privacyPolicy,
onTap: () {
Locale locale = Localizations.localeOf(context);
UriUtil.launchUrlUri(
context, privacyPolicyUrl + locale.languageCode);
},
showLeading: true,
leading: Icons.privacy_tip_outlined,
),
ItemBuilder.buildEntryItem(
context: context,
title: S.current.serviceTerm,
onTap: () {
Locale locale = Localizations.localeOf(context);
UriUtil.launchUrlUri(
context, serviceTermUrl + locale.languageCode);
},
showLeading: true,
bottomRadius: true,
leading: Icons.topic_outlined,
),
const SizedBox(height: 10),
ItemBuilder.buildEntryItem(
topRadius: true,
Expand Down
26 changes: 25 additions & 1 deletion lib/Screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
@override
void initState() {
super.initState();
initAppName();
initTab(true);
initAppName();
refresh(true);
_searchController.addListener(() {
performSearch(_searchController.text);
Expand Down Expand Up @@ -741,6 +741,19 @@ class HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
}

_buildTab(TokenCategory? category) {
// {
// bool normalUserBold = false,
// bool sameFontSize = false,
// double fontSizeDelta = 0,
// }) {
// TextStyle normalStyle = Theme.of(context).textTheme.titleLarge!.apply(
// color: Colors.grey,
// fontSizeDelta: fontSizeDelta - (sameFontSize ? 0 : 1),
// fontWeightDelta: normalUserBold ? 0 : -2,
// );
// TextStyle selectedStyle = Theme.of(context).textTheme.titleLarge!.apply(
// fontSizeDelta: fontSizeDelta + (sameFontSize ? 0 : 1),
// );
return Tab(
child: ContextMenuRegion(
behavior: ResponsiveUtil.isDesktop()
Expand All @@ -757,8 +770,19 @@ class HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
);
}
},
// child: AnimatedDefaultTextStyle(
// style: (category == null
// ? _currentTabIndex == 0
// : currentCategoryId == category.id)
// ? selectedStyle
// : normalStyle,
// duration: const Duration(milliseconds: 100),
// child: Container(
// alignment: Alignment.center,
child: Text(category?.title ?? S.current.allTokens),
),
// ),
// ),
),
);
}
Expand Down
9 changes: 1 addition & 8 deletions lib/TokenUtils/Cloud/dropbox_cloud_service.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'dart:typed_data';

import 'package:flutter/cupertino.dart';
import 'package:flutter_cloud/dropbox.dart';
import 'package:flutter_cloud/dropbox_response.dart';
import 'package:path/path.dart';

import '../../Models/cloud_service_config.dart';
import '../../Utils/hive_util.dart';
import '../../generated/l10n.dart';
import '../export_token_util.dart';
import 'cloud_service.dart';

Expand All @@ -22,11 +20,9 @@ class DropboxCloudService extends CloudService {
static const String _dropboxPath = '/';
final CloudServiceConfig _config;
late Dropbox dropbox;
late BuildContext context;
Function(CloudServiceConfig)? onConfigChanged;

DropboxCloudService(
this.context,
this._config, {
this.onConfigChanged,
}) {
Expand All @@ -46,10 +42,7 @@ class DropboxCloudService extends CloudService {
Future<CloudServiceStatus> authenticate() async {
bool isAuthorized = await dropbox.isConnected();
if (!isAuthorized) {
isAuthorized = await dropbox.connect(
context,
windowName: S.current.cloudTypeDropboxAuthenticateWindowName,
);
isAuthorized = await dropbox.connect();
}
if (isAuthorized) {
DropboxUserInfo? info = await fetchInfo();
Expand Down
Loading

0 comments on commit d5caa5e

Please sign in to comment.