Commit 01183e21 authored by jzhang's avatar jzhang

no message

parent a9ae7b9c
......@@ -15,7 +15,6 @@
692EC423284C8D6F0043E3EA /* spanish.json in Resources */ = {isa = PBXBuildFile; fileRef = 692EC41F284C8D6F0043E3EA /* spanish.json */; };
694B85BC2848EB4C009BEDE1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 694B85BB2848EB4C009BEDE1 /* AppDelegate.swift */; };
694B85BE2848EB4C009BEDE1 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 694B85BD2848EB4C009BEDE1 /* SceneDelegate.swift */; };
694B85C02848EB4C009BEDE1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 694B85BF2848EB4C009BEDE1 /* ViewController.swift */; };
694B85C32848EB4C009BEDE1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 694B85C12848EB4C009BEDE1 /* Main.storyboard */; };
694B85C52848EB4E009BEDE1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 694B85C42848EB4E009BEDE1 /* Assets.xcassets */; };
694B85C82848EB4E009BEDE1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 694B85C62848EB4E009BEDE1 /* LaunchScreen.storyboard */; };
......@@ -59,6 +58,7 @@
EA8F430528EF3DCA00983014 /* ZJTableViewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA8F42F728EF3DCA00983014 /* ZJTableViewManager.swift */; };
EA8F430628EF3DCA00983014 /* ZJExpandTreeCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA8F42F928EF3DCA00983014 /* ZJExpandTreeCellItem.swift */; };
EA8F430828EF3DCA00983014 /* Popover.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA8F42FD28EF3DCA00983014 /* Popover.swift */; };
EAB6F1C228F0449E0005FF33 /* BaseLandingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB6F1C128F0449E0005FF33 /* BaseLandingVC.swift */; };
EAD8102728E207A4002A86C9 /* MyTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8102628E207A4002A86C9 /* MyTools.swift */; };
EAD8102D28E20A54002A86C9 /* PermissionAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8102C28E20A54002A86C9 /* PermissionAlertVC.swift */; };
/* End PBXBuildFile section */
......@@ -95,7 +95,6 @@
694B85B82848EB4C009BEDE1 /* BreastFeedingDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BreastFeedingDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
694B85BB2848EB4C009BEDE1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
694B85BD2848EB4C009BEDE1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
694B85BF2848EB4C009BEDE1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
694B85C22848EB4C009BEDE1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
694B85C42848EB4E009BEDE1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
694B85C72848EB4E009BEDE1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
......@@ -131,6 +130,7 @@
EA8F42F728EF3DCA00983014 /* ZJTableViewManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZJTableViewManager.swift; sourceTree = "<group>"; };
EA8F42F928EF3DCA00983014 /* ZJExpandTreeCellItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZJExpandTreeCellItem.swift; sourceTree = "<group>"; };
EA8F42FD28EF3DCA00983014 /* Popover.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Popover.swift; sourceTree = "<group>"; };
EAB6F1C128F0449E0005FF33 /* BaseLandingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseLandingVC.swift; sourceTree = "<group>"; };
EAD8102628E207A4002A86C9 /* MyTools.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyTools.swift; sourceTree = "<group>"; };
EAD8102C28E20A54002A86C9 /* PermissionAlertVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionAlertVC.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -193,7 +193,6 @@
EAFC261B28E2144600F802FE /* ViewController */,
694B85BB2848EB4C009BEDE1 /* AppDelegate.swift */,
694B85BD2848EB4C009BEDE1 /* SceneDelegate.swift */,
694B85BF2848EB4C009BEDE1 /* ViewController.swift */,
692EC419284C81700043E3EA /* ViewModel.swift */,
EA14360628E0CA3100FFBE72 /* LanguageCell.swift */,
EA14360728E0CA3100FFBE72 /* LanguageCell.xib */,
......@@ -317,6 +316,7 @@
children = (
EA14360428E0BF1900FFBE72 /* DemoViewController.swift */,
EA8F42CE28EEA85200983014 /* CradleHoldLandingVC.swift */,
EAB6F1C128F0449E0005FF33 /* BaseLandingVC.swift */,
EA8F42D028EEA87A00983014 /* SideLyingLandingVC.swift */,
EAD8102C28E20A54002A86C9 /* PermissionAlertVC.swift */,
697B07EC284F2E5C0051FC23 /* CompleteVC.swift */,
......@@ -406,7 +406,6 @@
EA8F430628EF3DCA00983014 /* ZJExpandTreeCellItem.swift in Sources */,
EA8F42C528EE998000983014 /* StringModel.swift in Sources */,
EA8F430428EF3DCA00983014 /* ZJTableViewItem.swift in Sources */,
694B85C02848EB4C009BEDE1 /* ViewController.swift in Sources */,
EA8F42D128EEA87A00983014 /* SideLyingLandingVC.swift in Sources */,
694B85BC2848EB4C009BEDE1 /* AppDelegate.swift in Sources */,
EA8F42C328EE998000983014 /* StringLyingGestureIntroduce.swift in Sources */,
......@@ -416,6 +415,7 @@
EA8F430128EF3DCA00983014 /* ZJDefaultCell.swift in Sources */,
EA8F42CF28EEA85200983014 /* CradleHoldLandingVC.swift in Sources */,
EA14360528E0BF1900FFBE72 /* DemoViewController.swift in Sources */,
EAB6F1C228F0449E0005FF33 /* BaseLandingVC.swift in Sources */,
692EC41A284C81700043E3EA /* ViewModel.swift in Sources */,
EA8F430528EF3DCA00983014 /* ZJTableViewManager.swift in Sources */,
EA8F430828EF3DCA00983014 /* Popover.swift in Sources */,
......@@ -484,6 +484,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
......@@ -544,6 +545,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_BITCODE = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
......
......@@ -892,6 +892,7 @@
</state>
<connections>
<action selector="okAction:" destination="kbc-T2-Z4j" eventType="touchUpInside" id="ukf-Bw-3lq"/>
<action selector="startAction:" destination="2ZC-tX-YAa" eventType="touchUpInside" id="20l-lQ-8mF"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="a0G-Ge-cAP">
......@@ -1182,6 +1183,7 @@
</state>
<connections>
<action selector="okAction:" destination="kbc-T2-Z4j" eventType="touchUpInside" id="fHv-G0-4fD"/>
<action selector="startAction:" destination="ny1-NH-dmJ" eventType="touchUpInside" id="gjm-mt-6yv"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mpe-0M-8jL">
......
//
// ViewController.swift
// BreastFeedingDemo
//
// Created by Jay Zhang on 2022/6/2.
//
import AVFoundation
import Flutter
import UIKit
class ViewController: UIViewController {
@IBOutlet var titleL: UILabel!
@IBOutlet var stepL1: UILabel!
@IBOutlet var stepL2: UILabel!
@IBOutlet var stepL3: UILabel!
@IBOutlet var startBtn: UIButton!
@IBOutlet var panelV: UIStackView!
@IBOutlet var popupView: UIView!
@IBOutlet var switchBtn: UIButton!
@IBOutlet var permisionPopupV: UIView!
@IBOutlet var permissionTitle: UILabel!
@IBOutlet var permissionText: UILabel!
@IBOutlet var permissionOKBtn: UIButton!
@IBOutlet var permissionPanel: UIView!
var methodChannel: FlutterMethodChannel?
lazy var vm: ViewModel = .init()
var isFirstLoad: Bool = true
fileprivate func updateUI() {
// titleL.text = vm.landingPageTitle
// stepL1.text = vm.landingPageStep1
// stepL2.text = vm.landingPageStep2
// stepL3.text = vm.landingPageStep3
//
// permissionText.text = vm.cameraText1
// permissionTitle.text = vm.cameraText
// permissionOKBtn.setTitle(vm.cameraButtonText, for: .normal)
// startBtn.setTitle(vm.landingPageStart, for: .normal)
panelV.layer.cornerRadius = 8
permissionPanel.layer.cornerRadius = 8
permissionPanel.clipsToBounds = true
panelV.clipsToBounds = true
}
override func viewDidLoad() {
super.viewDidLoad()
overrideUserInterfaceStyle = .light
UIApplication.shared.isIdleTimerDisabled = true
navigationController?.setNavigationBarHidden(true, animated: false)
updateUI()
popupView.isHidden = true
if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine {
methodChannel = FlutterMethodChannel(name: "com.wmdigit.breastcoachai.native",
binaryMessenger: flutterEngine.binaryMessenger)
methodChannel?.setMethodCallHandler { [weak self]
(call: FlutterMethodCall, result: @escaping FlutterResult) in
if let strongSelf = self {
switch call.method {
case "init":
result(strongSelf.vm.flutterArguments)
case "teachingEnd":
strongSelf.methodChannel?.invokeMethod("dispose", arguments: nil)
// ["totalDuration": 3, "reasonText": Concern about my personal privacy, "status": incomplete, "incompleteReasonCode": 2]
let argument: [String: Any] = try! JSONSerialization.jsonObject(with: (call.arguments as! String).data(using: .utf8)!) as! [String: Any]
// let totalDuration: Int = argument["totalDuration"] as! Int
// let reasonText: String = argument["reasonText"] as! String
// let incompleteReasonCode: Int = argument["incompleteReasonCode"] as! Int
let status: String = argument["status"] as! String
if status == "incomplete" {
// strongSelf.showError(reasonText)
} else if status == "complete" {
strongSelf.toCompleteVC()
return
}
strongSelf.navigationController?.popViewController(animated: true)
default:
// Unrecognized method name
print("Unrecognized method name: \(call.method)")
}
}
}
}
}
func checkCameraPermission() -> Bool? {
let cameraAuthorizationStatus = AVCaptureDevice.authorizationStatus(for: .video)
switch cameraAuthorizationStatus {
case .notDetermined:
return nil
case .authorized:
return true
default:
permisionPopupV.isHidden = false
return false
}
}
func showError(_ text: String?) {
let alertVC = UIAlertController(title: text, message: nil, preferredStyle: .alert)
alertVC.addAction(UIAlertAction(title: "OK", style: .cancel))
navigationController?.pushViewController(alertVC, animated: true)
}
func toCompleteVC() {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "CompleteVC") as! CompleteVC
// vc.vm = vm
navigationController?.pushViewController(vc, animated: true)
}
@IBAction func toSetting(_: Any) {
if let appSettingsURL = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(appSettingsURL)
}
}
@IBAction func tapStart(_: Any) {
if checkCameraPermission() == false {
return
}
if !isFirstLoad {
methodChannel?.invokeMethod("reload", arguments: nil)
}
isFirstLoad = false
if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine {
let scanVC = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
scanVC.modalPresentationStyle = .overFullScreen
navigationController?.pushViewController(scanVC, animated: true)
}
}
/// 选择语言
@IBAction func showPanel(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
popupView.isHidden = !sender.isSelected
//
(panelV.viewWithTag(1000) as! UIButton).isSelected = false
(panelV.viewWithTag(1001) as! UIButton).isSelected = false
(panelV.viewWithTag(1002) as! UIButton).isSelected = false
// switch vm.language {
// case .english:
// (panelV.viewWithTag(1000) as! UIButton).isSelected = true
// case .français:
// (panelV.viewWithTag(1001) as! UIButton).isSelected = true
// case .español:
// (panelV.viewWithTag(1002) as! UIButton).isSelected = true
// }
}
@IBAction func dismissPermissimPanel(_: Any) {
permisionPopupV.isHidden = true
}
// @IBAction func selectLanguage(_ sender: UIButton) {
// switch sender.tag {
// case 1000:
// vm.language = .english
// case 1001:
// vm.language = .français
// case 1002:
// vm.language = .español
// default:
// break
// }
//
// switchBtn.isSelected = false
// popupView.isHidden = true
//
// updateUI()
// }
}
//
// BaseLandingVC.swift
// BreastFeedingDemo
//
// Created by Jie Zhang on 2022/10/7.
//
import AVFoundation
import Flutter
import UIKit
class BaseLandingVC: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
viewModel.teachingEndHandler = { [weak self] in
self?.navigationController?.popViewController(animated: true)
}
viewModel.completeHandler = { [weak self] in
self?.toCompleteVC()
}
// Do any additional setup after loading the view.
}
/// 检查权限
/// - Returns: 是否有相机权限
func checkCameraPermission() -> Bool? {
let cameraAuthorizationStatus = AVCaptureDevice.authorizationStatus(for: .video)
switch cameraAuthorizationStatus {
case .notDetermined:
return nil
case .authorized:
return true
default:
showPermissionChalenge()
return false
}
}
/// 提示权限问题
func showPermissionChalenge() {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "PermissionAlertVC") as! PermissionAlertVC
vc.modalPresentationStyle = .overCurrentContext
present(vc, animated: true)
}
func toCompleteVC() {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "CompleteVC") as! CompleteVC
navigationController?.pushViewController(vc, animated: true)
}
func showFlutterScreen() {
if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine {
let scanVC = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
scanVC.modalPresentationStyle = .overFullScreen
navigationController?.pushViewController(scanVC, animated: true)
}
}
@IBAction func startAction(_: Any) {
if checkCameraPermission() == false {
return
}
if !viewModel.isFirstLoad {
viewModel.methodChannel?.invokeMethod("reload", arguments: nil)
}
viewModel.isFirstLoad = false
showFlutterScreen()
}
}
......@@ -7,7 +7,7 @@
import UIKit
class CradleHoldLandingVC: UIViewController {
class CradleHoldLandingVC: BaseLandingVC {
@IBOutlet weak var titleL: UILabel!
@IBOutlet weak var subtitleL: UILabel!
......
......@@ -7,9 +7,7 @@
import AVFoundation
import Flutter
//import Popover
import UIKit
//import ZJTableViewManager
class DemoViewController: UIViewController {
fileprivate var popover: Popover!
......@@ -26,8 +24,6 @@ class DemoViewController: UIViewController {
@IBOutlet weak var lyingTitleL: UILabel!
@IBOutlet weak var lyingSubtitleL: UILabel!
@IBOutlet weak var topConstraint: NSLayoutConstraint!
var methodChannel: FlutterMethodChannel?
var isFirstLoad: Bool = true
override func viewDidLoad() {
super.viewDidLoad()
......@@ -37,7 +33,6 @@ class DemoViewController: UIViewController {
scrollView.automaticallyAdjustsScrollIndicatorInsets = false
scrollView.contentInsetAdjustmentBehavior = .never
updateUI()
flutterInitialize()
}
override func viewDidAppear(_ animated: Bool) {
......@@ -64,71 +59,6 @@ class DemoViewController: UIViewController {
updateUI()
}
/// 提示权限问题
fileprivate func showPermissionChalenge() {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "PermissionAlertVC") as! PermissionAlertVC
vc.modalPresentationStyle = .overCurrentContext
present(vc, animated: true)
}
/// 检查权限
/// - Returns: 是否有相机权限
fileprivate func checkCameraPermission() -> Bool? {
let cameraAuthorizationStatus = AVCaptureDevice.authorizationStatus(for: .video)
switch cameraAuthorizationStatus {
case .notDetermined:
return nil
case .authorized:
return true
default:
showPermissionChalenge()
return false
}
}
fileprivate func flutterInitialize() {
if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine {
methodChannel = FlutterMethodChannel(name: "com.wmdigit.breastcoachai.native",
binaryMessenger: flutterEngine.binaryMessenger)
methodChannel?.setMethodCallHandler { [weak self]
(call: FlutterMethodCall, result: @escaping FlutterResult) in
if let strongSelf = self {
switch call.method {
case "init":
result(viewModel.flutterArguments)
case "teachingEnd":
strongSelf.methodChannel?.invokeMethod("dispose", arguments: nil)
// ["totalDuration": 3, "reasonText": Concern about my personal privacy, "status": incomplete, "incompleteReasonCode": 2]
let argument: [String: Any] = try! JSONSerialization.jsonObject(with: (call.arguments as! String).data(using: .utf8)!) as! [String: Any]
// let totalDuration: Int = argument["totalDuration"] as! Int
// let reasonText: String = argument["reasonText"] as! String
// let incompleteReasonCode: Int = argument["incompleteReasonCode"] as! Int
let status: String = argument["status"] as! String
if status == "incomplete" {
// strongSelf.showError(reasonText)
} else if status == "complete" {
strongSelf.toCompleteVC()
return
}
strongSelf.navigationController?.popViewController(animated: true)
default:
// Unrecognized method name
print("Unrecognized method name: \(call.method)")
}
}
}
}
}
func toCompleteVC() {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "CompleteVC") as! CompleteVC
navigationController?.pushViewController(vc, animated: true)
}
func toSideLyingLandingVC() {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "SideLyingLandingVC") as! SideLyingLandingVC
......@@ -142,35 +72,14 @@ class DemoViewController: UIViewController {
}
@IBAction func sideLyingAction(_ sender: Any) {
if checkCameraPermission() == false {
return
}
if !isFirstLoad {
methodChannel?.invokeMethod("reload", arguments: nil)
}
isFirstLoad = false
viewModel.posture = .lying
toSideLyingLandingVC()
}
@IBAction func cradleHold(_: Any) {
if checkCameraPermission() == false {
return
}
if !isFirstLoad {
methodChannel?.invokeMethod("reload", arguments: nil)
}
isFirstLoad = false
viewModel.posture = .cradle
toCradleHoldLandingVC()
// if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine {
// let scanVC = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
// scanVC.modalPresentationStyle = .overFullScreen
// navigationController?.pushViewController(scanVC, animated: true)
// }
}
}
......
......@@ -7,7 +7,7 @@
import UIKit
class SideLyingLandingVC: UIViewController {
class SideLyingLandingVC: BaseLandingVC {
@IBOutlet weak var titleL: UILabel!
@IBOutlet weak var subtitleL: UILabel!
......@@ -28,6 +28,7 @@ class SideLyingLandingVC: UIViewController {
@IBAction func back(_ sender: Any) {
navigationController?.popViewController(animated: true)
}
fileprivate func setupUI() {
titleL.text = getString().lyingGestureIntroduce.title
subtitleL.text = getString().lyingGestureIntroduce.subTitle
......
......@@ -6,8 +6,13 @@
//
import Foundation
import Flutter
class ViewModel {
enum Posture: Int {
case cradle = 0
case lying = 1
}
/// 语言枚举,enum代表语言包文件名,rawValue代表语言选项
enum Language: String, CaseIterable {
case english = "English"
......@@ -25,7 +30,10 @@ class ViewModel {
}
}
var posture: Posture = .cradle
var string: StringModel!
var isFirstLoad: Bool = true
var languagePack: [String: Any] {
let languageFile = "\(language)".appending(".json")
......@@ -38,6 +46,7 @@ class ViewModel {
var flutterArguments: String {
let arguments: [String: Any] = [
"lying": posture.rawValue,
"languagePack": languagePack,
"env": env,
"apiKey": apiKey,
......@@ -49,9 +58,47 @@ class ViewModel {
return str!
}
var methodChannel: FlutterMethodChannel!
var completeHandler: (()->())?
var teachingEndHandler: (()->())?
init() {
language = .english
setupText()
methodChannel = setupFlutter()
}
func setupFlutter() -> FlutterMethodChannel {
let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine
let methodChannel = FlutterMethodChannel(name: "com.wmdigit.breastcoachai.native",
binaryMessenger: flutterEngine!.binaryMessenger)
methodChannel.setMethodCallHandler { [weak self]
(call: FlutterMethodCall, result: @escaping FlutterResult) in
if let strongSelf = self {
switch call.method {
case "init":
result(viewModel.flutterArguments)
case "teachingEnd":
strongSelf.methodChannel.invokeMethod("dispose", arguments: nil)
// ["totalDuration": 3, "reasonText": Concern about my personal privacy, "status": incomplete, "incompleteReasonCode": 2]
let argument: [String: Any] = try! JSONSerialization.jsonObject(with: (call.arguments as! String).data(using: .utf8)!) as! [String: Any]
let status: String = argument["status"] as! String
if status == "incomplete" {
// strongSelf.showError(reasonText)
} else if status == "complete" {
strongSelf.completeHandler?()
// strongSelf.toCompleteVC()
return
}
strongSelf.teachingEndHandler?()
default:
// Unrecognized method name
print("Unrecognized method name: \(call.method)")
}
}
}
return methodChannel
}
fileprivate func setupText() {
......
This diff is collapsed.
......@@ -24,7 +24,22 @@
"Pendant l'allaitement, gardez la tête de bébé en position plus haute que le reste du corps",
"nobabysittingBabystright":
"Pendant l'allaitement, gardez l'oreille, l'épaule et les fesses de bébé au même niveau",
"lyingUnrecognition":
"Aucun bébé détecté. Veuillez suivre les instructions à l'écran",
"lyingKeepadpos": "S'il vous plaît faites face au bébé",
"lyingKeeplying":
"Veuillez vous allonger correctement sur le côté. Ne soutenez pas votre tête uniquement avec vos bras",
"lyingBabyhead": "Ne limitez pas la tête de bébé avec vos mains",
"lyingNobabyback":
"Utilisez vos bras pour soutenir le dos du bébé et assurez-vous que la poitrine et l'abdomen sont près de vous",
"lyingBabystright":
"Gardez l'oreille, l'épaule et les fesses de bébé au même niveau",
"lyingBabyheadloc":
"Assurez-vous que bébé est face au sein à la bonne hauteur",
"nobabylyingBabyheadloc":
"Pendant l'allaitement proprement dit, assurez-vous que le bébé fait face au sein correctement",
"nobabylyingBabystright":
"Pendant l'allaitement, gardez l'oreille, l'épaule et les fesses de bébé au même niveau",
"sittingSuggest": [
"Ajustez-vous à une posture confortable et gardez bébé très près de vous à tout moment",
"Assurez-vous que le bébé prend correctement le sein (la bouche doit couvrir entièrement le mamelon et l'aréole)",
......@@ -33,6 +48,16 @@
"Détendez votre épaule",
"Votre main, votre taille et vos pieds doivent être soutenus lorsque vous tenez bébé",
"Restez détendu jusqu'à la fin de la séance"
],
"lyingSuggest": [
"Faites toujours attention à ce que bébé puisse respirer en douceur",
"Ne serrez pas la poitrine. Rapprochez les fesses du bébé de votre abdomen",
"Assurez-vous que le bébé prend correctement le sein (la bouche doit couvrir entièrement le mamelon et l'aréole)",
"Gardez le menton de bébé près de votre sein et sa bouche couvrant entièrement le mamelon et l'aréole",
"Appuyez sur l'icône en haut à droite pour afficher plus d'informations",
"Vous pouvez utiliser un coussin pour soutenir votre tête, mais il ne doit pas être trop épais",
"Vous pouvez utiliser un coussin pour soutenir votre taille ou le mettre entre vos jambes pour vous reposer et vous détendre",
"Restez détendu jusqu'à la fin de la séance"
]
},
"commonmemsg": {
......@@ -67,6 +92,26 @@
"babyheadloc":
"Assurez-vous que bébé est face au sein à la bonne hauteur"
},
"lyingMsg": {
"keepadpos": "S'il vous plaît faites face au bébé",
"keeplying": "Veuillez vous allonger droit",
"babyhead": "Ne limitez pas la tête de bébé avec vos mains",
"nobabyback":
"Utilisez vos bras pour soutenir le dos du bébé et assurez-vous que la poitrine et l'abdomen sont près de vous",
"babystright":
"Gardez l'oreille, l'épaule et les fesses de bébé au même niveau",
"babyheadloc":
"Assurez-vous que bébé est face au sein à la bonne hauteur"
},
"lyingMsgPart": {
"babyhead": "Ne limitez pas la tête de bébé avec vos mains",
"nobabyback":
"Utilisez vos bras pour soutenir le dos du bébé et assurez-vous que la poitrine et l'abdomen sont près de vous",
"babystright":
"Gardez l'oreille, l'épaule et les fesses de bébé au même niveau",
"babyheadloc":
"Assurez-vous que bébé est face au sein à la bonne hauteur"
},
"successmsg": {
"recordMessage":
"Vous pouvez commencer à allaiter maintenant ! La minuterie démarre dans 3 secondes…",
......@@ -77,7 +122,7 @@
"posSuccess": "Votre posture est correcte. Vous pouvez continuer"
},
"strings": {
"suggestTitle": "Pendant l'allaitemen:",
"suggestTitle": "\"Pendant l'allaitement\":",
"suggestText1":
"Ajustez-vous à une posture confortable et gardez bébé très près de vous à tout moment",
"suggestText2":
......@@ -85,6 +130,10 @@
"suggestText3":
"Votre main, votre taille et vos pieds doivent être soutenus lorsque vous tenez bébé",
"suggestText4": "Restez détendu jusqu'à la fin de la séance",
"lyingSuggestText1":
"1. Pendant l'allaitement, faites toujours attention à la respiration de votre bébé. Ne serrez pas la poitrine. Rapprochez les fesses du bébé de votre abdomen et laissez un peu d'espace entre votre sein et le nez de votre bébé.",
"lyingSuggestText2":
"2. Vous pouvez utiliser un coussin pour soutenir votre tête, mais il ne doit pas être trop épais. Vous pouvez utiliser un coussin pour soutenir votre taille ou le placer entre vos jambes pour vous reposer et vous détendre.",
"suggestConfirmText": "OK.",
"discardReasonTitle": "Raisons d'abandonner?",
"discardReason1": "Je ne sais pas comment l'utiliser",
......@@ -103,6 +152,16 @@
"Gardez le cou de bébé sur votre coude et ne limitez pas la tête de bébé avec votre main",
"sitMainPointsText4":
"Gardez l'oreille, l'épaule et les fesses de bébé au même niveau",
"sitMainPointsLyingText1":
"Gardez la tête de bébé en position haute pour que vous puissiez voir le visage de bébé",
"sitMainPointsLyingText2":
"Vous et le bébé devez être proches l'un de l'autre",
"sitMainPointsLyingText3":
"Gardez l'oreille, l'épaule et les fesses de bébé au même niveau",
"sitMainPointsLyingText4":
"Vous pouvez utiliser une main pour soutenir le dos du bébé et l'autre main pour vous reposer sous la tête.",
"sitMainPointsLyingText5":
"Faites toujours attention à la respiration de votre bébé. Ne serrez pas la poitrine. Rapprochez les fesses du bébé de votre abdomen et laissez un peu d'espace entre votre sein et le nez de votre bébé.",
"sitMainPointsConfirmText": "OK",
"momLeft":
"Aucune personne détectée. La page d'arrivée s'affichera après 5 secondes",
......@@ -111,6 +170,6 @@
"errorTitle": "Erreur",
"keyErrorText": "Interdire l'utilisation des clés",
"originErrorText": "Cors not allowed",
"noCameraErrorText": "Caméra non détectée",
}
"noCameraErrorText": "Caméra non détectée"
}
}
......@@ -24,8 +24,22 @@
"Durante la lactancia real, mantenga la cabeza del bebé en una posición más alta que el resto del cuerpo",
"nobabysittingBabystright":
"Durante la lactancia real, mantenga la oreja, el hombro y el trasero del bebé al mismo nivel",
"lyingUnrecognition":
"Ningún bebé detectado. Siga las instrucciones en pantalla",
"lyingKeepadpos": "Por favor, enfréntate al bebé.",
"lyingKeeplying":
"Acuéstese de lado correctamente. No apoyes tu cabeza solo con tus brazos",
"lyingBabyhead": "No restrinja la cabeza del bebé con las manos.",
"lyingNobabyback":
"Use sus brazos para sostener la espalda del bebé y asegúrese de que el pecho y el abdomen estén cerca de usted.",
"lyingBabystright":
"Mantenga la oreja, el hombro y el trasero del bebé al mismo nivel",
"lyingBabyheadloc":
"Asegúrese de que el bebé esté frente al pecho a la altura adecuada",
"nobabylyingBabyheadloc":
"Durante la lactancia real, asegúrese de que el bebé mire hacia el pecho correctamente.",
"nobabylyingBabystright":
"Durante la lactancia real, mantenga la oreja, el hombro y el trasero del bebé al mismo nivel",
"sittingSuggest": [
"Tome una postura cómoda y mantén al bebé muy cerca de usted en todo momento",
"Asegúrese de que el bebé esté bien sujeto (la boca debe cubrir completamente el pezón y la areola)",
......@@ -34,6 +48,16 @@
"Relaje su hombro",
"Debe haber apoyo en su mano, su cintura y sus pies al sostener al bebé",
"Manténgase relajada hasta el final de la sesión"
],
"lyingSuggest": [
"Siempre preste atención para asegurarse de que el bebé pueda respirar sin problemas.",
"No apriete el pecho. Haz que el trasero del bebé esté más cerca de tu abdomen.",
"Asegúrese de que el bebé esté bien sujeto (la boca debe cubrir completamente el pezón y la areola)",
"Mantenga la barbilla del bebé cerca de su seno y la boca cubriendo completamente el pezón y la areola.",
"Toque el icono superior derecho para ver más información",
"Puede usar un cojín para apoyar su cabeza, pero no debe ser demasiado grueso",
"Puede usar un cojín para apoyar su cintura o colocarlo entre sus piernas para descansar y relajarse.",
"Manténgase relajado hasta el final de la sesión."
]
},
"commonmemsg": {
......@@ -68,6 +92,26 @@
"babyheadloc":
"Asegúrese de que el bebé esté frente al pecho a la altura adecuada"
},
"lyingMsg": {
"keepadpos": "Por favor, enfréntate al bebé.",
"keeplying": "por favor acuéstate derecho",
"babyhead": "No restrinja la cabeza del bebé con las manos.",
"nobabyback":
"Use sus brazos para sostener la espalda del bebé y asegúrese de que el pecho y el abdomen estén cerca de usted.",
"babystright":
"Mantenga la oreja, el hombro y el trasero del bebé al mismo nivel",
"babyheadloc":
"Asegúrese de que el bebé esté frente al pecho a la altura adecuada"
},
"lyingMsgPart": {
"babyhead": "No restrinja la cabeza del bebé con las manos.",
"nobabyback":
"Use sus brazos para sostener la espalda del bebé y asegúrese de que el pecho y el abdomen estén cerca de usted.",
"babystright":
"Mantenga la oreja, el hombro y el trasero del bebé al mismo nivel",
"babyheadloc":
"Asegúrese de que el bebé esté frente al pecho a la altura adecuada"
},
"successmsg": {
"recordMessage":
"¡Puede comenzar a darle el pecho ahora! El temporizador comienza en 3 segundos...",
......@@ -77,7 +121,7 @@
"posSuccess": "Su postura es correcta. Por favor, sigua así"
},
"strings": {
"suggestTitle": "Durante la lactancia real:",
"suggestTitle": "\"Durante la lactancia real\":",
"suggestText1":
"Tome una postura cómoda y mantén al bebé muy cerca de usted en todo momento",
"suggestText2":
......@@ -85,6 +129,10 @@
"suggestText3":
"Debe haber apoyo en su mano, su cintura y sus pies al sostener al bebé",
"suggestText4": "Manténgase relajada hasta el final de la sesión",
"lyingSuggestText1":
"1. Durante la lactancia, siempre preste atención a la respiración de su bebé. No apriete el pecho. Acerque el trasero del bebé a su abdomen y deje algo de espacio entre su seno y la nariz de su bebé.",
"lyingSuggestText2":
"2. Puede usar un cojín para apoyar su cabeza, pero no debe ser demasiado grueso. Puede usar un cojín para apoyar su cintura o colocarlo entre sus piernas para descansar y relajarse.",
"suggestConfirmText": "DE ACUERDO",
"discardReasonTitle": "Razones para rendirse?",
"discardReason1": "No estoy segura de cómo usarlo",
......@@ -102,6 +150,15 @@
"Mantenga el cuello del bebé sobre su codo y no restrinja la cabeza del bebé con su mano",
"sitMainPointsText4":
"Mantenga la oreja, el hombro y el trasero del bebé al mismo nivel",
"sitMainPointsLyingText1":
"Mantenga la cabeza del bebé en una posición más alta para que pueda ver la cara del bebé",
"sitMainPointsLyingText2": "Tú y el bebé deben estar cerca el uno del otro.",
"sitMainPointsLyingText3":
"Mantenga la oreja, el hombro y el trasero del bebé al mismo nivel",
"sitMainPointsLyingText4":
"Puede usar una mano para sostener la espalda del bebé y la otra mano para descansar debajo de la cabeza.",
"sitMainPointsLyingText5":
"Siempre preste atención a la respiración de su bebé. No apriete el pecho. Acerque el trasero del bebé a su abdomen y deje algo de espacio entre su seno y la nariz de su bebé.",
"sitMainPointsConfirmText": "DE ACUERDO",
"momLeft":
"No se detectó ninguna persona. La página de finalización se mostrará después de 5 segundos",
......@@ -110,6 +167,6 @@
"errorTitle": "Error",
"keyErrorText": "Desactivar la clave",
"originErrorText": "CORS no permite",
"noCameraErrorText": "Cámara no detectada",
}
"noCameraErrorText": "Cámara no detectada"
}
}
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