Skip to content

Commit

Permalink
[AM-191] feat: 앱 기능과 서버 연동 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
calculus12 authored Sep 1, 2022
1 parent cdc57ee commit 1ed92a5
Show file tree
Hide file tree
Showing 43 changed files with 799 additions and 331 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.amond"
applicationId "com.amond.amondApp"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion min_Sdk_Version
Expand Down
4 changes: 2 additions & 2 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1050367952342:android:ddab571a7ed7ec6caf9077",
"mobilesdk_app_id": "1:1050367952342:android:8b5594684eed267eaf9077",
"android_client_info": {
"package_name": "com.example.amond"
"package_name": "com.amond.amondApp"
}
},
"oauth_client": [
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.amond">
package="com.amond.amondApp">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.amond">
package="com.amond.amondApp">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Generated file.
//
// If you wish to remove Flutter's multidex support, delete this entire file.
//
// Modifications to this file should be done in a copy under a different name
// as this file may be regenerated.

package io.flutter.app;

import android.app.Application;
import android.content.Context;
import androidx.annotation.CallSuper;
import androidx.multidex.MultiDex;

/**
* Extension of {@link android.app.Application}, adding multidex support.
*/
public class FlutterMultiDexApplication extends Application {
@Override
@CallSuper
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.amond
package com.amond.amondApp

import io.flutter.embedding.android.FlutterActivity

Expand Down
2 changes: 1 addition & 1 deletion android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.amond">
package="com.amond.amondApp">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
Binary file added assets/images/apple-login-icon.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 removed assets/images/appleid_button.png
Binary file not shown.
Binary file removed assets/images/baby_apple.png
Binary file not shown.
Binary file added assets/images/kakao-login-icon.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 removed assets/images/kakao_login_large_wide.png
Binary file not shown.
46 changes: 46 additions & 0 deletions google-services .json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"project_info": {
"project_number": "1050367952342",
"project_id": "amond-57eb7",
"storage_bucket": "amond-57eb7.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1050367952342:android:8b5594684eed267eaf9077",
"android_client_info": {
"package_name": "com.amond.amondApp"
}
},
"oauth_client": [
{
"client_id": "1050367952342-ugboev9cvjqugcnaep6fdar0g897acj0.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAHml78CH4YcL7dXmro9h4lKJd45WzPvzk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1050367952342-ugboev9cvjqugcnaep6fdar0g897acj0.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "1050367952342-hc5mb67e6iefqrv4dvbvh4q8pli3duia.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.amond.amondApp"
}
}
]
}
}
}
],
"configuration_version": "1"
}
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ PODS:
- nanopb/encode (2.30909.0)
- package_info_plus (0.4.5):
- Flutter
- path_provider_ios (0.0.1):
- Flutter
- permission_handler_apple (9.0.4):
- Flutter
- PromisesObjC (2.1.1)
Expand All @@ -76,6 +78,7 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- kakao_flutter_sdk_common (from `.symlinks/plugins/kakao_flutter_sdk_common/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
Expand Down Expand Up @@ -106,6 +109,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/kakao_flutter_sdk_common/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
qr_code_scanner:
Expand All @@ -131,6 +136,7 @@ SPEC CHECKSUMS:
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
Expand Down
25 changes: 15 additions & 10 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
4766335728C04F8B0009F4B0 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4766335628C04F8B0009F4B0 /* GoogleService-Info.plist */; };
5B4E56C40480EF5F2E51618B /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD20654A13D26C3477C45686 /* Pods_Runner.framework */; };
746861E228C07536007C11FA /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 746861E128C07536007C11FA /* GoogleService-Info.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
Expand All @@ -34,7 +34,8 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
746861E128C07536007C11FA /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
4766335328C04DFD0009F4B0 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
4766335628C04F8B0009F4B0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -114,7 +115,8 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
746861E128C07536007C11FA /* GoogleService-Info.plist */,
4766335628C04F8B0009F4B0 /* GoogleService-Info.plist */,
4766335328C04DFD0009F4B0 /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -192,7 +194,7 @@
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
746861E228C07536007C11FA /* GoogleService-Info.plist in Resources */,
4766335728C04F8B0009F4B0 /* GoogleService-Info.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -358,15 +360,16 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = HZ23QNBMVX;
DEVELOPMENT_TEAM = K6P7BL97DC;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.amond;
PRODUCT_BUNDLE_IDENTIFIER = com.amond.amondApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -487,15 +490,16 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = HZ23QNBMVX;
DEVELOPMENT_TEAM = K6P7BL97DC;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.amond;
PRODUCT_BUNDLE_IDENTIFIER = com.amond.amondApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -510,15 +514,16 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = HZ23QNBMVX;
DEVELOPMENT_TEAM = K6P7BL97DC;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.amond;
PRODUCT_BUNDLE_IDENTIFIER = com.amond.amondApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>camera</string>
<string>QR코드를 스캔하기 위해 카메라 접근이 필요합니다.</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
12 changes: 12 additions & 0 deletions ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict>
</plist>
22 changes: 20 additions & 2 deletions lib/data/repository/exp_repository_impl.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:amond/data/source/network/api/exp_api.dart';
import 'package:amond/domain/repositories/exp_repository.dart';

Expand All @@ -7,15 +6,34 @@ class ExpRepositoryImpl implements ExpRepository {
ExpRepositoryImpl(this.expApi);

@override

/// 서버에서 경험치를 가져오는 함수
///
/// 불러온 경험치값을 반환
Future<int> changeExp(String provider, String uid, int exp) async {
final resExp = await expApi.changeExp(provider, uid, exp);
return resExp;
}

@override

/// 서버에서 경험치를 변경하는 함수
///
/// 경험치 변경 후 결과값을 반환
Future<int> getExp(String provider, String uid) async {
final resExp = await expApi.getExp(provider, uid);
return resExp;
}

}
@override
Future<int> getMissionCompleted(String provider, String uid) async {
final resMission = await expApi.getMissionCompleted(provider, uid);
return resMission;
}

@override
Future<void> changeMissionCompleted(
String provider, String uid, int value) async {
await expApi.changeMissionCompleted(provider, uid, value);
}
}
12 changes: 10 additions & 2 deletions lib/data/repository/member_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ class MemberRepositoryImpl implements MemberRepository {
MemberRepositoryImpl(this.memberApi);

@override
/// 회원가입 함수
/// DB 회원가입 함수
///
/// response의 statusCode를 반환 성공하면 200을 반환
Future<int> signUp(MemberEntity me) async {
final response = await memberApi.signUp(me);
return response.statusCode;
}


@override
/// DB 회원탈퇴 함수
///
/// response의 statusCode를 반환 성공하면 200을 반환
Future<int> resign(MemberEntity me) async {
final response = await memberApi.resign(me);
return response.statusCode;
}
}
29 changes: 28 additions & 1 deletion lib/data/source/network/api/exp_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ import 'package:http/http.dart' as http;

class ExpApi {
Future<int> getExp(String provider, String uid) async {
try {
final url = Uri.parse('$baseUrl/v1/exp?provider=$provider&uid=$uid');
final response = await http.get(url);
if (response.statusCode >= 400) {
throw Exception('경험치 불러오기에 실패했습니다.');
}
final res = jsonDecode(response.body)['exp'];
return res;
} catch (error) {
rethrow;
}
}

Future<int> changeExp(String provider, String uid, int exp) async {
final url = Uri.parse('$baseUrl/v1/exp');

final response = await http.post(
final response = await http.put(
url,
body: jsonEncode({
'provider': provider,
Expand All @@ -32,4 +36,27 @@ class ExpApi {
final res = jsonDecode(response.body)['exp'];
return res;
}

Future<int> getMissionCompleted(String provider, String uid) async {
final url = Uri.parse('$baseUrl/v1/mission?provider=$provider&uid=$uid');
final response = await http.get(url);
final missionResult = jsonDecode(response.body)['mission'];
return missionResult;
}

Future<void> changeMissionCompleted(String provider, String uid, int value) async {
final url = Uri.parse('$baseUrl/v1/mission');
final response = await http.put(
url,
body: jsonEncode({
'provider': provider,
'uid': uid,
'mission': value,
}),
headers: {
'Content-type': 'application/json',
'Accept': 'application/json',
},
);
}
}
Loading

0 comments on commit 1ed92a5

Please sign in to comment.