Skip to content

Commit 6a0fc46

Browse files
committed
chore: updates
1 parent b819d01 commit 6a0fc46

30 files changed

+4724
-6590
lines changed

.vitepress/clientAppEnhance.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default ({ router }) => {
2+
router.afterEach(() => {
3+
// Ensure the DOM is updated before scrolling
4+
setTimeout(() => {
5+
window.scrollTo(0, 0)
6+
}, 0)
7+
})
8+
}

.vitepress/config.mts

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import mainSidebar from '../content/sidebar'
44
import uiSidebar from '../content/ui/sidebar'
55
import pluginsSidebar from '../content/plugins/sidebar'
66
import nav from './nav'
7-
import './theme/cliLanguage'
7+
import './clientAppEnhance';
8+
// import './theme/cliLanguage'
89
import path from 'node:path'
910
import { SiteMap } from './genSitemap.mjs'
1011

@@ -71,6 +72,7 @@ export default defineConfig({
7172
},
7273
markdown: {
7374
headers: true,
75+
theme: "github-dark"
7476
},
7577
async transformPageData(pageData, { siteConfig }) {
7678
// const contributors = await githubAuthors.getAuthorsForFilePath(
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

content/best-practices/native-class.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ You can use setup methods in this case to mitigate any cross compilation issue,
2929
```ts
3030
let customClass
3131
function setupCustomClass() {
32-
if (global.isAndroid) {
32+
if (__ANDROID__) {
3333
@NativeClass()
3434
class CustomClass extends android.view.View {}
3535
customClass = CustomClass
@@ -44,7 +44,7 @@ setupCustomClass()
4444
const customClassInstance = new customClass() // can handle different platform args with ternary if needed
4545
```
4646

47-
The `global.isAndroid` conditional will get removed when building the app for iOS so your compiled code is clean and isolated while allowing you to handle in a single file.
47+
The `__ANDROID__` macro will get removed when building the app for iOS so your compiled code is clean and isolated while allowing you to handle in a single file.
4848

4949
## When exported from a file and used elsewhere
5050

content/best-practices/platform-file-split-or-not.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The advent of tree shaking and webpack builds does away with quite a bit of worr
2828

2929
## Conditional with tree shaking
3030

31-
When speaking of tree shaking ever since NativeScript 7, you've been able to use `global.isAndroid` or `global.isIOS` and anytime those are used as conditional splits in your code, only the applicable code for the platform that's being built would actually end up in your compiled code alleviating a lot of concern here.
31+
When speaking of tree shaking ever since NativeScript 7, you've been able to use `__ANDROID__` or `global.isIOS` and anytime those are used as conditional splits in your code, only the applicable code for the platform that's being built would actually end up in your compiled code alleviating a lot of concern here.
3232

3333
## Future maintenance
3434

content/guide/animations.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,11 @@ In addition to expressing NativeScript [Animation APIs](#animating-with-code) wh
479479
```ts
480480
touchAnimation = {
481481
down(view: View) {
482-
if (global.isIOS) {
482+
if (__IOS__) {
483483
UIView.animateWithDurationAnimations(0.25, () => {
484484
view.ios.transform = CGAffineTransformMakeScale(0.95, 0.95)
485485
})
486-
} else if (global.isAndroid) {
486+
} else if (__ANDROID__) {
487487
const lib = androidx.dynamicanimation.animation
488488
const spring = new lib.SpringForce(0.95)
489489
.setDampingRatio(lib.SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY)
@@ -505,11 +505,11 @@ touchAnimation = {
505505
}
506506
},
507507
up(view: View) {
508-
if (global.isIOS) {
508+
if (__IOS__) {
509509
UIView.animateWithDurationAnimations(0.25, () => {
510510
view.ios.transform = CGAffineTransformIdentity
511511
})
512-
} else if (global.isAndroid) {
512+
} else if (__ANDROID__) {
513513
const lib = androidx.dynamicanimation.animation
514514
const spring = new lib.SpringForce(1)
515515
.setDampingRatio(lib.SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY)

content/guide/publishing/apple-app-store.md

+523
Large diffs are not rendered by default.

content/guide/publishing/index.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ breadcrumbs:
77
- name: 'Publishing'
88
---
99

10-
- [Publishing to Google Play](/guide/publishing/android-google-play)
11-
- Publishing to AppStore [WIP] [old v8 docs](https://v8.docs.nativescript.org/releasing.html#ios)
12-
- [Publishing with Fastlane](/guide/publishing/fastlane)
10+
## [Publishing to Google Play](/guide/publishing/android-google-play)
11+
## [Publishing to Apple App Store](/guide/publishing/apple-app-store)
12+
## [Publishing iOS updated using ns publish ios](/guide/publishing/ns-publish)
13+
## [Publishing with Fastlane](https://blog.nativescript.org/automatic-nativescript-app-deployments-with-fastlane/)
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: Publishing with ns publish
3+
category: Publishing
4+
categoryLink: /guide/publishing/
5+
prev: /guide/publishing/
6+
next: false
7+
contributors:
8+
- rigor789
9+
- NathanWalker
10+
breadcrumbs:
11+
- name: 'Publishing'
12+
href: '/guide/publishing/'
13+
- name: 'Using ns publish'
14+
---
15+
16+
You may want to review a few specific store preparation details in the following before using `ns publish`:
17+
- [Publishing to Google Play](/guide/publishing/android-google-play)
18+
- [Publishing to Apple App Store](/guide/publishing/apple-app-store)
19+
20+
You can execute the following command inside a NativeScript project using the CLI:
21+
22+
```bash
23+
ns publish ios
24+
```
25+
26+
The command will prompt for your `Apple ID` and `Password` for authentication with [iTunes Connect](https://itunesconnect.apple.com) and then produce a `release` build and proceed to upload it to iTunes Connect.
27+
28+
Alternatively, you can use an existing build by running the following command:
29+
30+
```bash
31+
ns publish ios --ipa <path-to-ipa>
32+
```
33+
34+
All of the parameters needed for publishing can be passed to the `publish` command directly:
35+
36+
```bash
37+
ns publish ios [<Apple ID> [<Password> [<Mobile Provisioning Profile Identifier> [<Code Sign Identity>]]]]]
38+
```
39+
40+
For example, assuming that you want to issue a build using a mobile provision with an identifier _d5d40f61-b303-4fc8-aea3-fbb229a8171c_, you could run:
41+
42+
```bash
43+
ns publish ios my-apple-id my-password d5d40f61-b303-4fc8-aea3-fbb229a8171c "iPhone Distribution"
44+
```
45+
46+
Note that the `Code Sign Identity` can be set to something generic like _iPhone Distribution_ in order to let the build automatically detect a code sign identity.
47+
48+
You can also automate the uploads of already built packages:
49+
50+
```bash
51+
ns publish ios my-apple-id my-password --ipa /tmp/build/myIpa.ipa
52+
```
53+
54+
For more information, run the following command:
55+
56+
```bash
57+
ns help publish ios
58+
```
59+
60+
Some tools that allow the submission process to be automated:
61+
62+
- https://blog.nativescript.org/automatic-nativescript-app-deployments-with-fastlane/
63+
- https://github.com/fastlane/fastlane

content/guide/widgets-ios.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ The widget generator expects iOS 17 minimum.
143143

144144
If you encounter errors similar to the following:
145145

146-
```
146+
```bash
147147
App_Resources/iOS/extensions/widget/WidgetBundle.swift:7:3: error: 'WidgetHomeScreen' is only available in application extensions for iOS 17.0 or newer
148148
```
149149

150150
Add the following line to your `App_Resources/iOS/build.xcconfig`:
151151

152-
```
152+
```bash
153153
IPHONEOS_DEPLOYMENT_TARGET = 17;
154154
```

content/sidebar.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export default [
4747
text: 'Debugging',
4848
link: '/guide/debugging',
4949
},
50+
{
51+
text: 'Publishing',
52+
link: '/guide/publishing',
53+
},
5054
{
5155
text: 'Plugins',
5256
link: '/guide/development-workflow/using-packages',
@@ -59,11 +63,6 @@ export default [
5963
text: 'Testing',
6064
link: '/guide/testing',
6165
},
62-
// TODO: finish app store and fastlane
63-
// {
64-
// text: 'Publishing',
65-
// link: '/guide/publishing/',
66-
// },
6766
{
6867
text: 'Updating',
6968
link: '/guide/updating/',

examples/angular/src/ui/ViewOrigin/component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ViewOriginComponent {
2929

3030
// allow custom origin to be visible outside of the box
3131
this.box.on('loaded', (args) => {
32-
if (global.isAndroid) {
32+
if (__ANDROID__) {
3333
;(args.object as GridLayout).android.getParent().setClipChildren(false)
3434
}
3535
})
@@ -70,7 +70,7 @@ export class ViewOriginComponent {
7070
this.box.originY = +y
7171

7272
// iOS shifts the view when origin is set??
73-
if (global.isIOS) {
73+
if (__IOS__) {
7474
this.box.translateX = this.box.originX * 200
7575
this.box.translateY = this.box.originY * 200
7676
}

examples/react/src/components/ui/placeholder.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ type HomeProps = {
1414
export function Placeholder({ navigation }: HomeProps) {
1515
const creatingView = (args) => {
1616
let nativeView
17-
if (global.isIOS) {
17+
if (__IOS__) {
1818
// Example with UITextView on iOS
1919
nativeView = UITextView.new()
2020
nativeView.text = 'Native View (iOS)'
21-
} else if (global.isAndroid) {
21+
} else if (__ANDROID__) {
2222
// Example with TextView on Android
2323
nativeView = new android.widget.TextView(
2424
Utils.android.getApplicationContext(),

examples/solid/src/ui/placeholder.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { Utils } from '@nativescript/core'
44
export const Placeholder = () => {
55
const creatingView = (args: any) => {
66
let nativeView
7-
if (global.isIOS) {
7+
if (__IOS__) {
88
// Example with UITextView on iOS
99
nativeView = UITextView.new()
1010
nativeView.text = 'Native View (iOS)'
11-
} else if (global.isAndroid) {
11+
} else if (__ANDROID__) {
1212
// Example with TextView on Android
1313
nativeView = new android.widget.TextView(
1414
Utils.android.getApplicationContext(),

examples/svelte/app/components/ui/Placeholder.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import { Utils } from '@nativescript/core'
33
const creatingView = (args) => {
44
let nativeView
5-
if (global.isIOS) {
5+
if (__IOS__) {
66
// Example with UITextView on iOS
77
nativeView = UITextView.new()
88
nativeView.text = 'Native View (iOS)'
9-
} else if (global.isAndroid) {
9+
} else if (__ANDROID__) {
1010
// Example with TextView on Android
1111
nativeView = new android.widget.TextView(
1212
Utils.android.getApplicationContext(),

examples/typescript/src/ui/Placeholder/template.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { Utils } from '@nativescript/core'
33

44
export function creatingView(args) {
55
let nativeView
6-
if (global.isIOS) {
6+
if (__IOS__) {
77
// Example with UITextView on iOS
88
nativeView = UITextView.new()
99
nativeView.text = 'Native View (iOS)'
10-
} else if (global.isAndroid) {
10+
} else if (__ANDROID__) {
1111
// Example with TextView on Android
1212
nativeView = new android.widget.TextView(
1313
Utils.android.getApplicationContext()

examples/typescript/src/ui/ViewOrigin/template.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function navigatingTo(args: EventData) {
2626

2727
// allow custom origin to be visible outside of the box
2828
box.on('loaded', (args) => {
29-
if (global.isAndroid) {
29+
if (__ANDROID__) {
3030
;(args.object as GridLayout).android.getParent().setClipChildren(false)
3131
}
3232
})
@@ -51,7 +51,7 @@ export function navigatingTo(args: EventData) {
5151
box.originY = +y
5252

5353
// iOS shifts the view when origin is set??
54-
if (global.isIOS) {
54+
if (__IOS__) {
5555
box.translateX = box.originX * 200
5656
box.translateY = box.originY * 200
5757
}

examples/typescript/src/utils/demoMode.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ function setDemoFlag(command: string, ...args: [string, string][]) {
1111
}
1212

1313
export function enableDemoMode() {
14-
if (global.isIOS) {
14+
if (__IOS__) {
1515
// set the status bar time to 9:41, full battery and full wifi/cellular
1616
SDStatusBarManager.sharedInstance().enableOverrides()
17-
} else if (global.isAndroid) {
17+
} else if (__ANDROID__) {
1818
setDemoFlag('enter')
1919
setDemoFlag('clock', ['hhmm', '0941'])
2020
setDemoFlag('battery', ['level', '100'])
@@ -31,9 +31,9 @@ export function enableDemoMode() {
3131
}
3232

3333
export function disableDemoMode() {
34-
if (global.isIOS) {
34+
if (__IOS__) {
3535
SDStatusBarManager.sharedInstance().disableOverrides()
36-
} else if (global.isAndroid) {
36+
} else if (__ANDROID__) {
3737
setDemoFlag('exit')
3838
}
3939
}

examples/vue/src/ui/Placeholder/component.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import { Utils } from '@nativescript/core'
33
const creatingView = (args) => {
44
let nativeView
5-
if (global.isIOS) {
5+
if (__IOS__) {
66
// Example with UITextView on iOS
77
nativeView = UITextView.new()
88
nativeView.text = 'Native View (iOS)'
9-
} else if (global.isAndroid) {
9+
} else if (__ANDROID__) {
1010
// Example with TextView on Android
1111
nativeView = new android.widget.TextView(
1212
Utils.android.getApplicationContext()

0 commit comments

Comments
 (0)