Commit bbc6be6d authored by jzhang's avatar jzhang

no message

parent 952a05a2
...@@ -5,35 +5,35 @@ ...@@ -5,35 +5,35 @@
// Created by Jay Zhang on 2022/6/2. // Created by Jay Zhang on 2022/6/2.
// //
import UIKit
import Flutter import Flutter
// Used to connect plugins (only if you have plugins with iOS platform code).
import FlutterPluginRegistrant
import UIKit
@main @main
class AppDelegate: UIResponder, UIApplicationDelegate { class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var flutterEngine = FlutterEngine(name: "my flutter engine")
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
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: flutterEngine)
// Override point for customization after application launch. // Override point for customization after application launch.
return true return true
} }
// MARK: UISceneSession Lifecycle // MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { func application(_: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options _: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created. // Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with. // Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
} }
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { func application(_: UIApplication, didDiscardSceneSessions _: Set<UISceneSession>) {
// Called when the user discards a scene session. // 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. // 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. // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
} }
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<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"> <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="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
...@@ -9,22 +9,6 @@ ...@@ -9,22 +9,6 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <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--> <!--View Controller-->
<scene sceneID="tne-QT-ifu"> <scene sceneID="tne-QT-ifu">
<objects> <objects>
......
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
import UIKit import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate { class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow? var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
...@@ -46,7 +44,4 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { ...@@ -46,7 +44,4 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// Use this method to save data, release shared resources, and store enough scene-specific state information // Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state. // to restore the scene back to its current state.
} }
} }
...@@ -5,155 +5,147 @@ ...@@ -5,155 +5,147 @@
// Created by Jay Zhang on 2022/6/2. // Created by Jay Zhang on 2022/6/2.
// //
import UIKit
import Flutter
import AVFoundation import AVFoundation
// Used to connect plugins (only if you have plugins with iOS platform code). import Flutter
import FlutterPluginRegistrant import permission_handler_apple
import UIKit
class ViewController: UIViewController { class ViewController: UIViewController {
var methodChannel : FlutterMethodChannel? var methodChannel: FlutterMethodChannel?
var flutterEngine: FlutterEngine?
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
// Make a button to call the showFluttaaer function when pressed. // Make a button to call the showFluttaaer function when pressed.
let button = UIButton(type:UIButton.ButtonType.custom) let button = UIButton(type: UIButton.ButtonType.custom)
button.addTarget(self, action: #selector(showFlutter), for: .touchUpInside) button.addTarget(self, action: #selector(showFlutter), for: .touchUpInside)
button.setTitle("Show Flutter!", for: UIControl.State.normal) button.setTitle("Show Flutter!", for: UIControl.State.normal)
button.frame = CGRect(x: 80.0, y: 210.0, width: 160.0, height: 40.0) button.frame = CGRect(x: 80.0, y: 210.0, width: 160.0, height: 40.0)
button.backgroundColor = UIColor.blue button.backgroundColor = UIColor.blue
self.view.addSubview(button) view.addSubview(button)
} if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine {
methodChannel = FlutterMethodChannel(name: "com.wmdigit.breastcoachai.native",
binaryMessenger: flutterEngine.binaryMessenger)
@objc func showFlutter() { methodChannel?.setMethodCallHandler { [weak self]
flutterEngine = FlutterEngine(name: "my flutter engine") (call: FlutterMethodCall, result: @escaping FlutterResult) in
// Runs the default Dart entrypoint with a default Flutter route. if let strongSelf = self {
flutterEngine!.run(); switch call.method {
// Used to connect plugins (only if you have plugins with iOS platform code). case "init":
GeneratedPluginRegistrant.register(with: self.flutterEngine!); result(self?.dicValueString(self!.getData()))
methodChannel = FlutterMethodChannel(name: "com.wmdigit.breastcoachai.native", case "teachingEnd":
binaryMessenger: flutterEngine!.binaryMessenger) strongSelf.navigationController?.popViewController(animated: true)
methodChannel?.setMethodCallHandler({ [weak self] default:
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in // Unrecognized method name
if let strongSelf = self { print("Unrecognized method name: \(call.method)")
switch(call.method) { }
case "init":
result(self?.dicValueString(self!.getData()))
case "teachingEnd":
strongSelf.navigationController?.popViewController(animated: true)
default:
// Unrecognized method name
print("Unrecognized method name: \(call.method)")
} }
} }
}) }
let flutterViewController = FlutterViewController(engine: flutterEngine!, nibName: nil, bundle: nil)
self.navigationController?.pushViewController(flutterViewController, animated: true)
} }
@objc func showFlutter() {
func dicValueString(_ dic:[String : Any]) -> String?{ if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine {
let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
flutterViewController.modalPresentationStyle = .overFullScreen
present(flutterViewController, animated: true)
}
}
func dicValueString(_ dic: [String: Any]) -> String? {
let data = try? JSONSerialization.data(withJSONObject: dic, options: []) let data = try? JSONSerialization.data(withJSONObject: dic, options: [])
let str = String(data: data!, encoding: String.Encoding.utf8) let str = String(data: data!, encoding: String.Encoding.utf8)
return str return str
} }
func getData() -> [String: Any] { func getData() -> [String: Any] {
let myDictionary: [String : Any] = [ let myDictionary: [String: Any] = [
"languagePack" : [ "languagePack": [
"tipsString" : [ "tipsString": [
"initInitial" : "请调整姿势", "initInitial": "请调整姿势",
"sittingUnrecognition" : "未识别到宝宝,请根据屏幕上的宝宝贴纸模拟动作", "sittingUnrecognition": "未识别到宝宝,请根据屏幕上的宝宝贴纸模拟动作",
"sittingBabyneckloc" : "请用肘关节支撑宝宝颈部", "sittingBabyneckloc": "请用肘关节支撑宝宝颈部",
"sittingBabyhead" : "请勿用手掌固定宝宝头部", "sittingBabyhead": "请勿用手掌固定宝宝头部",
"sittingBabybackloc" : "请将前臂顺着宝宝背部", "sittingBabybackloc": "请将前臂顺着宝宝背部",
"sittingUpleft" : "请抬高左手臂", "sittingUpleft": "请抬高左手臂",
"sittingUpright" : "请抬高右手臂", "sittingUpright": "请抬高右手臂",
"sittingDownleft" : "请放低左手臂", "sittingDownleft": "请放低左手臂",
"sittingDownright" : "请放低右手臂", "sittingDownright": "请放低右手臂",
"sittingHeadupassdown" : "请保持宝宝头部高于臀部", "sittingHeadupassdown": "请保持宝宝头部高于臀部",
"sittingBabystright" : "请保持宝宝耳肩臀在同一直线", "sittingBabystright": "请保持宝宝耳肩臀在同一直线",
"sittingBabyheadloc" : "请确保宝宝头部正对妈妈乳房,不宜过高", "sittingBabyheadloc": "请确保宝宝头部正对妈妈乳房,不宜过高",
"nobabysittingBabyneckloc" : "实际哺乳时,请注意用肘关节支撑宝宝颈部", "nobabysittingBabyneckloc": "实际哺乳时,请注意用肘关节支撑宝宝颈部",
"nobabysittingHeadupassdown" : "实际哺乳时,请保持宝宝头部高于臀部", "nobabysittingHeadupassdown": "实际哺乳时,请保持宝宝头部高于臀部",
"nobabysittingBabystright" : "实际哺乳时,请保持宝宝耳肩臀一条直线", "nobabysittingBabystright": "实际哺乳时,请保持宝宝耳肩臀一条直线",
"sittingSuggest" : [ "sittingSuggest": [
"请采用舒适姿势,确保与宝宝始终胸腹相贴", "请采用舒适姿势,确保与宝宝始终胸腹相贴",
"宝宝嘴巴尽量包裹住乳晕", "宝宝嘴巴尽量包裹住乳晕",
"使宝宝下巴紧贴乳房,张嘴角度大于100度", "使宝宝下巴紧贴乳房,张嘴角度大于100度",
"随时点击右上角指导图示调整含乳姿势", "随时点击右上角指导图示调整含乳姿势",
"放松肩膀", "放松肩膀",
"妈妈抱宝宝的手,腰部和脚有支撑", "妈妈抱宝宝的手,腰部和脚有支撑",
"保持放松,直到哺乳结束" "保持放松,直到哺乳结束",
] ],
],
"commonmemsg": ["initialMassage": "请与屏幕保持1米左右距离使身体进入轮廓线,5秒后开始识别"],
"sittingMsg": [
"babyneckloc": "请用肘关节支撑宝宝颈部",
"babyhead": "请勿用手掌固定宝宝头部",
"babybackloc": "请将前臂顺着宝宝背部",
"upleft": "请抬高左手臂",
"upright": "请抬高右手臂",
"downleft": "请放低左手臂",
"downright": "请放低右手臂",
"headupassdown": "请保持宝宝头部高于臀部",
"babystright": "请保持宝宝耳肩臀在同一直线",
"babyheadloc": "请确保宝宝头部正对妈妈乳房,不宜过高",
], ],
"commonmemsg" : ["initialMassage" : "请与屏幕保持1米左右距离使身体进入轮廓线,5秒后开始识别"], "sittingMsgPart": [
"sittingMsg" : [ "babyneckloc": "请用肘关节支撑宝宝颈部",
"babyneckloc" : "请用肘关节支撑宝宝颈部", "babyhead": "请勿用手掌固定宝宝头部",
"babyhead" : "请勿用手掌固定宝宝头部", "babybackloc": "请将前臂顺着宝宝背部",
"babybackloc" : "请将前臂顺着宝宝背部", "headupassdown": "请保持宝宝头部高于臀部",
"upleft" : "请抬高左手臂", "babystright": "请保持宝宝耳肩臀在同一直线",
"upright" : "请抬高右手臂", "babyheadloc": "请确保宝宝头部正对妈妈乳房,不宜过高",
"downleft" : "请放低左手臂",
"downright" : "请放低右手臂",
"headupassdown" : "请保持宝宝头部高于臀部",
"babystright" : "请保持宝宝耳肩臀在同一直线",
"babyheadloc" : "请确保宝宝头部正对妈妈乳房,不宜过高"
], ],
"sittingMsgPart" : [ "successmsg": [
"babyneckloc" : "请用肘关节支撑宝宝颈部", "recordMessage": "现在可以开始哺乳了!3秒后将自动开始计时",
"babyhead" : "请勿用手掌固定宝宝头部", "nobabyRecord": "您已掌握喂养姿势,期待您和宝宝一起来体验哺乳计时功能",
"babybackloc" : "请将前臂顺着宝宝背部", "suggest": "请及时点击右上角指导图示调整",
"headupassdown" : "请保持宝宝头部高于臀部", "posSuccess": "您的姿势正确,请继续保持",
"babystright" : "请保持宝宝耳肩臀在同一直线",
"babyheadloc" : "请确保宝宝头部正对妈妈乳房,不宜过高"
], ],
"successmsg" : [ "strings": [
"recordMessage" : "现在可以开始哺乳了!3秒后将自动开始计时", "suggestTitle": "在开始哺乳的时候可以保持:",
"nobabyRecord" : "您已掌握喂养姿势,期待您和宝宝一起来体验哺乳计时功能", "suggestText1": "1.在哺乳过程中,应采用妈妈和宝宝都舒适的姿势,确保与宝宝始终胸腹相贴。",
"suggest" : "请及时点击右上角指导图示调整", "suggestText2": "2.请让宝宝嘴巴尽量包裹住乳晕,下巴紧贴乳房,张嘴角度大于100度。",
"posSuccess" : "您的姿势正确,请继续保持" "suggestText3": "3.请放松肩膀,用垫子或枕头支撑抱宝宝的手,腰部和脚。",
"suggestText4": "4.全程请保持放松,愉悦的状态,直到宝宝主动吐出乳头。",
"suggestConfirmText": "知道了",
"discardReasonTitle": "放弃的原因是...",
"discardReason1": "不知道怎么用",
"discardReason2": "担心我的个人隐私",
"discardReason3": "觉得没有用处",
"mainTipsText": "请在安全环境安全设备使用本功能。在使用过程中,我们不会存储您的图像。",
"guidance": "指导",
"briefSummaryTitleFront": "恭喜您在",
"briefSummaryTitleAfter": "秒内完成了本次姿势矫正",
"sitMainPointsText1": "婴儿头高臀低,妈妈能看到婴儿的表情",
"sitMainPointsText2": "妈妈和婴儿应该腹胸相贴",
"sitMainPointsText3": "婴儿的头枕于妈妈手肘处,不要用手固定婴儿头部",
"sitMainPointsText4": "婴儿的耳、肩、臀成一条直线",
"sitMainPointsConfirmText": "好 的",
"momLeft": "当未检测到您,将自动停止计时后续流程,停留5s后跳转至结束页面",
"successStatusTips": "您的姿势正确,请继续保持大约10秒",
"errorTitle": "错误",
"keyErrorText": "密钥禁止使用",
"originErrorText": "不允许CORS",
], ],
"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" : "您的姿势正确,请继续保持大约10秒",
"errorTitle" : "错误",
"keyErrorText" : "密钥禁止使用",
"originErrorText" : "不允许CORS"
]
], ],
"env" : "testing", "env": "testing",
"apiKey" : "DLAB-customername-12345687", "apiKey": "DLAB-customername-12345687",
"region" : "apac" "region": "apac",
] ]
return myDictionary return myDictionary
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment