craft-native 0.0.149 → 0.0.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3303,7 +3303,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
3303
3303
  `);
3304
3304
  }
3305
3305
  // package.json
3306
- var version = "0.0.149";
3306
+ var version = "0.0.150";
3307
3307
 
3308
3308
  // bin/cli.ts
3309
3309
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -310,7 +310,7 @@ function craftBinaryNotFoundMessage(triedPath) {
310
310
  `);
311
311
  }
312
312
  // package.json
313
- var version = "0.0.149";
313
+ var version = "0.0.150";
314
314
 
315
315
  // src/sdk-version.ts
316
316
  var SDK_VERSION = version;
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ function craftBinaryNotFoundMessage(triedPath) {
58
58
  `);
59
59
  }
60
60
  // package.json
61
- var version = "0.0.149";
61
+ var version = "0.0.150";
62
62
 
63
63
  // src/sdk-version.ts
64
64
  var SDK_VERSION = version;
@@ -566,6 +566,18 @@ final class CraftChrome: ObservableObject {
566
566
  tabBarVisible = true
567
567
  }
568
568
 
569
+ /// A native screen that wants the whole screen (a workout under way) asks
570
+ /// the bar away while it shows (`tabBarHidden`, CraftNativeScreen.swift);
571
+ /// the next screen shown says again. The page's own hideTabBar is apart.
572
+ private(set) var hiddenByScreen = false
573
+ func setHiddenByScreen(_ hidden: Bool) {
574
+ guard hiddenByScreen != hidden else { return }
575
+ hiddenByScreen = hidden
576
+ pendingHide?.cancel()
577
+ withAnimation(Self.motion(.easeInOut(duration: 0.2))) { tabBarVisible = !hidden && !tabs.isEmpty }
578
+ publishLayout()
579
+ }
580
+
569
581
  /// However the page behaves, the splash is gone after `seconds`
570
582
  /// (`splashMaxSeconds`, three by default). It used to be ten: a page that
571
583
  /// never painted held a logo on screen for ten seconds, which reads as a
@@ -595,7 +607,7 @@ final class CraftChrome: ObservableObject {
595
607
  let dark = (body["tintDark"] as? String).flatMap { UIColor(hex: $0) }
596
608
  tint = light.map { light in dark.map { dark in UIColor { $0.userInterfaceStyle == .dark ? dark : light } } ?? light }
597
609
  }
598
- withAnimation(Self.motion(.easeOut(duration: 0.2))) { tabBarVisible = !tabs.isEmpty }
610
+ withAnimation(Self.motion(.easeOut(duration: 0.2))) { tabBarVisible = !tabs.isEmpty && !hiddenByScreen }
599
611
  publishLayout()
600
612
  case "selectTab":
601
613
  if let id = body["id"] as? String, id != selected {
@@ -2335,9 +2335,21 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
2335
2335
  // a screen that hid its own.
2336
2336
  navigationController?.setNavigationBarHidden(false, animated: animated)
2337
2337
  }
2338
+ // Each screen says whether it wants the tab bar, so one that hid it
2339
+ // never leaves it hidden for the next.
2340
+ CraftChrome.shared.setHiddenByScreen(tabBarHidden)
2338
2341
  refreshTraitDefaults()
2339
2342
  }
2340
2343
 
2344
+ override func viewWillDisappear(_ animated: Bool) {
2345
+ super.viewWillDisappear(animated)
2346
+ // Popped (or its stack dismissed) while the bar was away: it comes
2347
+ // back for whatever shows next, a web page included.
2348
+ if tabBarHidden, isMovingFromParent || isBeingDismissed || navigationController?.isBeingDismissed == true {
2349
+ CraftChrome.shared.setHiddenByScreen(false)
2350
+ }
2351
+ }
2352
+
2341
2353
  override func viewDidAppear(_ animated: Bool) {
2342
2354
  super.viewDidAppear(animated)
2343
2355
  screenVisibilityChanged(true)
@@ -2852,6 +2864,8 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
2852
2864
  private var rootTopToSafeArea: NSLayoutConstraint?
2853
2865
  private var rootTopToView: NSLayoutConstraint?
2854
2866
  private var navigationBarHidden: Bool?
2867
+ /// The app's tab bar away while this screen shows (`tabBarHidden`).
2868
+ private var tabBarHidden = false
2855
2869
  private var prefersLargeTitle: Bool?
2856
2870
 
2857
2871
  /// Whether this screen asked for a bar of its own through `setOptions`: a
@@ -2879,6 +2893,12 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
2879
2893
  if largeTitle { navigationController?.navigationBar.prefersLargeTitles = true }
2880
2894
  trackContentScrollView()
2881
2895
  }
2896
+ if let hidden = options["tabBarHidden"] as? Bool {
2897
+ tabBarHidden = hidden
2898
+ if navigationController?.topViewController === self, view.window != nil {
2899
+ CraftChrome.shared.setHiddenByScreen(hidden)
2900
+ }
2901
+ }
2882
2902
  if let hidden = options["hidden"] as? Bool {
2883
2903
  navigationBarHidden = hidden
2884
2904
  if navigationController?.topViewController === self {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.149",
3
+ "version": "0.0.150",
4
4
  "type": "module",
5
5
  "description": "Build desktop apps with web languages - TypeScript SDK for Craft",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",