Skip to content
This repository was archived by the owner on May 2, 2022. It is now read-only.

Commit bdb89bd

Browse files
committed
recent:
commit to rewrite author names To add: voice record improve notification background management smooth_page_indicator improve userLocation system show all users positions on the map tags for spots Firebase function to suppress all photos isn't referenced in the database Firebase function to suppress all residual data when suppress user fail
1 parent c4040cb commit bdb89bd

20 files changed

+268
-116
lines changed

android/app/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ dependencies {
6060
androidTestImplementation 'androidx.test:runner:1.2.0'
6161
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
6262
implementation 'com.android.support:multidex:1.0.3'
63+
implementation 'com.google.firebase:firebase-messaging:20.2.3'
6364

6465
}
6566

android/app/src/main/AndroidManifest.xml

+21-7
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,34 @@
2020

2121

2222
<application
23-
android:name="io.flutter.app.FlutterApplication"
23+
android:name=".Application"
2424
android:label="TheSpot"
2525
android:icon="@mipmap/ic_launcher">
2626
<meta-data android:name="com.google.android.geo.API_KEY"
2727
android:value="AIzaSyB9MdMFX3F78_FQLe3rgXRpDCtLFlYY6IA"/>
28+
<!-- <meta-data-->
29+
<!-- android:name="com.google.firebase.messaging.default_notification_channel_id"-->
30+
<!-- android:value="@string/notification_channel_id" />-->
2831
<activity
2932
android:name=".MainActivity"
3033
android:launchMode="singleTop"
3134
android:theme="@style/LaunchTheme"
3235
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
3336
android:hardwareAccelerated="true"
3437
android:windowSoftInputMode="adjustResize">
35-
<!-- This keeps the window background of the activity showing
36-
until Flutter renders its first frame. It can be removed if
37-
there is no splash screen (such as the default splash screen
38-
defined in @style/LaunchTheme). -->
38+
39+
<!-- Specify that the launch screen should continue being displayed -->
40+
<!-- until Flutter renders its first frame. -->
41+
<meta-data
42+
android:name="io.flutter.embedding.android.SplashScreenDrawable"
43+
android:resource="@drawable/launch_background" />
44+
45+
<!-- Theme to apply as soon as Flutter begins rendering frames -->
3946
<meta-data
40-
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
41-
android:value="true" />
47+
android:name="io.flutter.embedding.android.NormalTheme"
48+
android:resource="@style/NormalTheme"
49+
/>
50+
4251
<intent-filter>
4352
<action android:name="android.intent.action.MAIN"/>
4453
<category android:name="android.intent.category.LAUNCHER"/>
@@ -54,5 +63,10 @@
5463
android:name="com.yalantis.ucrop.UCropActivity"
5564
android:screenOrientation="portrait"
5665
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
66+
67+
<meta-data
68+
android:name="flutterEmbedding"
69+
android:value="2" />
5770
</application>
71+
5872
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.milvintsiss.thespot;
2+
3+
import io.flutter.app.FlutterApplication;
4+
import io.flutter.plugin.common.PluginRegistry;
5+
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
6+
import io.flutter.plugins.GeneratedPluginRegistrant;
7+
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
8+
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;
9+
10+
public class Application extends FlutterApplication implements PluginRegistrantCallback {
11+
12+
@Override
13+
public void onCreate() {
14+
super.onCreate();
15+
FlutterFirebaseMessagingService.setPluginRegistrant(this);
16+
}
17+
18+
@Override
19+
public void registerWith(PluginRegistry pluginRegistry) {
20+
FirebaseMessagingPlugin.registerWith(pluginRegistry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
package com.milvintsiss.thespot;
22

3-
import android.os.Bundle;
4-
import io.flutter.app.FlutterActivity;
5-
import io.flutter.plugins.GeneratedPluginRegistrant;
3+
import io.flutter.embedding.android.FlutterActivity;
64

75
public class MainActivity extends FlutterActivity {
8-
@Override
9-
protected void onCreate(Bundle savedInstanceState) {
10-
super.onCreate(savedInstanceState);
11-
GeneratedPluginRegistrant.registerWith(this);
12-
}
136
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="notification_channel_id">default</string>
4+
</resources>

android/app/src/main/res/values/styles.xml

+4
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
Flutter draws its first frame -->
66
<item name="android:windowBackground">@drawable/launch_background</item>
77
</style>
8+
<!-- You can name this style whatever you'd like -->
9+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
10+
<item name="android:windowBackground">@drawable/launch_background</item>
11+
</style>
812
</resources>

android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99

1010
dependencies {
1111
classpath 'com.android.tools.build:gradle:3.5.2'
12-
classpath 'com.google.gms:google-services:4.3.3'
12+
classpath 'com.google.gms:google-services:4.3.2'
1313
classpath 'io.fabric.tools:gradle:1.26.1'
1414
}
1515
}

android/settings_aar.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ':app'

functions/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,16 @@ exports.sendMessageNotificationTo = functions.https.onCall((data, context) => {
238238
const usersIds = data['usersIds']; //string containing ids in format "id/id/id/id/..."
239239
const message = data['message'];
240240
const senderPseudo = data['senderPseudo'];
241+
const isGroup = conversationName !== '%#%NOT_GROUP%#%';
241242

242243
return admin.messaging().sendToDevice(
243244
usersTokens,
244245
{
245246
notification: {
246247
tag: conversationId,
247-
title: conversationName,
248-
body: senderPseudo + ": " + message,
249-
image: conversationPictureDownloadPath,
248+
title: isGroup ? conversationName : senderPseudo,
249+
body: isGroup ? senderPseudo + ": " + message : message,
250+
//image: conversationPictureDownloadPath,
250251
click_action: 'FLUTTER_NOTIFICATION_CLICK',
251252
},
252253
data: {

lib/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void main() async {
1616
// This is only to be used for confirming that reports are being
1717
// submitted as expected. It is not intended to be used for everyday
1818
// development.
19-
Crashlytics.instance.enableInDevMode = true;
19+
Crashlytics.instance.enableInDevMode = false;
2020

2121
// Pass all uncaught errors from the framework to Crashlytics.
2222
FlutterError.onError = Crashlytics.instance.recordFlutterError;

lib/pages/bottom_navigation_page.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class _BottomNavigationPageState extends State<BottomNavigationPage> {
4141
configuration: widget.configuration,
4242
),
4343
FeatureNotAvailable(),
44-
FeatureNotAvailable(),//HomePage(configuration: widget.configuration,),
44+
FeatureNotAvailable(), //HomePage(configuration: widget.configuration,),
4545
Map(
4646
configuration: widget.configuration,
4747
context: context,
@@ -92,19 +92,19 @@ class _BottomNavigationPageState extends State<BottomNavigationPage> {
9292
items: [
9393
BottomNavigationBarItem(
9494
icon: Icon(Icons.chat_bubble),
95-
title: Text("Chat"),
95+
label: "Chat",
9696
),
9797
BottomNavigationBarItem(
9898
icon: Icon(Icons.short_text),
99-
title: Text("News"),
99+
label: "News",
100100
),
101101
BottomNavigationBarItem(
102102
icon: Icon(Icons.home),
103-
title: Text("Home"),
103+
label: "Home",
104104
),
105105
BottomNavigationBarItem(
106106
icon: Icon(Icons.map),
107-
title: Text("Map"),
107+
label: "Map",
108108
),
109109
BottomNavigationBarItem(
110110
icon: Stack(children: [
@@ -134,7 +134,7 @@ class _BottomNavigationPageState extends State<BottomNavigationPage> {
134134
)
135135
: Container()
136136
]),
137-
title: Text("Profile"),
137+
label: "Profile",
138138
)
139139
]),
140140

lib/pages/chat_pages/chat_list_page.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ class _ChatListPageState extends State<ChatListPage> {
7676
documentChanges = documentChanges.reversed.toList();
7777
firstLoad = false;
7878
}
79+
7980
await Future.forEach(documentChanges, (DocumentChange change) async {
81+
print(change.document.data);
8082
final ChatGroup chatGroup =
8183
convertMapToChatGroup(change.document.data);
8284
chatGroup.id = change.document.documentID;
@@ -395,11 +397,14 @@ class _ChatListPageState extends State<ChatListPage> {
395397
Widget showStartChatButton() {
396398
return Padding(
397399
padding: EdgeInsets.fromLTRB(
398-
widget.configuration.screenWidth / 60,
400+
widget.configuration.screenWidth / 30,
399401
0,
400-
widget.configuration.screenWidth / 60,
402+
widget.configuration.screenWidth / 30,
401403
0),
402404
child: RaisedButton(
405+
shape: RoundedRectangleBorder(
406+
borderRadius:
407+
BorderRadius.circular(widget.configuration.screenWidth)),
403408
child:
404409
Text(AppLocalizations.of(context).translate("Start a new chat")),
405410
onPressed: () {

lib/pages/chat_pages/chat_page.dart

+44-38
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ class _ChatPageState extends State<ChatPage> {
447447

448448
Widget showBottomTools() {
449449
return Container(
450-
height: widget.configuration.screenHeight / 11,
451450
color: PrimaryColor,
452451
child: Row(
453452
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -544,44 +543,51 @@ class _ChatPageState extends State<ChatPage> {
544543
color: PrimaryColorDark,
545544
width: widget.configuration.screenWidth / 300),
546545
borderRadius:
547-
BorderRadius.circular(widget.configuration.screenWidth)),
548-
child: membersDataIsLoaded
549-
? TextField(
550-
minLines: 1,
551-
maxLines: 10,
552-
maxLength: 1000,
553-
textAlignVertical: TextAlignVertical.center,
554-
controller: sendBoxController,
555-
onChanged: (value) => newMessage = value.trim(),
556-
onSubmitted: (value) => sendMessage(),
557-
style: TextStyle(
558-
color: Colors.white,
559-
fontSize: 12 * widget.configuration.textSizeFactor),
560-
textInputAction: TextInputAction.send,
561-
decoration: InputDecoration(
562-
counterText: "",
563-
contentPadding: EdgeInsets.symmetric(
564-
horizontal: widget.configuration.screenWidth / 25,
565-
vertical: widget.configuration.screenHeight / 50,
546+
BorderRadius.circular(widget.configuration.screenHeight / 20)),
547+
child: ConstrainedBox(
548+
constraints: BoxConstraints(
549+
maxHeight: widget.configuration.screenHeight / 8,
550+
minHeight: widget.configuration.screenHeight / 30,
551+
),
552+
child:
553+
membersDataIsLoaded
554+
? TextField(
555+
minLines: 1,
556+
maxLines: 10,
557+
maxLength: 1000,
558+
textAlignVertical: TextAlignVertical.center,
559+
controller: sendBoxController,
560+
onChanged: (value) => newMessage = value.trim(),
561+
onSubmitted: (value) => sendMessage(),
562+
style: TextStyle(
563+
color: Colors.white,
564+
fontSize: 12 * widget.configuration.textSizeFactor),
565+
textInputAction: TextInputAction.send,
566+
decoration: InputDecoration(
567+
counterText: "",
568+
contentPadding: EdgeInsets.symmetric(
569+
horizontal: widget.configuration.screenWidth / 25,
570+
vertical: widget.configuration.screenHeight / 150,
571+
),
572+
hintText: AppLocalizations.of(context)
573+
.translate("Send a message..."),
574+
hintMaxLines: 1,
575+
hintStyle: TextStyle(
576+
color: Colors.white70,
577+
fontSize: 12 * widget.configuration.textSizeFactor),
578+
border: InputBorder.none,
579+
focusedBorder: InputBorder.none,
580+
enabledBorder: InputBorder.none,
581+
errorBorder: InputBorder.none,
582+
disabledBorder: InputBorder.none,
583+
),
584+
)
585+
: Padding(
586+
padding:
587+
EdgeInsets.all(widget.configuration.screenHeight / 50),
588+
child: CircularProgressIndicator(),
566589
),
567-
hintText: AppLocalizations.of(context)
568-
.translate("Send a message..."),
569-
hintMaxLines: 1,
570-
hintStyle: TextStyle(
571-
color: Colors.white70,
572-
fontSize: 12 * widget.configuration.textSizeFactor),
573-
border: InputBorder.none,
574-
focusedBorder: InputBorder.none,
575-
enabledBorder: InputBorder.none,
576-
errorBorder: InputBorder.none,
577-
disabledBorder: InputBorder.none,
578-
),
579-
)
580-
: Padding(
581-
padding:
582-
EdgeInsets.all(widget.configuration.screenHeight / 50),
583-
child: CircularProgressIndicator(),
584-
),
590+
),
585591
),
586592
),
587593
);

lib/pages/profile_pages/profile.dart

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
3+
import 'package:google_maps_flutter/google_maps_flutter.dart';
34
import 'package:image_cropper/image_cropper.dart';
45
import 'package:the_spot/app_localizations.dart';
56
import 'package:the_spot/pages/profile_pages/followers_following_friends_page.dart';
@@ -8,6 +9,7 @@ import 'package:the_spot/pages/inscription_page.dart';
89
import 'package:the_spot/services/authentication.dart';
910
import 'package:the_spot/services/database.dart';
1011
import 'package:the_spot/services/deleteUser.dart';
12+
import 'package:the_spot/services/library/cluster_encoding.dart';
1113
import 'package:the_spot/services/library/profilePictureWidget.dart';
1214
import 'package:the_spot/services/library/userProfile.dart';
1315
import 'package:the_spot/services/configuration.dart';
@@ -204,6 +206,10 @@ class _Profile extends State<Profile> {
204206
AppLocalizations.of(context).translate("App info"),
205207
'App info',
206208
Icons.info_outline),
209+
showListTileButton(
210+
"...",
211+
'test',
212+
Icons.block),
207213
],
208214
),
209215
),
@@ -281,6 +287,11 @@ class _Profile extends State<Profile> {
281287
aboutDialog(context);
282288
}
283289
break;
290+
case 'test':
291+
{
292+
print(CLusterEncoding().getClusterIdForLocation(LatLng(48.0440, -16703)));
293+
}
294+
break;
284295
}
285296
},
286297
),

lib/services/configuration.dart

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class Configuration with ChangeNotifier {
3939

4040
Future<Configuration> getConfiguration(
4141
BuildContext context, String userId) async {
42+
print("UserID: $userId");
4243
Configuration configuration = Configuration();
4344
await configuration.pushNotificationsManager.init(context); //init notificationsHandler
4445
if (await checkConnection(context)) {
@@ -66,6 +67,7 @@ class Configuration with ChangeNotifier {
6667
if(configuration.userData != null) {
6768
configuration.userData.devicesTokens =
6869
[await configuration.pushNotificationsManager.getToken()];
70+
6971
Database().addDeviceTokenToUserProfile(
7072
context, userId, configuration.userData.devicesTokens);
7173
}

lib/services/database.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ class Database {
819819

820820
sendMessageNotificationTo.call(<String, dynamic>{
821821
'conversationId': group.id,
822-
'conversationName': group.name,
822+
'conversationName': group.isGroup ? group.name : '%#%NOT_GROUP%#%',
823823
'conversationPictureDownloadPath': group.isGroup
824824
? group.pictureDownloadPath ?? ""
825825
: mainUser.profilePictureDownloadPath ?? "",

0 commit comments

Comments
 (0)