Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
0xWDG committed Aug 23, 2024
1 parent fcba189 commit 84b3483
Show file tree
Hide file tree
Showing 54 changed files with 1,748 additions and 4,098 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .github/workflows/build-documentation.yml

name: build-documentation

on:
# Run on push to main branch
push:
branches:
- main

# Dispatch if triggered using Github (website)
workflow_dispatch:

jobs:
Build-documentation:
runs-on: macos-latest
steps:
- name: Build documentation
uses: 0xWDG/build-documentation@main
17 changes: 17 additions & 0 deletions .github/workflows/build-multiplatform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# .github/workflows/build-multiplatform.yml

name: Build-Packages

on:
# Run on pull_request
pull_request:

# Dispatch if triggered using Github (website)
workflow_dispatch:

jobs:
Build-Packages:
runs-on: macos-latest
steps:
- name: Build Swift Packages
uses: 0xWDG/build-swift@main
16 changes: 16 additions & 0 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Run Swiftlint
on:
push:
pull_request:
workflow_dispatch:

jobs:
swiftlint:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- name: SwiftLint
run: |
brew install swiftlint
swiftlint --reporter github-actions-logging --strict
23 changes: 23 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run tests on Linux and macOS
on:
push:
workflow_dispatch:

jobs:
test_linux:
if: false
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3

- name: Swift test
run: swift test

test_macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- name: Swift test
run: swift test
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

### Swift Package Manager
Packages/
Package.pins
Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
.swiftpm
.build/

### CocoaPods
Pods/
*.xcworkspace

### Carthage
Carthage/Checkouts
Carthage/Build/

### Accio dependency management
Dependencies/
.accio/

### fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

### Code Injection
iOSInjectionProject/
16 changes: 16 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
excluded:
- "*resource_bundle_accessor*" # SwiftPM Generated
- ".build/*"

opt_in_rules:
- missing_docs
- empty_count
- empty_string
- toggle_bool
- unused_optional_binding
- valid_ibinspectable
- modifier_order
- first_where
- fatal_error_message
- force_unwrapping

2 changes: 1 addition & 1 deletion LICENCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Wesley de Groot, OSS@WesleyDeGroot.nl
Copyright (c) 2024 Wesley de Groot, email@WesleydeGroot.nl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
# tvOS.js

[![Join the chat at https://gitter.im/wdg/tvOS.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/wdg/tvOS.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

tvOS.js is a JavaScript Library for easier developing in TVJS/TVML

* Built-in TVML Templates
* Built-in TVJS Templates
* Automatic return events to human readable format
- Built-in TVML Templates
- Built-in TVJS Templates
- Automatic return events to human readable format

<a href='https://github.com/wdg/tvOS.js/wiki/tvOS.js-Function-list' target='_blank'>Function list</a>
<a href='https://github.com/0xWDG/tvOS.js/wiki/tvOS.js-Function-list' target='_blank'>Function list</a>

##### Examples:

See some examples here:

* <a href='https://github.com/wdg/tvOS.js/wiki/compilationView' target='_blank'>wiki/compilationView</a>
* <a href='https://github.com/wdg/tvOS.js/wiki/searchView' target='_blank'>wiki/searchView</a>
* <a href='https://github.com/wdg/tvOS.js/wiki/listView' target='_blank'>wiki/listView</a>
* <a href='https://github.com/wdg/tvOS.js/wiki/alertView' target='_blank'>wiki/alertView</a>
* <a href='https://github.com/wdg/tvOS.js/wiki/loadingView' target='_blank'>wiki/loadingView</a>
* <a href='https://github.com/wdg/tvOS.js/wiki/ratingView' target='_blank'>wiki/ratingView</a>
- <a href='https://github.com/0xWDG/tvOS.js/wiki/compilationView' target='_blank'>wiki/compilationView</a>
- <a href='https://github.com/0xWDG/tvOS.js/wiki/searchView' target='_blank'>wiki/searchView</a>
- <a href='https://github.com/0xWDG/tvOS.js/wiki/listView' target='_blank'>wiki/listView</a>
- <a href='https://github.com/0xWDG/tvOS.js/wiki/alertView' target='_blank'>wiki/alertView</a>
- <a href='https://github.com/0xWDG/tvOS.js/wiki/loadingView' target='_blank'>wiki/loadingView</a>
- <a href='https://github.com/0xWDG/tvOS.js/wiki/ratingView' target='_blank'>wiki/ratingView</a>

##### Example (apps)

* [Twitter](https://github.com/wdg/tvOS.js/blob/master/Server/example_twitter.js)
* [Instagram](https://github.com/wdg/tvOS.js/blob/master/Server/example_instagram.js)
* [IMDB](https://github.com/wdg/tvOS.js/blob/master/Server/example_IMDB.js)
* [NU.nl](https://github.com/wdg/tvOS.js/blob/master/Server/example_app2.js) (dutch news website)
* [Meetups in amsterdam](https://github.com/wdg/tvOS.js/blob/master/Server/example_app.js) by The App Team ([git](https://github.com/The-app-team)/[www](http://www.the-app-team.com))
- [Twitter](https://github.com/0xWDG/tvOS.js/blob/master/Server/example_twitter.js)
- [Instagram](https://github.com/0xWDG/tvOS.js/blob/master/Server/example_instagram.js)
- [IMDB](https://github.com/0xWDG/tvOS.js/blob/master/Server/example_IMDB.js)
- [NU.nl](https://github.com/0xWDG/tvOS.js/blob/master/Server/example_app2.js) (dutch news website)
- [Meetups in amsterdam](https://github.com/0xWDG/tvOS.js/blob/master/Server/example_app.js) by The App Team ([git](https://github.com/The-app-team)/[www](http://www.the-app-team.com))

Made with 💙 in 🇳🇱
Made with 🩵 in 🇳🇱

------
---

![](https://cdn.rawgit.com/feross/standard/master/badge.svg)

------
---

## Contact

We can get in touch via [Mastodon](https://mastodon.social/@0xWDG), [Twitter/X](https://twitter.com/0xWDG), [Discord](https://discordapp.com/users/918438083861573692), [Email](mailto:[email protected]), [Website](https://wesleydegroot.nl).

Interested learning more about Swift? [Check out my blog](https://wesleydegroot.nl/blog/).
1 change: 0 additions & 1 deletion Server/README.md

This file was deleted.

112 changes: 64 additions & 48 deletions Server/example_IMDB.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,77 @@
if (App === 'undefined') var App = {} // Eslint error.
if (tvOS === 'undefined') var tvOS = {} // Eslint error.
if (evaluateScripts === 'undefined') var evaluateScripts = {} // Eslint error.
if (App === "undefined") var App = {}; // Eslint error.
if (tvOS === "undefined") var tvOS = {}; // Eslint error.
if (evaluateScripts === "undefined") var evaluateScripts = {}; // Eslint error.

evaluateScripts(['http://localhost:9001/tvOS.js'], function (success) {
if (success) {
// init App.
var old_count = ''
var myArray = []
var count = 0
evaluateScripts(
["https://0xwdg.github.io/tvOS.js/tvOS.js"],
function (success) {
if (success) {
// init App.
var old_count = "";
var myArray = [];
var count = 0;

// load data
tvOS.ajax('https://api.themoviedb.org/3/movie/popular?api_key=23afca60ebf72f8d88cdcae2c4f31866', 'GET', function (data) {
// Grabbed API KEY FROM
// -> https://github.com/ChristianLysne/TVOS-Example
data = JSON.parse(data)
data = data['results']
for (var i in data) {
console.log('Adding ' + data[i]['title'])
console.log(data[i]['overview'])
console.log(data[i]['release_date'] + ' - ' + data[i]['vote_average'] + '/10.0')
// load data
tvOS.ajax(
"https://api.themoviedb.org/3/movie/popular?api_key=23afca60ebf72f8d88cdcae2c4f31866",
"GET",
function (data) {
// Grabbed API KEY FROM
// -> https://github.com/ChristianLysne/TVOS-Example
data = JSON.parse(data);
data = data["results"];
for (var i in data) {
console.log("Adding " + data[i]["title"]);
console.log(data[i]["overview"]);
console.log(
data[i]["release_date"] +
" - " +
data[i]["vote_average"] +
"/10.0"
);

myArray.push({
image: 'https://image.tmdb.org/t/p/w500' + data[i]['poster_path'],
title: data[i]['title'],
description: data[i]['overview'],
subtitle: data[i]['release_date'] + ' - ' + data[i]['vote_average'] + '/10.0',
action: 'clickedOn',
accessibilityText: 'None'
})
myArray.push({
image: "https://image.tmdb.org/t/p/w500" + data[i]["poster_path"],
title: data[i]["title"],
description: data[i]["overview"],
subtitle:
data[i]["release_date"] +
" - " +
data[i]["vote_average"] +
"/10.0",
action: "clickedOn",
accessibilityText: "None",
});

count++
}
})
count++;
}
}
);

var publish_checker = function () {
if (old_count === count && myArray.length > 0) {
tvOS.listView('IMDB', myArray)
} else {
old_count = count
setTimeout(publish_checker, 500)
}
var publish_checker = function () {
if (old_count === count && myArray.length > 0) {
tvOS.listView("IMDB", myArray);
} else {
old_count = count;
setTimeout(publish_checker, 500);
}
};
setTimeout(publish_checker, 500);
} else {
console.log("Missing it all!");
}
setTimeout(publish_checker, 500)
} else {
console.log('Missing it all!')
}
})
);

function clickedOn (event) {
tvOS.alert(event, 'Return to example list?', ['Yes', 'No'], function (event) {
if (event.toLowerCase() === 'yes') {
tvOS.location('http://localhost:9001/index.js')
function clickedOn(event) {
tvOS.alert(event, "Return to example list?", ["Yes", "No"], function (event) {
if (event.toLowerCase() === "yes") {
tvOS.location("https://0xwdg.github.io/tvOS.js/index.js");
} else {
tvOS.dismiss() // Remove alert!
tvOS.dismiss(); // Remove alert!
}
})
});
}

// Becouse that weird eslint hates functions :/
if (typeof clickedOn === 'undefined') console.log('ok')
if (typeof clickedOn === "undefined") console.log("ok");
Loading

0 comments on commit 84b3483

Please sign in to comment.