Automatic refresh history if something has been uploaded and add fastlane alpha and debug
This commit is contained in:
parent
162137ee10
commit
1adf487782
11 changed files with 102 additions and 31 deletions
|
@ -1,4 +1,7 @@
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 1.0.0+2
|
||||||
|
* Automatic refresh history if something has been uploaded
|
||||||
|
|
||||||
## 1.0.0+1
|
## 1.0.0+1
|
||||||
* Initial release
|
* Initial release
|
|
@ -1,11 +1,22 @@
|
||||||
default_platform(:android)
|
default_platform(:android)
|
||||||
|
|
||||||
platform :android do
|
platform :android do
|
||||||
|
desc "Build Debug"
|
||||||
|
lane :build_debug do
|
||||||
|
sh("#{ENV['PWD']}/fastlane/buildAndroidDebug.sh")
|
||||||
|
end
|
||||||
|
|
||||||
desc "Build"
|
desc "Build"
|
||||||
lane :build do
|
lane :build do
|
||||||
sh("#{ENV['PWD']}/fastlane/buildAndroid.sh")
|
sh("#{ENV['PWD']}/fastlane/buildAndroid.sh")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Deploy a new version to the Google Play as Alpha"
|
||||||
|
lane :alpha do
|
||||||
|
build
|
||||||
|
upload_to_play_store(track: 'alpha', aab: '../build/app/outputs/bundle/release/app-release.aab')
|
||||||
|
end
|
||||||
|
|
||||||
desc "Deploy a new version to the Google Play as Beta"
|
desc "Deploy a new version to the Google Play as Beta"
|
||||||
lane :beta do
|
lane :beta do
|
||||||
build
|
build
|
||||||
|
|
|
@ -16,11 +16,21 @@ or alternatively using `brew install fastlane`
|
||||||
|
|
||||||
# Available Actions
|
# Available Actions
|
||||||
## Android
|
## Android
|
||||||
|
### android build_debug
|
||||||
|
```
|
||||||
|
fastlane android build_debug
|
||||||
|
```
|
||||||
|
Build Debug
|
||||||
### android build
|
### android build
|
||||||
```
|
```
|
||||||
fastlane android build
|
fastlane android build
|
||||||
```
|
```
|
||||||
Build
|
Build
|
||||||
|
### android alpha
|
||||||
|
```
|
||||||
|
fastlane android alpha
|
||||||
|
```
|
||||||
|
Deploy a new version to the Google Play as Alpha
|
||||||
### android beta
|
### android beta
|
||||||
```
|
```
|
||||||
fastlane android beta
|
fastlane android beta
|
||||||
|
|
43
lib/app.dart
43
lib/app.dart
|
@ -4,11 +4,13 @@ import 'package:flutter_translate/localization_provider.dart';
|
||||||
import 'package:flutter_translate/localized_app.dart';
|
import 'package:flutter_translate/localized_app.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'core/enums/refresh_event.dart';
|
||||||
import 'core/manager/dialog_manager.dart';
|
import 'core/manager/dialog_manager.dart';
|
||||||
import 'core/manager/lifecycle_manager.dart';
|
import 'core/manager/lifecycle_manager.dart';
|
||||||
import 'core/models/session.dart';
|
import 'core/models/session.dart';
|
||||||
import 'core/services/dialog_service.dart';
|
import 'core/services/dialog_service.dart';
|
||||||
import 'core/services/navigation_service.dart';
|
import 'core/services/navigation_service.dart';
|
||||||
|
import 'core/services/refresh_service.dart';
|
||||||
import 'core/services/session_service.dart';
|
import 'core/services/session_service.dart';
|
||||||
import 'locator.dart';
|
import 'locator.dart';
|
||||||
import 'ui/app_router.dart';
|
import 'ui/app_router.dart';
|
||||||
|
@ -22,24 +24,27 @@ class MyApp extends StatelessWidget {
|
||||||
|
|
||||||
return LocalizationProvider(
|
return LocalizationProvider(
|
||||||
state: LocalizationProvider.of(context).state,
|
state: LocalizationProvider.of(context).state,
|
||||||
child: StreamProvider<Session>(
|
child: StreamProvider<RefreshEvent>(
|
||||||
initialData: Session.initial(),
|
initialData: null,
|
||||||
create: (context) => locator<SessionService>().sessionController.stream,
|
create: (context) => locator<RefreshService>().refreshHistoryController.stream,
|
||||||
child: LifeCycleManager(
|
child: StreamProvider<Session>(
|
||||||
child: MaterialApp(
|
initialData: Session.initial(),
|
||||||
title: translate('app.title'),
|
create: (context) => locator<SessionService>().sessionController.stream,
|
||||||
builder: (context, child) => Navigator(
|
child: LifeCycleManager(
|
||||||
key: locator<DialogService>().dialogNavigationKey,
|
child: MaterialApp(
|
||||||
onGenerateRoute: (settings) => MaterialPageRoute(builder: (context) => DialogManager(child: child)),
|
title: translate('app.title'),
|
||||||
),
|
builder: (context, child) => Navigator(
|
||||||
theme: ThemeData(
|
key: locator<DialogService>().dialogNavigationKey,
|
||||||
brightness: Brightness.light, primarySwatch: primaryAccentColor, primaryColor: primaryAccentColor),
|
onGenerateRoute: (settings) => MaterialPageRoute(builder: (context) => DialogManager(child: child)),
|
||||||
onGenerateRoute: AppRouter.generateRoute,
|
),
|
||||||
navigatorKey: locator<NavigationService>().navigationKey,
|
theme: ThemeData(
|
||||||
home: StartUpView(),
|
brightness: Brightness.light, primarySwatch: primaryAccentColor, primaryColor: primaryAccentColor),
|
||||||
supportedLocales: localizationDelegate.supportedLocales,
|
onGenerateRoute: AppRouter.generateRoute,
|
||||||
locale: localizationDelegate.currentLocale,
|
navigatorKey: locator<NavigationService>().navigationKey,
|
||||||
)),
|
home: StartUpView(),
|
||||||
));
|
supportedLocales: localizationDelegate.supportedLocales,
|
||||||
|
locale: localizationDelegate.currentLocale,
|
||||||
|
)),
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
lib/core/enums/refresh_event.dart
Normal file
1
lib/core/enums/refresh_event.dart
Normal file
|
@ -0,0 +1 @@
|
||||||
|
enum RefreshEvent { RefreshHistory }
|
13
lib/core/services/refresh_service.dart
Normal file
13
lib/core/services/refresh_service.dart
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import '../enums/refresh_event.dart';
|
||||||
|
|
||||||
|
class RefreshService {
|
||||||
|
StreamController<RefreshEvent> refreshHistoryController = StreamController<RefreshEvent>();
|
||||||
|
|
||||||
|
void addEvent(RefreshEvent event) {
|
||||||
|
if (refreshHistoryController.hasListener) {
|
||||||
|
refreshHistoryController.add(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter_translate/flutter_translate.dart';
|
import 'package:flutter_translate/flutter_translate.dart';
|
||||||
|
@ -6,6 +7,7 @@ import 'package:logger/logger.dart';
|
||||||
import '../../locator.dart';
|
import '../../locator.dart';
|
||||||
import '../datamodels/dialog_response.dart';
|
import '../datamodels/dialog_response.dart';
|
||||||
import '../enums/error_code.dart';
|
import '../enums/error_code.dart';
|
||||||
|
import '../enums/refresh_event.dart';
|
||||||
import '../enums/viewstate.dart';
|
import '../enums/viewstate.dart';
|
||||||
import '../error/rest_service_exception.dart';
|
import '../error/rest_service_exception.dart';
|
||||||
import '../error/service_exception.dart';
|
import '../error/service_exception.dart';
|
||||||
|
@ -15,18 +17,30 @@ import '../models/uploaded_paste.dart';
|
||||||
import '../services/dialog_service.dart';
|
import '../services/dialog_service.dart';
|
||||||
import '../services/file_service.dart';
|
import '../services/file_service.dart';
|
||||||
import '../services/link_service.dart';
|
import '../services/link_service.dart';
|
||||||
|
import '../services/refresh_service.dart';
|
||||||
import '../util/logger.dart';
|
import '../util/logger.dart';
|
||||||
import 'base_model.dart';
|
import 'base_model.dart';
|
||||||
|
|
||||||
class HistoryModel extends BaseModel {
|
class HistoryModel extends BaseModel {
|
||||||
final Logger _logger = getLogger();
|
final Logger _logger = getLogger();
|
||||||
final FileService _fileService = locator<FileService>();
|
final FileService _fileService = locator<FileService>();
|
||||||
|
final RefreshService _refreshService = locator<RefreshService>();
|
||||||
final LinkService _linkService = locator<LinkService>();
|
final LinkService _linkService = locator<LinkService>();
|
||||||
final DialogService _dialogService = locator<DialogService>();
|
final DialogService _dialogService = locator<DialogService>();
|
||||||
|
|
||||||
String errorMessage;
|
StreamSubscription _refreshTriggerSubscription;
|
||||||
|
|
||||||
List<UploadedPaste> pastes = [];
|
List<UploadedPaste> pastes = [];
|
||||||
|
String errorMessage;
|
||||||
|
|
||||||
|
void init() {
|
||||||
|
this._refreshTriggerSubscription = _refreshService.refreshHistoryController.stream.listen((event) {
|
||||||
|
if (event == RefreshEvent.RefreshHistory) {
|
||||||
|
_logger.d('History needs a refresh');
|
||||||
|
getHistory();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Future getHistory() async {
|
Future getHistory() async {
|
||||||
setState(ViewState.Busy);
|
setState(ViewState.Busy);
|
||||||
|
@ -64,7 +78,6 @@ class HistoryModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
pastes.sort((a, b) => a.date.compareTo(b.date));
|
pastes.sort((a, b) => a.date.compareTo(b.date));
|
||||||
|
|
||||||
errorMessage = null;
|
errorMessage = null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e is RestServiceException) {
|
if (e is RestServiceException) {
|
||||||
|
@ -148,4 +161,10 @@ class HistoryModel extends BaseModel {
|
||||||
void openLink(String link) {
|
void openLink(String link) {
|
||||||
_linkService.open(link);
|
_linkService.open(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_refreshTriggerSubscription.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||||
|
|
||||||
import '../../locator.dart';
|
import '../../locator.dart';
|
||||||
import '../enums/error_code.dart';
|
import '../enums/error_code.dart';
|
||||||
|
import '../enums/refresh_event.dart';
|
||||||
import '../enums/viewstate.dart';
|
import '../enums/viewstate.dart';
|
||||||
import '../error/rest_service_exception.dart';
|
import '../error/rest_service_exception.dart';
|
||||||
import '../error/service_exception.dart';
|
import '../error/service_exception.dart';
|
||||||
|
@ -19,6 +20,7 @@ import '../models/rest/uploaded_multi_response.dart';
|
||||||
import '../models/rest/uploaded_response.dart';
|
import '../models/rest/uploaded_response.dart';
|
||||||
import '../services/file_service.dart';
|
import '../services/file_service.dart';
|
||||||
import '../services/link_service.dart';
|
import '../services/link_service.dart';
|
||||||
|
import '../services/refresh_service.dart';
|
||||||
import '../util/logger.dart';
|
import '../util/logger.dart';
|
||||||
import 'base_model.dart';
|
import 'base_model.dart';
|
||||||
|
|
||||||
|
@ -26,6 +28,7 @@ class UploadModel extends BaseModel {
|
||||||
final Logger _logger = getLogger();
|
final Logger _logger = getLogger();
|
||||||
final FileService _fileService = locator<FileService>();
|
final FileService _fileService = locator<FileService>();
|
||||||
final LinkService _linkService = locator<LinkService>();
|
final LinkService _linkService = locator<LinkService>();
|
||||||
|
final RefreshService _refreshService = locator<RefreshService>();
|
||||||
|
|
||||||
TextEditingController _pasteTextController = TextEditingController();
|
TextEditingController _pasteTextController = TextEditingController();
|
||||||
StreamSubscription _intentDataStreamSubscription;
|
StreamSubscription _intentDataStreamSubscription;
|
||||||
|
@ -171,6 +174,7 @@ class UploadModel extends BaseModel {
|
||||||
|
|
||||||
clearCachedFiles();
|
clearCachedFiles();
|
||||||
_pasteTextController.clear();
|
_pasteTextController.clear();
|
||||||
|
_refreshService.addEvent(RefreshEvent.RefreshHistory);
|
||||||
errorMessage = null;
|
errorMessage = null;
|
||||||
return uploadedPasteIds;
|
return uploadedPasteIds;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'core/services/file_service.dart';
|
||||||
import 'core/services/link_service.dart';
|
import 'core/services/link_service.dart';
|
||||||
import 'core/services/navigation_service.dart';
|
import 'core/services/navigation_service.dart';
|
||||||
import 'core/services/permission_service.dart';
|
import 'core/services/permission_service.dart';
|
||||||
|
import 'core/services/refresh_service.dart';
|
||||||
import 'core/services/session_service.dart';
|
import 'core/services/session_service.dart';
|
||||||
import 'core/services/storage_service.dart';
|
import 'core/services/storage_service.dart';
|
||||||
import 'core/viewmodels/about_model.dart';
|
import 'core/viewmodels/about_model.dart';
|
||||||
|
@ -35,6 +36,7 @@ void setupLocator() {
|
||||||
locator.registerLazySingleton(() => FileService());
|
locator.registerLazySingleton(() => FileService());
|
||||||
locator.registerLazySingleton(() => LinkService());
|
locator.registerLazySingleton(() => LinkService());
|
||||||
locator.registerLazySingleton(() => PermissionService());
|
locator.registerLazySingleton(() => PermissionService());
|
||||||
|
locator.registerLazySingleton(() => RefreshService());
|
||||||
|
|
||||||
/// view models
|
/// view models
|
||||||
locator.registerFactory(() => StartUpViewModel());
|
locator.registerFactory(() => StartUpViewModel());
|
||||||
|
|
|
@ -21,7 +21,10 @@ class HistoryView extends StatelessWidget {
|
||||||
var url = Provider.of<Session>(context).url;
|
var url = Provider.of<Session>(context).url;
|
||||||
|
|
||||||
return BaseView<HistoryModel>(
|
return BaseView<HistoryModel>(
|
||||||
onModelReady: (model) => model.getHistory(),
|
onModelReady: (model) {
|
||||||
|
model.init();
|
||||||
|
return model.getHistory();
|
||||||
|
},
|
||||||
builder: (context, model, child) => Scaffold(
|
builder: (context, model, child) => Scaffold(
|
||||||
appBar: MyAppBar(title: Text(translate('titles.history'))),
|
appBar: MyAppBar(title: Text(translate('titles.history'))),
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
|
@ -40,14 +43,6 @@ class HistoryView extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _renderOpenInBrowser(HistoryModel model, String url) {
|
|
||||||
return IconButton(
|
|
||||||
icon: Icon(Icons.open_in_new, color: Colors.blue, textDirection: TextDirection.ltr),
|
|
||||||
onPressed: () {
|
|
||||||
return model.openLink(url);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _render(HistoryModel model, String url) {
|
Widget _render(HistoryModel model, String url) {
|
||||||
List<Widget> cards = List<Widget>();
|
List<Widget> cards = List<Widget>();
|
||||||
|
|
||||||
|
@ -163,4 +158,12 @@ class HistoryView extends StatelessWidget {
|
||||||
physics: AlwaysScrollableScrollPhysics(),
|
physics: AlwaysScrollableScrollPhysics(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _renderOpenInBrowser(HistoryModel model, String url) {
|
||||||
|
return IconButton(
|
||||||
|
icon: Icon(Icons.open_in_new, color: Colors.blue, textDirection: TextDirection.ltr),
|
||||||
|
onPressed: () {
|
||||||
|
return model.openLink(url);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ description: A mobile client for FileBin.
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.0.0+1
|
version: 1.0.0+2
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|
Loading…
Reference in a new issue