diff --git a/lib/motion/project/template/ios-watch-extension/files/.gitignore b/lib/motion/project/template/ios-watch-extension/files/.gitignore new file mode 100644 index 00000000..ae6aa4dd --- /dev/null +++ b/lib/motion/project/template/ios-watch-extension/files/.gitignore @@ -0,0 +1,17 @@ +.repl_history +build +tags +app/pixate_code.rb +resources/*.nib +resources/*.momd +resources/*.storyboardc +.DS_Store +nbproject +.redcar +#*# +*~ +*.sw[po] +.eprj +.sass-cache +.idea +.dat*.* diff --git a/lib/motion/project/template/ios-watch-extension/files/Gemfile b/lib/motion/project/template/ios-watch-extension/files/Gemfile new file mode 100644 index 00000000..764be634 --- /dev/null +++ b/lib/motion/project/template/ios-watch-extension/files/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'rake' +# Add your dependencies here: diff --git a/lib/motion/project/template/ios-watch-extension/files/Rakefile.erb b/lib/motion/project/template/ios-watch-extension/files/Rakefile.erb new file mode 100644 index 00000000..c1267d8a --- /dev/null +++ b/lib/motion/project/template/ios-watch-extension/files/Rakefile.erb @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +$:.unshift("/Library/RubyMotion/lib") +require 'motion/project/template/ios-extension' + +begin + require 'bundler' + Bundler.require +rescue LoadError +end + +Motion::Project::App.setup do |app| + # Use `rake config' to see complete project settings. + app.name = '<%= name %>' + app.frameworks << "WatchKit" + app.info_plist['NSExtension'] = { + 'NSExtensionPointIdentifier' => 'com.apple.watchkit' + } + app.info_plist['RemoteInterfacePrincipalClass'] = 'InterfaceController' +end diff --git a/lib/motion/project/template/ios-watch-extension/files/app/glance_controller.rb b/lib/motion/project/template/ios-watch-extension/files/app/glance_controller.rb new file mode 100644 index 00000000..99ae42a4 --- /dev/null +++ b/lib/motion/project/template/ios-watch-extension/files/app/glance_controller.rb @@ -0,0 +1,23 @@ +class GlanceController < WKInterfaceController + + def initWithContext(context) + super + + # Initialize variables here. + # Configure interface objects here. + NSLog("%@ initWithContext", self) + + return self; + end + + def willActivate + # This method is called when watch view controller is about to be visible to user + NSLog("%@ will activate", self) + end + + def didDeactivate + # This method is called when watch view controller is no longer visible + NSLog("%@ did deactivate", self) + end + +end diff --git a/lib/motion/project/template/ios-watch-extension/files/app/interface_controller.rb b/lib/motion/project/template/ios-watch-extension/files/app/interface_controller.rb new file mode 100644 index 00000000..cb2f4c2e --- /dev/null +++ b/lib/motion/project/template/ios-watch-extension/files/app/interface_controller.rb @@ -0,0 +1,23 @@ +class InterfaceController < WKInterfaceController + + def initWithContext(context) + super + + # Initialize variables here. + # Configure interface objects here. + NSLog("%@ initWithContext", self) + + return self + end + + def willActivate + # This method is called when watch view controller is about to be visible to user + NSLog("%@ will activate", self) + end + + def didDeactivate + # This method is called when watch view controller is no longer visible + NSLog("%@ did deactivate", self) + end + +end diff --git a/lib/motion/project/template/ios-watch-extension/files/app/notification_controller.rb b/lib/motion/project/template/ios-watch-extension/files/app/notification_controller.rb new file mode 100644 index 00000000..5baa930b --- /dev/null +++ b/lib/motion/project/template/ios-watch-extension/files/app/notification_controller.rb @@ -0,0 +1,39 @@ +class NotificationController < WKUserNotificationInterfaceController + + def init + super + + NSLog("%@ init", self) + + return self; + end + + def willActivate + # This method is called when watch view controller is about to be visible to user + NSLog("%@ will activate", self) + end + + def didDeactivate + # This method is called when watch view controller is no longer visible + NSLog("%@ did deactivate", self) + end + + def didReceiveLocalNotification(localNotification, withCompletion:completionHandler) + # This method is called when a local notification needs to be presented. + # Implement it if you use a dynamic notification interface. + # Populate your dynamic notification inteface as quickly as possible. + + # After populating your dynamic notification interface call the completion block. + completionHandler(WKUserNotificationInterfaceTypeCustom) + end + + def didReceiveRemoteNotification(remoteNotification, withCompletion:completionHandler) + # This method is called when a remote notification needs to be presented. + # Implement it if you use a dynamic notification interface. + # Populate your dynamic notification inteface as quickly as possible. + + # After populating your dynamic notification interface call the completion block. + completionHandler(WKUserNotificationInterfaceTypeCustom) + end + +end diff --git a/lib/motion/project/template/ios-watch-extension/files/resources/.gitkeep b/lib/motion/project/template/ios-watch-extension/files/resources/.gitkeep new file mode 100644 index 00000000..e69de29b