~repos /only-bible-app

#kotlin#android#ios

git clone https://pyrossh.dev/repos/only-bible-app.git

The only bible app you will ever need. No ads. No in-app purchases. No distractions.


ab2c8e4b pyrossh

2 years ago
remove env package
.github/workflows/build.yml CHANGED
@@ -17,14 +17,9 @@ jobs:
17
17
  flutter-version: '3.13.0'
18
18
  channel: 'stable'
19
19
  cache: true
20
- - uses: SpicyPizza/create-envfile@v2.0
21
- with:
22
- envkey_TTS_SUBSCRIPTION_KEY: ${{ secrets.TTS_SUBSCRIPTION_KEY }}
23
- envkey_RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
24
20
  - run: flutter --version
25
21
  - run: flutter pub get
26
- - run: flutter build web
27
- - run: cp .env build/web/assets
22
+ - run: flutter build web --dart-define=TTS_SUBSCRIPTION_KEY=${{ secrets.TTS_SUBSCRIPTION_KEY }} --dart-define=RESEND_API_KEY=${{ secrets.RESEND_API_KEY }}
28
23
  - uses: actions/upload-pages-artifact@v1
29
24
  with:
30
25
  path: build/web
lib/env.dart ADDED
@@ -0,0 +1,9 @@
1
+ abstract class Env {
2
+ static const String ttsSubscriptionKey = String.fromEnvironment(
3
+ "TTS_SUBSCRIPTION_KEY",
4
+ );
5
+
6
+ static const String resendApiKey = String.fromEnvironment(
7
+ "RESEND_API_KEY",
8
+ );
9
+ }
lib/main.dart CHANGED
@@ -2,11 +2,11 @@ import "package:flutter/material.dart";
2
2
  import "package:flutter/foundation.dart";
3
3
  import "package:flutter/scheduler.dart";
4
4
  import "package:flutter_azure_tts/flutter_azure_tts.dart";
5
- import "package:flutter_dotenv/flutter_dotenv.dart";
6
5
  import "package:flutter_web_plugins/url_strategy.dart";
7
6
  import "package:flutter_native_splash/flutter_native_splash.dart";
8
7
  import "package:only_bible_app/app.dart";
9
8
  import "package:only_bible_app/dialog.dart";
9
+ import "package:only_bible_app/env.dart";
10
10
  import "package:only_bible_app/navigation.dart";
11
11
  import "package:only_bible_app/store/state.dart";
12
12
 
@@ -34,9 +34,8 @@ void main() async {
34
34
  widgetsBinding: WidgetsFlutterBinding.ensureInitialized(),
35
35
  );
36
36
  usePathUrlStrategy();
37
- await dotenv.load(fileName: ".env");
38
37
  AzureTts.init(
39
- subscriptionKey: dotenv.get("TTS_SUBSCRIPTION_KEY"),
38
+ subscriptionKey: Env.ttsSubscriptionKey,
40
39
  region: "centralindia",
41
40
  withLogs: false,
42
41
  );
lib/screens/chapter_view_screen.dart CHANGED
@@ -1,6 +1,6 @@
1
1
  import "package:flutter/material.dart";
2
2
  import "package:only_bible_app/models.dart";
3
- import 'package:only_bible_app/store/state.dart';
3
+ import "package:only_bible_app/store/state.dart";
4
4
  import "package:only_bible_app/utils.dart";
5
5
  import "package:only_bible_app/widgets/chapter_app_bar.dart";
6
6
  import "package:only_bible_app/widgets/sidebar.dart";
lib/utils.dart CHANGED
@@ -1,8 +1,8 @@
1
1
  import "dart:convert";
2
- import "package:flutter_dotenv/flutter_dotenv.dart";
3
2
  import "package:http/http.dart" as http;
4
3
  import "package:flutter/services.dart";
5
4
  import "package:only_bible_app/dialog.dart";
5
+ import "package:only_bible_app/env.dart";
6
6
  import "package:only_bible_app/models.dart";
7
7
  import "package:only_bible_app/store/state.dart";
8
8
  import "package:url_launcher/url_launcher.dart";
@@ -203,13 +203,11 @@ recordError(String message, StackTrace? stack) async {
203
203
  print("ERROR STACK: ${stack.toString()}");
204
204
  return;
205
205
  }
206
- await Future.delayed(Duration(seconds: 2));
207
- final apiKey = dotenv.get("RESEND_API_KEY");
208
206
  final url = Uri.https("api.resend.com", "/emails");
209
207
  final response = await http.post(
210
208
  url,
211
209
  headers: {
212
- "Authorization": "Bearer $apiKey",
210
+ "Authorization": "Bearer ${Env.resendApiKey}",
213
211
  "Content-Type": "application/json",
214
212
  },
215
213
  body: jsonEncode({
pubspec.lock CHANGED
@@ -286,14 +286,6 @@ packages:
286
286
  url: "https://pub.dev"
287
287
  source: hosted
288
288
  version: "0.1.6"
289
- flutter_dotenv:
290
- dependency: "direct main"
291
- description:
292
- name: flutter_dotenv
293
- sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77"
294
- url: "https://pub.dev"
295
- source: hosted
296
- version: "5.1.0"
297
289
  flutter_driver:
298
290
  dependency: transitive
299
291
  description: flutter
pubspec.yaml CHANGED
@@ -29,7 +29,6 @@ dependencies:
29
29
  url_launcher: ^6.1.12
30
30
  package_info_plus: ^4.1.0
31
31
  flutter_azure_tts: ^0.1.6
32
- flutter_dotenv: ^5.1.0
33
32
  http: ^0.13.6
34
33
 
35
34
  dev_dependencies: