Skip to content

Commit e4a5dfd

Browse files
econesaglpinonjosuecapgeminiairhernacapf4bbo
authored
Develop (#781)
* Migration to Notifications as Data dict (#718) * Sp7 682 notifications multilanguage (#719) * Changed notifications and added languages * Get data from backend * notifications fixed and finished * Go Route migration & testing (#720) * initial code * initial changes * From to login to Main page and profile redirects * reload fixed * url fixes and location web cache * dont show drawer, only navigation rail * advances in routes * advances in migration * completed migration for groups and contacts * profile, logout, phone verification, etc * go router migration without onboarding * phone verification migration * Solve test warning problems * User state test passed * login page test passed * contact profile test passed * Contacts page test passed * migration without tests * Friends page test passed * removed non used imports * current page not used anymore * Profile integration test * refactor and dead code elimination * removed dead code and changed names * name changes * homa map page test passed almost all test * Update map_page.dart * Update home_map_page_test.dart * Onboarding test passed * Progress page test passed * Selected contact test passed * Manage groups page test * View group page test * Solve multiple test problems * Groups page test passed * Manage group page passed * Delete unnecessary profile current pages * Update invite wayat with last_release * partial tests of share location service * share location service partial testing * partial testing app_router and delete unused methods * App Router full tested * Rename statusState to locationListener * services tests * Refactor test * Update contact_profile_page.dart * test env file * Update pubspec.yaml Co-authored-by: Eduard Conesa Guerrero <[email protected]> * Fixed mypy issues (#725) * Increase coverage of location listener service (#724) * initial code * initial changes * From to login to Main page and profile redirects * reload fixed * url fixes and location web cache * dont show drawer, only navigation rail * advances in routes * advances in migration * completed migration for groups and contacts * profile, logout, phone verification, etc * go router migration without onboarding * phone verification migration * Solve test warning problems * User state test passed * login page test passed * contact profile test passed * Contacts page test passed * migration without tests * Friends page test passed * removed non used imports * current page not used anymore * Profile integration test * refactor and dead code elimination * removed dead code and changed names * name changes * homa map page test passed almost all test * Update map_page.dart * Update home_map_page_test.dart * Onboarding test passed * Progress page test passed * Selected contact test passed * Manage groups page test * View group page test * Solve multiple test problems * Groups page test passed * Manage group page passed * Delete unnecessary profile current pages * Update invite wayat with last_release * partial tests of share location service * share location service partial testing * partial testing app_router and delete unused methods * App Router full tested * Rename statusState to locationListener * services tests * Refactor test * Update contact_profile_page.dart * test env file * Update pubspec.yaml * location listener service tests Co-authored-by: Eduard Conesa Guerrero <[email protected]> * Update poetry.lock * Missing Types PyYAML * 684 contacts number without prefix should use user prefix (#726) * remove checks in contact_service and added to import phones service with checks of prefix * Updated test for contact service and import phones service * Added condition of start * groups page layout (#728) * 463 own contact appearing in onboarding suggestions (#729) * Added check for user phone in suggestions * update test for suggestions controller and edit_profile_controller * Added test to import_phones_service * Changed 'where' to be an arrow function Co-authored-by: airherna <[email protected]> * Contact profile layout fixed * Manage request errors (500, 400, etc.) (#731) * redirect to error page on request error * Handle exceptions in requests * Fixed profile & edit profile layout (#733) * Fixed profile & edit profile layout * Update fontsize save button in edit profile page * Preferences page layout fixed (#732) * Show dialog if isDesktopOrWeb (#734) * Manage & View Group page fixed layout (#735) * Manage and view group page fixed layout * stay in center when the screen is medium size * Max size to bottom sheet in manage group page * Content added to error page (#737) * Remove push notification tokens no longer valid (#738) * Handle notifications results and remove bad tokens from user profile * Added handle_notifications_response test * fixed sent request layout in web and removed dividers (#739) * fixed sent request layout in web and removed dividers * with a request error goes to the 500 page * fixed profile layout in mid size screen * Check blob exists before delete (#756) * Fixed testing session bugs (#754) * WIP * navigation fixes WIP * fix navigation WIP * groups navigation fix WIP * fix tabbar unexpected null value (flutter bug) * Go walking by default to a contact in android * fix go back with OS in sent requests page * fixed delete account layout * Fixed group save button * Fixed profile save button * update groups after deleting one * removed commented code in manage_group_page * Future<void> annotations in groups_controller * Add additional information to 'hack' solution in contacts_page * fixed tests * 759 contacts profile os back button closes the app (#760) * Update routes to navigation to contact profile from different pages * Correct navigation inside contacts * 751 push notifications not received (#762) * Refactor Notifications Service * Update generate_coverage * International notifications * Feature/cache locations reduce reads (#761) * New algorithm * Reordering to avoid loops * Check share_location * Refactor user * Revert "Refactor user" This reverts commit e65437f. * Use location cache to reduce reads * Cache as variable * Fixed cache dict update * Add type check to MimeType (#764) * remove duplicate code * Temporally avoid test * fixed search bar does not move on tap & delete group optimistic updates (#768) * fixed search bar does not move on tap * optimistic updates on delete group * Blue line in groups picture when using default image removed (#769) * Pipeline/fix and testing (#771) * Pipeline changes * Update cloudbuild_prod_web.yaml * Update pubspec.yaml * Update cloudbuild_prod_web.yaml * Dependencies changes * Update app_icon.png * Update pubspec.yaml * Flutter image uploaded * Update pubspec.yaml * 763 refactor group validator (#772) * Update group page and its controller * Updated test * 681-notifications-redirect-to-friends-page (#774) * WIP * WIP * Refactor Notifications Service * WIP * WIP * redirect to requests page WIP * Notifications redirection Co-authored-by: Josué Ausejo Hernández <[email protected]> Co-authored-by: Eduard Conesa Guerrero <[email protected]> * Fix notifications not recevied on first login (#776) * Update gauth_service_impl.dart * fixed tests * Initial page is set to map when putting the app on background * Notifications code should not be executed in web * Fix web not launching due to FirebaseMessaging Co-authored-by: LuisPi <[email protected]> Co-authored-by: Josué Ausejo Hernández <[email protected]> Co-authored-by: airherna <[email protected]> Co-authored-by: airherna <[email protected]> Co-authored-by: Fabián Scherle <[email protected]> Co-authored-by: Josué Ausejo Hernández <[email protected]>
1 parent 9eee516 commit e4a5dfd

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

wayat/frontend/lib/services/authentication/gauth_service_impl.dart

+14-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class GoogleAuthService implements AuthService {
3939
/// Instance of the authentication service for Firebase
4040
final FirebaseAuth _auth;
4141

42-
final FirebaseMessaging firebaseMessaging;
42+
FirebaseMessaging? firebaseMessaging;
43+
44+
late PlatformService platformService;
4345

4446
GoogleAuthService(
4547
{GoogleSignIn? gS,
@@ -48,13 +50,15 @@ class GoogleAuthService implements AuthService {
4850
FirebaseMessaging? messaging})
4951
: _auth = auth ??
5052
FirebaseAuth.instanceFor(
51-
app: Firebase.app(EnvModel.FIREBASE_APP_NAME)),
52-
firebaseMessaging = messaging ?? FirebaseMessaging.instance {
53+
app: Firebase.app(EnvModel.FIREBASE_APP_NAME)) {
54+
this.platformService = platformService ?? PlatformService();
55+
firebaseMessaging = (this.platformService.isWeb)
56+
? null
57+
: messaging ?? FirebaseMessaging.instance;
5358
if (gS != null) {
5459
googleSignIn = gS;
5560
} else {
56-
platformService ??= PlatformService();
57-
if (platformService.isWeb) {
61+
if (this.platformService.isWeb) {
5862
googleSignIn = GoogleSignIn(
5963
clientId: EnvModel.WEB_CLIENT_ID,
6064
scopes: ['email'],
@@ -81,9 +85,11 @@ class GoogleAuthService implements AuthService {
8185
);
8286
await _auth.signInWithCredential(credential);
8387
if (_auth.currentUser == null) return null;
84-
String? token = await firebaseMessaging.getToken();
85-
httpProvider
86-
.sendPostRequest(APIContract.pushNotification, {"token": token});
88+
if (platformService.isMobile) {
89+
String? token = await firebaseMessaging?.getToken();
90+
httpProvider
91+
.sendPostRequest(APIContract.pushNotification, {"token": token});
92+
}
8793
return account;
8894
} on PlatformException {
8995
return null;

wayat/frontend/test/services/authentication/gauth_service_impl_test.dart

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void main() async {
110110
MockGoogleSignInAuthentication();
111111
MockUserCredential mockUserCredential = MockUserCredential();
112112

113+
when(mockPlatformService.isMobile).thenReturn(true);
113114
when(mockGoogleSignIn.signIn())
114115
.thenAnswer((_) async => mockGoogleSignInAccount);
115116
when(mockGoogleSignInAccount.authentication)

0 commit comments

Comments
 (0)