Commit 4798268a authored by jzhang's avatar jzhang

子页面搭建

parent e71f1048
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
EA8F42CB28EE99D900983014 /* string_english.json in Resources */ = {isa = PBXBuildFile; fileRef = EA8F42C828EE99D900983014 /* string_english.json */; }; EA8F42CB28EE99D900983014 /* string_english.json in Resources */ = {isa = PBXBuildFile; fileRef = EA8F42C828EE99D900983014 /* string_english.json */; };
EA8F42CC28EE99D900983014 /* string_french.json in Resources */ = {isa = PBXBuildFile; fileRef = EA8F42C928EE99D900983014 /* string_french.json */; }; EA8F42CC28EE99D900983014 /* string_french.json in Resources */ = {isa = PBXBuildFile; fileRef = EA8F42C928EE99D900983014 /* string_french.json */; };
EA8F42CD28EE99D900983014 /* string_spanish.json in Resources */ = {isa = PBXBuildFile; fileRef = EA8F42CA28EE99D900983014 /* string_spanish.json */; }; EA8F42CD28EE99D900983014 /* string_spanish.json in Resources */ = {isa = PBXBuildFile; fileRef = EA8F42CA28EE99D900983014 /* string_spanish.json */; };
EA8F42CF28EEA85200983014 /* CradleHoldLandingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA8F42CE28EEA85200983014 /* CradleHoldLandingVC.swift */; };
EA8F42D128EEA87A00983014 /* SideLyingLandingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA8F42D028EEA87A00983014 /* SideLyingLandingVC.swift */; };
EAD8102728E207A4002A86C9 /* MyTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8102628E207A4002A86C9 /* MyTools.swift */; }; EAD8102728E207A4002A86C9 /* MyTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8102628E207A4002A86C9 /* MyTools.swift */; };
EAD8102D28E20A54002A86C9 /* PermissionAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8102C28E20A54002A86C9 /* PermissionAlertVC.swift */; }; EAD8102D28E20A54002A86C9 /* PermissionAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8102C28E20A54002A86C9 /* PermissionAlertVC.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -117,6 +119,8 @@ ...@@ -117,6 +119,8 @@
EA8F42C828EE99D900983014 /* string_english.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = string_english.json; sourceTree = "<group>"; }; EA8F42C828EE99D900983014 /* string_english.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = string_english.json; sourceTree = "<group>"; };
EA8F42C928EE99D900983014 /* string_french.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = string_french.json; sourceTree = "<group>"; }; EA8F42C928EE99D900983014 /* string_french.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = string_french.json; sourceTree = "<group>"; };
EA8F42CA28EE99D900983014 /* string_spanish.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = string_spanish.json; sourceTree = "<group>"; }; EA8F42CA28EE99D900983014 /* string_spanish.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = string_spanish.json; sourceTree = "<group>"; };
EA8F42CE28EEA85200983014 /* CradleHoldLandingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CradleHoldLandingVC.swift; sourceTree = "<group>"; };
EA8F42D028EEA87A00983014 /* SideLyingLandingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideLyingLandingVC.swift; sourceTree = "<group>"; };
EAD8102628E207A4002A86C9 /* MyTools.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyTools.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>"; }; EAD8102C28E20A54002A86C9 /* PermissionAlertVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionAlertVC.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -265,6 +269,8 @@ ...@@ -265,6 +269,8 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
EA14360428E0BF1900FFBE72 /* DemoViewController.swift */, EA14360428E0BF1900FFBE72 /* DemoViewController.swift */,
EA8F42CE28EEA85200983014 /* CradleHoldLandingVC.swift */,
EA8F42D028EEA87A00983014 /* SideLyingLandingVC.swift */,
EAD8102C28E20A54002A86C9 /* PermissionAlertVC.swift */, EAD8102C28E20A54002A86C9 /* PermissionAlertVC.swift */,
697B07EC284F2E5C0051FC23 /* CompleteVC.swift */, 697B07EC284F2E5C0051FC23 /* CompleteVC.swift */,
); );
...@@ -396,10 +402,12 @@ ...@@ -396,10 +402,12 @@
files = ( files = (
EA8F42C528EE998000983014 /* StringModel.swift in Sources */, EA8F42C528EE998000983014 /* StringModel.swift in Sources */,
694B85C02848EB4C009BEDE1 /* ViewController.swift in Sources */, 694B85C02848EB4C009BEDE1 /* ViewController.swift in Sources */,
EA8F42D128EEA87A00983014 /* SideLyingLandingVC.swift in Sources */,
694B85BC2848EB4C009BEDE1 /* AppDelegate.swift in Sources */, 694B85BC2848EB4C009BEDE1 /* AppDelegate.swift in Sources */,
EA8F42C328EE998000983014 /* StringLyingGestureIntroduce.swift in Sources */, EA8F42C328EE998000983014 /* StringLyingGestureIntroduce.swift in Sources */,
697B07ED284F2E5C0051FC23 /* CompleteVC.swift in Sources */, 697B07ED284F2E5C0051FC23 /* CompleteVC.swift in Sources */,
EA8F42C628EE998000983014 /* StringLyingGesture.swift in Sources */, EA8F42C628EE998000983014 /* StringLyingGesture.swift in Sources */,
EA8F42CF28EEA85200983014 /* CradleHoldLandingVC.swift in Sources */,
EA14360528E0BF1900FFBE72 /* DemoViewController.swift in Sources */, EA14360528E0BF1900FFBE72 /* DemoViewController.swift in Sources */,
692EC41A284C81700043E3EA /* ViewModel.swift in Sources */, 692EC41A284C81700043E3EA /* ViewModel.swift in Sources */,
EAD8102D28E20A54002A86C9 /* PermissionAlertVC.swift in Sources */, EAD8102D28E20A54002A86C9 /* PermissionAlertVC.swift in Sources */,
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summaryBg.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summaryWireframe.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summaryWireframeLie.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summaryleftbottom.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summarylinelefttop.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summarylinelie1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summarylinelie2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summarylinelie3.heic",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summarylinelie4.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summarylinelie5.heic",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summaryrightbottom.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "summaryrighttop.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,8 +16,8 @@ class CompleteVC: UIViewController { ...@@ -16,8 +16,8 @@ class CompleteVC: UIViewController {
super.viewDidLoad() super.viewDidLoad()
overrideUserInterfaceStyle = .light overrideUserInterfaceStyle = .light
containerV.layer.cornerRadius = 8 containerV.layer.cornerRadius = 8
titleL.text = viewModel.string.completeText titleL.text = getString().completeText
btn.setTitle(viewModel.string.cameraButtonText, for: .normal) btn.setTitle(getString().cameraButtonText, for: .normal)
} }
@IBAction func okAction(_: Any) { @IBAction func okAction(_: Any) {
......
//
// CradleHoldLandingVC.swift
// BreastFeedingDemo
//
// Created by Jie Zhang on 2022/10/6.
//
import UIKit
class CradleHoldLandingVC: UIViewController {
@IBOutlet weak var titleL: UILabel!
@IBOutlet weak var subtitleL: UILabel!
@IBOutlet weak var text1L: UILabel!
@IBOutlet weak var text2L: UILabel!
@IBOutlet weak var text3L: UILabel!
@IBOutlet weak var text4L: UILabel!
@IBOutlet weak var tipsL: UILabel!
@IBOutlet weak var startBtn: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
@IBAction func back(_ sender: Any) {
navigationController?.popViewController(animated: true)
}
fileprivate func setupUI() {
titleL.text = getString().sittingGestureIntroduce.title
subtitleL.text = getString().sittingGestureIntroduce.subTitle
text1L.text = getString().sittingGestureIntroduce.suggestedText1
text2L.text = getString().sittingGestureIntroduce.suggestedText2
text3L.text = getString().sittingGestureIntroduce.suggestedText3
text4L.text = getString().sittingGestureIntroduce.suggestedText4
startBtn.setTitle(getString().homeButtonText, for: .normal)
}
}
...@@ -46,15 +46,15 @@ class DemoViewController: UIViewController { ...@@ -46,15 +46,15 @@ class DemoViewController: UIViewController {
} }
fileprivate func updateUI() { fileprivate func updateUI() {
titleL.text = viewModel.string.homeTitle titleL.text = getString().homeTitle
stepL1.text = viewModel.string.homeText1 stepL1.text = getString().homeText1
stepL2.text = viewModel.string.homeText2 stepL2.text = getString().homeText2
stepL3.text = viewModel.string.homeText3 stepL3.text = getString().homeText3
sittingTitleL.text = viewModel.string.sittingGesture.title sittingTitleL.text = getString().sittingGesture.title
sittingSubtitleL.text = viewModel.string.sittingGesture.subTitle sittingSubtitleL.text = getString().sittingGesture.subTitle
lyingTitleL.text = viewModel.string.lyingGesture.title lyingTitleL.text = getString().lyingGesture.title
lyingSubtitleL.text = viewModel.string.lyingGesture.subTitle lyingSubtitleL.text = getString().lyingGesture.subTitle
} }
/// 切换根据选择的语言更新UI /// 切换根据选择的语言更新UI
...@@ -129,7 +129,19 @@ class DemoViewController: UIViewController { ...@@ -129,7 +129,19 @@ class DemoViewController: UIViewController {
navigationController?.pushViewController(vc, animated: true) navigationController?.pushViewController(vc, animated: true)
} }
@IBAction func cradleHold(_: Any) { func toSideLyingLandingVC() {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "SideLyingLandingVC") as! SideLyingLandingVC
navigationController?.pushViewController(vc, animated: true)
}
func toCradleHoldLandingVC() {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "CradleHoldLandingVC") as! CradleHoldLandingVC
navigationController?.pushViewController(vc, animated: true)
}
@IBAction func sideLyingAction(_ sender: Any) {
if checkCameraPermission() == false { if checkCameraPermission() == false {
return return
} }
...@@ -138,15 +150,32 @@ class DemoViewController: UIViewController { ...@@ -138,15 +150,32 @@ class DemoViewController: UIViewController {
methodChannel?.invokeMethod("reload", arguments: nil) methodChannel?.invokeMethod("reload", arguments: nil)
} }
isFirstLoad = false isFirstLoad = false
if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine {
let scanVC = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil) toSideLyingLandingVC()
scanVC.modalPresentationStyle = .overFullScreen
navigationController?.pushViewController(scanVC, animated: true)
} }
@IBAction func cradleHold(_: Any) {
if checkCameraPermission() == false {
return
}
if !isFirstLoad {
methodChannel?.invokeMethod("reload", arguments: nil)
}
isFirstLoad = false
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)
// }
} }
} }
extension DemoViewController { extension DemoViewController {
/// 切换语言
@IBAction func switchLanguageAction(_ sender: UIButton) { @IBAction func switchLanguageAction(_ sender: UIButton) {
let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: 100, height: 135)) let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: 100, height: 135))
tableView.isScrollEnabled = false tableView.isScrollEnabled = false
......
...@@ -16,9 +16,9 @@ class PermissionAlertVC: UIViewController { ...@@ -16,9 +16,9 @@ class PermissionAlertVC: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
overrideUserInterfaceStyle = .light overrideUserInterfaceStyle = .light
permissionText.text = viewModel.string.cameraText1 permissionText.text = getString().cameraText1
permissionTitle.text = viewModel.string.cameraText permissionTitle.text = getString().cameraText
permissionOKBtn.setTitle(viewModel.string.cameraButtonText, for: .normal) permissionOKBtn.setTitle(getString().cameraButtonText, for: .normal)
permissionPanel.layer.cornerRadius = 8 permissionPanel.layer.cornerRadius = 8
permissionPanel.clipsToBounds = true permissionPanel.clipsToBounds = true
......
//
// SideLyingLandingVC.swift
// BreastFeedingDemo
//
// Created by Jie Zhang on 2022/10/6.
//
import UIKit
class SideLyingLandingVC: UIViewController {
@IBOutlet weak var titleL: UILabel!
@IBOutlet weak var subtitleL: UILabel!
@IBOutlet weak var text1L: UILabel!
@IBOutlet weak var text2L: UILabel!
@IBOutlet weak var text3L: UILabel!
@IBOutlet weak var text4L: UILabel!
@IBOutlet weak var text5L: UILabel!
@IBOutlet weak var tipsL: UILabel!
@IBOutlet weak var startBtn: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
@IBAction func back(_ sender: Any) {
navigationController?.popViewController(animated: true)
}
fileprivate func setupUI() {
titleL.text = getString().lyingGestureIntroduce.title
subtitleL.text = getString().lyingGestureIntroduce.subTitle
text1L.text = getString().lyingGestureIntroduce.suggestedText1
text2L.text = getString().lyingGestureIntroduce.suggestedText2
text3L.text = getString().lyingGestureIntroduce.suggestedText3
text4L.text = getString().lyingGestureIntroduce.suggestedText4
text5L.text = getString().lyingGestureIntroduce.suggestedText5
startBtn.setTitle(getString().homeButtonText, for: .normal)
tipsL.text = getString().lyingGestureIntroduce.tipsText
}
}
...@@ -27,17 +27,6 @@ class ViewModel { ...@@ -27,17 +27,6 @@ class ViewModel {
var string: StringModel! var string: StringModel!
// var landingPageTitle: String?
// var landingPageStep1: String?
// var landingPageStep2: String?
// var landingPageStep3: String?
// var landingPageStart: String?
// var congratulation: String?
// var completeBtn: String?
// var cameraText: String?
// var cameraText1: String?
// var cameraButtonText: String?
var languagePack: [String: Any] { var languagePack: [String: Any] {
let languageFile = "\(language)".appending(".json") let languageFile = "\(language)".appending(".json")
let path: String = Bundle.main.path(forResource: languageFile, ofType: nil)! let path: String = Bundle.main.path(forResource: languageFile, ofType: nil)!
...@@ -73,41 +62,5 @@ class ViewModel { ...@@ -73,41 +62,5 @@ class ViewModel {
let json = try! JSONSerialization.jsonObject(with: nsData) as! [String: Any] let json = try! JSONSerialization.jsonObject(with: nsData) as! [String: Any]
string = .init(fromDictionary: json) string = .init(fromDictionary: json)
// switch language {
// case .english:
// landingPageTitle = "Breastfeeding posture AI coach"
// landingPageStep1 = "Put your device on a stable surface"
// landingPageStep2 = "Keep one meter away from the camera, and fit your body into the guide line. Session starts in 5 seconds after you click \"Start Now\" button"
// landingPageStep3 = "Camera permission is needed for AI coach. Your clothes will not affect the AI coach"
// landingPageStart = "Start Now"
// congratulation = "Congratulations!"
// completeBtn = "OK"
// cameraText = "Camera not detected"
// cameraText1 = "Camera disabled. Please grant camera permission first!"
// cameraButtonText = "OK"
// case .français:
// landingPageTitle = "Coach AI en posture d'allaitement"
// landingPageStep1 = "Placez votre appareil sur une surface stable"
// landingPageStep2 = "Tenez-vous à un mètre de la caméra et placez votre corps dans la ligne de guidage. La session démarre dans 5 secondes après avoir cliqué sur le bouton \"Démarrer maintenant\""
// landingPageStep3 = "L'autorisation de la caméra est nécessaire pour l'entraîneur AI. Vos vêtements n'affecteront pas l'entraîneur AI"
// landingPageStart = "Commencez maintenant"
// congratulation = "Toutes nos félicitations!"
// completeBtn = "OK"
// cameraText = "Caméra non détectée"
// cameraText1 = "Caméra désactivée. Veuillez d'abord accorder l'autorisation de la caméra !"
// cameraButtonText = "OK"
// case .español:
// landingPageTitle = "Asistente de AI de postura de lactancia"
// landingPageStep1 = "Coloque su dispositivo en una superficie estable"
// landingPageStep2 = "Manténgase a un metro de distancia de la cámara y coloque su cuerpo en la línea. La sesión comienza en 5 segundos después de hacer clic en el botón \"Comenzar ahora\""
// landingPageStep3 = "Se necesita permiso para acceder a la cámara para el asistente de IA. Su ropa no afectará al asistente de IA"
// landingPageStart = "Empezar ahora"
// congratulation = "¡Felicidades!"
// completeBtn = "DE ACUERDO"
// cameraText = "Cámara no detectada"
// cameraText1 = "Cámara desactivada. ¡Por favor, conceda permiso a la cámara primero!"
// cameraButtonText = "DE ACUERDO"
// }
} }
} }
...@@ -50,6 +50,9 @@ extension UIApplication { ...@@ -50,6 +50,9 @@ extension UIApplication {
} }
let viewModel = ViewModel.init() let viewModel = ViewModel.init()
func getString() -> StringModel {
return viewModel.string!
}
let mainColor = hexStringToUIColor(hex: "F58685") let mainColor = hexStringToUIColor(hex: "F58685")
let blackColor = hexStringToUIColor(hex: "322D31") let blackColor = hexStringToUIColor(hex: "322D31")
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