Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Solvro/topwr-mobile into main
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-the-shark committed Sep 24, 2024
2 parents 2f9f8b0 + 5285a0b commit bbc2547
Show file tree
Hide file tree
Showing 16 changed files with 296 additions and 2 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ analyzer:
- "**/*.gen.dart"
- "**/*.graphql.dart"
- "**/*.icons.dart"
- "**/firebase_options.dart"
47 changes: 47 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"project_info": {
"project_number": "399902347530",
"project_id": "topwr-a2066",
"storage_bucket": "topwr-a2066.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:399902347530:android:54f57104b4011528db2af3",
"android_client_info": {
"package_name": "com.solvro.topwr"
}
},
"oauth_client": [
{
"client_id": "399902347530-u4rvugj7gmcan53gma2u0j6ii2uruh6n.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAR3ysGBw3Nz5L85-rfgSGH_4RWlEUHDPM"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "399902347530-u4rvugj7gmcan53gma2u0j6ii2uruh6n.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "399902347530-1pdnhl4c0fmk62pulk4vomp5jbd0ovcj.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.solvro.ToPwr",
"app_store_id": "1644647395"
}
}
]
}
}
}
],
"configuration_version": "1"
}
28 changes: 28 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
E4D1DC503BA93E72C699AB49 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0E48F61A398F12E3C345EB41 /* GoogleService-Info.plist */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -43,6 +44,7 @@

/* Begin PBXFileReference section */
07A164151074C96F7113FDEE /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
0E48F61A398F12E3C345EB41 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
1856337164D1E003865A7BB0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -138,6 +140,7 @@
331C8082294A63A400263BE5 /* RunnerTests */,
2E79EC3007437A6282FF92AC /* Pods */,
8A7DB4AE981D1179FFBFF6CF /* Frameworks */,
0E48F61A398F12E3C345EB41 /* GoogleService-Info.plist */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -201,6 +204,7 @@
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
C25C982F25BE0C677CF22079 /* [CP] Embed Pods Frameworks */,
CF84BF477A0DA77C07C12289 /* [CP] Copy Pods Resources */,
3A7A20ADF483C21D5CB4FADC /* [firebase_crashlytics] Crashlytics Upload Symbols */,
);
buildRules = (
);
Expand Down Expand Up @@ -266,12 +270,36 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
E4D1DC503BA93E72C699AB49 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
3A7A20ADF483C21D5CB4FADC /* [firebase_crashlytics] Crashlytics Upload Symbols */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}\"",
"\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/\"",
"\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist\"",
"\"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)\"",
"\"$(PROJECT_DIR)/firebase_app_id_file.json\"",
);
name = "[firebase_crashlytics] Crashlytics Upload Symbols";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$PODS_ROOT/FirebaseCrashlytics/upload-symbols\" --flutter-project \"$PROJECT_DIR/firebase_app_id_file.json\" ";
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
Expand Down
34 changes: 34 additions & 0 deletions ios/Runner/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>399902347530-1pdnhl4c0fmk62pulk4vomp5jbd0ovcj.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.399902347530-1pdnhl4c0fmk62pulk4vomp5jbd0ovcj</string>
<key>API_KEY</key>
<string>AIzaSyBaDwyDAki28oTuwVc4Vg9_ZYQClzChxWE</string>
<key>GCM_SENDER_ID</key>
<string>399902347530</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.solvro.ToPwr</string>
<key>PROJECT_ID</key>
<string>topwr-a2066</string>
<key>STORAGE_BUCKET</key>
<string>topwr-a2066.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:399902347530:ios:46a00f036bf46d80db2af3</string>
</dict>
</plist>
7 changes: 7 additions & 0 deletions ios/firebase_app_id_file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"file_generated_by": "FlutterFire CLI",
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
"GOOGLE_APP_ID": "1:399902347530:ios:46a00f036bf46d80db2af3",
"FIREBASE_PROJECT_ID": "topwr-a2066",
"GCM_SENDER_ID": "399902347530"
}
9 changes: 8 additions & 1 deletion lib/features/guide_view/guide_view.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import "package:auto_route/auto_route.dart";
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:flutter/material.dart";
import "package:flutter_hooks/flutter_hooks.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:wiredash/wiredash.dart";

import "../../../../widgets/my_error_widget.dart";
import "../../config/ui_config.dart";
import "../../config/wiredash.dart";
import "../../firebase_init.dart";
import "../../hooks/use_effect_on_init.dart";
import "../../theme/app_theme.dart";
import "../../utils/context_extensions.dart";
import "../../widgets/search_box_app_bar.dart";
Expand All @@ -19,11 +22,15 @@ import "widgets/guide_grid.dart";
import "widgets/guide_tile.dart";

@RoutePage()
class GuideView extends StatelessWidget {
class GuideView extends HookWidget {
const GuideView({super.key});

@override
Widget build(BuildContext context) {
useEffectOnInit(() {
Future.microtask(requestFCMPermission);
return null;
});
return ProviderScope(
overrides: [
searchGuideControllerProvider,
Expand Down
3 changes: 3 additions & 0 deletions lib/features/splash_screen/splash_screen_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "package:riverpod_annotation/riverpod_annotation.dart";

import "../../api_base/hive_init.dart";
import "../../config/ui_config.dart";
import "../../firebase_init.dart";
import "../home_view/widgets/logo_app_bar.dart";

part "splash_screen_controller.g.dart";
Expand All @@ -18,6 +19,8 @@ class SplashScreenController extends _$SplashScreenController {
Insert here any initialization async logic or operations
to be performed, when SplashScreen is showed.
*/
WidgetsFlutterBinding.ensureInitialized();
await firebaseInit();
await initHiveForGraphqlCache();
await AppBarLogo.precacheImageIfAbsent();
}
Expand Down
34 changes: 34 additions & 0 deletions lib/firebase_init.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import "dart:async";

import "package:firebase_core/firebase_core.dart";
import "package:firebase_crashlytics/firebase_crashlytics.dart";
import "package:firebase_messaging/firebase_messaging.dart";
import "package:flutter/foundation.dart";
import "package:logger/logger.dart";

import "firebase_options.dart";

Future<void> firebaseInit() async {
// * General Firebase setup
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
// * Crashlytics setup
if (!kDebugMode) {
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
PlatformDispatcher.instance.onError = (error, stack) {
unawaited(
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true),
);
return true;
};
}

if (kDebugMode) {
unawaited(FirebaseMessaging.instance.getToken().then(Logger().i));
}
}

Future<void> requestFCMPermission() async {
await FirebaseMessaging.instance.requestPermission();
}
83 changes: 83 additions & 0 deletions lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// 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:
return ios;
case TargetPlatform.macOS:
return macos;
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: 'AIzaSyDU1JCqYFVCp0KVVDjAcEOhqBLsHfE2WeM',
appId: '1:399902347530:web:9c8d0eb4e22dbbb7db2af3',
messagingSenderId: '399902347530',
projectId: 'topwr-a2066',
authDomain: 'topwr-a2066.firebaseapp.com',
storageBucket: 'topwr-a2066.appspot.com',
measurementId: 'G-0B5HMNSE0C',
);

static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyAR3ysGBw3Nz5L85-rfgSGH_4RWlEUHDPM',
appId: '1:399902347530:android:54f57104b4011528db2af3',
messagingSenderId: '399902347530',
projectId: 'topwr-a2066',
storageBucket: 'topwr-a2066.appspot.com',
);

static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyBaDwyDAki28oTuwVc4Vg9_ZYQClzChxWE',
appId: '1:399902347530:ios:46a00f036bf46d80db2af3',
messagingSenderId: '399902347530',
projectId: 'topwr-a2066',
storageBucket: 'topwr-a2066.appspot.com',
iosClientId:
'399902347530-1pdnhl4c0fmk62pulk4vomp5jbd0ovcj.apps.googleusercontent.com',
iosBundleId: 'com.solvro.ToPwr',
);

static const FirebaseOptions macos = FirebaseOptions(
apiKey: 'AIzaSyBaDwyDAki28oTuwVc4Vg9_ZYQClzChxWE',
appId: '1:399902347530:ios:3f66b1b8f9cc9742db2af3',
messagingSenderId: '399902347530',
projectId: 'topwr-a2066',
storageBucket: 'topwr-a2066.appspot.com',
iosBundleId: 'pl.edu.pwr.solvro.topwrMobile.RunnerTests',
);
}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import "features/splash_screen/splash_screen_controller.dart";
import "theme/app_theme.dart";
import "theme/colors.dart";

void main() async {
void main() {
SplashScreenController.preserveNativeSplashScreen();
runApp(
const ProviderScope(
Expand Down
4 changes: 4 additions & 0 deletions macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
567882F575EDAA28377C9130 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FBD67A3E016849FAD81C2489 /* Pods_RunnerTests.framework */; };
9520EFD72D5A996B48DA3764 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DBBAB499BED1DA0B59817B7C /* GoogleService-Info.plist */; };
F2B3CA506298E7F0FA785529 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A166D3414AEAF30FFE1ABBB /* Pods_Runner.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -87,6 +88,7 @@
88EEDB917D017D8816663BAE /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
B2D8EAE26DF915144364602F /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
DBBAB499BED1DA0B59817B7C /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
FBD67A3E016849FAD81C2489 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -138,6 +140,7 @@
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
59120DD6A9BB026B994DA210 /* Pods */,
DBBAB499BED1DA0B59817B7C /* GoogleService-Info.plist */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -317,6 +320,7 @@
files = (
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
9520EFD72D5A996B48DA3764 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit bbc2547

Please sign in to comment.