Skip to content

Commit

Permalink
bak
Browse files Browse the repository at this point in the history
  • Loading branch information
timzaak committed Aug 8, 2023
1 parent 591b0f4 commit 5031e59
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ jobs:
encodedString: ${{ secrets.KEYSTORE_BASE64 }}
- name: Create key.properties
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/sign.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/sign.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/sign.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/sign.properties
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > app/android/sign.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> app/android/sign.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> app/android/sign.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> app/android/sign.properties
- name: Build
run: make release-android
- name: Upload artifact
Expand Down
13 changes: 12 additions & 1 deletion app/lib/mobile_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:for_net_ui/native/extra_ffi.dart';
import 'package:for_net_ui/native/ffi.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as p;
import 'package:permission_handler/permission_handler.dart';

void mobileRun() {
runApp(MaterialApp(
Expand All @@ -18,6 +19,16 @@ class MobileApp extends StatelessWidget {
Key? key,
}) : super(key: key);


startService(BuildContext context) async {
if(await Permission.notification.request().isGranted) {
await AndroidFFI.instance.invokeMethod('init_vpn_service');
}else {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text("Service must be run with notification permission"),
));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -37,7 +48,7 @@ class MobileApp extends StatelessWidget {
print('finish init....');
}, child: const Text('Test')),
ElevatedButton(onPressed: ()async {
await AndroidFFI.instance.invokeMethod('init_vpn_service');
await startService(context);
}, child: const Text('Start Service')),
ElevatedButton(onPressed: ()async {
await AndroidFFI.instance.invokeMethod('stop_vpn_service');
Expand Down

0 comments on commit 5031e59

Please sign in to comment.