Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #206 Removed "Subscribe to mail" data from others profile. #210

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 29
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
9 changes: 8 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="io.flutter.app.FlutterApplication"
android:name="${applicationName}"
android:label="CircuitVerse"
android:icon="@mipmap/launcher_icon">
<activity
Expand All @@ -17,6 +17,13 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specify that the launch screen should continue being displayed -->
<!-- until Flutter renders its first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<!-- Theme to apply as soon as Flutter begins rendering frames -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package org.circuitverse.mobile_app

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.5.10'
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
Expand Down
50 changes: 25 additions & 25 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ PODS:
- AppAuth/ExternalUserAgent (= 1.4.0)
- AppAuth/Core (1.4.0)
- AppAuth/ExternalUserAgent (1.4.0)
- FBAEMKit (12.1.0):
- FBSDKCoreKit_Basics (= 12.1.0)
- FBSDKCoreKit (12.1.0):
- FBAEMKit (= 12.1.0)
- FBSDKCoreKit_Basics (= 12.1.0)
- FBSDKCoreKit_Basics (12.1.0)
- FBSDKLoginKit (12.1.0):
- FBSDKCoreKit (= 12.1.0)
- FBAEMKit (12.2.1):
- FBSDKCoreKit_Basics (= 12.2.1)
- FBSDKCoreKit (12.2.1):
- FBAEMKit (= 12.2.1)
- FBSDKCoreKit_Basics (= 12.2.1)
- FBSDKCoreKit_Basics (12.2.1)
- FBSDKLoginKit (12.2.1):
- FBSDKCoreKit (= 12.2.1)
- Flutter (1.0.0)
- flutter_facebook_auth (3.5.3):
- FBSDKCoreKit (~> 12.1.0)
- FBSDKLoginKit (~> 12.1.0)
- FBSDKCoreKit (~> 12.2.1)
- FBSDKLoginKit (~> 12.2.1)
- Flutter
- flutter_keyboard_visibility (0.0.1):
- Flutter
- flutter_secure_storage (3.3.1):
- Flutter
- flutter_web_auth (0.3.2):
- flutter_web_auth (0.4.0):
- Flutter
- google_sign_in (0.0.1):
- Flutter
Expand All @@ -44,7 +44,7 @@ PODS:
- Flutter
- url_launcher_ios (0.0.1):
- Flutter
- video_player (0.0.1):
- video_player_avfoundation (0.0.1):
- Flutter
- wakelock (0.0.1):
- Flutter
Expand All @@ -63,7 +63,7 @@ DEPENDENCIES:
- share (from `.symlinks/plugins/share/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player (from `.symlinks/plugins/video_player/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
- wakelock (from `.symlinks/plugins/wakelock/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

Expand Down Expand Up @@ -101,34 +101,34 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player:
:path: ".symlinks/plugins/video_player/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/ios"
wakelock:
:path: ".symlinks/plugins/wakelock/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
AppAuth: 31bcec809a638d7bd2f86ea8a52bd45f6e81e7c7
FBAEMKit: 56c0bb9b42e3747cd82b67934f0c2b19325382ea
FBSDKCoreKit: 75368765d9c2303073145a7925dfaa9d60bcd77b
FBSDKCoreKit_Basics: 39865aff97e5f6951a78fb3e89dc4460e35e1895
FBSDKLoginKit: e993f97c7cc794c5da4056d8aec3c3d66033a727
FBAEMKit: 4cea610d0bc1680572f2aad7b25db7a2f2690d82
FBSDKCoreKit: 5b1992fe65802ca26be7e68bc4fac5f59fa39908
FBSDKCoreKit_Basics: a6a92ca628e05f86f458a4721574c5ddfb058ba3
FBSDKLoginKit: 7467b7f988ca4fdf48f12a839bcfce4264752429
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
flutter_facebook_auth: dfd6b2563406c538098e2127512d385c9ffd70ad
flutter_facebook_auth: dbc47556cbdc61ced50e14473bd32461386a1425
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
flutter_web_auth: 16bc97b544d14c399d4db60bfc3a85320d200cb3
flutter_web_auth: fd071763f61703882adbb2524f5cd5251883118c
google_sign_in: c5cecea71f3be43282263550556e311c4cc03582
GoogleSignIn: 7137d297ddc022a7e0aa4619c86d72c909fa7213
GTMAppAuth: ad5c2b70b9a8689e1a04033c9369c4915bfcbe89
GTMSessionFetcher: 43748f93435c2aa068b1cbe39655aaf600652e91
image_picker: 9aa50e1d8cdacdbed739e925b7eea16d014367e6
image_picker: 541dcbb3b9cf32d87eacbd957845d8651d6c62c3
path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5
share: 0b2c3e82132f5888bccca3351c504d0003b3b410
shared_preferences_ios: aef470a42dc4675a1cdd50e3158b42e3d1232b32
url_launcher_ios: 02f1989d4e14e998335b02b67a7590fa34f971af
video_player: ecd305f42e9044793efd34846e1ce64c31ea6fcb
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter_wkwebview: 005fbd90c888a42c5690919a1527ecc6649e1162

Expand Down
4 changes: 2 additions & 2 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
"${BUILT_PRODUCTS_DIR}/share/share.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences_ios/shared_preferences_ios.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher_ios/url_launcher_ios.framework",
"${BUILT_PRODUCTS_DIR}/video_player/video_player.framework",
"${BUILT_PRODUCTS_DIR}/video_player_avfoundation/video_player_avfoundation.framework",
"${BUILT_PRODUCTS_DIR}/wakelock/wakelock.framework",
"${BUILT_PRODUCTS_DIR}/webview_flutter_wkwebview/webview_flutter_wkwebview.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/FBAEMKit/FBAEMKit.framework/FBAEMKit",
Expand All @@ -315,7 +315,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player_avfoundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/wakelock.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter_wkwebview.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBAEMKit.framework",
Expand Down
48 changes: 46 additions & 2 deletions lib/models/projects.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ class Project {
ProjectRelationships relationships;
List<Collaborator>? collaborators;

Project copyWith({
String? id,
String? type,
ProjectAttributes? attributes,
ProjectRelationships? relationships,
List<Collaborator>? collaborators,
}) {
return Project(
id: id ?? this.id,
type: type ?? this.type,
attributes: attributes ?? this.attributes,
relationships: relationships ?? this.relationships,
collaborators: collaborators ?? this.collaborators,
);
}

bool get hasAuthorAccess {
var currentUser = locator<LocalStorageService>().currentUser;

Expand Down Expand Up @@ -81,7 +97,7 @@ class ProjectAttributes {
this.description,
required this.view,
required this.tags,
this.isStarred,
required this.isStarred,
required this.authorName,
required this.starsCount,
});
Expand All @@ -94,9 +110,37 @@ class ProjectAttributes {
String? description;
int view;
List<Tag> tags;
bool? isStarred;
bool isStarred;
String authorName;
int starsCount;

ProjectAttributes copyWith({
String? name,
String? projectAccessType,
DateTime? createdAt,
DateTime? updatedAt,
ImagePreview? imagePreview,
String? description,
int? view,
List<Tag>? tags,
bool? isStarred,
String? authorName,
int? starsCount,
}) {
return ProjectAttributes(
name: name ?? this.name,
projectAccessType: projectAccessType ?? this.projectAccessType,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
imagePreview: imagePreview ?? this.imagePreview,
view: view ?? this.view,
tags: tags ?? this.tags,
authorName: authorName ?? this.authorName,
starsCount: starsCount ?? this.starsCount,
description: description ?? this.description,
isStarred: isStarred ?? this.isStarred,
);
}
}

class ImagePreview {
Expand Down
10 changes: 8 additions & 2 deletions lib/ui/views/authentication/signup_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ class _SignupViewState extends State<SignupView> {
Widget _buildPasswordInput() {
return CVPasswordField(
focusNode: _emailFocusNode,
validator: (value) =>
value?.isEmpty ?? true ? 'Password can\'t be empty' : null,
validator: (value) {
if (value!.isEmpty) {
return "Password can't be empty";
} else if (value.length < 6) {
return "Password length should be at least 6";
}
return null;
},
onSaved: (value) => _password = value!.trim(),
);
}
Expand Down
36 changes: 31 additions & 5 deletions lib/ui/views/profile/profile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,38 @@ class _ProfileViewState extends State<ProfileView> {
return Container();
}

Widget _buildProfileCard() {
Widget _buildSubcribeToMailComponent() {
var _attrs = _model.user?.data.attributes;
var _localStorageService = locator<LocalStorageService>();
if (_localStorageService.isLoggedIn &&
userId == _localStorageService.currentUser!.data.id) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 4),
alignment: Alignment.centerLeft,
child: RichText(
text: TextSpan(
style: Theme.of(context).textTheme.bodyText1,
children: <TextSpan>[
TextSpan(
text: 'Subscribed to mails : ',
style: Theme.of(context).textTheme.bodyText1?.copyWith(
fontWeight: FontWeight.bold,
),
),
TextSpan(
text: _attrs?.subscribed.toString(),
)
],
),
),
);
}

return Container();
}

Widget _buildProfileCard() {
var _attrs = _model.user?.data.attributes;
return Card(
shape: RoundedRectangleBorder(
side: const BorderSide(color: CVTheme.lightGrey),
Expand Down Expand Up @@ -149,10 +178,7 @@ class _ProfileViewState extends State<ProfileView> {
'Educational Institute',
_attrs?.educationalInstitute,
),
_buildProfileComponent(
'Subscribed to mails',
_attrs?.subscribed.toString(),
),
_buildSubcribeToMailComponent(),
_buildEditProfileButton()
],
),
Expand Down
15 changes: 14 additions & 1 deletion lib/ui/views/profile/user_favourites_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import 'package:mobile_app/ui/components/cv_add_icon_button.dart';
import 'package:mobile_app/ui/views/base_view.dart';
import 'package:mobile_app/ui/views/projects/components/project_card.dart';
import 'package:mobile_app/ui/views/projects/project_details_view.dart';
import 'package:mobile_app/viewmodels/profile/profile_viewmodel.dart';
import 'package:mobile_app/viewmodels/profile/user_favourites_viewmodel.dart';
import 'package:provider/provider.dart';

class UserFavouritesView extends StatefulWidget {
const UserFavouritesView({
Expand All @@ -30,7 +32,14 @@ class _UserFavouritesViewState extends State<UserFavouritesView>
Widget build(BuildContext context) {
super.build(context);
return BaseView<UserFavouritesViewModel>(
onModelReady: (model) => model.fetchUserFavourites(userId: widget.userId),
onModelReady: (model) {
model.fetchUserFavourites(userId: widget.userId);
context.watch<ProfileViewModel>().addListener(() {
final project = context.read<ProfileViewModel>().updatedProject;
if (project == null) return;
model.onProjectChanged(project);
});
},
builder: (context, model, child) {
final _items = <Widget>[];

Expand All @@ -44,6 +53,10 @@ class _UserFavouritesViewState extends State<UserFavouritesView>
var _result = await Get.toNamed(ProjectDetailsView.id,
arguments: project);
if (_result is bool) model.onProjectDeleted(project.id);
if (_result is Project) {
model.onProjectChanged(_result);
context.read<ProfileViewModel>().updatedProject = _result;
}
},
),
);
Expand Down
16 changes: 15 additions & 1 deletion lib/ui/views/profile/user_projects_view.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:mobile_app/models/projects.dart';
import 'package:mobile_app/ui/components/cv_add_icon_button.dart';
import 'package:mobile_app/ui/views/base_view.dart';
import 'package:mobile_app/ui/views/projects/components/project_card.dart';
import 'package:mobile_app/ui/views/projects/project_details_view.dart';
import 'package:mobile_app/viewmodels/profile/profile_viewmodel.dart';
import 'package:mobile_app/viewmodels/profile/user_projects_viewmodel.dart';
import 'package:provider/provider.dart';

class UserProjectsView extends StatefulWidget {
const UserProjectsView({
Expand All @@ -27,7 +30,14 @@ class _UserProjectsViewState extends State<UserProjectsView>
Widget build(BuildContext context) {
super.build(context);
return BaseView<UserProjectsViewModel>(
onModelReady: (model) => model.fetchUserProjects(userId: widget.userId),
onModelReady: (model) {
model.fetchUserProjects(userId: widget.userId);
context.watch<ProfileViewModel>().addListener(() {
var updatedProject = context.read<ProfileViewModel>().updatedProject;
if (updatedProject == null) return;
model.onProjectChanged(updatedProject);
});
},
builder: (context, model, child) {
final _items = <Widget>[];

Expand All @@ -41,6 +51,10 @@ class _UserProjectsViewState extends State<UserProjectsView>
var _result = await Get.toNamed(ProjectDetailsView.id,
arguments: project);
if (_result is bool) model.onProjectDeleted(project.id);
if (_result is Project) {
model.onProjectChanged(_result);
context.read<ProfileViewModel>().updatedProject = _result;
}
},
),
);
Expand Down
Loading