Skip to content

Commit 88d7052

Browse files
authored
chore: link fixes and various cleanups (#3)
1 parent b902f3b commit 88d7052

27 files changed

Lines changed: 353 additions & 119 deletions

.vitepress/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function getSidebar() {
134134
// },
135135
{
136136
text: 'Scalability',
137-
children: [{ text: 'Code Sharing', link: '/code-sharing/index' }],
137+
children: [{ text: 'Code Sharing', link: '/code-sharing/index.html' }],
138138
},
139139
{
140140
text: 'Native API Access',

advanced-concepts.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ androidx.appcompat.app.AppCompatActivity.extend('org.myApp.MainActivity', {
318318
The `this._callbacks` property is automatically assigned to your extended class by the `frame.setActivityCallbacks` method. It implements the [AndroidActivityCallbacks interface](https://docs.nativescript.org/core-concepts/application-lifecycle#android-activity-events) and allows the core modules to get notified for important Activity events. It is **important** to use these callbacks, as many parts of NativeScript rely on them!
319319
:::
320320

321+
<!-- TODO: fix links -->
322+
321323
Next, modify the activity in `App_Resources/Android/src/main/AndroidManifest.xml`
322324

323325
```xml
@@ -589,11 +591,13 @@ NativeScript considers instances of `NSNull`, `NSNumber`, `NSString` and `NSDate
589591
590592
On the other hand, any API that expects a `NSNull`, `NSNumber`, `NSString` or `NSDate` instance in Objective-C can be called either with a wrapper object or a JavaScript value - `null`, `number` or `boolean`, `string` or `Date`, in JavaScript. The conversion is automatically handled by NativeScript.
591593
592-
More information on how NativeScript deals with Objective-C classes is available [here](types/ObjC-Classes.md).
594+
More information on how NativeScript deals with Objective-C classes is available [here](/advanced-concepts.html#objective-c-classes-and-objects).
593595
594596
#### Objective-C Protocols
595597
596-
Protocols in Objective-C are like interfaces in other languages - they are blueprints of what members a class should contain, a sort of an API contract. Protocols are exposed as empty objects in JavaScript. Protocols are usually only referenced when [subclassing](../how-to/ObjC-Subclassing.md) an Objective-C class or when checking whether an object or class conforms to a protocol.
598+
Protocols in Objective-C are like interfaces in other languages - they are blueprints of what members a class should contain, a sort of an API contract. Protocols are exposed as empty objects in JavaScript. Protocols are usually only referenced when [subclassing](#ObjC-Subclassing) an Objective-C class or when checking whether an object or class conforms to a protocol.
599+
600+
<!-- TODO: fix links -->
597601
598602
```objc
599603
BOOL isCopying = [NSArray conformsToProtocol:@protocol(NSCopying)];
@@ -694,7 +698,9 @@ const rect = {
694698
const view = UIView.alloc().initWithFrame(rect)
695699
```
696700

697-
More information on how NativeScript deals with structures is available [here](./types/C-Structures.md).
701+
More information on how NativeScript deals with structures is available [here](#C-Structures).
702+
703+
<!-- TODO: fix links -->
698704

699705
#### `NSError **` marshalling
700706

@@ -1136,7 +1142,7 @@ Array in Java is a special [java.lang.Object](http://docs.oracle.com/javase/7/do
11361142
- Has length property
11371143
- Has registered indexed getter and setter callbacks, which:
11381144
- If the array contains elements of type convertible to a JavaScript type, then accessing the i-th element will return a converted type
1139-
- If the array contains elements of type non-convertible to JavaScript, then accessing the i-th element will return a proxy object over the Java/Android type (see [Accessing APIs](../metadata/accessing-packages.md))
1145+
- If the array contains elements of type non-convertible to JavaScript, then accessing the i-th element will return a proxy object over the Java/Android type (see [Accessing APIs](#accessing-apis))
11401146

11411147
```js
11421148
var directory = new java.io.File('path/to/myDir')
@@ -1245,7 +1251,7 @@ var background = button.getBackground(); // if there is no background drawable m
12451251

12461252
##### Android Types
12471253

1248-
All Android-declared types are projected to JavaScript using the Package and Class proxies as described in [Accessing APIs](../metadata/accessing-packages.md)
1254+
All Android-declared types are projected to JavaScript using the Package and Class proxies as described in [Accessing APIs](#accessing-apis)
12491255

12501256
#### Kotlin to Javascript Conversion
12511257

@@ -1265,7 +1271,7 @@ Keep in mind that some of Kotlin's fundamental types are translated to a Java ty
12651271
| kotlin.Long | long | kotlin.Long? | java.lang.Long |
12661272
| kotlin.Float | float | kotlin.Float? | java.lang.Float |
12671273

1268-
Although the conversion of Kotlin types in NativeScript is quite the same as the [Java conversion](./java-to-js.md), let's take a look at some examples.
1274+
Although the conversion of Kotlin types in NativeScript is quite the same as the [Java conversion](#java-to-javascript-conversion), let's take a look at some examples.
12691275

12701276
##### String & Character
12711277

@@ -1423,7 +1429,7 @@ Array in Kotlin is a special object that has an implicit Class associated. A Kot
14231429
- Has length property
14241430
- Has registered indexed getter and setter callbacks, which:
14251431
- If the array contains elements of type convertible to a JavaScript type, then accessing the n-th element will return a converted type
1426-
- If the array contains elements of type non-convertible to JavaScript, then accessing the n-th element will return a proxy object over the Kotlin type (see [Accessing APIs](../metadata/accessing-packages.md))
1432+
- If the array contains elements of type non-convertible to JavaScript, then accessing the n-th element will return a proxy object over the Kotlin type (see [Accessing APIs](#accessing-apis))
14271433

14281434
```js
14291435
var kotlinClass = new com.example.KotlinClassWithStringArrayProperty()
@@ -1445,7 +1451,7 @@ A Kotlin Array is intentionally not converted to a JavaScript [Array](http://www
14451451

14461452
##### Creating arrays
14471453

1448-
Occasionally you have to create Kotlin arrays from JavaScript. Because of the translation of the fundamental Kotlin types to Java types in Android, creating Kotlin array could be done the same way Java arrays are created. This is described in [Java to JavaScript](./java-to-js.md)
1454+
Occasionally you have to create Kotlin arrays from JavaScript. Because of the translation of the fundamental Kotlin types to Java types in Android, creating Kotlin array could be done the same way Java arrays are created. This is described in [Java to JavaScript](#java-to-javascript-conversion)
14491455

14501456
##### Null
14511457

@@ -1466,7 +1472,7 @@ class KotlinClassWithNullableProperty() {
14661472

14671473
##### Kotlin Types
14681474

1469-
All Kotlin types are projected to JavaScript using the Package and Class proxies as described in [Accessing APIs](../metadata/accessing-packages.md)
1475+
All Kotlin types are projected to JavaScript using the Package and Class proxies as described in [Accessing APIs](#accessing-apis)
14701476

14711477
##### Kotlin Companion objects
14721478

@@ -1790,7 +1796,7 @@ if (android.os.Build.VERSION.SDK_INT >= 21) {
17901796

17911797
### Accessing APIs
17921798

1793-
One of NativeScript's strongest capabilities is the access to Android (also referred to as **'Java/Kotlin'** or **'native'**) APIs inside JavaScript/TypeScript. That's possible thanks to build-time generated [Metadata](./overview.md) chunks which hold the information about the public classes from the Android SDK, Android support libraries, and any other Android libraries which may be imported into your Android NativeScript project.
1799+
One of NativeScript's strongest capabilities is the access to Android (also referred to as **'Java/Kotlin'** or **'native'**) APIs inside JavaScript/TypeScript. That's possible thanks to build-time generated [Metadata](#metadata) chunks which hold the information about the public classes from the Android SDK, Android support libraries, and any other Android libraries which may be imported into your Android NativeScript project.
17941800

17951801
::: warning Note
17961802
'Android classes' and 'Java/Kotlin classes' are used interchangeably throughout the article to refer to classes in the Java/Kotlin programming language.
@@ -1836,7 +1842,7 @@ To have access and Intellisense for the native APIs with **NativeScript + TypeSc
18361842
:::
18371843

18381844
::: warning Note
1839-
You cannot use APIs that are not present in the metadata. By default, if `--compileSdk` argument isn't provided while building, metadata will be built against the latest Android [Platform SDK](https://developer.android.com/about/versions/nougat/index.html) installed on the workstation. See [metadata limitations](./overview.md).
1845+
You cannot use APIs that are not present in the metadata. By default, if `--compileSdk` argument isn't provided while building, metadata will be built against the latest Android [Platform SDK](https://developer.android.com/about/versions/nougat/index.html) installed on the workstation. See [metadata limitations](#metadata-limitations).
18401846
:::
18411847

18421848
#### Access Android Classes
@@ -1927,7 +1933,9 @@ const randomViewId = android.view.View.generateViewId();
19271933

19281934
#### Extend Classes and Interfaces
19291935

1930-
For a comprehensive guide on extending classes and implementing interfaces through JavaScript/TypeScript check out [the dedicated article](../binding-generator/extend-class-interface.md).
1936+
For a comprehensive guide on extending classes and implementing interfaces through JavaScript/TypeScript check out [the dedicated article](/binding-generator/extend-class-interface).
1937+
1938+
<!-- TODO: fix links -->
19311939

19321940
#### Full-fledged Example
19331941

@@ -2347,10 +2355,8 @@ These two lists unambigously determine how filtering is performed:
23472355

23482356
Sample filtering specifications can be found in `@nativescript/core` plugin's repository:
23492357

2350-
- [Plugin's Android API usage list](https://github.com/NativeScript/NativeScript/blob/master/nativescript-core/platforms/android/native-api-usage.json)
2351-
- [Plugin's iOS API usage list](https://github.com/NativeScript/NativeScript/blob/master/nativescript-core/platforms/ios/native-api-usage.json)
2352-
- [App's Andoroid API usage lists](https://github.com/NativeScript/NativeScript/blob/master/tests/app/App_Resources/Android/native-api-usage.json)
2353-
- [App's iOS API usage lists](https://github.com/NativeScript/NativeScript/blob/master/tests/app/App_Resources/iOS/native-api-usage.json)
2358+
- [Android API usage list](https://github.com/NativeScript/NativeScript/blob/master/packages/core/platforms/android/native-api-usage.json)
2359+
- [iOS API usage list](https://github.com/NativeScript/NativeScript/blob/master/packages/core/platforms/ios/native-api-usage.json)
23542360

23552361
### Troubleshooting
23562362

@@ -2369,6 +2375,6 @@ For each global symbol that is discovered by the generator, there should be a li
23692375
- `verbose: Exception [Name: 'vfwprintf', JsName: 'vfwprintf', Module: 'Darwin.C.wchar', File: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include/wchar.h'] : Can't create type dependency. --> [Type Decayed] : Can't create type dependency. --> [Type Typedef] : VaList type is not supported.` - if a symbol is not included because it isn't supported for some reason it will be stated in the logged exception. In this case the symbol cannot be used from JavaScript because {N} doesn't support calling functions with variable argument lists.
23702376
- `verbose: Exception [Name: 'GLKVector3Make', JsName: 'GLKVector3Make', Module: 'GLKit.GLKVector3', File: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/GLKit.framework/Headers/GLKVector3.h'] : Can't create type dependency. --> [Type Typedef] : Can't create type dependency. --> [Type Elaborated] : Can't create type dependency. --> [Type Record] : The record is an union.` - Another example of an unsupported symbol, this time the reason is that `union`s are unsupported
23712377

2372-
# Code Sharing
2378+
#### Code Sharing
23732379

23742380
- [Code Sharing](code-sharing/index.md)
-31 KB
Binary file not shown.
167 KB
Loading
153 KB
Loading
199 KB
Loading
201 KB
Loading
-13 KB
Binary file not shown.
166 KB
Loading
191 KB
Loading

0 commit comments

Comments
 (0)