Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
BreastFeedingAI-Demo-iOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
BreastFeedingAI-Demo-iOS
Commits
51c99384
Commit
51c99384
authored
Jun 03, 2022
by
jzhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
6f2c197d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
176 additions
and
32 deletions
+176
-32
project.pbxproj
BreastFeedingDemo.xcodeproj/project.pbxproj
+6
-2
AppDelegate.swift
BreastFeedingDemo/AppDelegate.swift
+11
-11
Main.storyboard
BreastFeedingDemo/Base.lproj/Main.storyboard
+31
-5
ViewController.swift
BreastFeedingDemo/ViewController.swift
+128
-14
No files found.
BreastFeedingDemo.xcodeproj/project.pbxproj
View file @
51c99384
...
...
@@ -25,12 +25,12 @@
694B85EE2848ECF4009BEDE1
/* camera.xcframework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D52848EBB1009BEDE1
/* camera.xcframework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
694B85F12848ECF8009BEDE1
/* package_info_plus.xcframework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D02848EBB1009BEDE1
/* package_info_plus.xcframework */
;
};
694B85F22848ECF8009BEDE1
/* package_info_plus.xcframework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D02848EBB1009BEDE1
/* package_info_plus.xcframework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
694B85F32848ECF9009BEDE1
/* permission_handler_apple.xcframework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D82848EBB2009BEDE1
/* permission_handler_apple.xcframework */
;
};
694B85F52848ECFB009BEDE1
/* shared_preferences_ios.xcframework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D32848EBB1009BEDE1
/* shared_preferences_ios.xcframework */
;
};
694B85F62848ECFB009BEDE1
/* shared_preferences_ios.xcframework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D32848EBB1009BEDE1
/* shared_preferences_ios.xcframework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
694B85F72848ECFC009BEDE1
/* Toast.xcframework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D62848EBB2009BEDE1
/* Toast.xcframework */
;
};
694B85F82848ECFC009BEDE1
/* Toast.xcframework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D62848EBB2009BEDE1
/* Toast.xcframework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
694B85F92848EDC4009BEDE1
/* FlutterPluginRegistrant.xcframework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D12848EBB1009BEDE1
/* FlutterPluginRegistrant.xcframework */
;
};
694B85FD284902EF009BEDE1
/* permission_handler_apple.xcframework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
694B85D82848EBB2009BEDE1
/* permission_handler_apple.xcframework */
;
};
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
...
...
@@ -86,8 +86,8 @@
694B85E72848ECBE009BEDE1
/* device_info_plus.xcframework in Frameworks */
,
694B85F12848ECF8009BEDE1
/* package_info_plus.xcframework in Frameworks */
,
694B85F72848ECFC009BEDE1
/* Toast.xcframework in Frameworks */
,
694B85FD284902EF009BEDE1
/* permission_handler_apple.xcframework in Frameworks */
,
694B85EB2848ECF2009BEDE1
/* App.xcframework in Frameworks */
,
694B85F32848ECF9009BEDE1
/* permission_handler_apple.xcframework in Frameworks */
,
694B85F92848EDC4009BEDE1
/* FlutterPluginRegistrant.xcframework in Frameworks */
,
694B85ED2848ECF4009BEDE1
/* camera.xcframework in Frameworks */
,
);
...
...
@@ -369,6 +369,8 @@
FRAMEWORK_SEARCH_PATHS
=
"$(PROJECT_DIR)/Flutter"
;
GENERATE_INFOPLIST_FILE
=
YES
;
INFOPLIST_FILE
=
BreastFeedingDemo/Info.plist
;
INFOPLIST_KEY_NSCameraUsageDescription
=
"The app tries to use your camera"
;
INFOPLIST_KEY_NSMicrophoneUsageDescription
=
"The app tries to use your microphone"
;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents
=
YES
;
INFOPLIST_KEY_UILaunchStoryboardName
=
LaunchScreen
;
INFOPLIST_KEY_UIMainStoryboardFile
=
Main
;
...
...
@@ -399,6 +401,8 @@
FRAMEWORK_SEARCH_PATHS
=
"$(PROJECT_DIR)/Flutter"
;
GENERATE_INFOPLIST_FILE
=
YES
;
INFOPLIST_FILE
=
BreastFeedingDemo/Info.plist
;
INFOPLIST_KEY_NSCameraUsageDescription
=
"The app tries to use your camera"
;
INFOPLIST_KEY_NSMicrophoneUsageDescription
=
"The app tries to use your microphone"
;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents
=
YES
;
INFOPLIST_KEY_UILaunchStoryboardName
=
LaunchScreen
;
INFOPLIST_KEY_UIMainStoryboardFile
=
Main
;
...
...
BreastFeedingDemo/AppDelegate.swift
View file @
51c99384
...
...
@@ -13,32 +13,32 @@ import FlutterPluginRegistrant
@main
class
AppDelegate
:
UIResponder
,
UIApplicationDelegate
{
lazy
var
flutterEngine
=
FlutterEngine
(
name
:
"my flutter engine"
)
func
application
(
_
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
UIApplication
.
LaunchOptionsKey
:
Any
]?)
->
Bool
{
// Runs the default Dart entrypoint with a default Flutter route.
flutterEngine
.
run
();
// Used to connect plugins (only if you have plugins with iOS platform code).
GeneratedPluginRegistrant
.
register
(
with
:
self
.
flutterEngine
);
flutterEngine
.
run
();
// Used to connect plugins (only if you have plugins with iOS platform code).
GeneratedPluginRegistrant
.
register
(
with
:
self
.
flutterEngine
);
// Override point for customization after application launch.
return
true
}
// MARK: UISceneSession Lifecycle
func
application
(
_
application
:
UIApplication
,
configurationForConnecting
connectingSceneSession
:
UISceneSession
,
options
:
UIScene
.
ConnectionOptions
)
->
UISceneConfiguration
{
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return
UISceneConfiguration
(
name
:
"Default Configuration"
,
sessionRole
:
connectingSceneSession
.
role
)
}
func
application
(
_
application
:
UIApplication
,
didDiscardSceneSessions
sceneSessions
:
Set
<
UISceneSession
>
)
{
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
BreastFeedingDemo/Base.lproj/Main.storyboard
View file @
51c99384
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"13122.16"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
initialViewController=
"BYZ-38-t0r"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"20037"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
initialViewController=
"Sik-Bb-ahv"
>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"13104.12"
/>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"20020"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"System colors in document resources"
minToolsVersion=
"11.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene
sceneID=
"0ey-3x-YtP"
>
<objects>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"5df-wq-WhE"
userLabel=
"First Responder"
customClass=
"UIResponder"
sceneMemberID=
"firstResponder"
/>
<navigationController
id=
"Sik-Bb-ahv"
sceneMemberID=
"viewController"
>
<navigationBar
key=
"navigationBar"
contentMode=
"scaleToFill"
id=
"wGR-Id-DNs"
>
<rect
key=
"frame"
x=
"0.0"
y=
"44"
width=
"414"
height=
"44"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
</navigationBar>
<connections>
<segue
destination=
"BYZ-38-t0r"
kind=
"relationship"
relationship=
"rootViewController"
id=
"mv6-PK-FaQ"
/>
</connections>
</navigationController>
</objects>
<point
key=
"canvasLocation"
x=
"-1481"
y=
"-227"
/>
</scene>
<!--View Controller-->
<scene
sceneID=
"tne-QT-ifu"
>
<objects>
<viewController
id=
"BYZ-38-t0r"
customClass=
"ViewController"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<viewController
id=
"BYZ-38-t0r"
customClass=
"ViewController"
customModule
=
"BreastFeedingDemo"
customModule
Provider=
"target"
sceneMemberID=
"viewController"
>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"8bC-Xf-vdC"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"
375"
height=
"667
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"
414"
height=
"896
"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<color
key=
"backgroundColor"
xcode11CocoaTouchSystemColor=
"systemBackgroundColor"
cocoaTouchSystemColor=
"whiteColor"
/>
<viewLayoutGuide
key=
"safeArea"
id=
"6Tk-OE-BBY"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
</view>
<navigationItem
key=
"navigationItem"
id=
"6kL-xH-Sf2"
/>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"dkx-z0-nzr"
sceneMemberID=
"firstResponder"
/>
</objects>
<point
key=
"canvasLocation"
x=
"-601"
y=
"-227"
/>
</scene>
</scenes>
<resources>
<systemColor
name=
"systemBackgroundColor"
>
<color
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
</systemColor>
</resources>
</document>
BreastFeedingDemo/ViewController.swift
View file @
51c99384
...
...
@@ -7,28 +7,142 @@
import
UIKit
import
Flutter
import
AVFoundation
import
permission_handler_apple
class
ViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
// Make a button to call the showFlutter function when pressed.
let
button
=
UIButton
(
type
:
UIButton
.
ButtonType
.
custom
)
button
.
addTarget
(
self
,
action
:
#selector(
showFlutter
)
,
for
:
.
touchUpInside
)
button
.
setTitle
(
"Show Flutter!"
,
for
:
UIControl
.
State
.
normal
)
button
.
frame
=
CGRect
(
x
:
80.0
,
y
:
210.0
,
width
:
160.0
,
height
:
40.0
)
button
.
backgroundColor
=
UIColor
.
blue
self
.
view
.
addSubview
(
button
)
if
!
AVCaptureDevice
.
devices
(
for
:
AVMediaType
.
video
)
.
isEmpty
{
AVCaptureDevice
.
requestAccess
(
for
:
AVMediaType
.
video
)
{
granted
in
// 首次授权 用户没有给予照相机访问的权限 => 返回上一层处理
DispatchQueue
.
main
.
async
{
}
}
}
// Make a button to call the showFluttaaer function when pressed.
let
button
=
UIButton
(
type
:
UIButton
.
ButtonType
.
custom
)
button
.
addTarget
(
self
,
action
:
#selector(
showFlutter
)
,
for
:
.
touchUpInside
)
button
.
setTitle
(
"Show Flutter!"
,
for
:
UIControl
.
State
.
normal
)
button
.
frame
=
CGRect
(
x
:
80.0
,
y
:
210.0
,
width
:
160.0
,
height
:
40.0
)
button
.
backgroundColor
=
UIColor
.
blue
self
.
view
.
addSubview
(
button
)
// Do any additional setup after loading the view.
}
@objc
func
showFlutter
()
{
let
flutterEngine
=
(
UIApplication
.
shared
.
delegate
as!
AppDelegate
)
.
flutterEngine
let
flutterViewController
=
FlutterViewController
(
engine
:
flutterEngine
,
nibName
:
nil
,
bundle
:
nil
)
present
(
flutterViewController
,
animated
:
true
,
completion
:
nil
)
let
flutterEngine
=
(
UIApplication
.
shared
.
delegate
as!
AppDelegate
)
.
flutterEngine
let
flutterViewController
=
FlutterViewController
(
engine
:
flutterEngine
,
nibName
:
nil
,
bundle
:
nil
)
let
chanel
=
FlutterMethodChannel
.
init
(
name
:
"com.wmdigit.breastcoachai.native"
,
binaryMessenger
:
flutterViewController
.
binaryMessenger
)
chanel
.
setMethodCallHandler
{
[
weak
self
]
call
,
result
in
if
call
.
method
==
"init"
{
result
(
self
?
.
getData
())
}
}
navigationController
?
.
pushViewController
(
flutterViewController
,
animated
:
true
)
}
func
getData
()
->
[
String
:
Any
]
{
let
myDictionary
:
[
String
:
Any
]
=
[
"env"
:
"testing"
,
"apiKey"
:
"DLAB-customername-12345687"
,
"region"
:
"apac"
,
"languagePack"
:
[
"tipsString"
:
[
"initInitial"
:
"请调整姿势"
,
"sittingUnrecognition"
:
"未识别到宝宝,请根据屏幕上的宝宝贴纸模拟动作"
,
"sittingBabyneckloc"
:
"请用肘关节支撑宝宝颈部"
,
"sittingBabyhead"
:
"请勿用手掌固定宝宝头部"
,
"sittingBabybackloc"
:
"请将前臂顺着宝宝背部"
,
"sittingUpleft"
:
"请抬高左手臂"
,
"sittingUpright"
:
"请抬高右手臂"
,
"sittingDownleft"
:
"请放低左手臂"
,
"sittingDownright"
:
"请放低右手臂"
,
"sittingHeadupassdown"
:
"请保持宝宝头部高于臀部"
,
"sittingBabystright"
:
"请保持宝宝耳肩臀在同一直线"
,
"sittingBabyheadloc"
:
"请确保宝宝头部正对妈妈乳房,不宜过高"
,
"nobabysittingBabyneckloc"
:
"实际哺乳时,请注意用肘关节支撑宝宝颈部"
,
"nobabysittingHeadupassdown"
:
"实际哺乳时,请保持宝宝头部高于臀部"
,
"nobabysittingBabystright"
:
"实际哺乳时,请保持宝宝耳肩臀一条直线"
,
"sittingSuggest"
:
[
"请采用舒适姿势,确保与宝宝始终胸腹相贴"
,
"宝宝嘴巴尽量包裹住乳晕"
,
"使宝宝下巴紧贴乳房,张嘴角度大于100度"
,
"随时点击右上角指导图示调整含乳姿势"
,
"放松肩膀"
,
"妈妈抱宝宝的手,腰部和脚有支撑"
,
"保持放松,直到哺乳结束"
]
],
"commonmemsg"
:
[
"initialMassage"
:
"请与屏幕保持1米左右距离使身体进入轮廓线,5秒后开始识别"
],
"sittingMsg"
:
[
"babyneckloc"
:
"请用肘关节支撑宝宝颈部"
,
"babyhead"
:
"请勿用手掌固定宝宝头部"
,
"babybackloc"
:
"请将前臂顺着宝宝背部"
,
"upleft"
:
"请抬高左手臂"
,
"upright"
:
"请抬高右手臂"
,
"downleft"
:
"请放低左手臂"
,
"downright"
:
"请放低右手臂"
,
"headupassdown"
:
"请保持宝宝头部高于臀部"
,
"babystright"
:
"请保持宝宝耳肩臀在同一直线"
,
"babyheadloc"
:
"请确保宝宝头部正对妈妈乳房,不宜过高"
],
"sittingMsgPart"
:
[
"babyneckloc"
:
"请用肘关节支撑宝宝颈部"
,
"babyhead"
:
"请勿用手掌固定宝宝头部"
,
"babybackloc"
:
"请将前臂顺着宝宝背部"
,
"headupassdown"
:
"请保持宝宝头部高于臀部"
,
"babystright"
:
"请保持宝宝耳肩臀在同一直线"
,
"babyheadloc"
:
"请确保宝宝头部正对妈妈乳房,不宜过高"
],
"successmsg"
:
[
"recordMessage"
:
"现在可以开始哺乳了!3秒后将自动开始计时"
,
"nobabyRecord"
:
"您已掌握喂养姿势,期待您和宝宝一起来体验哺乳计时功能"
,
"suggest"
:
"请及时点击右上角指导图示调整"
,
"posSuccess"
:
"您的姿势正确,请继续保持"
],
"strings"
:
[
"suggestTitle"
:
"在开始哺乳的时候可以保持:"
,
"suggestText1"
:
"1.在哺乳过程中,应采用妈妈和宝宝都舒适的姿势,确保与宝宝始终胸腹相贴。"
,
"suggestText2"
:
"2.请让宝宝嘴巴尽量包裹住乳晕,下巴紧贴乳房,张嘴角度大于100度。"
,
"suggestText3"
:
"3.请放松肩膀,用垫子或枕头支撑抱宝宝的手,腰部和脚。"
,
"suggestText4"
:
"4.全程请保持放松,愉悦的状态,直到宝宝主动吐出乳头。"
,
"suggestConfirmText"
:
"知道了"
,
"discardReasonTitle"
:
"放弃的原因是..."
,
"discardReason1"
:
"不知道怎么用"
,
"discardReason2"
:
"担心我的个人隐私"
,
"discardReason3"
:
"觉得没有用处"
,
"mainTipsText"
:
"请在安全环境安全设备使用本功能。在使用过程中,我们不会存储您的图像。"
,
"guidance"
:
"指导"
,
"briefSummaryTitleFront"
:
"恭喜您在"
,
"briefSummaryTitleAfter"
:
"秒内完成了本次姿势矫正"
,
"sitMainPointsText1"
:
"婴儿头高臀低,妈妈能看到婴儿的表情"
,
"sitMainPointsText2"
:
"妈妈和婴儿应该腹胸相贴"
,
"sitMainPointsText3"
:
"婴儿的头枕于妈妈手肘处,不要用手固定婴儿头部"
,
"sitMainPointsText4"
:
"婴儿的耳、肩、臀成一条直线"
,
"sitMainPointsConfirmText"
:
"好 的"
,
"momLeft"
:
"当未检测到您,将自动停止计时后续流程,停留5s后跳转至结束页面"
,
"successStatusTips"
:
"您的姿势正确,请继续保持大约20秒"
,
"errorTitle"
:
"错误"
,
"keyErrorText"
:
"密钥禁止使用"
,
"originErrorText"
:
"不允许CORS"
]
]
]
return
myDictionary
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment