Skip to content

Commit

Permalink
feat: monument_3d_model, follow, discover, notification, scan and view
Browse files Browse the repository at this point in the history
  • Loading branch information
vkprogrammer-001 committed Aug 22, 2024
1 parent 3602b78 commit 9bee413
Show file tree
Hide file tree
Showing 49 changed files with 2,065 additions and 428 deletions.
15 changes: 11 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (flutterVersionName == null) {

android {
namespace "org.aossie.monumento"
compileSdk flutter.compileSdkVersion
compileSdk 34
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -48,8 +48,8 @@ android {
applicationId "org.aossie.monumento"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
minSdkVersion 23
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand All @@ -61,10 +61,17 @@ android {
signingConfig signingConfigs.debug
}
}

aaptOptions {
noCompress 'tflite'
noCompress 'lite'
}
}

flutter {
source '../..'
}

dependencies {}
dependencies {
implementation('com.google.firebase:firebase-iid:21.1.0')
}
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="monumento"
android:usesCleartextTraffic="true"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {
// START: FlutterFire Configuration
id "com.google.gms.google-services" version "4.3.15" apply false
// END: FlutterFire Configuration
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "org.jetbrains.kotlin.android" version "2.0.10" apply false
}

include ":app"
Binary file added assets/aossie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/ic_github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/ml/asia.tflite
Binary file not shown.
Binary file added assets/ml/europe.tflite
Binary file not shown.
4 changes: 4 additions & 0 deletions assets/ml/labels.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0 Mount Rushmore National Memorial
1 Pyramids of Giza
2 Colosseum
3 Taj Mahal
Binary file added assets/ml/model.tflite
Binary file not shown.
3 changes: 3 additions & 0 deletions assets/monumento_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@
<true/>
<key>UIStatusBarHidden</key>
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:monumento/domain/entities/monument_entity.dart';
import 'package:monumento/domain/repositories/monument_repository.dart';

part 'monument_3d_model_event.dart';
part 'monument_3d_model_state.dart';

class Monument3dModelBloc extends Bloc<MonumentModelEvent, MonumentModelState> {
final MonumentRepository _monumentRepository;
Monument3dModelBloc(this._monumentRepository) : super(MonumentInitial()) {
on<ViewMonument3DModel>(_mapViewMonument3DModelToState);
}

_mapViewMonument3DModelToState(
ViewMonument3DModel event, Emitter<MonumentModelState> emit) async {
try {
emit(LoadingMonumentModel());
final monumentModel = await _monumentRepository.getMonumentModelByName(
monumentName: event.monumentName);
emit(LoadingMonumentModelSuccess(monumentModel: monumentModel!.toEntity()));
} catch (e) {
emit(MonumentModelLoadFailed(message: e.toString()));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
part of 'monument_3d_model_bloc.dart';

sealed class MonumentModelEvent extends Equatable {
const MonumentModelEvent();

@override
List<Object?> get props => [];
}

class ViewMonument3DModel extends MonumentModelEvent {
final String monumentName;

const ViewMonument3DModel({required this.monumentName});

@override
List<Object?> get props => [monumentName];

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
part of 'monument_3d_model_bloc.dart';

sealed class MonumentModelState extends Equatable {
const MonumentModelState();

@override
List<Object> get props => [];
}

class MonumentInitial extends MonumentModelState {
@override
List<Object> get props => [];
}

class LoadingMonumentModel extends MonumentModelState {
@override
List<Object> get props => [];
}

class LoadingMonumentModelSuccess extends MonumentModelState {
final MonumentEntity monumentModel;

const LoadingMonumentModelSuccess({required this.monumentModel});
@override
List<Object> get props => [];
}

class MonumentModelLoadFailed extends MonumentModelState {
final String message;

const MonumentModelLoadFailed({required this.message});
@override
List<Object> get props => [message];
}

9 changes: 1 addition & 8 deletions lib/application/profile/follow/follow_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:developer';

import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:monumento/data/models/user_model.dart';
import 'package:monumento/domain/entities/user_entity.dart';
import 'package:monumento/domain/repositories/social_repository.dart';

Expand Down Expand Up @@ -62,15 +61,9 @@ class FollowBloc extends Bloc<FollowEvent, FollowState> {
FutureOr<void> _mapLoadUserToState(
LoadUser event, Emitter<FollowState> emit) async {
try {
List<UserModel> userData = [];
emit(LoadingFollowUserListState());

for (int i = 0; i < event.following.length; i++) {
UserModel user =
await _socialRepository.getUserByUid(uid: event.following[i]);

userData.add(user);
}
final userData = await _socialRepository.loadUser(event.following);

List<UserEntity> userDataEntity =
userData.map((e) => e.toEntity()).toList();
Expand Down
18 changes: 9 additions & 9 deletions lib/application/profile/follow/follow_event.dart
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
part of 'follow_bloc.dart';

abstract class FollowEvent extends Equatable {
sealed class FollowEvent extends Equatable {
const FollowEvent();
}

class FollowUser extends FollowEvent {
final class FollowUser extends FollowEvent {
final UserEntity targetUser;

const FollowUser({required this.targetUser});

@override
List<Object> get props => [];
List<Object> get props => [targetUser];
}

class UnfollowUser extends FollowEvent {
final class UnfollowUser extends FollowEvent {
final UserEntity targetUser;
const UnfollowUser({required this.targetUser});

@override
List<Object> get props => [];
List<Object> get props => [targetUser];
}

class GetFollowStatus extends FollowEvent {
final class GetFollowStatus extends FollowEvent {
final UserEntity targetUser;

const GetFollowStatus({required this.targetUser});

@override
List<Object> get props => [];
List<Object> get props => [targetUser];
}

class LoadUser extends FollowEvent {
final class LoadUser extends FollowEvent {
final List<String> following;

const LoadUser({required this.following});

@override
List<Object?> get props => [];
List<Object?> get props => [following];

}
22 changes: 11 additions & 11 deletions lib/application/profile/follow/follow_state.dart
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
part of 'follow_bloc.dart';

abstract class FollowState extends Equatable {
sealed class FollowState extends Equatable {
const FollowState();
}

class FollowInitial extends FollowState {
final class FollowInitial extends FollowState {
@override
List<Object> get props => [];
}

class FollowStatusRetrieved extends FollowState {
final class FollowStatusRetrieved extends FollowState {
final bool following;

const FollowStatusRetrieved({required this.following});

@override
List<Object> get props => [];
List<Object> get props => [following];
}

class FollowStateError extends FollowState {
final class FollowStateError extends FollowState {
final String message;

const FollowStateError(this.message);

@override
List<Object> get props => [];
List<Object> get props => [message];
}

class LoadingFollowState extends FollowState {
final class LoadingFollowState extends FollowState {
@override
List<Object> get props => [];
}

class CurrentUserProfile extends FollowState {
final class CurrentUserProfile extends FollowState {
@override
List<Object> get props => [];
}

class LoadingFollowUserListState extends FollowState {
final class LoadingFollowUserListState extends FollowState {
@override
List<Object?> get props => [];

}

class LoadedFollowUserListState extends FollowState {
final class LoadedFollowUserListState extends FollowState {
final List<UserEntity> userData;

const LoadedFollowUserListState({required this.userData});
Expand All @@ -53,7 +53,7 @@ class LoadedFollowUserListState extends FollowState {

}

class FollowUserListErrorState extends FollowState {
final class FollowUserListErrorState extends FollowState {
final String message;

const FollowUserListErrorState({required this.message});
Expand Down
10 changes: 5 additions & 5 deletions lib/application/profile/update_profile/update_profile_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ class UpdateProfileBloc extends Bloc<UpdateProfileEvent, UpdateProfileState> {
}
await _socialRepository
.updateUserProfile(userInfo: {'profilePictureUrl': url});
emit(UpdateProfileSuccess());
emit(UpdateProfileSuccess(userInfo: event.userInfo));
} else if (event.userInfo.keys.first == "email" ||
event.userInfo.keys.first == "password") {
await _authenticationRepository.updateEmailPassword(
emailPassword: event.userInfo);
emit(UpdateProfileSuccess());
emit(UpdateProfileSuccess(userInfo: event.userInfo));
} else {
if (event.userInfo.keys.first == "username") {
bool isUserNameAvailable = await _socialRepository
.checkUserNameAvailability(username: event.userInfo.values.first);
if (isUserNameAvailable) {
await _socialRepository.updateUserProfile(userInfo: event.userInfo);
emit(UpdateProfileSuccess());
emit(UpdateProfileSuccess(userInfo: event.userInfo));
} else {
emit(const UpdateProfileFailure(message: "Username already taken"));
}
} else {
await _socialRepository.updateUserProfile(userInfo: event.userInfo);
emit(UpdateProfileSuccess());
emit(UpdateProfileSuccess(userInfo: event.userInfo));
}
}
} catch (e) {
Expand Down Expand Up @@ -82,7 +82,7 @@ class UpdateProfileBloc extends Bloc<UpdateProfileEvent, UpdateProfileState> {
}

await _socialRepository.updateUserProfile(userInfo: event.userInfo);
emit(UpdateProfileSuccess());
emit(UpdateProfileSuccess(userInfo: event.userInfo));
} catch (e) {
emit(UpdateProfileFailure(message: e.toString()));
}
Expand Down
Loading

0 comments on commit 9bee413

Please sign in to comment.