Skip to content

Commit

Permalink
Merge pull request #215 from Monday-Rocket/develop
Browse files Browse the repository at this point in the history
1.0.61 업데이트
  • Loading branch information
boring-km authored May 21, 2024
2 parents 7645695 + 7f9fa98 commit d6f261c
Show file tree
Hide file tree
Showing 14 changed files with 335 additions and 7 deletions.
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def kakaoApiKey = signingProperties.getProperty('kakao.api.key')
apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
Expand Down
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:7.4.2'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand Down
68 changes: 67 additions & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
AEFAAC81291D586A00ED5DDC /* UserDefaultsHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEFAAC80291D586A00ED5DDC /* UserDefaultsHelper.swift */; };
AEFAAC84291D6E1600ED5DDC /* CommentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEFAAC83291D6E1600ED5DDC /* CommentViewController.swift */; };
AEFAAC86291D791700ED5DDC /* PaddingTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEFAAC85291D791700ED5DDC /* PaddingTextField.swift */; };
E97025A1799B60AA1DA3EE18 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8AF2D531BDA70F0A6D9C0D90 /* GoogleService-Info.plist */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -94,6 +95,7 @@
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
77DA2DBBFBCA594F81CC37E1 /* 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>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
8AF2D531BDA70F0A6D9C0D90 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -207,6 +209,7 @@
97C146EF1CF9000F007C117D /* Products */,
B0F7507DCC206DB6EBB05ADC /* Pods */,
41380AD61BDA3685827DB58C /* Frameworks */,
8AF2D531BDA70F0A6D9C0D90 /* GoogleService-Info.plist */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -351,12 +354,15 @@
06D908F3BF919B7EE15A8705 /* [CP] Check Pods Manifest.lock */,
242C769F86A7805781E3C954 /* [CP] Embed Pods Frameworks */,
AEE2471C28CF82200092F192 /* Embed App Extensions */,
AE2358E82BF5C1200045890F /* [Crashlytics] Clear dSYM */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
04407A3D77A27457A3AE6C17 /* [CP] Copy Pods Resources */,
E8FF0151F034C36084045D9B /* [firebase_crashlytics] Crashlytics Upload Symbols */,
AE2358E92BF5C1B30045890F /* [Crashlytics] Upload dSYM */,
);
buildRules = (
);
Expand Down Expand Up @@ -437,6 +443,7 @@
51F09A2629711B8A00BA053D /* GoogleService-Info.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
E97025A1799B60AA1DA3EE18 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -528,7 +535,66 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
AE2358E82BF5C1200045890F /* [Crashlytics] Clear dSYM */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[Crashlytics] Clear dSYM";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "rm -rf $DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME\n";
};
AE2358E92BF5C1B30045890F /* [Crashlytics] Upload dSYM */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[Crashlytics] Upload dSYM";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "sleep 1 # Without this, there seems a chance that the script runs before dSYM generation is finished \n$PODS_ROOT/FirebaseCrashlytics/upload-symbols -gsp $PROJECT_DIR/Runner/GoogleService-Info.plist -p ios $DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME\n";
};
E8FF0151F034C36084045D9B /* [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\" ";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
1 change: 1 addition & 0 deletions lib/const/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const grey100 = Color(0xFFF5F7FA);
const ccGrey100 = Color(0x99F5F7FA);

const grey200 = Color(0xFFE6EAF1);
const grey200_9a = Color(0x9AE6EAF1);
const ccGrey200 = Color(0xCCE6EAF1);

const grey300 = Color(0xFFCFD4DE);
Expand Down
2 changes: 1 addition & 1 deletion lib/const/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const helpLink =
'https://heejin-alex.notion.site/14514c8fc84442fab1fc34d1377f8fc6';

// API LINK
const baseUrl = 'http://acprojectapiserver-env.eba-tazwmppk.ap-northeast-2.elasticbeanstalk.com';
const baseUrl = 'https://api.linkpool.co.kr';

//warning message
const warningMsgTitle = '링크풀은 건전한 링크 관리 및 공유 문화를 지향해요';
Expand Down
26 changes: 25 additions & 1 deletion lib/cubits/login/auto_login_cubit.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
import 'package:ac_project_app/cubits/login/login_user_state.dart';
import 'package:ac_project_app/di/set_up_get_it.dart';
import 'package:ac_project_app/provider/api/user/user_api.dart';
import 'package:ac_project_app/provider/manager/app_pause_manager.dart';
import 'package:ac_project_app/provider/share_data_provider.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class AutoLoginCubit extends Cubit<LoginUserState> {
AutoLoginCubit() : super(LoginInitialState());

void userCheck() {
final appPauseManager = getIt<AppPauseManager>();

Future<void> userCheck() async {
final pause = await appPauseManager.getPause();

if (pause) {
await _showInspectionMessage();
} else {
_userCheck();
}
}

Future<void> _showInspectionMessage() async {
final title = await appPauseManager.getTitle();
final description = await appPauseManager.getDescription();
final timeText = await appPauseManager.getTimeText();
emit(InspectionState(title, description, timeText));
}

void _userCheck() {
final user = FirebaseAuth.instance.currentUser;
if (user != null) {
getIt<UserApi>().postUsers().then((result) {
Expand All @@ -26,4 +46,8 @@ class AutoLoginCubit extends Cubit<LoginUserState> {
});
}
}

void closeApp() {
appPauseManager.closeApp();
}
}
11 changes: 11 additions & 0 deletions lib/cubits/login/login_user_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ class LoginLoadedState extends LoginUserState {
List<Object> get props => [user];
}

class InspectionState extends LoginUserState {
InspectionState(this.title, this.description, this.timeText);

final String title;
final String description;
final String timeText;

@override
List<Object> get props => [title, description, timeText];
}

class LoginErrorState extends LoginUserState {
LoginErrorState(this.message);

Expand Down
4 changes: 3 additions & 1 deletion lib/di/set_up_get_it.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:ac_project_app/provider/api/linkpool_pick/linkpool_pick_api.dart
import 'package:ac_project_app/provider/api/report/report_api.dart';
import 'package:ac_project_app/provider/api/user/profile_api.dart';
import 'package:ac_project_app/provider/api/user/user_api.dart';
import 'package:ac_project_app/provider/manager/app_pause_manager.dart';
import 'package:get_it/get_it.dart';

final getIt = GetIt.instance;
Expand All @@ -31,5 +32,6 @@ void locator() {
..registerLazySingleton(GetUserFoldersCubit.new)
..registerLazySingleton(GetProfileInfoCubit.new)
..registerLazySingleton(AutoLoginCubit.new)
..registerLazySingleton(LinkpoolPickCubit.new);
..registerLazySingleton(LinkpoolPickCubit.new)
..registerLazySingleton(AppPauseManager.new);
}
9 changes: 9 additions & 0 deletions lib/initial_settings.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'dart:async';
import 'dart:ui';

import 'package:ac_project_app/firebase_options.dart';
// ignore: depend_on_referenced_packages
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
Expand Down Expand Up @@ -31,6 +33,13 @@ Future<void> initSettings() async {
} else {
Firebase.app();
}

FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
PlatformDispatcher.instance.onError = (error, stackTrace) {
FirebaseCrashlytics.instance.recordError(error, stackTrace, fatal: true);
return true;
};

_saveFirstInstalled();
}

Expand Down
49 changes: 49 additions & 0 deletions lib/provider/manager/app_pause_manager.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import 'package:ac_project_app/ui/widget/dialog/center_dialog.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';

class AppPauseManager {
final database = FirebaseDatabase.instance;

Future<bool> getPause() async {
return (await database.ref('pause').get()).value as bool? ?? false;
}

Future<String> getTitle() async {
return (await database.ref('title').get()).value as String? ?? '';
}

Future<String> getDescription() async {
return (await database.ref('description').get()).value as String? ?? '';
}

Future<String> getTimeText() async {
return (await database.ref('time').get()).value as String? ?? '';
}

Future<void> showPopup(BuildContext context) async {
showPausePopup(
title: await getTitle(),
description: await getDescription(),
timeText: await getTimeText(),
parentContext: context,
callback: () {
Navigator.pop(context);
closeApp();
},
);
}

void closeApp() {
FirebaseCrashlytics.instance.crash();
}

void showPopupIfPaused(BuildContext context) {
getPause().then((value) {
if (value) {
showPopup(context);
}
});
}
}
19 changes: 18 additions & 1 deletion lib/ui/view/home_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:ac_project_app/const/colors.dart';
import 'package:ac_project_app/cubits/folders/folder_view_type_cubit.dart';
import 'package:ac_project_app/cubits/folders/get_my_folders_cubit.dart';
Expand All @@ -11,6 +13,7 @@ import 'package:ac_project_app/di/set_up_get_it.dart';
import 'package:ac_project_app/gen/assets.gen.dart';
import 'package:ac_project_app/provider/api/folders/folder_api.dart';
import 'package:ac_project_app/provider/kakao/kakao.dart';
import 'package:ac_project_app/provider/manager/app_pause_manager.dart';
import 'package:ac_project_app/provider/upload_state_variable.dart';
import 'package:ac_project_app/routes.dart';
import 'package:ac_project_app/ui/page/home/home_page.dart';
Expand All @@ -34,19 +37,28 @@ class HomeView extends StatefulWidget {

class _HomeViewState extends State<HomeView> with WidgetsBindingObserver {
final uploadToolTipButtonKey = GlobalKey();
final appPauseManager = getIt<AppPauseManager>();

@override
void initState() {
WidgetsBinding.instance.addObserver(this);
saveLinksFromOutside();
processAfterGetContext();
super.initState();
}

void saveLinksFromOutside() {
getIt<FolderApi>().bulkSave().then((value) {
setState(() {});
});
}

void processAfterGetContext() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
final url = await receiveKakaoScheme();
if (!mounted) return;
Kakao.receiveLink(context, url: url);
});
super.initState();
}

@override
Expand All @@ -62,6 +74,7 @@ class _HomeViewState extends State<HomeView> with WidgetsBindingObserver {
if (state == AppLifecycleState.resumed) {
if (!resumeState.value) return;
resetResumeState();
appPauseManager.showPopupIfPaused(context);
getIt<FolderApi>().bulkSave();
Kakao.receiveLink(context);
navigateToUploadViewIfClipboardIsValid();
Expand Down Expand Up @@ -227,4 +240,8 @@ class _HomeViewState extends State<HomeView> with WidgetsBindingObserver {
}
return icons;
}

void checkAppPause(BuildContext context) {
appPauseManager.showPopupIfPaused(context);
}
}
15 changes: 14 additions & 1 deletion lib/ui/view/splash_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:ac_project_app/di/set_up_get_it.dart';
import 'package:ac_project_app/gen/assets.gen.dart';
import 'package:ac_project_app/provider/tutorial_provider.dart';
import 'package:ac_project_app/routes.dart';
import 'package:ac_project_app/ui/widget/dialog/center_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

Expand Down Expand Up @@ -43,8 +44,20 @@ class _SplashViewState extends State<SplashView> with TickerProviderStateMixin {
}

void moveToNextView() {
if (autoLoginCubit.state is LoginInitialState) {
final state = autoLoginCubit.state;
if (state is LoginInitialState) {
moveToLoginView();
} else if (state is InspectionState) {
showPausePopup(
title: state.title,
description: state.description,
timeText: state.timeText,
parentContext: context,
callback: () {
Navigator.pop(context);
autoLoginCubit.closeApp();
},
);
} else {
Navigator.pushReplacementNamed(
context,
Expand Down
Loading

0 comments on commit d6f261c

Please sign in to comment.