Skip to content

Commit

Permalink
chore: upgrade packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Jan 19, 2023
1 parent 1cc6453 commit 675c582
Show file tree
Hide file tree
Showing 10 changed files with 262 additions and 153 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
}
}
Expand Down
71 changes: 71 additions & 0 deletions lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;

/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
return web;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for ios - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}

static const FirebaseOptions web = FirebaseOptions(
apiKey: 'AIzaSyD7J47vzvzUnAp015DeHhMsBhEs68eDjWw',
appId: '1:375733449982:web:c54f802d4860a7e9a061af',
messagingSenderId: '375733449982',
projectId: 'vertretung-b5742',
authDomain: 'vertretung-b5742.firebaseapp.com',
databaseURL: 'https://vertretung-b5742.firebaseio.com',
storageBucket: 'vertretung-b5742.appspot.com',
measurementId: 'G-GL8RZ5JJP1',
);

static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyDFexN4pWnz04vYvtRfoo3k2xWJ__y_xh0',
appId: '1:375733449982:android:d5ee95a7bc5d10a8a061af',
messagingSenderId: '375733449982',
projectId: 'vertretung-b5742',
databaseURL: 'https://vertretung-b5742.firebaseio.com',
storageBucket: 'vertretung-b5742.appspot.com',
);
}
7 changes: 4 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:Vertretung/authentication/account_page.dart';
import 'package:Vertretung/data/my_keys.dart';
import 'package:Vertretung/data/wiredash_keys.dart';
import 'package:Vertretung/firebase_options.dart';
import 'package:Vertretung/friends/friend_list.dart';
import 'package:Vertretung/logic/shared_pref.dart';
import 'package:Vertretung/pages/help_page.dart';
Expand All @@ -11,7 +12,6 @@ import 'package:Vertretung/settings/about_page.dart';
import 'package:Vertretung/settings/settings_page.dart';
import 'package:Vertretung/substitute/substitute_logic.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
Expand All @@ -29,7 +29,8 @@ void main() {
WidgetsFlutterBinding.ensureInitialized();
FirebaseMessaging.onBackgroundMessage(_handleBackgroundNotification);
setPathUrlStrategy();
Firebase.initializeApp().then((value) async {
Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform)
.then((value) async {
if (!kIsWeb) {
await FirebaseCrashlytics.instance
.setCrashlyticsCollectionEnabled(!kDebugMode);
Expand Down Expand Up @@ -66,7 +67,7 @@ class MyAppSt extends StatelessWidget {
child: MaterialApp(
navigatorKey: MyKeys.navigatorKey,
navigatorObservers: [
FirebaseAnalyticsObserver(analytics: FirebaseAnalytics()),
FirebaseAnalyticsObserver(analytics: FirebaseAnalytics.instance),
],
theme: lightTheme,
darkTheme: darkTheme,
Expand Down
2 changes: 1 addition & 1 deletion lib/otherWidgets/school_class_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _SchoolClassSelectionState extends State<SchoolClassSelection> {
await push.unsubTopic(oldSchoolClass);
}
push.subTopic(newSchoolClass);
FirebaseAnalytics()
FirebaseAnalytics.instance
.setUserProperty(name: "schoolClass", value: newSchoolClass);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/services/auth_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class AuthService {
EmailAuthProvider.credential(email: email, password: password);
try {
await user.linkWithCredential(credential);
FirebaseAnalytics().logSignUp(signUpMethod: "email");
FirebaseAnalytics.instance.logSignUp(signUpMethod: "email");
} on FirebaseAuthException catch (e) {
switch (e.code) {
case "weak-password":
Expand Down Expand Up @@ -110,7 +110,7 @@ class AuthService {
Future<String> signInEmail({String email, String password}) async {
try {
await _auth.signInWithEmailAndPassword(email: email, password: password);
FirebaseAnalytics().logLogin(loginMethod: "email");
FirebaseAnalytics.instance.logLogin(loginMethod: "email");
} on FirebaseAuthException catch (e) {
switch (e.code) {
case "invalid-email":
Expand Down
9 changes: 5 additions & 4 deletions lib/services/dynamic_link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class DynamicLink {
if (data != null) _handleDeepLink(data, true);

//if app gets to foreground because auf that link
FirebaseDynamicLinks.instance.onLink(
onSuccess: (PendingDynamicLinkData dynamicLinkData) async {
FirebaseDynamicLinks.instance.onLink.listen(
(PendingDynamicLinkData dynamicLinkData) async {
_handleDeepLink(dynamicLinkData, false);
},
onError: (OnLinkErrorException e) {
onError: (e) {
print("Error: ${e.message}");
},
);
Expand Down Expand Up @@ -51,7 +51,8 @@ class DynamicLink {
fallbackUrl: Uri.parse("https://info-vertretung-whg.web.app"),
),
);
final ShortDynamicLink shortDynamicUrl = await parameters.buildShortLink();
final ShortDynamicLink shortDynamicUrl =
await FirebaseDynamicLinks.instance.buildShortLink(parameters);
return shortDynamicUrl.shortUrl.toString();
}
}
2 changes: 1 addition & 1 deletion lib/substitute/substitute_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class SubstituteListTile extends StatelessWidget {
}

share(BuildContext context) {
FirebaseAnalytics analytics = FirebaseAnalytics();
FirebaseAnalytics analytics = FirebaseAnalytics.instance;
analytics.logShare(
contentType: substitute.names == null ? "SubstitutePage" : "FriendsPage",
method: "button pressed",
Expand Down
Loading

0 comments on commit 675c582

Please sign in to comment.