Skip to content

Commit

Permalink
Introducce cordova based ios platform
Browse files Browse the repository at this point in the history
  • Loading branch information
comrat committed Sep 28, 2017
1 parent 8c2e576 commit 428743f
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
4 changes: 4 additions & 0 deletions platform/ios/.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"requires": ["html5"],
"templates": ["*.html", "config.xml"]
}
11 changes: 11 additions & 0 deletions platform/ios/Device.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Object {
property bool macAccessable: false;
property bool supportingUhd;
property bool supporting3d;
property string modelName;
property string firmware;
property string sdk;

getDeviceId(callback): { log("Not implemented") }
getMacAddress(callback): { log("Not implemented") }
}
40 changes: 40 additions & 0 deletions platform/ios/VideoPlayer.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Item {
signal error;
signal finished;
property string source;
property Color backgroundColor: "#000";
property float volume: 1.0;
property bool loop: false;
property bool ready: false;
property bool muted: false;
property bool paused: false;
property bool autoPlay: false;
property bool waiting: false;
property bool seeking: false;
property int duration;
property int progress;
property int buffered;

LocalStorage { id: volumeStorage; name: "volume"; }

play: { }
stop: { }
pause: { }
seek(value): { }
seekTo(value): { }

volumeUp: { this.volume += 0.1 }
volumeDown: { this.volume -= 0.1 }
toggleMute: { this.element.dom.muted = !this.element.dom.muted }
onVolumeChanged: { this.applyVolume() }

applyVolume: {
if (this.volume > 1.0)
this.volume = 1.0;
else if (this.volume < 0.0)
this.volume = 0.0;

volumeStorage.value = this.volume
this.element.dom.volume = this.volume
}
}
32 changes: 32 additions & 0 deletions platform/ios/dist/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python2.7

import argparse
import os


def build(app, title):
os.system('rm -rf %s' %app)
res = os.system('cordova create %s com.example.app %s' %(app,title))
if res != 0:
print "Failed to create ios app"
return
os.system('cp -r `ls -A | grep -v "%s"` %s/www' %(app,app))
os.system('cp androidIcon.png %s' %(app))
os.system('cp config.xml %s' %(app))
os.chdir(app)
os.system('cordova platform add ios')
os.system('cordova build ios')
os.chdir('..')


parser = argparse.ArgumentParser('qmlcore build tool')
parser.add_argument('--app', '-a', help='application name', default="app")
parser.add_argument('--title', '-t', help='application title', default="App")
args = parser.parse_args()


res = os.system('cordova --version')
if res == 0:
build(args.app, args.title)
else:
print 'Install "cordova" first: https://cordova.apache.org/docs/en/latest/guide/cli/'

0 comments on commit 428743f

Please sign in to comment.