diff --git a/README.md b/README.md index 2a38a85..6343c14 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ### Compatibility Tested for Compatibility with: -* Ti SDK 6.0.3.GA +* Ti SDK 8.1.1.GA Althought we've managed to build the module to work on Ti SDK 5.x, it causes so many conflicts with other jars in the Android version that made us simply give up making it work. It works fine for iOS on Ti 5 and you're welcome to download the source and build it for Ti 5. (See issues#1) @@ -15,44 +15,29 @@ Implementation details for each platform are described below: ### iOS -For iOS we have mapped 3 main methods, one that verifies if the AdvertisingID is allowed to be read by your app and the other two for returning both the advertisingId itself and the vendorId. +**DEPRECATED!!!** -#### iOS Attributes: +For iOS, the current Titanium SDK GA (8.1.1.GA) already provides access to the Ads Identifiers therefore this module is not required anymore in order to access those parameters. -*isAdvertisingTrackingEnabled* (Boolean) +You can use the following accessors on the latest versions of Titanium: -> Returns a boolean indicating if the user has allowed the advertisingId to be tracked. According to Apple Guidelines this must always be respected and verified before calling the advertisingIdentifier method for retrieving it. -> Always calls this before calling the **advertisingIdentifier** method. - -*advertisingIdentifier* (String) - -> Returns Apple's advertisingIdentifier according to the official iOS Docs: [advertisingIdentifier](https://developer.apple.com/reference/adsupport/asidentifiermanager/1614151-advertisingidentifier?language=objc) -> In iOS 10.0 and later, the value of advertising​Identifier is all zeroes when the user has limited ad tracking. - -*identifierForVendor* (String) - -> The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor. -> Normally, the vendor is determined by data provided by the App Store. If the app was not installed from the app store (such as enterprise apps and apps still in development), then a vendor identifier is calculated based on the app’s bundle ID. The bundle ID is assumed to be in reverse-DNS format. -> On iOS 6, the first two components of the bundle ID are used to generate the vendor ID. if the bundle ID only has a single component, then the entire bundle ID is used. -> On IOS 7, all components of the bundle except for the last component are used to generate the vendor ID. If the bundle ID only has a single component, then the entire bundle ID is used. -> -> When implementing a system for serving advertisements, use the value in the advertisingIdentifier property of the ASIdentifierManager class instead of this property. Use of that property requires you to follow the guidelines set forth in the class discussion for the proper use of that identifier. For more information, see ASIdentifierManager. -> -> https://developer.apple.com/reference/uikit/uidevice/1620059-identifierforvendor -> - -#### iOS References: - -* https://developer.apple.com/reference/adsupport/asidentifiermanager -* https://developer.apple.com/reference/adsupport/asidentifiermanager/1614151-advertisingidentifier -* https://developer.apple.com/reference/uikit/uidevice/1620059-identifierforvendor +- Ti.Platform.identifierForVendor +- Ti.Platform.identifierForAdvertising +-Ti.Platform.isAdvertisingTrackingEnabled +Please refer to official Ti Documentation for more info. ### Android On Android we mapped the method getAdvertisingIdInfo from the AdvertisingIdClient API available as part of the Google Play Services. Be aware that this requires the GooglePlayServices to be installed on the user's device in order to work properly and this also requires the GooglePlayServices base jar and the ads jar (both included on the android/lib). I have tried my best to use a version of those JARs that doesn't conflict with other modules like ti.map but JAR hell might happen. +> The module is still needed on Android as of Ti 8.1.1.GA since I couldn't find a clean way to use AsyncTask with Hyperloop since we need to access the AdvertisingIdClient out of the main thread. Thus this module is still required for Android + +#### Deprecations + +I have deprecated the *getAndroidID* method since the same info can be fetched using Ti.Platform.id on current Titanium versions. + #### Android Methods: *getAdvertisingIdInfo* (String) @@ -66,6 +51,9 @@ Be aware that this requires the GooglePlayServices to be installed on the user's *getAndroidID* (String) +*DEPRECATED* - Use Ti.Platform.id directly. + + > Returns the **ANDROID_ID** of the user device from Android SDK Settings.Secure. > A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. > This can be used as an equivalent to iOS identifierForVendor on Android although it is not reseted on every installation. @@ -74,6 +62,8 @@ Be aware that this requires the GooglePlayServices to be installed on the user's #### Android Notes: +> Google Play Services JAR Hell should not happen anymore since Appcelerator greatly improved this area with the introduction of ti.playservices. + If you get a google-play-services-base.jar conflict with other modules like ti.map, try removing the jar from one of the modules in order to solve it. Due to the nature of Android AdvertisingIdClient implementation, the methods for fetching the ID cannot be called from the main thread and should be called on a separate AsyncTask. This sometimes causes a delay for reading the parameter as it must be called from a Google Play Services API (and probably makes some network connections behind). That said, the method will return the string: **processing** if the AsyncTask haven't returned yet. diff --git a/android/.classpath b/android/.classpath deleted file mode 100644 index 82e0165..0000000 --- a/android/.classpath +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/android/.idea/compiler.xml b/android/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/android/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/android/.idea/copyright/profiles_settings.xml b/android/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/android/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml deleted file mode 100644 index 797cf08..0000000 --- a/android/.idea/misc.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/android/.idea/modules.xml b/android/.idea/modules.xml deleted file mode 100644 index 9dddca5..0000000 --- a/android/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/android/.idea/workspace.xml b/android/.idea/workspace.xml deleted file mode 100644 index 6a91549..0000000 --- a/android/.idea/workspace.xml +++ /dev/null @@ -1,474 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1490993709753 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/android/.project b/android/.project index 725bec0..8bc7c30 100644 --- a/android/.project +++ b/android/.project @@ -1,29 +1,23 @@ - tiadid + android - com.appcelerator.titanium.core.builder - - - - - com.aptana.ide.core.unifiedBuilder + org.eclipse.jdt.core.javabuilder - org.eclipse.jdt.core.javabuilder + org.eclipse.buildship.core.gradleprojectbuilder org.eclipse.jdt.core.javanature - com.appcelerator.titanium.mobile.module.nature - com.aptana.projects.webnature + org.eclipse.buildship.core.gradleprojectnature - + \ No newline at end of file diff --git a/android/.settings/org.eclipse.jdt.apt.core.prefs b/android/.settings/org.eclipse.jdt.apt.core.prefs deleted file mode 100644 index 9726f16..0000000 --- a/android/.settings/org.eclipse.jdt.apt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Thu Sep 02 15:18:34 CDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.apt.aptEnabled=true -org.eclipse.jdt.apt.genSrcDir=.apt_generated -org.eclipse.jdt.apt.reconcileEnabled=true - -org.eclipse.jdt.apt.processorOptions/kroll.jsonFile=tiadid.json diff --git a/android/.settings/org.eclipse.jdt.core.prefs b/android/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2595d34..0000000 --- a/android/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Thu Sep 02 15:18:34 CDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.processAnnotations=enabled diff --git a/android/assets/README b/android/assets/README deleted file mode 100644 index 01ef590..0000000 --- a/android/assets/README +++ /dev/null @@ -1,9 +0,0 @@ -Place your assets like PNG files in this directory and they will be packaged -with your module. - -All JavaScript files in the assets directory are IGNORED except if you create a -file named "ninja.ygor.tiads.js" in this directory in which case it will be -wrapped by native code, compiled, and used as your module. This allows you to -run pure JavaScript modules that are pre-compiled. - -Note: Mobile Web does not support this assets directory. diff --git a/android/build.properties b/android/build.properties index 9ac46d9..ab513aa 100644 --- a/android/build.properties +++ b/android/build.properties @@ -1,9 +1,8 @@ -titanium.sdk=/Users/perdona/Library/Application Support/Titanium/ +titanium.sdk=/Users/yg/Library/Application Support/Titanium/ titanium.os=osx -titanium.version=6.2.0.GA +titanium.version=8.1.1.GA titanium.platform=${titanium.sdk}/mobilesdk/${titanium.os}/${titanium.version}/android android.sdk=/Applications/android -android.platform=${android.sdk}/platforms/android-23 -google.apis=${android.sdk}/add-ons/addon-google_apis-google-23 -android.ndk=${android.sdk}/android-ndk-r11c +android.platform=${android.sdk}/platforms/android-28 +android.ndk=${android.sdk}/ndk diff --git a/android/documentation/index.md b/android/documentation/index.md index dc42e21..e68ab40 100644 --- a/android/documentation/index.md +++ b/android/documentation/index.md @@ -1,39 +1,98 @@ # TiAds Module -## Description +### Compatibility -TODO: Enter your module description here +Tested for Compatibility with: +* Ti SDK 8.1.1.GA -## Accessing the TiAds Module +Althought we've managed to build the module to work on Ti SDK 5.x, it causes so many conflicts with other jars in the Android version that made us simply give up making it work. It works fine for iOS on Ti 5 and you're welcome to download the source and build it for Ti 5. (See issues#1) -To access this module from JavaScript, you would do the following: +### Abstract - var tiads = require("ninja.ygor.tiads"); +This module maps native Advertising and Vendor Ids available for iOS and Android and make them accessible inside the Titanium application. -The tiads variable is a reference to the Module object. +Implementation details for each platform are described below: -## Reference +### iOS -TODO: If your module has an API, you should document -the reference here. +**DEPRECATED!!!** -### tiads.function +For iOS, the current Titanium SDK GA (8.1.1.GA) already provides access to the Ads Identifiers therefore this module is not required anymore in order to access those parameters. -TODO: This is an example of a module function. +You can use the following accessors on the latest versions of Titanium: -### tiads.property +- Ti.Platform.identifierForVendor +- Ti.Platform.identifierForAdvertising +-Ti.Platform.isAdvertisingTrackingEnabled -TODO: This is an example of a module property. +Please refer to official Ti Documentation for more info. -## Usage +### Android -TODO: Enter your usage example here +On Android we mapped the method getAdvertisingIdInfo from the AdvertisingIdClient API available as part of the Google Play Services. +Be aware that this requires the GooglePlayServices to be installed on the user's device in order to work properly and this also requires the GooglePlayServices base jar and the ads jar (both included on the android/lib). I have tried my best to use a version of those JARs that doesn't conflict with other modules like ti.map but JAR hell might happen. -## Author +> The module is still needed on Android as of Ti 8.1.1.GA since I couldn't find a clean way to use AsyncTask with Hyperloop since we need to access the AdvertisingIdClient out of the main thread. Thus this module is still required for Android -TODO: Enter your author name, email and other contact -details you want to share here. +#### Deprecations -## License +I have deprecated the *getAndroidID* method since the same info can be fetched using Ti.Platform.id on current Titanium versions. -TODO: Enter your license/legal information here. +#### Android Methods: + +*getAdvertisingIdInfo* (String) + +> This method returns Android AdvertisingId from AdvertisingIdClient.getAdvertisingIdInfo native method. This follows the [AdvertisingIdClient API](https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient) +> May return **processing** if the AsyncTask haven't returned with the advertising id yet. + +*isLimitAdTrackingEnabled* (Boolean) + +> Returns a boolean indicating if the user has allowed to be tracked using Advertising IDs on Android. This is similar to iOS isAdvertisingTrackingEnabled and should be respected according to Google Play Privacy Guidelines. + +_getAndroidID_ (String) + +*DEPRECATED* - Use Ti.Platform.id directly. + + +> Returns the **ANDROID_ID** of the user device from Android SDK Settings.Secure. +> A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. +> This can be used as an equivalent to iOS identifierForVendor on Android although it is not reseted on every installation. +> ANDROID_ID seems a good choice for a unique device identifier. +> There are downsides: First, it is not 100% reliable on releases of Android prior to 2.2 (“Froyo”). Also, there has been at least one widely-observed bug in a popular handset from a major manufacturer, where every instance has the same ANDROID_ID. According to https://android-developers.googleblog.com/2011/03/identifying-app-installations.html + +#### Android Notes: + +If you get a google-play-services-base.jar conflict with other modules like ti.map, try removing the jar from one of the modules in order to solve it. +Due to the nature of Android AdvertisingIdClient implementation, the methods for fetching the ID cannot be called from the main thread and should be called on a separate AsyncTask. This sometimes causes a delay for reading the parameter as it must be called from a Google Play Services API (and probably makes some network connections behind). That said, the method will return the string: **processing** if the AsyncTask haven't returned yet. + +#### Android References: + +* https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient +* http://stackoverflow.com/questions/25846108/how-to-get-advertising-id-in-android +* http://stackoverflow.com/questions/27961634/advertisingidclient-getadvertisingidinfo-blocked-by-main-thread + +### Usage + +Follow the example on example/app.js. There you can find all methods used on the sample app. + +### Building the Module + +For **iOS**: + +cd on the ios directory and run: + +> ti build -p ios --build-only + +the module zip will be generated at the root directory. + +For **Android**: + +cd on the android directory and run: + +> ant + +the module zip will be on the dist folder. + +PR's are more than welcome. + +Issues can be reported on this repository Issues. \ No newline at end of file diff --git a/android/example/app.js b/android/example/app.js index 3dddd34..65d245a 100644 --- a/android/example/app.js +++ b/android/example/app.js @@ -30,55 +30,6 @@ if (Ti.Platform.osname == "android") { var isLimitAdTrackingEnabled = tiads.isLimitAdTrackingEnabled(); lblLAE.setText("isLimitAdTrackingEnabled: " + isLimitAdTrackingEnabled); }) - - var lblAID = Ti.UI.createLabel({ - text: "getAndroidID" - }); - - w.add(lblAID); - - lblAID.addEventListener("click", function() { - var androidid = tiads.getAndroidID(); - lblAID.setText("getAndroidID: " + androidid); - }) - - - -} else { - var lblADID = Ti.UI.createLabel({ - text: "advertisingIdentifier", - top: 40 - }); - - w.add(lblADID); - - lblADID.addEventListener("click", function() { - var idfa = tiads.advertisingIdentifier; - lblADID.setText("advertisingIdentifier: " + idfa); - }); - - var lblATE = Ti.UI.createLabel({ - text: "isAdvertisingTrackingEnabled" - }); - - w.add(lblATE); - - lblATE.addEventListener("click", function() { - var iidfa = tiads.isAdvertisingTrackingEnabled; - lblATE.setText("isAdvertisingTrackingEnabled: " + iidfa); - }) - - var lblIFV = Ti.UI.createLabel({ - text: "identifierForVendor" - }); - - w.add(lblIFV); - - lblIFV.addEventListener("click", function() { - var idfv = tiads.identifierForVendor; - lblIFV.setText("identifierForVendor: " + idfv); - }) - } diff --git a/android/java-sources.txt b/android/java-sources.txt index 6d03054..b0ee50f 100644 --- a/android/java-sources.txt +++ b/android/java-sources.txt @@ -1,8 +1,49 @@ -"/Users/perdona/Dev/projects/titanium/modules/tiads/android/src/ninja/ygor/tiads/TiAdsModule.java" -"/Users/perdona/Dev/projects/titanium/modules/tiads/android/build/generated/java/ninja/ygor/tiads/TiAdsBootstrap.java" -"/Users/perdona/Dev/projects/titanium/modules/tiads/android/build/generated/r/android/support/compat/R.java" -"/Users/perdona/Dev/projects/titanium/modules/tiads/android/build/generated/r/android/support/design/R.java" -"/Users/perdona/Dev/projects/titanium/modules/tiads/android/build/generated/r/android/support/v7/appcompat/R.java" -"/Users/perdona/Dev/projects/titanium/modules/tiads/android/build/generated/r/android/support/v7/cardview/R.java" -"/Users/perdona/Dev/projects/titanium/modules/tiads/android/build/generated/r/ninja/ygor/tiads/R.java" -"/Users/perdona/Dev/projects/titanium/modules/tiads/android/build/generated/r/ti/modules/titanium/ui/R.java" \ No newline at end of file +"/Users/yg/Developer/tiads/android/src/ninja/ygor/tiads/TiAdsModule.java" +"/Users/yg/Developer/tiads/android/build/generated/java/ninja/ygor/tiads/TiAdsBootstrap.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/compat/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/coreui/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/coreutils/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/design/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/exifinterface/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/fragment/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/graphics/drawable/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/graphics/drawable/animated/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/mediacompat/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/transition/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/v4/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/v7/appcompat/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/v7/cardview/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/android/support/v7/recyclerview/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/ads/impl/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/ads_base/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/ads_identifier/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/analyticsservices/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/analyticsservices_app_library/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/appstate/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/audience/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/auth/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/auth/api/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/auth/api/phone/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/base/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/common/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/cronet/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/flags/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/gcm/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/identity/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/iid/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/location/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/location/places/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/maps/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/measurement/api/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/measurement/sdk/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/measurement/sdk/api/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/measurement_base/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/nearby/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/oss/licenses/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/places_placereport/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/stats/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/tasks/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/android/gms/wallet/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/com/google/firebase/measurement_impl/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/ninja/ygor/tiads/R.java" +"/Users/yg/Developer/tiads/android/build/generated/r/ti/modules/titanium/ui/R.java" \ No newline at end of file diff --git a/android/lib/google-play-services-ads.jar b/android/lib/google-play-services-ads.jar deleted file mode 100644 index 054fc39..0000000 Binary files a/android/lib/google-play-services-ads.jar and /dev/null differ diff --git a/android/lib/google-play-services-base.jar b/android/lib/google-play-services-base.jar deleted file mode 100644 index ed2872b..0000000 Binary files a/android/lib/google-play-services-base.jar and /dev/null differ diff --git a/android/lib/version b/android/lib/version deleted file mode 100644 index 9e548d0..0000000 --- a/android/lib/version +++ /dev/null @@ -1 +0,0 @@ -revision 33 / 9683000 diff --git a/android/manifest b/android/manifest index 5655090..02905cf 100644 --- a/android/manifest +++ b/android/manifest @@ -5,7 +5,7 @@ # Note: After sdk 7.x, android modules are built using 'appc run -p android --build-only' instead of 'ant' # -version: 3.0.0 +version: 4.0.0 apiversion: 4 architectures: arm64-v8a armeabi-v7a x86 description: ninja.ygor.tiads diff --git a/android/platform/README.md b/android/platform/README.md deleted file mode 100644 index ced6ac3..0000000 --- a/android/platform/README.md +++ /dev/null @@ -1,10 +0,0 @@ -Files in this folder are copied directory into the Android build directory -when the Android app is compiled: - - /build/android - -You can place files such as res strings or drawable files. - -Files in this directory are copied directly on top of whatever files are already -in the build directory, so please be careful that your files don't clobber -essential project files or files from other modules. diff --git a/android/platform/android/res/values/version.xml b/android/platform/android/res/values/version.xml deleted file mode 100644 index 6c2c6e3..0000000 --- a/android/platform/android/res/values/version.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - 9683000 - diff --git a/android/src/ninja/ygor/tiads/TiAdsModule.java b/android/src/ninja/ygor/tiads/TiAdsModule.java index 25ea669..78c5752 100644 --- a/android/src/ninja/ygor/tiads/TiAdsModule.java +++ b/android/src/ninja/ygor/tiads/TiAdsModule.java @@ -10,13 +10,11 @@ import com.google.android.gms.ads.identifier.AdvertisingIdClient; import com.google.android.gms.ads.identifier.AdvertisingIdClient.Info; -import com.google.android.gms.common.ConnectionResult; +//import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; -import com.google.android.gms.common.GooglePlayServicesUtil; -import java.io.IOException; - -import android.provider.Settings.Secure; +//import com.google.android.gms.common.GooglePlayServicesUtil; +//import java.io.IOException; import android.os.AsyncTask; @@ -81,11 +79,6 @@ public boolean isLimitAdTrackingEnabled() { new AdvertisingIdTask().execute(); return adidLimit; } - - @Kroll.getProperty @Kroll.method - public String getAndroidID() { - return Secure.getString(TiApplication.getInstance().getApplicationContext().getContentResolver(), Secure.ANDROID_ID); - } } diff --git a/android/timodule.xml b/android/timodule.xml index f904634..e0971b8 100644 --- a/android/timodule.xml +++ b/android/timodule.xml @@ -5,9 +5,11 @@ - - - + + + + ti.playservices + \ No newline at end of file diff --git a/example/app.js b/example/app.js index 3dddd34..472f316 100644 --- a/example/app.js +++ b/example/app.js @@ -44,41 +44,6 @@ if (Ti.Platform.osname == "android") { -} else { - var lblADID = Ti.UI.createLabel({ - text: "advertisingIdentifier", - top: 40 - }); - - w.add(lblADID); - - lblADID.addEventListener("click", function() { - var idfa = tiads.advertisingIdentifier; - lblADID.setText("advertisingIdentifier: " + idfa); - }); - - var lblATE = Ti.UI.createLabel({ - text: "isAdvertisingTrackingEnabled" - }); - - w.add(lblATE); - - lblATE.addEventListener("click", function() { - var iidfa = tiads.isAdvertisingTrackingEnabled; - lblATE.setText("isAdvertisingTrackingEnabled: " + iidfa); - }) - - var lblIFV = Ti.UI.createLabel({ - text: "identifierForVendor" - }); - - w.add(lblIFV); - - lblIFV.addEventListener("click", function() { - var idfv = tiads.identifierForVendor; - lblIFV.setText("identifierForVendor: " + idfv); - }) - } diff --git a/ios/Classes/NinjaYgorTiadsModule.h b/ios/Classes/NinjaYgorTiadsModule.h deleted file mode 100644 index 4361242..0000000 --- a/ios/Classes/NinjaYgorTiadsModule.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * TiAds - * - * Created by Your Name - * Copyright (c) 2016 Your Company. All rights reserved. - */ - -#import "TiModule.h" - -@interface NinjaYgorTiadsModule : TiModule -{ -} - -@end diff --git a/ios/Classes/NinjaYgorTiadsModule.m b/ios/Classes/NinjaYgorTiadsModule.m deleted file mode 100644 index 87be87d..0000000 --- a/ios/Classes/NinjaYgorTiadsModule.m +++ /dev/null @@ -1,100 +0,0 @@ -/** - * TiAds - * - * Created by Ygor Lemos - * - */ - -#import "NinjaYgorTiadsModule.h" -#import "TiBase.h" -#import "TiHost.h" -#import "TiUtils.h" - -#import - - -@implementation NinjaYgorTiadsModule - -#pragma mark Internal - -// this is generated for your module, please do not change it --(id)moduleGUID -{ - return @"0c092039-ebfa-43fb-a74e-0a0e9c776d1a"; -} - -// this is generated for your module, please do not change it --(NSString*)moduleId -{ - return @"ninja.ygor.tiads"; -} - -#pragma mark Lifecycle - --(void)startup -{ - // this method is called when the module is first loaded - // you *must* call the superclass - [super startup]; - - NSLog(@"[INFO] %@ loaded",self); -} - --(void)shutdown:(id)sender -{ - // this method is called when the module is being unloaded - // typically this is during shutdown. make sure you don't do too - // much processing here or the app will be quit forceably - - // you *must* call the superclass - [super shutdown:sender]; -} - -#pragma mark Cleanup - --(void)dealloc -{ - // release any resources that have been retained by the module - [super dealloc]; -} - -#pragma mark Internal Memory Management - --(void)didReceiveMemoryWarning:(NSNotification*)notification -{ - // optionally release any resources that can be dynamically - // reloaded once memory is available - such as caches - [super didReceiveMemoryWarning:notification]; -} - -#pragma Public APIs - --(id)identifierForVendor -{ - if([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) { - return [[[UIDevice currentDevice] identifierForVendor] UUIDString]; - } - - return nil; -} - --(id)isAdvertisingTrackingEnabled -{ - if([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) { - return NUMBOOL(YES); - } else { - return NUMBOOL(NO); - } -} - --(id)advertisingIdentifier -{ - if([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) { - NSUUID *IDFA = [[ASIdentifierManager sharedManager] advertisingIdentifier]; - return [IDFA UUIDString]; - } - - return nil; -} - -@end diff --git a/ios/Classes/NinjaYgorTiadsModuleAssets.h b/ios/Classes/NinjaYgorTiadsModuleAssets.h deleted file mode 100644 index 983a642..0000000 --- a/ios/Classes/NinjaYgorTiadsModuleAssets.h +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This is a generated file. Do not edit or your changes will be lost - */ - -@interface NinjaYgorTiadsModuleAssets : NSObject -{ -} -- (NSData*) moduleAsset; -- (NSData*) resolveModuleAsset:(NSString*)path; - -@end diff --git a/ios/Classes/NinjaYgorTiadsModuleAssets.m b/ios/Classes/NinjaYgorTiadsModuleAssets.m deleted file mode 100644 index e7ad50b..0000000 --- a/ios/Classes/NinjaYgorTiadsModuleAssets.m +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This is a generated file. Do not edit or your changes will be lost - */ -#import "NinjaYgorTiadsModuleAssets.h" - -extern NSData* filterDataInRange(NSData* thedata, NSRange range); - -@implementation NinjaYgorTiadsModuleAssets - -- (NSData*) moduleAsset -{ - - - return nil; -} - -- (NSData*) resolveModuleAsset:(NSString*)path -{ - - - return nil; -} - -@end diff --git a/ios/NinjaYgorTiads_Prefix.pch b/ios/NinjaYgorTiads_Prefix.pch deleted file mode 100644 index 60070a9..0000000 --- a/ios/NinjaYgorTiads_Prefix.pch +++ /dev/null @@ -1,3 +0,0 @@ -#ifdef __OBJC__ - #import -#endif diff --git a/ios/TiAds.xcodeproj/project.pbxproj b/ios/TiAds.xcodeproj/project.pbxproj deleted file mode 100644 index 1ec76c3..0000000 --- a/ios/TiAds.xcodeproj/project.pbxproj +++ /dev/null @@ -1,450 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXAggregateTarget section */ - 24416B8111C4CA220047AFDD /* Build & Test */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 24416B8A11C4CA520047AFDD /* Build configuration list for PBXAggregateTarget "Build & Test" */; - buildPhases = ( - 24416B8011C4CA220047AFDD /* ShellScript */, - ); - dependencies = ( - 24416B8511C4CA280047AFDD /* PBXTargetDependency */, - ); - name = "Build & Test"; - productName = "Build & test"; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 24DD6CF91134B3F500162E58 /* NinjaYgorTiadsModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DD6CF71134B3F500162E58 /* NinjaYgorTiadsModule.h */; }; - 24DD6CFA1134B3F500162E58 /* NinjaYgorTiadsModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DD6CF81134B3F500162E58 /* NinjaYgorTiadsModule.m */; }; - 24DE9E1111C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DE9E0F11C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.h */; }; - 24DE9E1211C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DE9E1011C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.m */; }; - AA747D9F0F9514B9006C5449 /* NinjaYgorTiads_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* NinjaYgorTiads_Prefix.pch */; }; - AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; - D8651D8A1DADA8400008D897 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8651D891DADA8400008D897 /* AdSupport.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 24416B8411C4CA280047AFDD /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D2AAC07D0554694100DB518D; - remoteInfo = TiAds; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 24DD6CF71134B3F500162E58 /* NinjaYgorTiadsModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NinjaYgorTiadsModule.h; path = Classes/NinjaYgorTiadsModule.h; sourceTree = ""; }; - 24DD6CF81134B3F500162E58 /* NinjaYgorTiadsModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NinjaYgorTiadsModule.m; path = Classes/NinjaYgorTiadsModule.m; sourceTree = ""; }; - 24DD6D1B1134B66800162E58 /* titanium.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = titanium.xcconfig; sourceTree = ""; }; - 24DE9E0F11C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NinjaYgorTiadsModuleAssets.h; path = Classes/NinjaYgorTiadsModuleAssets.h; sourceTree = ""; }; - 24DE9E1011C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NinjaYgorTiadsModuleAssets.m; path = Classes/NinjaYgorTiadsModuleAssets.m; sourceTree = ""; }; - AA747D9E0F9514B9006C5449 /* NinjaYgorTiads_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NinjaYgorTiads_Prefix.pch; sourceTree = SOURCE_ROOT; }; - AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - D2AAC07E0554694100DB518D /* libNinjaYgorTiads.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNinjaYgorTiads.a; sourceTree = BUILT_PRODUCTS_DIR; }; - D8651D891DADA8400008D897 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - D2AAC07C0554694100DB518D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D8651D8A1DADA8400008D897 /* AdSupport.framework in Frameworks */, - AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 034768DFFF38A50411DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - D2AAC07E0554694100DB518D /* libNinjaYgorTiads.a */, - ); - name = Products; - sourceTree = ""; - }; - 0867D691FE84028FC02AAC07 /* TiAds */ = { - isa = PBXGroup; - children = ( - 08FB77AEFE84172EC02AAC07 /* Classes */, - 32C88DFF0371C24200C91783 /* Other Sources */, - 0867D69AFE84028FC02AAC07 /* Frameworks */, - 034768DFFF38A50411DB9C8B /* Products */, - ); - name = TiAds; - sourceTree = ""; - }; - 0867D69AFE84028FC02AAC07 /* Frameworks */ = { - isa = PBXGroup; - children = ( - D8651D891DADA8400008D897 /* AdSupport.framework */, - AACBBE490F95108600F1A2B1 /* Foundation.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 08FB77AEFE84172EC02AAC07 /* Classes */ = { - isa = PBXGroup; - children = ( - 24DE9E0F11C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.h */, - 24DE9E1011C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.m */, - 24DD6CF71134B3F500162E58 /* NinjaYgorTiadsModule.h */, - 24DD6CF81134B3F500162E58 /* NinjaYgorTiadsModule.m */, - ); - name = Classes; - sourceTree = ""; - }; - 32C88DFF0371C24200C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - AA747D9E0F9514B9006C5449 /* NinjaYgorTiads_Prefix.pch */, - 24DD6D1B1134B66800162E58 /* titanium.xcconfig */, - ); - name = "Other Sources"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - D2AAC07A0554694100DB518D /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - AA747D9F0F9514B9006C5449 /* NinjaYgorTiads_Prefix.pch in Headers */, - 24DD6CF91134B3F500162E58 /* NinjaYgorTiadsModule.h in Headers */, - 24DE9E1111C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - D2AAC07D0554694100DB518D /* TiAds */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "TiAds" */; - buildPhases = ( - D2AAC07A0554694100DB518D /* Headers */, - D2AAC07B0554694100DB518D /* Sources */, - D2AAC07C0554694100DB518D /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = TiAds; - productName = TiAds; - productReference = D2AAC07E0554694100DB518D /* libNinjaYgorTiads.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0800; - }; - buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "TiAds" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* TiAds */; - productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - D2AAC07D0554694100DB518D /* TiAds */, - 24416B8111C4CA220047AFDD /* Build & Test */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXShellScriptBuildPhase section */ - 24416B8011C4CA220047AFDD /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# shell script goes here\n\npython \"${TITANIUM_SDK}/titanium.py\" run --dir=\"${PROJECT_DIR}\"\nexit $?\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - D2AAC07B0554694100DB518D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 24DD6CFA1134B3F500162E58 /* NinjaYgorTiadsModule.m in Sources */, - 24DE9E1211C5FE74003F90F6 /* NinjaYgorTiadsModuleAssets.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 24416B8511C4CA280047AFDD /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D2AAC07D0554694100DB518D /* TiAds */; - targetProxy = 24416B8411C4CA280047AFDD /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 1DEB921F08733DC00010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DSTROOT = /tmp/NinjaYgorTiads.dst; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = NinjaYgorTiads_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = ""; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = NO; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = NO; - INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = ( - "-DDEBUG", - "-DTI_POST_1_2", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = NinjaYgorTiads; - PROVISIONING_PROFILE = ""; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = ""; - }; - name = Debug; - }; - 1DEB922008733DC00010E9CD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - DSTROOT = /tmp/NinjaYgorTiads.dst; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = NinjaYgorTiads_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = ""; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = NO; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = NO; - INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = "-DTI_POST_1_2"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = NinjaYgorTiads; - RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = ""; - }; - name = Release; - }; - 1DEB922308733DC00010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LIBRARY = "compiler-default"; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DSTROOT = /tmp/NinjaYgorTiads.dst; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = NinjaYgorTiads_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = ""; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = NO; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = NO; - INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - ONLY_ACTIVE_ARCH = NO; - OTHER_CFLAGS = ( - "-DDEBUG", - "-DTI_POST_1_2", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = NinjaYgorTiads; - PROVISIONING_PROFILE = ""; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = ""; - }; - name = Debug; - }; - 1DEB922408733DC00010E9CD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LIBRARY = "compiler-default"; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DSTROOT = /tmp/NinjaYgorTiads.dst; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_MODEL_TUNING = G5; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = NinjaYgorTiads_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = ""; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = NO; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = NO; - INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - ONLY_ACTIVE_ARCH = NO; - OTHER_CFLAGS = "-DTI_POST_1_2"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = NinjaYgorTiads; - RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = ""; - }; - name = Release; - }; - 24416B8211C4CA220047AFDD /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - PRODUCT_NAME = "Build & test"; - }; - name = Debug; - }; - 24416B8311C4CA220047AFDD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - PRODUCT_NAME = "Build & test"; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "TiAds" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB921F08733DC00010E9CD /* Debug */, - 1DEB922008733DC00010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "TiAds" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB922308733DC00010E9CD /* Debug */, - 1DEB922408733DC00010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 24416B8A11C4CA520047AFDD /* Build configuration list for PBXAggregateTarget "Build & Test" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 24416B8211C4CA220047AFDD /* Debug */, - 24416B8311C4CA220047AFDD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/ios/build.py b/ios/build.py deleted file mode 100755 index 71df55f..0000000 --- a/ios/build.py +++ /dev/null @@ -1,281 +0,0 @@ -#!/usr/bin/env python -# -# Appcelerator Titanium Module Packager -# -# -import os, subprocess, sys, glob, string -import zipfile -from datetime import date - -cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename)) -os.chdir(cwd) -required_module_keys = ['architectures', 'name','version','moduleid','description','copyright','license','copyright','platform','minsdk'] -module_defaults = { - 'description':'My module', - 'author': 'Your Name', - 'license' : 'Specify your license', - 'copyright' : 'Copyright (c) %s by Your Company' % str(date.today().year), -} -module_license_default = "TODO: place your license here and we'll include it in the module distribution" - -def find_sdk(config): - sdk = config['TITANIUM_SDK'] - return os.path.expandvars(os.path.expanduser(sdk)) - -def replace_vars(config,token): - idx = token.find('$(') - while idx != -1: - idx2 = token.find(')',idx+2) - if idx2 == -1: break - key = token[idx+2:idx2] - if not config.has_key(key): break - token = token.replace('$(%s)' % key, config[key]) - idx = token.find('$(') - return token - - -def read_ti_xcconfig(): - contents = open(os.path.join(cwd,'titanium.xcconfig')).read() - config = {} - for line in contents.splitlines(False): - line = line.strip() - if line[0:2]=='//': continue - idx = line.find('=') - if idx > 0: - key = line[0:idx].strip() - value = line[idx+1:].strip() - config[key] = replace_vars(config,value) - return config - -def generate_doc(config): - docdir = os.path.join(cwd,'documentation') - if not os.path.exists(docdir): - docdir = os.path.join(cwd,'..','documentation') - if not os.path.exists(docdir): - print "Couldn't find documentation file at: %s" % docdir - return None - - try: - import markdown2 as markdown - except ImportError: - import markdown - documentation = [] - for file in os.listdir(docdir): - if file in ignoreFiles or os.path.isdir(os.path.join(docdir, file)): - continue - md = open(os.path.join(docdir,file)).read() - html = markdown.markdown(md) - documentation.append({file:html}); - return documentation - -def compile_js(manifest,config): - js_file = os.path.join(cwd,'assets','ninja.ygor.tiads.js') - if not os.path.exists(js_file): - js_file = os.path.join(cwd,'..','assets','ninja.ygor.tiads.js') - if not os.path.exists(js_file): return - - from compiler import Compiler - try: - import json - except: - import simplejson as json - - compiler = Compiler(cwd, manifest['moduleid'], manifest['name'], 'commonjs') - root_asset, module_assets = compiler.compile_module() - - root_asset_content = """ -%s - - return filterDataInRange([NSData dataWithBytesNoCopy:data length:sizeof(data) freeWhenDone:NO], ranges[0]); -""" % root_asset - - module_asset_content = """ -%s - - NSNumber *index = [map objectForKey:path]; - if (index == nil) { - return nil; - } - return filterDataInRange([NSData dataWithBytesNoCopy:data length:sizeof(data) freeWhenDone:NO], ranges[index.integerValue]); -""" % module_assets - - from tools import splice_code - - assets_router = os.path.join(cwd,'Classes','NinjaYgorTiadsModuleAssets.m') - splice_code(assets_router, 'asset', root_asset_content) - splice_code(assets_router, 'resolve_asset', module_asset_content) - - # Generate the exports after crawling all of the available JS source - exports = open('metadata.json','w') - json.dump({'exports':compiler.exports }, exports) - exports.close() - -def die(msg): - print msg - sys.exit(1) - -def warn(msg): - print "[WARN] %s" % msg - -def error(msg): - print "[ERROR] %s" % msg - -def validate_license(): - license_file = os.path.join(cwd,'LICENSE') - if not os.path.exists(license_file): - license_file = os.path.join(cwd,'..','LICENSE') - if os.path.exists(license_file): - c = open(license_file).read() - if c.find(module_license_default)!=-1: - warn('please update the LICENSE file with your license text before distributing') - -def validate_manifest(): - path = os.path.join(cwd,'manifest') - f = open(path) - if not os.path.exists(path): die("missing %s" % path) - manifest = {} - for line in f.readlines(): - line = line.strip() - if line[0:1]=='#': continue - if line.find(':') < 0: continue - key,value = line.split(':') - manifest[key.strip()]=value.strip() - for key in required_module_keys: - if not manifest.has_key(key): die("missing required manifest key '%s'" % key) - if manifest[key].strip() == '': die("manifest key '%s' missing required value" % key) - if module_defaults.has_key(key): - defvalue = module_defaults[key] - curvalue = manifest[key] - if curvalue==defvalue: warn("please update the manifest key: '%s' to a non-default value" % key) - return manifest,path - -ignoreFiles = ['.DS_Store','.gitignore','libTitanium.a','titanium.jar','README'] -ignoreDirs = ['.DS_Store','.svn','.git','CVSROOT'] - -def zip_dir(zf,dir,basepath,ignore=[],includeJSFiles=False): - for root, dirs, files in os.walk(dir): - for name in ignoreDirs: - if name in dirs: - dirs.remove(name) # don't visit ignored directories - for file in files: - if file in ignoreFiles: continue - e = os.path.splitext(file) - if len(e) == 2 and e[1] == '.pyc': continue - if not includeJSFiles and len(e) == 2 and e[1] == '.js': continue - from_ = os.path.join(root, file) - to_ = from_.replace(dir, basepath, 1) - zf.write(from_, to_) - -def glob_libfiles(): - files = [] - for libfile in glob.glob('build/**/*.a'): - if libfile.find('Release-')!=-1: - files.append(libfile) - return files - -def build_module(manifest,config): - from tools import ensure_dev_path - ensure_dev_path() - - rc = os.system("xcodebuild -sdk iphoneos -configuration Release") - if rc != 0: - die("xcodebuild failed") - rc = os.system("xcodebuild -sdk iphonesimulator -configuration Release") - if rc != 0: - die("xcodebuild failed") - # build the merged library using lipo - moduleid = manifest['moduleid'] - libpaths = '' - for libfile in glob_libfiles(): - libpaths+='%s ' % libfile - - os.system("lipo %s -create -output build/lib%s.a" %(libpaths,moduleid)) - -def verify_build_arch(manifest, config): - binaryname = 'lib%s.a' % manifest['moduleid'] - binarypath = os.path.join('build', binaryname) - manifestarch = set(manifest['architectures'].split(' ')) - - output = subprocess.check_output('xcrun lipo -info %s' % binarypath, shell=True) - - builtarch = set(output.split(':')[-1].strip().split(' ')) - - print 'Check build architectures\n' - - if ('arm64' not in builtarch): - warn('built module is missing 64-bit support.') - - if (manifestarch != builtarch): - warn('architectures in manifest: %s' % ', '.join(manifestarch)) - warn('compiled binary architectures: %s' % ', '.join(builtarch)) - - print '\nMODULE BUILD FAILED' - error('there is discrepancy between the architectures specified in module manifest and compiled binary.') - error('Please update manifest to match module binary architectures.') - die('') - -def package_module(manifest,mf,config): - name = manifest['name'].lower() - moduleid = manifest['moduleid'].lower() - version = manifest['version'] - modulezip = '%s-iphone-%s.zip' % (moduleid,version) - if os.path.exists(modulezip): os.remove(modulezip) - zf = zipfile.ZipFile(modulezip, 'w', zipfile.ZIP_DEFLATED) - modulepath = 'modules/iphone/%s/%s' % (moduleid,version) - zf.write(mf,'%s/manifest' % modulepath) - libname = 'lib%s.a' % moduleid - zf.write('build/%s' % libname, '%s/%s' % (modulepath,libname)) - docs = generate_doc(config) - if docs!=None: - for doc in docs: - for file, html in doc.iteritems(): - filename = string.replace(file,'.md','.html') - zf.writestr('%s/documentation/%s'%(modulepath,filename),html) - - p = os.path.join(cwd, 'assets') - if not os.path.exists(p): - p = os.path.join(cwd, '..', 'assets') - if os.path.exists(p): - zip_dir(zf,p,'%s/%s' % (modulepath,'assets'),['README']) - - for dn in ('example','platform'): - p = os.path.join(cwd, dn) - if not os.path.exists(p): - p = os.path.join(cwd, '..', dn) - if os.path.exists(p): - zip_dir(zf,p,'%s/%s' % (modulepath,dn),['README'],True) - - license_file = os.path.join(cwd,'LICENSE') - if not os.path.exists(license_file): - license_file = os.path.join(cwd,'..','LICENSE') - if os.path.exists(license_file): - zf.write(license_file,'%s/LICENSE' % modulepath) - - zf.write('module.xcconfig','%s/module.xcconfig' % modulepath) - exports_file = 'metadata.json' - if os.path.exists(exports_file): - zf.write(exports_file, '%s/%s' % (modulepath, exports_file)) - zf.close() - - -if __name__ == '__main__': - print "**************************************************************" - print " WARNING!" - print " This Python script is deprecated!" - print " Please use 'ti build -p ios --build-only' instead" - print "**************************************************************" - print "" - - manifest,mf = validate_manifest() - validate_license() - config = read_ti_xcconfig() - - sdk = find_sdk(config) - sys.path.insert(0,os.path.join(sdk,'iphone')) - sys.path.append(os.path.join(sdk, "common")) - - compile_js(manifest,config) - build_module(manifest,config) - verify_build_arch(manifest, config) - package_module(manifest,mf,config) - sys.exit(0) diff --git a/ios/manifest b/ios/manifest deleted file mode 100644 index ae95e4d..0000000 --- a/ios/manifest +++ /dev/null @@ -1,18 +0,0 @@ -# -# this is your module manifest and used by Titanium -# during compilation, packaging, distribution, etc. -# -version: 1.2.0 -apiversion: 2 -architectures: armv7 arm64 i386 x86_64 -description: ninja.ygor.tiads -author: Ygor Lemos -license: MIT -copyright: Ygor Lemos - -# these should not be edited -name: ninja.ygor.tiads -moduleid: ninja.ygor.tiads -guid: 0c092039-ebfa-43fb-a74e-0a0e9c776d1a -platform: iphone -minsdk: 6.2.0 diff --git a/ios/module.xcconfig b/ios/module.xcconfig deleted file mode 100644 index 5c15702..0000000 --- a/ios/module.xcconfig +++ /dev/null @@ -1,27 +0,0 @@ -// -// PLACE ANY BUILD DEFINITIONS IN THIS FILE AND THEY WILL BE -// PICKED UP DURING THE APP BUILD FOR YOUR MODULE -// -// see the following webpage for instructions on the settings -// for this file: -// http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/400-Build_Configurations/build_configs.html -// - -// -// How to add a Framework (example) -// -OTHER_LDFLAGS=$(inherited) -framework AdSupport -// -// Adding a framework for a specific version(s) of iPhone: -// -// OTHER_LDFLAGS[sdk=iphoneos4*]=$(inherited) -framework Foo -// OTHER_LDFLAGS[sdk=iphonesimulator4*]=$(inherited) -framework Foo -// -// -// How to add a compiler define: -// -// OTHER_CFLAGS=$(inherited) -DFOO=1 -// -// -// IMPORTANT NOTE: always use $(inherited) in your overrides -// diff --git a/ios/timodule.xml b/ios/timodule.xml deleted file mode 100644 index 693334c..0000000 --- a/ios/timodule.xml +++ /dev/null @@ -1,5 +0,0 @@ - - -