├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── actionscript └── src │ └── com │ └── freshplanet │ └── ane │ └── AirDeviceId │ ├── AirDeviceId.as │ └── events │ └── AirDeviceIdEvent.as ├── android ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib │ ├── build.gradle │ ├── libs │ │ └── FlashRuntimeExtensions.jar │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── freshplanet │ │ │ └── ane │ │ │ └── AirDeviceId │ │ │ ├── AirDeviceIdExtension.java │ │ │ ├── AirDeviceIdExtensionContext.java │ │ │ ├── Constants.java │ │ │ └── functions │ │ │ ├── BaseFunction.java │ │ │ ├── GetIDFAFunction.java │ │ │ └── GetIDFVFunction.java │ │ └── res │ │ └── values │ │ └── strings.xml └── settings.gradle ├── bin └── AirDeviceId.ane ├── build ├── ant-contrib-0.6.jar ├── build.xml ├── example.build.config ├── extension.xml ├── platform-android.xml └── platform-ios.xml ├── ios ├── AirDeviceId.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── AirDeviceId.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── AirDeviceId │ ├── AirDeviceId.h │ ├── AirDeviceId.m │ └── Constants.h ├── FPANEUtils.h ├── FPANEUtils.m ├── FlashRuntimeExtensions.h ├── Podfile ├── Podfile.lock └── Pods │ ├── Manifest.lock │ ├── Pods.xcodeproj │ └── project.pbxproj │ └── Target Support Files │ └── Pods-AirDeviceId │ ├── Pods-AirDeviceId-acknowledgements.markdown │ ├── Pods-AirDeviceId-acknowledgements.plist │ ├── Pods-AirDeviceId-dummy.m │ ├── Pods-AirDeviceId-frameworks.sh │ ├── Pods-AirDeviceId-resources.sh │ ├── Pods-AirDeviceId.debug.xcconfig │ └── Pods-AirDeviceId.release.xcconfig └── sample ├── Main-app.xml ├── libs └── AirDeviceId.ane └── src ├── Main.as └── com └── freshplanet └── ui ├── ScrollableContainer.as └── TestBlock.as /.gitignore: -------------------------------------------------------------------------------- 1 | # General 2 | temp 3 | build.config 4 | 5 | # Flash Builder 6 | actionscript/bin 7 | .actionScriptProperties 8 | .flexProperties 9 | .flexLibProperties 10 | 11 | # Eclipse 12 | .settings 13 | .project 14 | 15 | # Android 16 | android/bin 17 | android/gen 18 | android/res 19 | android/lint.xml 20 | .classpath 21 | proguard-project.txt 22 | project.properties 23 | 24 | # Xcode 25 | xcuserdata 26 | 27 | # OS X 28 | Icon 29 | Thumbs.db 30 | .DS_Store 31 | ios/build/ 32 | 33 | android/\.gradle/ 34 | 35 | android/lib/build/ 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Freshplanet (http://freshplanet.com | opensource@freshplanet.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Air Native Extension to access a device unique id (iOS + Android) 2 | ====================================== 3 | 4 | This is an [Air native extension](http://www.adobe.com/devnet/air/native-extensions-for-air.html) that gives you access to a device unique id and an advertiser unique id. It has been developed by [FreshPlanet](http://freshplanet.com). 5 | 6 | Usage 7 | --------- 8 | 9 | Complete usage example is in the *sample* directory. 10 | 11 | On android make sure to add this to your android manifest additions inside the application descriptor: 12 | 13 | 14 | 15 | ... 16 | 17 | ... 18 | 19 | 20 | 21 | Build script 22 | --------- 23 | 24 | Should you need to edit the extension source code and/or recompile it, you will find an ant build script (build.xml) in the *build* folder: 25 | 26 | cd /path/to/the/ane/build 27 | #edit the build.properties file to provide your machine-specific paths 28 | ant 29 | 30 | 31 | Notes: 32 | * included binary has been compiled for 64-bit iOS support 33 | 34 | Reference 35 | ------ 36 | 37 | - iOS 6 http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor 38 | http://developer.apple.com/library/ios/#documentation/AdSupport/Reference/ASIdentifierManager_Ref/ASIdentifierManager.html#//apple_ref/occ/instp/ASIdentifierManager/advertisingIdentifier 39 | - iOS 5 http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIDevice_Class/DeprecationAppendix/AppendixADeprecatedAPI.html 40 | - Android http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID 41 | 42 | Authors 43 | ------ 44 | 45 | This ANE has been written by [Arnaud Bernard](https://github.com/arnobern) and [Mateo Kozomara](mateo.kozomara@gmail.com). It belongs to [FreshPlanet Inc.](http://freshplanet.com) and is distributed under the [Apache Licence, version 2.0](http://www.apache.org/licenses/LICENSE-2.0). 46 | 47 | 48 | Join the FreshPlanet team - GAME DEVELOPMENT in NYC 49 | ------ 50 | 51 | We are expanding our mobile engineering teams. 52 | 53 | FreshPlanet is a NYC based mobile game development firm and we are looking for senior engineers to lead the development initiatives for one or more of our games/apps. We work in small teams (6-9) who have total product control. These teams consist of mobile engineers, UI/UX designers and product experts. 54 | 55 | 56 | Please contact Tom Cassidy (tcassidy@freshplanet.com) or apply at http://freshplanet.com/jobs/ 57 | -------------------------------------------------------------------------------- /actionscript/src/com/freshplanet/ane/AirDeviceId/AirDeviceId.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.freshplanet.ane.AirDeviceId { 17 | 18 | import com.freshplanet.ane.AirDeviceId.events.AirDeviceIdEvent; 19 | 20 | import flash.events.EventDispatcher; 21 | import flash.events.StatusEvent; 22 | import flash.external.ExtensionContext; 23 | import flash.system.Capabilities; 24 | 25 | public class AirDeviceId extends EventDispatcher { 26 | 27 | // --------------------------------------------------------------------------------------// 28 | // // 29 | // PUBLIC API // 30 | // // 31 | // --------------------------------------------------------------------------------------// 32 | 33 | /** AirAlert is supported on iOS and Android devices. */ 34 | public static function get isSupported() : Boolean { 35 | return isAndroid || isIOS; 36 | } 37 | 38 | /** 39 | * AirDeviceId instance 40 | * @return AirDeviceId instance 41 | */ 42 | public static function get instance() : AirDeviceId { 43 | return _instance ? _instance : new AirDeviceId(); 44 | } 45 | 46 | /** 47 | * Get vendor identifier 48 | * @return 49 | */ 50 | public function getIDFV():String { 51 | 52 | if (isSupported) 53 | return _context.call( 'getIDFV' ) as String; 54 | 55 | return null; 56 | } 57 | 58 | /** 59 | * Get advertising identifier 60 | * @return 61 | */ 62 | public function getIDFA() : void { 63 | 64 | if ( isSupported ) 65 | _context.call( 'getIDFA' ); 66 | 67 | } 68 | 69 | // --------------------------------------------------------------------------------------// 70 | // // 71 | // PRIVATE API // 72 | // // 73 | // --------------------------------------------------------------------------------------// 74 | 75 | private static const EXTENSION_ID : String = "com.freshplanet.ane.AirDeviceId"; 76 | private static var _instance : AirDeviceId = null; 77 | private var _context : ExtensionContext = null; 78 | 79 | /** 80 | * "private" singleton constructor 81 | */ 82 | public function AirDeviceId() { 83 | 84 | if ( !_instance ) { 85 | 86 | _context = ExtensionContext.createExtensionContext( EXTENSION_ID, null ); 87 | 88 | if (_context != null ) { 89 | _context.addEventListener( StatusEvent.STATUS, _onStatus ); 90 | } 91 | else { 92 | trace('[AirDeviceId] Error - Extension Context is null.'); 93 | } 94 | 95 | _instance = this; 96 | } 97 | else { 98 | throw Error( 'This is a singleton, use getInstance(), do not call the constructor directly.' ); 99 | } 100 | } 101 | 102 | /** 103 | * Status events allow the native part of the ANE to communicate with the ActionScript part. 104 | * We use event.code to represent the type of event, and event.level to carry the data. 105 | */ 106 | private function _onStatus( event:StatusEvent ) : void { 107 | 108 | if ( event.code == AirDeviceIdEvent.RECEIVED_IDFA ) { 109 | this.dispatchEvent(new AirDeviceIdEvent(AirDeviceIdEvent.RECEIVED_IDFA, event.level)); 110 | } 111 | else if ( event.code == "log" ) { 112 | trace( '[AirDeviceId] ' + event.level ); 113 | } 114 | } 115 | 116 | private static function get isIOS():Boolean { 117 | return Capabilities.manufacturer.indexOf("iOS") > -1 && Capabilities.os.indexOf("x86_64") < 0 && Capabilities.os.indexOf("i386") < 0; 118 | } 119 | 120 | private static function get isAndroid():Boolean { 121 | return Capabilities.manufacturer.indexOf("Android") > -1; 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /actionscript/src/com/freshplanet/ane/AirDeviceId/events/AirDeviceIdEvent.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.freshplanet.ane.AirDeviceId.events { 17 | import flash.events.Event; 18 | 19 | public class AirDeviceIdEvent extends Event { 20 | 21 | public static const RECEIVED_IDFA:String = "AirDeviceIdEvent_receivedIDFA"; 22 | private var _idfa:String; 23 | 24 | public function AirDeviceIdEvent(type:String, idfa:String, bubbles:Boolean = false, cancelable:Boolean = false) { 25 | super(type, bubbles, cancelable); 26 | _idfa = idfa; 27 | } 28 | 29 | public function get idfa():String { 30 | return _idfa; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | maven { 9 | url "https://maven.google.com" 10 | } 11 | 12 | 13 | } 14 | 15 | dependencies { 16 | classpath 'com.android.tools.build:gradle:3.4.2' 17 | } 18 | 19 | 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | google() 25 | jcenter() 26 | maven { 27 | url "https://maven.google.com" 28 | } 29 | } 30 | } 31 | 32 | 33 | task clean(type: Delete) { 34 | delete rootProject.buildDir 35 | } 36 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | android.useAndroidX=true 19 | android.enableJetifier=true -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshplanet/ANE-DeviceId/c80d3a839349a8c268f778dc3836fe534f2f7837/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Nov 11 14:12:58 EST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/lib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion "29.0.3" 6 | 7 | defaultConfig { 8 | minSdkVersion 16 9 | targetSdkVersion 29 10 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 11 | 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(include: ['*.jar'], dir: 'libs') 23 | compile 'androidx.legacy:legacy-support-v4:1.0.0' 24 | compile 'com.google.android.gms:play-services-ads-identifier:17.0.0' 25 | } 26 | 27 | task copyDependencies(type: Copy) { 28 | from configurations.compile 29 | into 'dependencies' 30 | } -------------------------------------------------------------------------------- /android/lib/libs/FlashRuntimeExtensions.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshplanet/ANE-DeviceId/c80d3a839349a8c268f778dc3836fe534f2f7837/android/lib/libs/FlashRuntimeExtensions.jar -------------------------------------------------------------------------------- /android/lib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/lib/src/main/java/com/freshplanet/ane/AirDeviceId/AirDeviceIdExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.freshplanet.ane.AirDeviceId; 17 | 18 | import com.adobe.fre.FREContext; 19 | import com.adobe.fre.FREExtension; 20 | 21 | public class AirDeviceIdExtension implements FREExtension { 22 | public static AirDeviceIdExtensionContext context; 23 | 24 | public FREContext createContext(String extId) { 25 | return context = new AirDeviceIdExtensionContext(); 26 | } 27 | 28 | public void dispose() { 29 | context = null; 30 | } 31 | 32 | public void initialize() {} 33 | } 34 | -------------------------------------------------------------------------------- /android/lib/src/main/java/com/freshplanet/ane/AirDeviceId/AirDeviceIdExtensionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.freshplanet.ane.AirDeviceId; 17 | 18 | 19 | import com.adobe.fre.FREContext; 20 | import com.adobe.fre.FREFunction; 21 | import com.freshplanet.ane.AirDeviceId.functions.GetIDFAFunction; 22 | import com.freshplanet.ane.AirDeviceId.functions.GetIDFVFunction; 23 | 24 | import java.util.HashMap; 25 | import java.util.Map; 26 | 27 | public class AirDeviceIdExtensionContext extends FREContext { 28 | @Override 29 | public void dispose() 30 | { 31 | AirDeviceIdExtension.context = null; 32 | } 33 | 34 | @Override 35 | public Map getFunctions() { 36 | Map functions = new HashMap(); 37 | 38 | functions.put("getIDFV", new GetIDFVFunction()); 39 | functions.put("getIDFA", new GetIDFAFunction()); 40 | return functions; 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /android/lib/src/main/java/com/freshplanet/ane/AirDeviceId/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.freshplanet.ane.AirDeviceId; 16 | 17 | public class Constants { 18 | 19 | public static final String AirDeviceIdEvent_receivedIDFA = "AirDeviceIdEvent_receivedIDFA"; 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /android/lib/src/main/java/com/freshplanet/ane/AirDeviceId/functions/BaseFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.freshplanet.ane.AirDeviceId.functions; 17 | 18 | import android.graphics.Bitmap; 19 | import android.graphics.Canvas; 20 | import android.graphics.ColorMatrix; 21 | import android.graphics.ColorMatrixColorFilter; 22 | import android.graphics.Paint; 23 | import android.os.Bundle; 24 | 25 | import com.adobe.fre.FREArray; 26 | import com.adobe.fre.FREBitmapData; 27 | import com.adobe.fre.FREContext; 28 | import com.adobe.fre.FREFunction; 29 | import com.adobe.fre.FREObject; 30 | import com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension; 31 | import com.freshplanet.ane.AirDeviceId.AirDeviceIdExtensionContext; 32 | 33 | import java.util.ArrayList; 34 | import java.util.List; 35 | 36 | public class BaseFunction implements FREFunction { 37 | @Override 38 | public FREObject call(FREContext context, FREObject[] args) { 39 | AirDeviceIdExtension.context = (AirDeviceIdExtensionContext) context; 40 | return null; 41 | } 42 | 43 | protected String getStringFromFREObject(FREObject object) { 44 | try { 45 | return object.getAsString(); 46 | } 47 | catch (Exception e) { 48 | e.printStackTrace(); 49 | return null; 50 | } 51 | } 52 | 53 | protected Boolean getBooleanFromFREObject(FREObject object) { 54 | try { 55 | return object.getAsBool(); 56 | } 57 | catch(Exception e) { 58 | e.printStackTrace(); 59 | return false; 60 | } 61 | } 62 | 63 | protected int getIntFromFREObject(FREObject object) { 64 | try { 65 | return object.getAsInt(); 66 | } 67 | catch(Exception e) { 68 | e.printStackTrace(); 69 | return 0; 70 | } 71 | } 72 | 73 | protected double getDoubleFromFREObject(FREObject object) { 74 | try { 75 | return object.getAsDouble(); 76 | } 77 | catch(Exception e) { 78 | e.printStackTrace(); 79 | return 0; 80 | } 81 | } 82 | 83 | protected List getListOfStringFromFREArray(FREArray array) { 84 | List result = new ArrayList(); 85 | 86 | try { 87 | for (int i = 0; i < array.getLength(); i++) { 88 | try { 89 | result.add(getStringFromFREObject(array.getObjectAt((long)i))); 90 | } 91 | catch (Exception e) { 92 | e.printStackTrace(); 93 | } 94 | } 95 | } 96 | catch (Exception e) { 97 | e.printStackTrace(); 98 | return null; 99 | } 100 | 101 | return result; 102 | } 103 | 104 | protected Bitmap getBitmapFromFREBitmapData(FREObject object) { 105 | Bitmap result; 106 | 107 | try { 108 | FREBitmapData freBitmapData = (FREBitmapData) object; 109 | 110 | Paint paint = new Paint(); 111 | float[] bgrToRgbColorTransform = 112 | { 113 | 0, 0, 1f, 0, 0, 114 | 0, 1f, 0, 0, 0, 115 | 1f, 0, 0, 0, 0, 116 | 0, 0, 0, 1f, 0 117 | }; 118 | ColorMatrix colorMatrix = new ColorMatrix(bgrToRgbColorTransform); 119 | ColorMatrixColorFilter colorFilter = new ColorMatrixColorFilter(colorMatrix); 120 | paint.setColorFilter(colorFilter); 121 | 122 | freBitmapData.acquire(); 123 | int width = freBitmapData.getWidth(); 124 | int height = freBitmapData.getHeight(); 125 | result = Bitmap.createBitmap( width, height, Bitmap.Config.ARGB_8888 ); 126 | result.copyPixelsFromBuffer(freBitmapData.getBits()); 127 | freBitmapData.release(); 128 | 129 | // Convert the bitmap from BGRA to RGBA. 130 | Canvas canvas = new Canvas(result); 131 | canvas.drawBitmap(result, 0, 0, paint); 132 | } 133 | catch (Exception e) { 134 | e.printStackTrace(); 135 | return null; 136 | } 137 | 138 | return result; 139 | } 140 | 141 | protected List getListOfBitmapFromFREArray(FREArray array) { 142 | List result = new ArrayList(); 143 | 144 | try { 145 | for (int i = 0; i < array.getLength(); i++) { 146 | try { 147 | result.add(getBitmapFromFREBitmapData(array.getObjectAt((long)i))); 148 | } 149 | catch (Exception e) { 150 | e.printStackTrace(); 151 | } 152 | } 153 | } 154 | catch (Exception e) { 155 | e.printStackTrace(); 156 | return null; 157 | } 158 | 159 | return result; 160 | } 161 | 162 | protected Bundle getBundleOfStringFromFREArrays(FREArray keys, FREArray values) { 163 | Bundle result = new Bundle(); 164 | 165 | try { 166 | long length = Math.min(keys.getLength(), values.getLength()); 167 | for (int i = 0; i < length; i++) { 168 | try { 169 | String key = getStringFromFREObject(keys.getObjectAt((long)i)); 170 | String value = getStringFromFREObject(values.getObjectAt((long)i)); 171 | result.putString(key, value); 172 | } 173 | catch (Exception e) { 174 | e.printStackTrace(); 175 | } 176 | } 177 | } 178 | catch (Exception e) { 179 | e.printStackTrace(); 180 | return null; 181 | } 182 | 183 | return result; 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /android/lib/src/main/java/com/freshplanet/ane/AirDeviceId/functions/GetIDFAFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.freshplanet.ane.AirDeviceId.functions; 17 | 18 | import android.app.Activity; 19 | import android.content.Context; 20 | 21 | import com.adobe.fre.FREContext; 22 | import com.adobe.fre.FREObject; 23 | import com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension; 24 | import com.freshplanet.ane.AirDeviceId.Constants; 25 | import com.google.android.gms.ads.identifier.AdvertisingIdClient; 26 | import com.google.android.gms.common.GooglePlayServicesNotAvailableException; 27 | import com.google.android.gms.common.GooglePlayServicesRepairableException; 28 | 29 | import java.io.IOException; 30 | 31 | public class GetIDFAFunction extends BaseFunction { 32 | 33 | public FREObject call(FREContext context, FREObject[] args) { 34 | 35 | super.call(context, args); 36 | 37 | final Activity activity = context.getActivity(); 38 | final Context applicationContext = activity.getApplicationContext(); 39 | 40 | Thread idfaThread = new Thread(new Runnable() { 41 | 42 | @Override 43 | public void run() { 44 | 45 | try { 46 | finished(activity, AdvertisingIdClient.getAdvertisingIdInfo(applicationContext)); 47 | } 48 | catch (GooglePlayServicesRepairableException e) { 49 | AirDeviceIdExtension.context.dispatchStatusEventAsync("log", "Exception occurred while trying to getIDFA " + e.getLocalizedMessage() ); 50 | } 51 | catch (GooglePlayServicesNotAvailableException e) { 52 | AirDeviceIdExtension.context.dispatchStatusEventAsync("log", "Exception occurred while trying to getIDFA " + e.getLocalizedMessage() ); 53 | } 54 | catch (IOException e) { 55 | AirDeviceIdExtension.context.dispatchStatusEventAsync("log", "Exception occurred while trying to getIDFA " + e.getLocalizedMessage() ); 56 | } 57 | 58 | } 59 | }); 60 | 61 | idfaThread.start(); 62 | 63 | return null; 64 | 65 | } 66 | 67 | private void finished(final Activity activity, final AdvertisingIdClient.Info adInfo){ 68 | if (adInfo != null) { 69 | activity.runOnUiThread(new Runnable() { 70 | @Override 71 | public void run() { 72 | String idfa = adInfo.getId(); 73 | AirDeviceIdExtension.context.dispatchStatusEventAsync(Constants.AirDeviceIdEvent_receivedIDFA, idfa ); 74 | } 75 | }); 76 | } 77 | else { 78 | AirDeviceIdExtension.context.dispatchStatusEventAsync(Constants.AirDeviceIdEvent_receivedIDFA, "" ); 79 | } 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /android/lib/src/main/java/com/freshplanet/ane/AirDeviceId/functions/GetIDFVFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.freshplanet.ane.AirDeviceId.functions; 17 | 18 | import android.provider.Settings.Secure; 19 | 20 | import com.adobe.fre.FREContext; 21 | import com.adobe.fre.FREObject; 22 | import com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension; 23 | 24 | public class GetIDFVFunction extends BaseFunction { 25 | 26 | public FREObject call(FREContext context, FREObject[] args) { 27 | 28 | super.call(context, args); 29 | 30 | // Closest thing to iOS' IDFV on Android 31 | String deviceId = Secure.getString(context.getActivity().getContentResolver(), Secure.ANDROID_ID); 32 | 33 | try { 34 | return FREObject.newObject(deviceId); 35 | } catch (Exception e) { 36 | AirDeviceIdExtension.context.dispatchStatusEventAsync("log", "Exception occurred while trying to getID " + e.getLocalizedMessage()); 37 | } 38 | 39 | return null; 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /android/lib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | lib 3 | 4 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':lib' 2 | -------------------------------------------------------------------------------- /bin/AirDeviceId.ane: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshplanet/ANE-DeviceId/c80d3a839349a8c268f778dc3836fe534f2f7837/bin/AirDeviceId.ane -------------------------------------------------------------------------------- /build/ant-contrib-0.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshplanet/ANE-DeviceId/c80d3a839349a8c268f778dc3836fe534f2f7837/build/ant-contrib-0.6.jar -------------------------------------------------------------------------------- /build/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /build/example.build.config: -------------------------------------------------------------------------------- 1 | name = AirDeviceId 2 | air.sdk.home = /path/to/your/air/sdk 3 | android.sdk.home = /path/to/your/android/sdk 4 | include.shared.resources = false 5 | -------------------------------------------------------------------------------- /build/extension.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | com.freshplanet.ane.AirDeviceId 18 | 1.0 19 | 20 | 21 | 22 | libAirDeviceId.a 23 | AirDeviceIdInitializer 24 | AirDeviceIdFinalizer 25 | 26 | 27 | 28 | 29 | libAirDeviceId.jar 30 | com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension 31 | com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension 32 | 33 | 34 | 35 | 36 | libAirDeviceId.jar 37 | com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension 38 | com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension 39 | 40 | 41 | 42 | 43 | libAirDeviceId.jar 44 | com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension 45 | com.freshplanet.ane.AirDeviceId.AirDeviceIdExtension 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /build/platform-android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /build/platform-ios.xml: -------------------------------------------------------------------------------- 1 | 2 | 10.0 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ios/AirDeviceId.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 77590C217EB8174289CEC025 /* libPods-AirDeviceId.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D988BA732AC67333291266AF /* libPods-AirDeviceId.a */; }; 11 | A2B3C13B1F27A8E5009A918E /* AirDeviceId.m in Sources */ = {isa = PBXBuildFile; fileRef = A2B3C13A1F27A8E5009A918E /* AirDeviceId.m */; }; 12 | A2B3C13C1F27A8E5009A918E /* AirDeviceId.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2B3C1391F27A8E5009A918E /* AirDeviceId.h */; }; 13 | A2B3C1451F27A90D009A918E /* FPANEUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = A2B3C1441F27A90D009A918E /* FPANEUtils.m */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXCopyFilesBuildPhase section */ 17 | A2B3C1341F27A8E4009A918E /* CopyFiles */ = { 18 | isa = PBXCopyFilesBuildPhase; 19 | buildActionMask = 2147483647; 20 | dstPath = "include/$(PRODUCT_NAME)"; 21 | dstSubfolderSpec = 16; 22 | files = ( 23 | A2B3C13C1F27A8E5009A918E /* AirDeviceId.h in CopyFiles */, 24 | ); 25 | runOnlyForDeploymentPostprocessing = 0; 26 | }; 27 | /* End PBXCopyFilesBuildPhase section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 9E5491671082BE982B1CFEF0 /* Pods-AirDeviceId.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AirDeviceId.release.xcconfig"; path = "Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId.release.xcconfig"; sourceTree = ""; }; 31 | A2B3C1361F27A8E4009A918E /* libAirDeviceId.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAirDeviceId.a; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | A2B3C1391F27A8E5009A918E /* AirDeviceId.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AirDeviceId.h; sourceTree = ""; }; 33 | A2B3C13A1F27A8E5009A918E /* AirDeviceId.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AirDeviceId.m; sourceTree = ""; }; 34 | A2B3C1421F27A90D009A918E /* FlashRuntimeExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlashRuntimeExtensions.h; sourceTree = ""; }; 35 | A2B3C1431F27A90D009A918E /* FPANEUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FPANEUtils.h; sourceTree = ""; }; 36 | A2B3C1441F27A90D009A918E /* FPANEUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FPANEUtils.m; sourceTree = ""; }; 37 | A2B3C1491F27D41C009A918E /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = ""; }; 38 | D988BA732AC67333291266AF /* libPods-AirDeviceId.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AirDeviceId.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | F00B32FFC08FC56B18B2D92C /* Pods-AirDeviceId.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AirDeviceId.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId.debug.xcconfig"; sourceTree = ""; }; 40 | /* End PBXFileReference section */ 41 | 42 | /* Begin PBXFrameworksBuildPhase section */ 43 | A2B3C1331F27A8E4009A918E /* Frameworks */ = { 44 | isa = PBXFrameworksBuildPhase; 45 | buildActionMask = 2147483647; 46 | files = ( 47 | 77590C217EB8174289CEC025 /* libPods-AirDeviceId.a in Frameworks */, 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | 5DCBB82BD0F31BB8004153D9 /* Pods */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | F00B32FFC08FC56B18B2D92C /* Pods-AirDeviceId.debug.xcconfig */, 58 | 9E5491671082BE982B1CFEF0 /* Pods-AirDeviceId.release.xcconfig */, 59 | ); 60 | name = Pods; 61 | sourceTree = ""; 62 | }; 63 | A2B3C12D1F27A8E4009A918E = { 64 | isa = PBXGroup; 65 | children = ( 66 | A2B3C1421F27A90D009A918E /* FlashRuntimeExtensions.h */, 67 | A2B3C1431F27A90D009A918E /* FPANEUtils.h */, 68 | A2B3C1441F27A90D009A918E /* FPANEUtils.m */, 69 | A2B3C1381F27A8E4009A918E /* AirDeviceId */, 70 | A2B3C1371F27A8E4009A918E /* Products */, 71 | 5DCBB82BD0F31BB8004153D9 /* Pods */, 72 | E41CEAC25D5D6C914D6F386E /* Frameworks */, 73 | ); 74 | sourceTree = ""; 75 | }; 76 | A2B3C1371F27A8E4009A918E /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | A2B3C1361F27A8E4009A918E /* libAirDeviceId.a */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | A2B3C1381F27A8E4009A918E /* AirDeviceId */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | A2B3C1491F27D41C009A918E /* Constants.h */, 88 | A2B3C1391F27A8E5009A918E /* AirDeviceId.h */, 89 | A2B3C13A1F27A8E5009A918E /* AirDeviceId.m */, 90 | ); 91 | path = AirDeviceId; 92 | sourceTree = ""; 93 | }; 94 | E41CEAC25D5D6C914D6F386E /* Frameworks */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | D988BA732AC67333291266AF /* libPods-AirDeviceId.a */, 98 | ); 99 | name = Frameworks; 100 | sourceTree = ""; 101 | }; 102 | /* End PBXGroup section */ 103 | 104 | /* Begin PBXNativeTarget section */ 105 | A2B3C1351F27A8E4009A918E /* AirDeviceId */ = { 106 | isa = PBXNativeTarget; 107 | buildConfigurationList = A2B3C13F1F27A8E5009A918E /* Build configuration list for PBXNativeTarget "AirDeviceId" */; 108 | buildPhases = ( 109 | B5F9253C454EBF3379529901 /* [CP] Check Pods Manifest.lock */, 110 | A2B3C1321F27A8E4009A918E /* Sources */, 111 | A2B3C1331F27A8E4009A918E /* Frameworks */, 112 | A2B3C1341F27A8E4009A918E /* CopyFiles */, 113 | 609D0DCF23DB18A7A4B1D626 /* [CP] Copy Pods Resources */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = AirDeviceId; 120 | productName = AirDeviceId; 121 | productReference = A2B3C1361F27A8E4009A918E /* libAirDeviceId.a */; 122 | productType = "com.apple.product-type.library.static"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | A2B3C12E1F27A8E4009A918E /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 0830; 131 | ORGANIZATIONNAME = "Mateo Kozomara"; 132 | TargetAttributes = { 133 | A2B3C1351F27A8E4009A918E = { 134 | CreatedOnToolsVersion = 8.3.3; 135 | DevelopmentTeam = HWKC8H7H6U; 136 | ProvisioningStyle = Automatic; 137 | }; 138 | }; 139 | }; 140 | buildConfigurationList = A2B3C1311F27A8E4009A918E /* Build configuration list for PBXProject "AirDeviceId" */; 141 | compatibilityVersion = "Xcode 3.2"; 142 | developmentRegion = English; 143 | hasScannedForEncodings = 0; 144 | knownRegions = ( 145 | English, 146 | en, 147 | ); 148 | mainGroup = A2B3C12D1F27A8E4009A918E; 149 | productRefGroup = A2B3C1371F27A8E4009A918E /* Products */; 150 | projectDirPath = ""; 151 | projectRoot = ""; 152 | targets = ( 153 | A2B3C1351F27A8E4009A918E /* AirDeviceId */, 154 | ); 155 | }; 156 | /* End PBXProject section */ 157 | 158 | /* Begin PBXShellScriptBuildPhase section */ 159 | 609D0DCF23DB18A7A4B1D626 /* [CP] Copy Pods Resources */ = { 160 | isa = PBXShellScriptBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | ); 164 | inputPaths = ( 165 | ); 166 | name = "[CP] Copy Pods Resources"; 167 | outputPaths = ( 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | shellPath = /bin/sh; 171 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId-resources.sh\"\n"; 172 | showEnvVarsInLog = 0; 173 | }; 174 | B5F9253C454EBF3379529901 /* [CP] Check Pods Manifest.lock */ = { 175 | isa = PBXShellScriptBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | ); 179 | inputPaths = ( 180 | ); 181 | name = "[CP] Check Pods Manifest.lock"; 182 | outputPaths = ( 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | shellPath = /bin/sh; 186 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 187 | showEnvVarsInLog = 0; 188 | }; 189 | /* End PBXShellScriptBuildPhase section */ 190 | 191 | /* Begin PBXSourcesBuildPhase section */ 192 | A2B3C1321F27A8E4009A918E /* Sources */ = { 193 | isa = PBXSourcesBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | A2B3C1451F27A90D009A918E /* FPANEUtils.m in Sources */, 197 | A2B3C13B1F27A8E5009A918E /* AirDeviceId.m in Sources */, 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXSourcesBuildPhase section */ 202 | 203 | /* Begin XCBuildConfiguration section */ 204 | A2B3C13D1F27A8E5009A918E /* Debug */ = { 205 | isa = XCBuildConfiguration; 206 | buildSettings = { 207 | ALWAYS_SEARCH_USER_PATHS = NO; 208 | CLANG_ANALYZER_NONNULL = YES; 209 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 210 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 211 | CLANG_CXX_LIBRARY = "libc++"; 212 | CLANG_ENABLE_MODULES = YES; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_WARN_BOOL_CONVERSION = YES; 215 | CLANG_WARN_CONSTANT_CONVERSION = YES; 216 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 217 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 218 | CLANG_WARN_EMPTY_BODY = YES; 219 | CLANG_WARN_ENUM_CONVERSION = YES; 220 | CLANG_WARN_INFINITE_RECURSION = YES; 221 | CLANG_WARN_INT_CONVERSION = YES; 222 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 223 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 224 | CLANG_WARN_UNREACHABLE_CODE = YES; 225 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 226 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 227 | COPY_PHASE_STRIP = NO; 228 | DEBUG_INFORMATION_FORMAT = dwarf; 229 | ENABLE_STRICT_OBJC_MSGSEND = YES; 230 | ENABLE_TESTABILITY = YES; 231 | GCC_C_LANGUAGE_STANDARD = gnu99; 232 | GCC_DYNAMIC_NO_PIC = NO; 233 | GCC_NO_COMMON_BLOCKS = YES; 234 | GCC_OPTIMIZATION_LEVEL = 0; 235 | GCC_PREPROCESSOR_DEFINITIONS = ( 236 | "DEBUG=1", 237 | "$(inherited)", 238 | ); 239 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 240 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 241 | GCC_WARN_UNDECLARED_SELECTOR = YES; 242 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 243 | GCC_WARN_UNUSED_FUNCTION = YES; 244 | GCC_WARN_UNUSED_VARIABLE = YES; 245 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 246 | MTL_ENABLE_DEBUG_INFO = YES; 247 | ONLY_ACTIVE_ARCH = YES; 248 | SDKROOT = iphoneos; 249 | }; 250 | name = Debug; 251 | }; 252 | A2B3C13E1F27A8E5009A918E /* Release */ = { 253 | isa = XCBuildConfiguration; 254 | buildSettings = { 255 | ALWAYS_SEARCH_USER_PATHS = NO; 256 | CLANG_ANALYZER_NONNULL = YES; 257 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 266 | CLANG_WARN_EMPTY_BODY = YES; 267 | CLANG_WARN_ENUM_CONVERSION = YES; 268 | CLANG_WARN_INFINITE_RECURSION = YES; 269 | CLANG_WARN_INT_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 272 | CLANG_WARN_UNREACHABLE_CODE = YES; 273 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 274 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 275 | COPY_PHASE_STRIP = NO; 276 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 277 | ENABLE_NS_ASSERTIONS = NO; 278 | ENABLE_STRICT_OBJC_MSGSEND = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_NO_COMMON_BLOCKS = YES; 281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 283 | GCC_WARN_UNDECLARED_SELECTOR = YES; 284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 285 | GCC_WARN_UNUSED_FUNCTION = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 288 | MTL_ENABLE_DEBUG_INFO = NO; 289 | SDKROOT = iphoneos; 290 | VALIDATE_PRODUCT = YES; 291 | }; 292 | name = Release; 293 | }; 294 | A2B3C1401F27A8E5009A918E /* Debug */ = { 295 | isa = XCBuildConfiguration; 296 | baseConfigurationReference = F00B32FFC08FC56B18B2D92C /* Pods-AirDeviceId.debug.xcconfig */; 297 | buildSettings = { 298 | DEVELOPMENT_TEAM = HWKC8H7H6U; 299 | OTHER_LDFLAGS = "-ObjC"; 300 | PRODUCT_NAME = "$(TARGET_NAME)"; 301 | SKIP_INSTALL = YES; 302 | }; 303 | name = Debug; 304 | }; 305 | A2B3C1411F27A8E5009A918E /* Release */ = { 306 | isa = XCBuildConfiguration; 307 | baseConfigurationReference = 9E5491671082BE982B1CFEF0 /* Pods-AirDeviceId.release.xcconfig */; 308 | buildSettings = { 309 | DEVELOPMENT_TEAM = HWKC8H7H6U; 310 | OTHER_LDFLAGS = "-ObjC"; 311 | PRODUCT_NAME = "$(TARGET_NAME)"; 312 | SKIP_INSTALL = YES; 313 | }; 314 | name = Release; 315 | }; 316 | /* End XCBuildConfiguration section */ 317 | 318 | /* Begin XCConfigurationList section */ 319 | A2B3C1311F27A8E4009A918E /* Build configuration list for PBXProject "AirDeviceId" */ = { 320 | isa = XCConfigurationList; 321 | buildConfigurations = ( 322 | A2B3C13D1F27A8E5009A918E /* Debug */, 323 | A2B3C13E1F27A8E5009A918E /* Release */, 324 | ); 325 | defaultConfigurationIsVisible = 0; 326 | defaultConfigurationName = Release; 327 | }; 328 | A2B3C13F1F27A8E5009A918E /* Build configuration list for PBXNativeTarget "AirDeviceId" */ = { 329 | isa = XCConfigurationList; 330 | buildConfigurations = ( 331 | A2B3C1401F27A8E5009A918E /* Debug */, 332 | A2B3C1411F27A8E5009A918E /* Release */, 333 | ); 334 | defaultConfigurationIsVisible = 0; 335 | defaultConfigurationName = Release; 336 | }; 337 | /* End XCConfigurationList section */ 338 | }; 339 | rootObject = A2B3C12E1F27A8E4009A918E /* Project object */; 340 | } 341 | -------------------------------------------------------------------------------- /ios/AirDeviceId.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/AirDeviceId.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/AirDeviceId.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/AirDeviceId/AirDeviceId.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #import 17 | #import 18 | #import "FPANEUtils.h" 19 | 20 | @interface AirDeviceId : NSObject { 21 | FREContext _context; 22 | } 23 | 24 | @end 25 | 26 | void AirDeviceIdContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet); 27 | void AirDeviceIdContextFinalizer(FREContext ctx); 28 | void AirDeviceIdInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet); 29 | void AirDeviceIdFinalizer(void *extData); 30 | -------------------------------------------------------------------------------- /ios/AirDeviceId/AirDeviceId.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #import "AirDeviceId.h" 17 | #import 18 | #import "Constants.h" 19 | 20 | @interface AirDeviceId () 21 | @property (nonatomic, readonly) FREContext context; 22 | @end 23 | 24 | @implementation AirDeviceId 25 | 26 | - (instancetype)initWithContext:(FREContext)extensionContext { 27 | 28 | if ((self = [super init])) { 29 | 30 | _context = extensionContext; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void) sendLog:(NSString*)log { 37 | [self sendEvent:@"log" level:log]; 38 | } 39 | 40 | - (void) sendEvent:(NSString*)code { 41 | [self sendEvent:code level:@""]; 42 | } 43 | 44 | - (void) sendEvent:(NSString*)code level:(NSString*)level { 45 | FREDispatchStatusEventAsync(_context, (const uint8_t*)[code UTF8String], (const uint8_t*)[level UTF8String]); 46 | } 47 | @end 48 | 49 | AirDeviceId* GetAirDeviceIdContextNativeData(FREContext context) { 50 | 51 | CFTypeRef controller; 52 | FREGetContextNativeData(context, (void**)&controller); 53 | return (__bridge AirDeviceId*)controller; 54 | } 55 | 56 | DEFINE_ANE_FUNCTION(getIDFV) { 57 | 58 | if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) { 59 | NSString* idString = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; 60 | return AirDeviceId_FPANE_NSStringToFREObject(idString); 61 | } 62 | 63 | return nil; 64 | } 65 | 66 | DEFINE_ANE_FUNCTION(getIDFA) { 67 | 68 | AirDeviceId* controller = GetAirDeviceIdContextNativeData(context); 69 | 70 | if (!controller) 71 | return AirDeviceId_FPANE_CreateError(@"context's AirDeviceId is null", 0); 72 | 73 | if ([[ASIdentifierManager sharedManager] respondsToSelector:@selector(advertisingIdentifier)]) { 74 | NSString* idString = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; 75 | [controller sendEvent:kAirDeviceIdEvent_receivedIDFA level:idString]; 76 | } 77 | 78 | return nil; 79 | } 80 | 81 | #pragma mark - ANE setup 82 | 83 | void AirDeviceIdContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, 84 | uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet) { 85 | 86 | AirDeviceId* controller = [[AirDeviceId alloc] initWithContext:ctx]; 87 | FRESetContextNativeData(ctx, (void*)CFBridgingRetain(controller)); 88 | 89 | static FRENamedFunction functions[] = { 90 | MAP_FUNCTION(getIDFV, NULL), 91 | MAP_FUNCTION(getIDFA, NULL) 92 | }; 93 | 94 | *numFunctionsToTest = sizeof(functions) / sizeof(FRENamedFunction); 95 | *functionsToSet = functions; 96 | 97 | } 98 | 99 | void AirDeviceIdContextFinalizer(FREContext ctx) { 100 | CFTypeRef controller; 101 | FREGetContextNativeData(ctx, (void **)&controller); 102 | CFBridgingRelease(controller); 103 | } 104 | 105 | void AirDeviceIdInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet ) { 106 | *extDataToSet = NULL; 107 | *ctxInitializerToSet = &AirDeviceIdContextInitializer; 108 | *ctxFinalizerToSet = &AirDeviceIdContextFinalizer; 109 | } 110 | 111 | void AirDeviceIdFinalizer(void *extData) {} 112 | -------------------------------------------------------------------------------- /ios/AirDeviceId/Constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #ifndef Constants_h 17 | #define Constants_h 18 | 19 | 20 | #endif /* Constants_h */ 21 | 22 | static NSString *const kAirDeviceIdEvent_receivedIDFA = @"AirDeviceIdEvent_receivedIDFA"; 23 | -------------------------------------------------------------------------------- /ios/FPANEUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | #import 16 | #import "FlashRuntimeExtensions.h" 17 | #import 18 | 19 | #define DEFINE_ANE_FUNCTION(fn) FREObject fn(FREContext context, void* functionData, uint32_t argc, FREObject argv[]) 20 | #define MAP_FUNCTION(fn, data) { (const uint8_t*)(#fn), (data), &(fn) } 21 | #define ROOT_VIEW_CONTROLLER [[[UIApplication sharedApplication] keyWindow] rootViewController] 22 | 23 | void AirDeviceId_FPANE_DispatchEvent(FREContext context, NSString* eventName); 24 | void AirDeviceId_FPANE_DispatchEventWithInfo(FREContext context, NSString* eventName, NSString* eventInfo); 25 | void AirDeviceId_FPANE_Log(FREContext context, NSString* message); 26 | 27 | NSString* AirDeviceId_FPANE_FREObjectToNSString(FREObject object); 28 | NSArray* AirDeviceId_FPANE_FREObjectToNSArrayOfNSString(FREObject object); 29 | NSDictionary* AirDeviceId_FPANE_FREObjectsToNSDictionaryOfNSString(FREObject keys, FREObject values); 30 | BOOL AirDeviceId_FPANE_FREObjectToBool(FREObject object); 31 | NSInteger AirDeviceId_FPANE_FREObjectToInt(FREObject object); 32 | double AirDeviceId_FPANE_FREObjectToDouble(FREObject object); 33 | 34 | FREObject AirDeviceId_FPANE_BOOLToFREObject(BOOL boolean); 35 | FREObject AirDeviceId_FPANE_IntToFREObject(NSInteger i); 36 | FREObject AirDeviceId_FPANE_DoubleToFREObject(double d); 37 | FREObject AirDeviceId_FPANE_NSStringToFREObject(NSString* string); 38 | FREObject AirDeviceId_FPANE_CreateError(NSString* error, NSInteger* id); 39 | FREObject AirDeviceId_FPANE_UIImageToFREBitmapData(UIImage *image); 40 | FREObject AirDeviceId_FPANE_UIImageToFREByteArray(UIImage *image); 41 | 42 | UIImage* AirDeviceId_FPANE_FREBitmapDataToUIImage(FREObject object); 43 | NSArray* AirDeviceId_FPANE_FREObjectToNSArrayOfUIImage(FREObject object); 44 | -------------------------------------------------------------------------------- /ios/FPANEUtils.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | #import "FPANEUtils.h" 16 | 17 | #pragma mark - Dispatch events 18 | 19 | void AirDeviceId_FPANE_DispatchEvent(FREContext context, NSString* eventName) { 20 | 21 | FREDispatchStatusEventAsync(context, (const uint8_t*) [eventName UTF8String], (const uint8_t*) ""); 22 | } 23 | 24 | void AirDeviceId_FPANE_DispatchEventWithInfo(FREContext context, NSString* eventName, NSString* eventInfo) { 25 | 26 | FREDispatchStatusEventAsync(context, (const uint8_t*) [eventName UTF8String], (const uint8_t*) [eventInfo UTF8String]); 27 | } 28 | 29 | void AirDeviceId_FPANE_Log(FREContext context, NSString* message) { 30 | 31 | AirDeviceId_FPANE_DispatchEventWithInfo(context, @"LOGGING", message); 32 | } 33 | 34 | #pragma mark - FREObject -> Obj-C 35 | 36 | NSString* AirDeviceId_FPANE_FREObjectToNSString(FREObject object) { 37 | 38 | uint32_t stringLength; 39 | const uint8_t* string; 40 | FREGetObjectAsUTF8(object, &stringLength, &string); 41 | return [NSString stringWithUTF8String:(char*) string]; 42 | } 43 | 44 | NSArray* AirDeviceId_FPANE_FREObjectToNSArrayOfNSString(FREObject object) { 45 | 46 | uint32_t arrayLength; 47 | FREGetArrayLength(object, &arrayLength); 48 | 49 | uint32_t stringLength; 50 | NSMutableArray* mutableArray = [NSMutableArray arrayWithCapacity:arrayLength]; 51 | for (NSInteger i = 0; i < arrayLength; i++) { 52 | FREObject itemRaw; 53 | FREGetArrayElementAt(object, (uint) i, &itemRaw); 54 | 55 | // Convert item to string. Skip with warning if not possible. 56 | const uint8_t* itemString; 57 | if (FREGetObjectAsUTF8(itemRaw, &stringLength, &itemString) != FRE_OK) { 58 | NSLog(@"Couldn't convert FREObject to NSString at index %ld", (long) i); 59 | continue; 60 | } 61 | 62 | NSString* item = [NSString stringWithUTF8String:(char*) itemString]; 63 | [mutableArray addObject:item]; 64 | } 65 | 66 | return [NSArray arrayWithArray:mutableArray]; 67 | } 68 | 69 | UIImage* AirDeviceId_FPANE_FREBitmapDataToUIImage(FREObject object) { 70 | 71 | 72 | FREBitmapData bitmapData; 73 | UIImage* image = nil; 74 | // Convert item to UIImage. Skip with warning if not possible. 75 | if (FREAcquireBitmapData(object, &bitmapData) == FRE_OK) { 76 | 77 | // make data provider from buffer 78 | CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmapData.bits32, (bitmapData.width * bitmapData.height * 4), NULL); 79 | 80 | // set up for CGImage creation 81 | int bitsPerComponent = 8; 82 | int bitsPerPixel = 32; 83 | int bytesPerRow = 4 * bitmapData.width; 84 | CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); 85 | CGBitmapInfo bitmapInfo; 86 | 87 | if (!bitmapData.hasAlpha) 88 | bitmapInfo = kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst; 89 | else { 90 | 91 | if (bitmapData.isPremultiplied) 92 | bitmapInfo = kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst; 93 | else 94 | bitmapInfo = kCGBitmapByteOrder32Little | kCGImageAlphaFirst; 95 | } 96 | 97 | CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; 98 | CGImageRef imageRef = CGImageCreate(bitmapData.width, bitmapData.height, bitsPerComponent, 99 | bitsPerPixel, bytesPerRow, colorSpaceRef, 100 | bitmapInfo, provider, NULL, YES, renderingIntent); 101 | 102 | // make UIImage from CGImage 103 | image = [UIImage imageWithCGImage:imageRef]; 104 | 105 | FREReleaseBitmapData(object); 106 | 107 | NSData* imageData = UIImagePNGRepresentation(image); 108 | 109 | image = [UIImage imageWithData:imageData]; 110 | 111 | } 112 | else { 113 | NSLog(@"Couldn't convert FREObject to UIImage"); 114 | } 115 | 116 | return image; 117 | } 118 | 119 | NSArray* AirDeviceId_FPANE_FREObjectToNSArrayOfUIImage(FREObject object) { 120 | 121 | uint32_t arrayLength; 122 | FREGetArrayLength(object, &arrayLength); 123 | 124 | NSMutableArray* mutableArray = [NSMutableArray arrayWithCapacity:arrayLength]; 125 | for (NSInteger i = 0; i < arrayLength; i++) { 126 | FREObject itemRaw; 127 | FREGetArrayElementAt(object, (uint) i, &itemRaw); 128 | 129 | UIImage *image = AirDeviceId_FPANE_FREBitmapDataToUIImage(itemRaw); 130 | [mutableArray addObject:image]; 131 | } 132 | 133 | return [NSArray arrayWithArray:mutableArray]; 134 | } 135 | 136 | NSDictionary* AirDeviceId_FPANE_FREObjectsToNSDictionaryOfNSString(FREObject keys, FREObject values) { 137 | 138 | uint32_t numKeys, numValues; 139 | FREGetArrayLength(keys, &numKeys); 140 | FREGetArrayLength(values, &numValues); 141 | 142 | uint32_t stringLength; 143 | uint32_t numItems = MIN(numKeys, numValues); 144 | NSMutableDictionary* mutableDictionary = [NSMutableDictionary dictionaryWithCapacity:numItems]; 145 | for (NSInteger i = 0; i < numItems; i++) { 146 | FREObject keyRaw, valueRaw; 147 | FREGetArrayElementAt(keys, (uint) i, &keyRaw); 148 | FREGetArrayElementAt(values, (uint) i, &valueRaw); 149 | 150 | // Convert key and value to strings. Skip with warning if not possible. 151 | const uint8_t* keyString, * valueString; 152 | if (FREGetObjectAsUTF8(keyRaw, &stringLength, &keyString) != FRE_OK || FREGetObjectAsUTF8(valueRaw, &stringLength, &valueString) != FRE_OK) { 153 | NSLog(@"Couldn't convert FREObject to NSString at index %ld", (long) i); 154 | continue; 155 | } 156 | 157 | NSString* key = [NSString stringWithUTF8String:(char*) keyString]; 158 | NSString* value = [NSString stringWithUTF8String:(char*) valueString]; 159 | [mutableDictionary setObject:value forKey:key]; 160 | } 161 | 162 | return [NSDictionary dictionaryWithDictionary:mutableDictionary]; 163 | } 164 | 165 | BOOL AirDeviceId_FPANE_FREObjectToBool(FREObject object) { 166 | 167 | uint32_t b; 168 | FREGetObjectAsBool(object, &b); 169 | return b != 0; 170 | } 171 | 172 | NSInteger AirDeviceId_FPANE_FREObjectToInt(FREObject object) { 173 | 174 | int32_t i; 175 | FREGetObjectAsInt32(object, &i); 176 | return i; 177 | } 178 | 179 | double AirDeviceId_FPANE_FREObjectToDouble(FREObject object) { 180 | 181 | double x; 182 | FREGetObjectAsDouble(object, &x); 183 | return x; 184 | } 185 | 186 | #pragma mark - Obj-C -> FREObject 187 | 188 | FREObject AirDeviceId_FPANE_BOOLToFREObject(BOOL boolean) { 189 | 190 | FREObject result; 191 | FRENewObjectFromBool(boolean, &result); 192 | return result; 193 | } 194 | 195 | FREObject AirDeviceId_FPANE_IntToFREObject(NSInteger i) { 196 | 197 | FREObject result; 198 | FRENewObjectFromInt32((int32_t) i, &result); 199 | return result; 200 | } 201 | 202 | FREObject AirDeviceId_FPANE_DoubleToFREObject(double d) { 203 | 204 | FREObject result; 205 | FRENewObjectFromDouble(d, &result); 206 | return result; 207 | } 208 | 209 | FREObject AirDeviceId_FPANE_NSStringToFREObject(NSString* string) { 210 | 211 | FREObject result; 212 | FRENewObjectFromUTF8((int) string.length, (const uint8_t*) [string UTF8String], &result); 213 | return result; 214 | } 215 | 216 | FREObject AirDeviceId_FPANE_CreateError(NSString* error, NSInteger* id) { 217 | 218 | FREObject ret; 219 | FREObject errorThrown; 220 | 221 | FREObject freId; 222 | FRENewObjectFromInt32((int32_t) *id, &freId); 223 | FREObject argV[] = { 224 | AirDeviceId_FPANE_NSStringToFREObject(error), 225 | freId 226 | }; 227 | FRENewObject((const uint8_t*) "Error", 2, argV, &ret, &errorThrown); 228 | 229 | return ret; 230 | } 231 | 232 | FREObject AirDeviceId_FPANE_UIImageToFREBitmapData(UIImage *image) { 233 | 234 | // create bitmap data 235 | FREObject widthObj; 236 | FRENewObjectFromInt32(image.size.width, &widthObj); 237 | FREObject heightObj; 238 | FRENewObjectFromInt32(image.size.height, &heightObj); 239 | FREObject transparent; 240 | FRENewObjectFromBool( 0, &transparent); 241 | FREObject fillColor; 242 | FRENewObjectFromUint32( 0x000000, &fillColor); 243 | 244 | FREObject params[4] = { widthObj, heightObj, transparent, fillColor }; 245 | 246 | FREObject obj; 247 | FRENewObject((uint8_t *)"flash.display.BitmapData", 4, params, &obj , NULL); 248 | 249 | FREResult result; 250 | FREBitmapData bitmapData; 251 | result = FREAcquireBitmapData(obj, &bitmapData); 252 | if (result != FRE_OK) { 253 | return nil; 254 | } 255 | 256 | // Pull the raw pixels values out of the image data 257 | CGImageRef imageRef = [image CGImage]; 258 | size_t width = CGImageGetWidth(imageRef); 259 | size_t height = CGImageGetHeight(imageRef); 260 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 261 | if(colorSpace == NULL) { 262 | return nil; 263 | } 264 | unsigned char *rawData = malloc(height * width * 4); 265 | size_t bytesPerPixel = 4; 266 | size_t bytesPerRow = bytesPerPixel * width; 267 | size_t bitsPerComponent = 8; 268 | CGContextRef context = CGBitmapContextCreate(rawData, width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); 269 | if(context == NULL) { 270 | return nil; 271 | } 272 | CGColorSpaceRelease(colorSpace); 273 | CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef); 274 | CGContextRelease(context); 275 | 276 | // Pixels are now it rawData in the format RGBA8888 277 | // Now loop over each pixel to write them into the AS3 BitmapData memory 278 | int x, y; 279 | // There may be extra pixels in each row due to the value of lineStride32. 280 | // We'll skip over those as needed. 281 | int offset = bitmapData.lineStride32 - bitmapData.width; 282 | size_t offset2 = bytesPerRow - bitmapData.width*4; 283 | int byteIndex = 0; 284 | uint32_t *bitmapDataPixels = bitmapData.bits32; 285 | for (y=0; y 22 | #endif 23 | 24 | #ifndef FRNATIVEEXTENSIONS_H_ 25 | #define FRNATIVEEXTENSIONS_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef void * FREContext; 32 | typedef void * FREObject; 33 | 34 | /* Initialization *************************************************************/ 35 | 36 | /** 37 | * Defines the signature for native calls that can be invoked via an 38 | * instance of the AS ExtensionContext class. 39 | * 40 | * @return The return value corresponds to the return value 41 | * from the AS ExtensionContext class call() method. It defaults to 42 | * FRE_INVALID_OBJECT, which is reported as null in AS. 43 | */ 44 | 45 | typedef FREObject (*FREFunction)( 46 | FREContext ctx, 47 | void* functionData, 48 | uint32_t argc, 49 | FREObject argv[] 50 | ); 51 | 52 | typedef struct FRENamedFunction_ { 53 | const uint8_t* name; 54 | void* functionData; 55 | FREFunction function; 56 | } FRENamedFunction; 57 | 58 | /** 59 | * Defines the signature for the initializer that is called each time 60 | * a new AS ExtensionContext object is created. 61 | * 62 | * @param extData The extension client data provided to the FREInitializer function as extDataToSet. 63 | * 64 | * @param ctxType Pointer to the contextType string (UTF8) as provided to the AS createExtensionContext call. 65 | * 66 | * @param ctx The FREContext being initialized. 67 | * 68 | * @param numFunctionsToSet The number of elements in the functionsToSet array. 69 | * 70 | * @param functionsToSet A pointer to an array of FRENamedFunction elements. 71 | */ 72 | 73 | typedef void (*FREContextInitializer)( 74 | void* extData , 75 | const uint8_t* ctxType , 76 | FREContext ctx , 77 | uint32_t* numFunctionsToSet, 78 | const FRENamedFunction** functionsToSet 79 | ); 80 | 81 | /** 82 | * Defines the signature for the finalizer that is called each time 83 | * an ExtensionContext instance is disposed. 84 | */ 85 | 86 | typedef void (*FREContextFinalizer)( 87 | FREContext ctx 88 | ); 89 | 90 | /** 91 | * The initialization function provided by each extension must conform 92 | * to the following signature. 93 | * 94 | * @param extDataToSet Provided for the extension to store per-extension instance data. 95 | * For example, if the extension creates 96 | * globals per-instance, it can store a pointer to them here. 97 | * 98 | * @param ctxInitializerToSet Must be set to a pointer to a function 99 | * of type FREContextInitializer. Will be invoked whenever 100 | * the ActionScript code creates a new context for this extension. 101 | * 102 | * @param ctxFinalizerToSet Must be set to a pointer to a function 103 | * of type FREContextFinalizer. 104 | */ 105 | 106 | typedef void (*FREInitializer)( 107 | void** extDataToSet , 108 | FREContextInitializer* ctxInitializerToSet, 109 | FREContextFinalizer* ctxFinalizerToSet 110 | ); 111 | 112 | /** 113 | * Called iff the extension is unloaded from the process. Extensions 114 | * are not guaranteed to be unloaded; the runtime process may exit without 115 | * doing so. 116 | */ 117 | 118 | typedef void (*FREFinalizer)( 119 | void* extData 120 | ); 121 | 122 | /* Result Codes ***************************************************************/ 123 | /** 124 | * These values must not be changed. 125 | */ 126 | 127 | typedef enum { 128 | FRE_OK = 0, 129 | FRE_NO_SUCH_NAME = 1, 130 | FRE_INVALID_OBJECT = 2, 131 | FRE_TYPE_MISMATCH = 3, 132 | FRE_ACTIONSCRIPT_ERROR = 4, 133 | FRE_INVALID_ARGUMENT = 5, 134 | FRE_READ_ONLY = 6, 135 | FRE_WRONG_THREAD = 7, 136 | FRE_ILLEGAL_STATE = 8, 137 | FRE_INSUFFICIENT_MEMORY = 9, 138 | FREResult_ENUMPADDING = 0xfffff /* will ensure that C and C++ treat this enum as the same size. */ 139 | } FREResult; 140 | 141 | /* Context Data ************************************************************/ 142 | 143 | /** 144 | * @returns FRE_OK 145 | * FRE_WRONG_THREAD 146 | * FRE_INVALID_ARGUMENT If nativeData is null. 147 | */ 148 | 149 | FREResult FREGetContextNativeData( FREContext ctx, void** nativeData ); 150 | 151 | /** 152 | * @returns FRE_OK 153 | * FRE_INVALID_ARGUMENT 154 | * FRE_WRONG_THREAD 155 | */ 156 | 157 | FREResult FRESetContextNativeData( FREContext ctx, void* nativeData ); 158 | 159 | /** 160 | * @returns FRE_OK 161 | * FRE_WRONG_THREAD 162 | * FRE_INVALID_ARGUMENT If actionScriptData is null. 163 | */ 164 | 165 | FREResult FREGetContextActionScriptData( FREContext ctx, FREObject *actionScriptData ); 166 | 167 | /** 168 | * @returns FRE_OK 169 | * FRE_WRONG_THREAD 170 | */ 171 | 172 | FREResult FRESetContextActionScriptData( FREContext ctx, FREObject actionScriptData ); 173 | 174 | /* Primitive Types ************************************************************/ 175 | /** 176 | * These values must not be changed. 177 | */ 178 | 179 | typedef enum { 180 | FRE_TYPE_OBJECT = 0, 181 | FRE_TYPE_NUMBER = 1, 182 | FRE_TYPE_STRING = 2, 183 | FRE_TYPE_BYTEARRAY = 3, 184 | FRE_TYPE_ARRAY = 4, 185 | FRE_TYPE_VECTOR = 5, 186 | FRE_TYPE_BITMAPDATA = 6, 187 | FRE_TYPE_BOOLEAN = 7, 188 | FRE_TYPE_NULL = 8, 189 | FREObjectType_ENUMPADDING = 0xfffff /* will ensure that C and C++ treat this enum as the same size. */ 190 | } FREObjectType; 191 | 192 | /** 193 | * @returns FRE_OK 194 | * FRE_INVALID_OBJECT 195 | * FRE_WRONG_THREAD 196 | * FRE_INVALID_ARGUMENT If objectType is null. 197 | */ 198 | 199 | FREResult FREGetObjectType( FREObject object, FREObjectType *objectType ); 200 | 201 | /** 202 | * @return FRE_OK 203 | * FRE_TYPE_MISMATCH 204 | * FRE_INVALID_OBJECT 205 | * FRE_INVALID_ARGUMENT 206 | * FRE_WRONG_THREAD 207 | */ 208 | 209 | FREResult FREGetObjectAsInt32 ( FREObject object, int32_t *value ); 210 | FREResult FREGetObjectAsUint32( FREObject object, uint32_t *value ); 211 | FREResult FREGetObjectAsDouble( FREObject object, double *value ); 212 | FREResult FREGetObjectAsBool ( FREObject object, uint32_t *value ); 213 | 214 | /** 215 | * @return FRE_OK 216 | * FRE_INVALID_ARGUMENT 217 | * FRE_WRONG_THREAD 218 | */ 219 | 220 | FREResult FRENewObjectFromInt32 ( int32_t value, FREObject *object ); 221 | FREResult FRENewObjectFromUint32( uint32_t value, FREObject *object ); 222 | FREResult FRENewObjectFromDouble( double value, FREObject *object ); 223 | FREResult FRENewObjectFromBool ( uint32_t value, FREObject *object ); 224 | 225 | /** 226 | * Retrieves a string representation of the object referred to by 227 | * the given object. The referenced string is immutable and valid 228 | * only for duration of the call to a registered function. If the 229 | * caller wishes to keep the the string, they must keep a copy of it. 230 | * 231 | * @param object The string to be retrieved. 232 | * 233 | * @param length The size, in bytes, of the string. Includes the 234 | * null terminator. 235 | * 236 | * @param value A pointer to a possibly temporary copy of the string. 237 | * 238 | * @return FRE_OK 239 | * FRE_TYPE_MISMATCH 240 | * FRE_INVALID_OBJECT 241 | * FRE_INVALID_ARGUMENT 242 | * FRE_WRONG_THREAD 243 | */ 244 | 245 | FREResult FREGetObjectAsUTF8( 246 | FREObject object, 247 | uint32_t* length, 248 | const uint8_t** value 249 | ); 250 | 251 | /** 252 | * Creates a new String object that contains a copy of the specified 253 | * string. 254 | * 255 | * @param length The length, in bytes, of the original string. Must include 256 | * the null terminator. 257 | * 258 | * @param value A pointer to the original string. 259 | * 260 | * @param object Receives a reference to the new string object. 261 | * 262 | * @return FRE_OK 263 | * FRE_INVALID_ARGUMENT 264 | * FRE_WRONG_THREAD 265 | */ 266 | 267 | FREResult FRENewObjectFromUTF8( 268 | uint32_t length, 269 | const uint8_t* value , 270 | FREObject* object 271 | ); 272 | 273 | /* Object Access **************************************************************/ 274 | 275 | /** 276 | * @param className UTF8-encoded name of the class being constructed. 277 | * 278 | * @param thrownException A pointer to a handle that can receive the handle of any ActionScript 279 | * Error thrown during execution. May be null if the caller does not 280 | * want to receive this handle. If not null and no error occurs, is set an 281 | * invalid handle value. 282 | * 283 | * @return FRE_OK 284 | * FRE_TYPE_MISMATCH 285 | * FRE_INVALID_OBJECT 286 | * FRE_INVALID_ARGUMENT 287 | * FRE_ACTIONSCRIPT_ERROR If an ActionScript exception results from calling this method. 288 | * In this case, thrownException will be set to the handle of the thrown value. 289 | * FRE_ILLEGAL_STATE If a ByteArray or BitmapData has been acquired and not yet released. 290 | * FRE_NO_SUCH_NAME 291 | * FRE_WRONG_THREAD 292 | */ 293 | 294 | FREResult FRENewObject( 295 | const uint8_t* className , 296 | uint32_t argc , 297 | FREObject argv[] , 298 | FREObject* object , 299 | FREObject* thrownException 300 | ); 301 | 302 | /** 303 | * @param propertyName UTF8-encoded name of the property being fetched. 304 | * 305 | * @param thrownException A pointer to a handle that can receive the handle of any ActionScript 306 | * Error thrown during getting the property. May be null if the caller does not 307 | * want to receive this handle. If not null and no error occurs, is set an 308 | * invalid handle value. 309 | * 310 | * @return FRE_OK 311 | * FRE_TYPE_MISMATCH 312 | * FRE_INVALID_OBJECT 313 | * FRE_INVALID_ARGUMENT 314 | * 315 | * FRE_ACTIONSCRIPT_ERROR If an ActionScript exception results from getting this property. 316 | * In this case, thrownException will be set to the handle of the thrown value. 317 | * 318 | * FRE_NO_SUCH_NAME If the named property doesn't exist, or if the reference is ambiguous 319 | * because the property exists in more than one namespace. 320 | * 321 | * FRE_ILLEGAL_STATE If a ByteArray or BitmapData has been acquired and not yet released. 322 | * 323 | * FRE_WRONG_THREAD 324 | */ 325 | 326 | FREResult FREGetObjectProperty( 327 | FREObject object , 328 | const uint8_t* propertyName , 329 | FREObject* propertyValue , 330 | FREObject* thrownException 331 | ); 332 | 333 | /** 334 | * @param propertyName UTF8-encoded name of the property being set. 335 | * 336 | * @param thrownException A pointer to a handle that can receive the handle of any ActionScript 337 | * Error thrown during method execution. May be null if the caller does not 338 | * want to receive this handle. If not null and no error occurs, is set an 339 | * invalid handle value. 340 | * 341 | * 342 | * @return FRE_OK 343 | * FRE_TYPE_MISMATCH 344 | * FRE_INVALID_OBJECT 345 | * FRE_INVALID_ARGUMENT 346 | * FRE_ACTIONSCRIPT_ERROR If an ActionScript exception results from getting this property. 347 | * In this case, thrownException will be set to the handle of the thrown value. 348 | * 349 | * FRE_NO_SUCH_NAME If the named property doesn't exist, or if the reference is ambiguous 350 | * because the property exists in more than one namespace. 351 | * 352 | * FRE_ILLEGAL_STATE If a ByteArray or BitmapData has been acquired and not yet released. 353 | * 354 | * FRE_READ_ONLY 355 | * FRE_WRONG_THREAD 356 | */ 357 | 358 | FREResult FRESetObjectProperty( 359 | FREObject object , 360 | const uint8_t* propertyName , 361 | FREObject propertyValue , 362 | FREObject* thrownException 363 | ); 364 | 365 | /** 366 | * @param methodName UTF8-encoded null-terminated name of the method being invoked. 367 | * 368 | * @param thrownException A pointer to a handle that can receive the handle of any ActionScript 369 | * Error thrown during method execution. May be null if the caller does not 370 | * want to receive this handle. If not null and no error occurs, is set an 371 | * invalid handle value. 372 | * 373 | * @return FRE_OK 374 | * FRE_TYPE_MISMATCH 375 | * FRE_INVALID_OBJECT 376 | * FRE_INVALID_ARGUMENT 377 | * FRE_ACTIONSCRIPT_ERROR If an ActionScript exception results from calling this method. 378 | * In this case, thrownException will be set to the handle of the thrown value. 379 | * 380 | * FRE_NO_SUCH_NAME If the named method doesn't exist, or if the reference is ambiguous 381 | * because the method exists in more than one namespace. 382 | * 383 | * FRE_ILLEGAL_STATE If a ByteArray or BitmapData has been acquired and not yet released. 384 | * 385 | * FRE_WRONG_THREAD 386 | */ 387 | 388 | FREResult FRECallObjectMethod ( 389 | FREObject object , 390 | const uint8_t* methodName , 391 | uint32_t argc , 392 | FREObject argv[] , 393 | FREObject* result , 394 | FREObject* thrownException 395 | ); 396 | 397 | /* BitmapData Access **********************************************************/ 398 | 399 | typedef struct { 400 | uint32_t width; /* width of the BitmapData bitmap */ 401 | uint32_t height; /* height of the BitmapData bitmap */ 402 | uint32_t hasAlpha; /* if non-zero, pixel format is ARGB32, otherwise pixel format is _RGB32, host endianness */ 403 | uint32_t isPremultiplied; /* pixel color values are premultiplied with alpha if non-zero, un-multiplied if zero */ 404 | uint32_t lineStride32; /* line stride in number of 32 bit values, typically the same as width */ 405 | uint32_t* bits32; /* pointer to the first 32-bit pixel of the bitmap data */ 406 | } FREBitmapData; 407 | 408 | typedef struct { 409 | uint32_t width; /* width of the BitmapData bitmap */ 410 | uint32_t height; /* height of the BitmapData bitmap */ 411 | uint32_t hasAlpha; /* if non-zero, pixel format is ARGB32, otherwise pixel format is _RGB32, host endianness */ 412 | uint32_t isPremultiplied; /* pixel color values are premultiplied with alpha if non-zero, un-multiplied if zero */ 413 | uint32_t lineStride32; /* line stride in number of 32 bit values, typically the same as width */ 414 | uint32_t isInvertedY; /* if non-zero, last row of pixels starts at bits32, otherwise, first row of pixels starts at bits32. */ 415 | uint32_t* bits32; /* pointer to the first 32-bit pixel of the bitmap data */ 416 | } FREBitmapData2; 417 | 418 | /** 419 | * Referenced data is valid only for duration of the call 420 | * to a registered function. 421 | * 422 | * @return FRE_OK 423 | * FRE_TYPE_MISMATCH 424 | * FRE_INVALID_OBJECT 425 | * FRE_INVALID_ARGUMENT 426 | * FRE_WRONG_THREAD 427 | * FRE_ILLEGAL_STATE 428 | */ 429 | 430 | FREResult FREAcquireBitmapData( 431 | FREObject object , 432 | FREBitmapData* descriptorToSet 433 | ); 434 | 435 | /** 436 | * Referenced data is valid only for duration of the call 437 | * to a registered function. 438 | * 439 | * Use of this API requires that the extension and application must be packaged for 440 | * the 3.1 namespace or later. 441 | * 442 | * @return FRE_OK 443 | * FRE_TYPE_MISMATCH 444 | * FRE_INVALID_OBJECT 445 | * FRE_INVALID_ARGUMENT 446 | * FRE_WRONG_THREAD 447 | * FRE_ILLEGAL_STATE 448 | */ 449 | 450 | FREResult FREAcquireBitmapData2( 451 | FREObject object , 452 | FREBitmapData2* descriptorToSet 453 | ); 454 | 455 | /** 456 | * BitmapData must be acquired to call this. Clients must invalidate any region 457 | * they modify in order to notify AIR of the changes. Only invalidated regions 458 | * are redrawn. 459 | * 460 | * @return FRE_OK 461 | * FRE_INVALID_OBJECT 462 | * FRE_WRONG_THREAD 463 | * FRE_ILLEGAL_STATE 464 | * FRE_TYPE_MISMATCH 465 | */ 466 | 467 | FREResult FREInvalidateBitmapDataRect( 468 | FREObject object, 469 | uint32_t x , 470 | uint32_t y , 471 | uint32_t width , 472 | uint32_t height 473 | ); 474 | /** 475 | * @return FRE_OK 476 | * FRE_WRONG_THREAD 477 | * FRE_ILLEGAL_STATE 478 | * FRE_TYPE_MISMATCH 479 | */ 480 | 481 | FREResult FREReleaseBitmapData( FREObject object ); 482 | 483 | /** 484 | * Referenced data is valid only for duration of the call 485 | * to a registered function. 486 | * 487 | * @return FRE_OK 488 | * FRE_TYPE_MISMATCH 489 | * FRE_INVALID_OBJECT 490 | * FRE_WRONG_THREAD 491 | */ 492 | 493 | /* ByteArray Access ***********************************************************/ 494 | 495 | typedef struct { 496 | uint32_t length; 497 | uint8_t* bytes; 498 | } FREByteArray; 499 | 500 | /** 501 | * Referenced data is valid only for duration of the call 502 | * to a registered function. 503 | * 504 | * @return FRE_OK 505 | * FRE_TYPE_MISMATCH 506 | * FRE_INVALID_OBJECT 507 | * FRE_INVALID_ARGUMENT 508 | * FRE_WRONG_THREAD 509 | * FRE_ILLEGAL_STATE 510 | */ 511 | 512 | FREResult FREAcquireByteArray( 513 | FREObject object , 514 | FREByteArray* byteArrayToSet 515 | ); 516 | 517 | /** 518 | * @return FRE_OK 519 | * FRE_INVALID_OBJECT 520 | * FRE_ILLEGAL_STATE 521 | * FRE_WRONG_THREAD 522 | */ 523 | 524 | FREResult FREReleaseByteArray( FREObject object ); 525 | 526 | /* Array and Vector Access ****************************************************/ 527 | 528 | /** 529 | * @return FRE_OK 530 | * FRE_INVALID_OBJECT 531 | * FRE_INVALID_ARGUMENT 532 | * FRE_ILLEGAL_STATE 533 | * FRE_TYPE_MISMATCH 534 | * FRE_WRONG_THREAD 535 | */ 536 | 537 | FREResult FREGetArrayLength( 538 | FREObject arrayOrVector, 539 | uint32_t* length 540 | ); 541 | 542 | /** 543 | * @return FRE_OK 544 | * FRE_INVALID_OBJECT 545 | * FRE_TYPE_MISMATCH 546 | * FRE_ILLEGAL_STATE 547 | * FRE_INVALID_ARGUMENT If length is greater than 2^32. 548 | * 549 | * FRE_READ_ONLY If the handle refers to a Vector 550 | * of fixed size. 551 | * 552 | * FRE_WRONG_THREAD 553 | * FRE_INSUFFICIENT_MEMORY 554 | */ 555 | 556 | FREResult FRESetArrayLength( 557 | FREObject arrayOrVector, 558 | uint32_t length 559 | ); 560 | 561 | /** 562 | * If an Array is sparse and an element that isn't defined is requested, the 563 | * return value will be FRE_OK but the handle value will be invalid. 564 | * 565 | * @return FRE_OK 566 | * FRE_ILLEGAL_STATE 567 | * 568 | * FRE_INVALID_ARGUMENT If the handle refers to a vector and the index is 569 | * greater than the size of the array. 570 | * 571 | * FRE_INVALID_OBJECT 572 | * FRE_TYPE_MISMATCH 573 | * FRE_WRONG_THREAD 574 | */ 575 | 576 | FREResult FREGetArrayElementAt( 577 | FREObject arrayOrVector, 578 | uint32_t index , 579 | FREObject* value 580 | ); 581 | 582 | /** 583 | * 584 | * @return FRE_OK 585 | * FRE_INVALID_OBJECT 586 | * FRE_ILLEGAL_STATE 587 | * 588 | * FRE_TYPE_MISMATCH If an attempt to made to set a value in a Vector 589 | * when the type of the value doesn't match the Vector's item type. 590 | * 591 | * FRE_WRONG_THREAD 592 | */ 593 | 594 | FREResult FRESetArrayElementAt( 595 | FREObject arrayOrVector, 596 | uint32_t index , 597 | FREObject value 598 | ); 599 | 600 | /* Callbacks ******************************************************************/ 601 | 602 | /** 603 | * Causes a StatusEvent to be dispatched from the associated 604 | * ExtensionContext object. 605 | * 606 | * Dispatch happens asynchronously, even if this is called during 607 | * a call to a registered function. 608 | * 609 | * The ActionScript portion of this extension can listen for that event 610 | * and, upon receipt, query the native portion for details of the event 611 | * that occurred. 612 | * 613 | * This call is thread-safe and may be invoked from any thread. The string 614 | * values are copied before the call returns. 615 | * 616 | * @return FRE_OK In all circumstances, as the referenced object cannot 617 | * necessarily be checked for validity on the invoking thread. 618 | * However, no event will be dispatched if the object is 619 | * invalid or not an EventDispatcher. 620 | * FRE_INVALID_ARGUMENT If code or level is NULL 621 | */ 622 | 623 | FREResult FREDispatchStatusEventAsync( 624 | FREContext ctx , 625 | const uint8_t* code , 626 | const uint8_t* level 627 | ); 628 | 629 | #ifdef __cplusplus 630 | } 631 | #endif 632 | 633 | #endif /* #ifndef _FLASH_RUNTIME_EXTENSIONS_H_ */ 634 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'AirDeviceId' do 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | # Pods for AirDeviceId 9 | 10 | end 11 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODFILE CHECKSUM: 3160ce7c32dac4fc9ba2103241bb01256c8cc0e4 2 | 3 | COCOAPODS: 1.1.1 4 | -------------------------------------------------------------------------------- /ios/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODFILE CHECKSUM: 3160ce7c32dac4fc9ba2103241bb01256c8cc0e4 2 | 3 | COCOAPODS: 1.1.1 4 | -------------------------------------------------------------------------------- /ios/Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 10DE81A47B317F5525C436B3F544A79F /* Pods-AirDeviceId-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B589CD855CC07817AB16B7B40D2D1147 /* Pods-AirDeviceId-dummy.m */; }; 11 | 8238A3B22579E48BFE4335CF53C142F0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXFileReference section */ 15 | 0FC77400ADEAB170403C509E581E887C /* Pods-AirDeviceId-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-AirDeviceId-acknowledgements.plist"; sourceTree = ""; }; 16 | 3991D3B135A914F78E26A863BCC86191 /* Pods-AirDeviceId-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-AirDeviceId-frameworks.sh"; sourceTree = ""; }; 17 | 3F18077348E66E0B1CB334B8C2A178DF /* Pods-AirDeviceId.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AirDeviceId.release.xcconfig"; sourceTree = ""; }; 18 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 19 | B12ED4B2B8ED2130C443145E5705A7BA /* libPods-AirDeviceId.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AirDeviceId.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | B589CD855CC07817AB16B7B40D2D1147 /* Pods-AirDeviceId-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-AirDeviceId-dummy.m"; sourceTree = ""; }; 21 | C46196D6C7AFDD0DE9060AD01C03151F /* Pods-AirDeviceId-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-AirDeviceId-resources.sh"; sourceTree = ""; }; 22 | CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 23 | CBC57C4B1B7482F0BFF4815A4C8433AB /* Pods-AirDeviceId-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-AirDeviceId-acknowledgements.markdown"; sourceTree = ""; }; 24 | EA3DAF8D10DC9F01CDA4EECEC8D654C8 /* Pods-AirDeviceId.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AirDeviceId.debug.xcconfig"; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | 9095C787823FDD70E01FA9275DA1A787 /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | 8238A3B22579E48BFE4335CF53C142F0 /* Foundation.framework in Frameworks */, 33 | ); 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXFrameworksBuildPhase section */ 37 | 38 | /* Begin PBXGroup section */ 39 | 7531C8F8DE19F1AA3C8A7AC97A91DC29 /* iOS */ = { 40 | isa = PBXGroup; 41 | children = ( 42 | CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */, 43 | ); 44 | name = iOS; 45 | sourceTree = ""; 46 | }; 47 | 7DB346D0F39D3F0E887471402A8071AB = { 48 | isa = PBXGroup; 49 | children = ( 50 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, 51 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, 52 | F7367962864E0A8084BB119D5620DE2A /* Products */, 53 | C53CBC317DB6D791C5BA98B2E6D86D5D /* Targets Support Files */, 54 | ); 55 | sourceTree = ""; 56 | }; 57 | 8FBC7F0CCC47A51C4CD544A15F3A381F /* Pods-AirDeviceId */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | CBC57C4B1B7482F0BFF4815A4C8433AB /* Pods-AirDeviceId-acknowledgements.markdown */, 61 | 0FC77400ADEAB170403C509E581E887C /* Pods-AirDeviceId-acknowledgements.plist */, 62 | B589CD855CC07817AB16B7B40D2D1147 /* Pods-AirDeviceId-dummy.m */, 63 | 3991D3B135A914F78E26A863BCC86191 /* Pods-AirDeviceId-frameworks.sh */, 64 | C46196D6C7AFDD0DE9060AD01C03151F /* Pods-AirDeviceId-resources.sh */, 65 | EA3DAF8D10DC9F01CDA4EECEC8D654C8 /* Pods-AirDeviceId.debug.xcconfig */, 66 | 3F18077348E66E0B1CB334B8C2A178DF /* Pods-AirDeviceId.release.xcconfig */, 67 | ); 68 | name = "Pods-AirDeviceId"; 69 | path = "Target Support Files/Pods-AirDeviceId"; 70 | sourceTree = ""; 71 | }; 72 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 7531C8F8DE19F1AA3C8A7AC97A91DC29 /* iOS */, 76 | ); 77 | name = Frameworks; 78 | sourceTree = ""; 79 | }; 80 | C53CBC317DB6D791C5BA98B2E6D86D5D /* Targets Support Files */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 8FBC7F0CCC47A51C4CD544A15F3A381F /* Pods-AirDeviceId */, 84 | ); 85 | name = "Targets Support Files"; 86 | sourceTree = ""; 87 | }; 88 | F7367962864E0A8084BB119D5620DE2A /* Products */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | B12ED4B2B8ED2130C443145E5705A7BA /* libPods-AirDeviceId.a */, 92 | ); 93 | name = Products; 94 | sourceTree = ""; 95 | }; 96 | /* End PBXGroup section */ 97 | 98 | /* Begin PBXNativeTarget section */ 99 | 70D0FC64D67015ED1324D26E5F933697 /* Pods-AirDeviceId */ = { 100 | isa = PBXNativeTarget; 101 | buildConfigurationList = 0D52CDF5380B0EC23ECE39133F2F7B8B /* Build configuration list for PBXNativeTarget "Pods-AirDeviceId" */; 102 | buildPhases = ( 103 | 36A902E275F0F0997B0C07959F6FADB1 /* Sources */, 104 | 9095C787823FDD70E01FA9275DA1A787 /* Frameworks */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = "Pods-AirDeviceId"; 111 | productName = "Pods-AirDeviceId"; 112 | productReference = B12ED4B2B8ED2130C443145E5705A7BA /* libPods-AirDeviceId.a */; 113 | productType = "com.apple.product-type.library.static"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastSwiftUpdateCheck = 0730; 122 | LastUpgradeCheck = 0700; 123 | }; 124 | buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; 125 | compatibilityVersion = "Xcode 3.2"; 126 | developmentRegion = English; 127 | hasScannedForEncodings = 0; 128 | knownRegions = ( 129 | en, 130 | ); 131 | mainGroup = 7DB346D0F39D3F0E887471402A8071AB; 132 | productRefGroup = F7367962864E0A8084BB119D5620DE2A /* Products */; 133 | projectDirPath = ""; 134 | projectRoot = ""; 135 | targets = ( 136 | 70D0FC64D67015ED1324D26E5F933697 /* Pods-AirDeviceId */, 137 | ); 138 | }; 139 | /* End PBXProject section */ 140 | 141 | /* Begin PBXSourcesBuildPhase section */ 142 | 36A902E275F0F0997B0C07959F6FADB1 /* Sources */ = { 143 | isa = PBXSourcesBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 10DE81A47B317F5525C436B3F544A79F /* Pods-AirDeviceId-dummy.m in Sources */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | /* End PBXSourcesBuildPhase section */ 151 | 152 | /* Begin XCBuildConfiguration section */ 153 | 156284431C64CB05C59BDA0595A1E95A /* Release */ = { 154 | isa = XCBuildConfiguration; 155 | buildSettings = { 156 | ALWAYS_SEARCH_USER_PATHS = NO; 157 | CLANG_ANALYZER_NONNULL = YES; 158 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 159 | CLANG_CXX_LIBRARY = "libc++"; 160 | CLANG_ENABLE_MODULES = YES; 161 | CLANG_ENABLE_OBJC_ARC = YES; 162 | CLANG_WARN_BOOL_CONVERSION = YES; 163 | CLANG_WARN_CONSTANT_CONVERSION = YES; 164 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 165 | CLANG_WARN_EMPTY_BODY = YES; 166 | CLANG_WARN_ENUM_CONVERSION = YES; 167 | CLANG_WARN_INT_CONVERSION = YES; 168 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 169 | CLANG_WARN_UNREACHABLE_CODE = YES; 170 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 171 | CODE_SIGNING_REQUIRED = NO; 172 | COPY_PHASE_STRIP = YES; 173 | ENABLE_NS_ASSERTIONS = NO; 174 | GCC_C_LANGUAGE_STANDARD = gnu99; 175 | GCC_PREPROCESSOR_DEFINITIONS = ( 176 | "POD_CONFIGURATION_RELEASE=1", 177 | "$(inherited)", 178 | ); 179 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 180 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 181 | GCC_WARN_UNDECLARED_SELECTOR = YES; 182 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 183 | GCC_WARN_UNUSED_FUNCTION = YES; 184 | GCC_WARN_UNUSED_VARIABLE = YES; 185 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 186 | PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; 187 | STRIP_INSTALLED_PRODUCT = NO; 188 | SYMROOT = "${SRCROOT}/../build"; 189 | VALIDATE_PRODUCT = YES; 190 | }; 191 | name = Release; 192 | }; 193 | 16E8B2297EAEFDBBEB2A50CA2FE64016 /* Debug */ = { 194 | isa = XCBuildConfiguration; 195 | baseConfigurationReference = EA3DAF8D10DC9F01CDA4EECEC8D654C8 /* Pods-AirDeviceId.debug.xcconfig */; 196 | buildSettings = { 197 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 198 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 199 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 200 | DEBUG_INFORMATION_FORMAT = dwarf; 201 | ENABLE_STRICT_OBJC_MSGSEND = YES; 202 | GCC_NO_COMMON_BLOCKS = YES; 203 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 204 | MACH_O_TYPE = staticlib; 205 | MTL_ENABLE_DEBUG_INFO = YES; 206 | OTHER_LDFLAGS = ""; 207 | OTHER_LIBTOOLFLAGS = ""; 208 | PODS_ROOT = "$(SRCROOT)"; 209 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 210 | PRODUCT_NAME = "$(TARGET_NAME)"; 211 | SDKROOT = iphoneos; 212 | SKIP_INSTALL = YES; 213 | }; 214 | name = Debug; 215 | }; 216 | C382132BB6BF8CA1A911872A2062FD0D /* Debug */ = { 217 | isa = XCBuildConfiguration; 218 | buildSettings = { 219 | ALWAYS_SEARCH_USER_PATHS = NO; 220 | CLANG_ANALYZER_NONNULL = YES; 221 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 222 | CLANG_CXX_LIBRARY = "libc++"; 223 | CLANG_ENABLE_MODULES = YES; 224 | CLANG_ENABLE_OBJC_ARC = YES; 225 | CLANG_WARN_BOOL_CONVERSION = YES; 226 | CLANG_WARN_CONSTANT_CONVERSION = YES; 227 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 228 | CLANG_WARN_EMPTY_BODY = YES; 229 | CLANG_WARN_ENUM_CONVERSION = YES; 230 | CLANG_WARN_INT_CONVERSION = YES; 231 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 232 | CLANG_WARN_UNREACHABLE_CODE = YES; 233 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 234 | CODE_SIGNING_REQUIRED = NO; 235 | COPY_PHASE_STRIP = NO; 236 | ENABLE_TESTABILITY = YES; 237 | GCC_C_LANGUAGE_STANDARD = gnu99; 238 | GCC_DYNAMIC_NO_PIC = NO; 239 | GCC_OPTIMIZATION_LEVEL = 0; 240 | GCC_PREPROCESSOR_DEFINITIONS = ( 241 | "POD_CONFIGURATION_DEBUG=1", 242 | "DEBUG=1", 243 | "$(inherited)", 244 | ); 245 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 246 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 247 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 248 | GCC_WARN_UNDECLARED_SELECTOR = YES; 249 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 250 | GCC_WARN_UNUSED_FUNCTION = YES; 251 | GCC_WARN_UNUSED_VARIABLE = YES; 252 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 253 | ONLY_ACTIVE_ARCH = YES; 254 | PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; 255 | STRIP_INSTALLED_PRODUCT = NO; 256 | SYMROOT = "${SRCROOT}/../build"; 257 | }; 258 | name = Debug; 259 | }; 260 | D7A18877D00466A86A63C6AF68FCAD66 /* Release */ = { 261 | isa = XCBuildConfiguration; 262 | baseConfigurationReference = 3F18077348E66E0B1CB334B8C2A178DF /* Pods-AirDeviceId.release.xcconfig */; 263 | buildSettings = { 264 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 265 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 266 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 267 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_NO_COMMON_BLOCKS = YES; 270 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 271 | MACH_O_TYPE = staticlib; 272 | MTL_ENABLE_DEBUG_INFO = NO; 273 | OTHER_LDFLAGS = ""; 274 | OTHER_LIBTOOLFLAGS = ""; 275 | PODS_ROOT = "$(SRCROOT)"; 276 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 277 | PRODUCT_NAME = "$(TARGET_NAME)"; 278 | SDKROOT = iphoneos; 279 | SKIP_INSTALL = YES; 280 | }; 281 | name = Release; 282 | }; 283 | /* End XCBuildConfiguration section */ 284 | 285 | /* Begin XCConfigurationList section */ 286 | 0D52CDF5380B0EC23ECE39133F2F7B8B /* Build configuration list for PBXNativeTarget "Pods-AirDeviceId" */ = { 287 | isa = XCConfigurationList; 288 | buildConfigurations = ( 289 | 16E8B2297EAEFDBBEB2A50CA2FE64016 /* Debug */, 290 | D7A18877D00466A86A63C6AF68FCAD66 /* Release */, 291 | ); 292 | defaultConfigurationIsVisible = 0; 293 | defaultConfigurationName = Release; 294 | }; 295 | 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { 296 | isa = XCConfigurationList; 297 | buildConfigurations = ( 298 | C382132BB6BF8CA1A911872A2062FD0D /* Debug */, 299 | 156284431C64CB05C59BDA0595A1E95A /* Release */, 300 | ); 301 | defaultConfigurationIsVisible = 0; 302 | defaultConfigurationName = Release; 303 | }; 304 | /* End XCConfigurationList section */ 305 | }; 306 | rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 307 | } 308 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_AirDeviceId : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_AirDeviceId 5 | @end 6 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | *) 22 | TARGET_DEVICE_ARGS="--target-device mac" 23 | ;; 24 | esac 25 | 26 | install_resource() 27 | { 28 | if [[ "$1" = /* ]] ; then 29 | RESOURCE_PATH="$1" 30 | else 31 | RESOURCE_PATH="${PODS_ROOT}/$1" 32 | fi 33 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 34 | cat << EOM 35 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 36 | EOM 37 | exit 1 38 | fi 39 | case $RESOURCE_PATH in 40 | *.storyboard) 41 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 42 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 43 | ;; 44 | *.xib) 45 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 46 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 47 | ;; 48 | *.framework) 49 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 50 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 51 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 52 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | ;; 54 | *.xcdatamodel) 55 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 56 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 57 | ;; 58 | *.xcdatamodeld) 59 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 60 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 61 | ;; 62 | *.xcmappingmodel) 63 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 64 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 65 | ;; 66 | *.xcassets) 67 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 68 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 69 | ;; 70 | *) 71 | echo "$RESOURCE_PATH" 72 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 73 | ;; 74 | esac 75 | } 76 | 77 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 78 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 79 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 80 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 82 | fi 83 | rm -f "$RESOURCES_TO_COPY" 84 | 85 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 86 | then 87 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 88 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 89 | while read line; do 90 | if [[ $line != "${PODS_ROOT}*" ]]; then 91 | XCASSET_FILES+=("$line") 92 | fi 93 | done <<<"$OTHER_XCASSETS" 94 | 95 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | fi 97 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" 5 | OTHER_LDFLAGS = $(inherited) -ObjC 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-AirDeviceId/Pods-AirDeviceId.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" 5 | OTHER_LDFLAGS = $(inherited) -ObjC 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /sample/Main-app.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 15 | Main 16 | 17 | 18 | Main 19 | 20 | 21 | Main 22 | 23 | 26 | 0.0.0 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | com.freshplanet.ane.AirDeviceId 46 | 47 | 48 | 49 | 50 | 51 | SWF file name is set automatically at compile time 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | true 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | true 97 | 98 | 99 | true 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 153 | 154 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | UIDeviceFamily 189 | 190 | 191 | 1 192 | 193 | 2 194 | 195 | 196 | 197 | 198 | 199 | Fabric 200 | 201 | APIKey 202 | YOUR-API-KEY 203 | Kits 204 | 205 | 206 | KitInfo 207 | 208 | KitName 209 | Crashlytics 210 | 211 | 212 | 213 | ]]> 214 | 215 | 216 | 217 | 226 | 227 | 228 | high 229 | 230 | 231 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | ]]> 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /sample/libs/AirDeviceId.ane: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshplanet/ANE-DeviceId/c80d3a839349a8c268f778dc3836fe534f2f7837/sample/libs/AirDeviceId.ane -------------------------------------------------------------------------------- /sample/src/Main.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package { 16 | 17 | 18 | import com.freshplanet.ane.AirDeviceId.AirDeviceId; 19 | import com.freshplanet.ane.AirDeviceId.events.AirDeviceIdEvent; 20 | 21 | import flash.display.Sprite; 22 | import flash.display.StageAlign; 23 | import flash.events.Event; 24 | 25 | import com.freshplanet.ui.ScrollableContainer; 26 | import com.freshplanet.ui.TestBlock; 27 | 28 | [SWF(backgroundColor="#057fbc", frameRate='60')] 29 | public class Main extends Sprite { 30 | 31 | public static var stageWidth:Number = 0; 32 | public static var indent:Number = 0; 33 | 34 | private var _scrollableContainer:ScrollableContainer = null; 35 | 36 | public function Main() { 37 | this.addEventListener(Event.ADDED_TO_STAGE, _onAddedToStage); 38 | } 39 | 40 | private function _onAddedToStage(event:Event):void { 41 | this.removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage); 42 | this.stage.align = StageAlign.TOP_LEFT; 43 | 44 | stageWidth = this.stage.stageWidth; 45 | indent = stage.stageWidth * 0.025; 46 | 47 | _scrollableContainer = new ScrollableContainer(false, true); 48 | this.addChild(_scrollableContainer); 49 | 50 | if (!AirDeviceId.isSupported) { 51 | trace("AirDeviceId ANE is NOT supported on this platform!"); 52 | return; 53 | } 54 | 55 | AirDeviceId.instance.addEventListener(AirDeviceIdEvent.RECEIVED_IDFA, onReceivedIDFA); 56 | var blocks:Array = []; 57 | 58 | blocks.push(new TestBlock("getID", function():void { 59 | var id:String = AirDeviceId.instance.getID("some_salt"); 60 | trace("ID is ", id); 61 | })); 62 | blocks.push(new TestBlock("getIDFV", function():void { 63 | var idfv:String = AirDeviceId.instance.getIDFV(); 64 | trace("IDFV is ", idfv); 65 | })); 66 | blocks.push(new TestBlock("getIDFA", function():void { 67 | AirDeviceId.instance.getIDFA(); 68 | })); 69 | 70 | 71 | 72 | /** 73 | * add ui to screen 74 | */ 75 | 76 | var nextY:Number = indent; 77 | 78 | for each (var block:TestBlock in blocks) { 79 | 80 | _scrollableContainer.addChild(block); 81 | block.y = nextY; 82 | nextY += block.height + indent; 83 | } 84 | } 85 | 86 | private function onReceivedIDFA(event:AirDeviceIdEvent):void { 87 | trace("Received IDFA ", event.idfa); 88 | } 89 | 90 | 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /sample/src/com/freshplanet/ui/ScrollableContainer.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.freshplanet.ui { 16 | 17 | import flash.display.Sprite; 18 | import flash.events.Event; 19 | import flash.events.MouseEvent; 20 | import flash.geom.Point; 21 | 22 | public class ScrollableContainer extends Sprite { 23 | 24 | private var _xMovement:Boolean = true; 25 | private var _yMovement:Boolean = true; 26 | 27 | private var _prevTime:Number = 0; 28 | private var _moving:Boolean = false; 29 | private var _velocity:Point = new Point(); 30 | private var _prevGripPoint:Point = new Point(); 31 | private var _force:Point = new Point(); 32 | 33 | public function ScrollableContainer(xMovement:Boolean, yMovement:Boolean) { 34 | 35 | super(); 36 | 37 | _xMovement = xMovement; 38 | _yMovement = yMovement; 39 | 40 | this.addEventListener(Event.ADDED_TO_STAGE, _onAddedToStage); 41 | } 42 | 43 | private function _onAddedToStage(event:Event):void { 44 | 45 | this.removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage); 46 | this.stage.addEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown); 47 | } 48 | 49 | private function _onMouseDown(mouseEvent:MouseEvent):void { 50 | 51 | var gripPoint:Point = new Point(mouseEvent.stageX, mouseEvent.stageY); 52 | 53 | _moving = true; 54 | _velocity.setTo(0, 0); 55 | _prevGripPoint.copyFrom(gripPoint); 56 | 57 | this.stage.removeEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown); 58 | this.stage.addEventListener(MouseEvent.MOUSE_MOVE, _onMouseMove); 59 | this.stage.addEventListener(MouseEvent.MOUSE_UP, _onMouseUp); 60 | 61 | if (this.hasEventListener(Event.ENTER_FRAME)) 62 | this.removeEventListener(Event.ENTER_FRAME, _onEnterFrame); 63 | } 64 | 65 | private function _onMouseMove(mouseEvent:MouseEvent):void { 66 | 67 | var gripPoint:Point = new Point(mouseEvent.stageX, mouseEvent.stageY); 68 | var movement:Point = gripPoint.subtract(_prevGripPoint); 69 | 70 | _force.copyFrom(movement); 71 | 72 | if (_xMovement) 73 | this.x += movement.x; 74 | 75 | if (_yMovement) 76 | this.y += movement.y; 77 | 78 | _prevGripPoint.copyFrom(gripPoint); 79 | } 80 | 81 | private function _onMouseUp(mouseEvent:MouseEvent):void { 82 | 83 | var gripPoint:Point = new Point(mouseEvent.stageX, mouseEvent.stageY); 84 | 85 | if (!gripPoint.equals(_prevGripPoint)) 86 | _onMouseMove(mouseEvent); 87 | 88 | _moving = false; 89 | 90 | _velocity.copyFrom(_force); 91 | // _maxVelocity = _force ? _force / stopDuration : 1; 92 | 93 | _force.setTo(0, 0); 94 | 95 | this.stage.addEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown); 96 | this.stage.removeEventListener(MouseEvent.MOUSE_MOVE, _onMouseMove); 97 | this.stage.removeEventListener(MouseEvent.MOUSE_UP, _onMouseUp); 98 | this.addEventListener(Event.ENTER_FRAME, _onEnterFrame); 99 | } 100 | 101 | private function _onEnterFrame(event:Event):void { 102 | 103 | // grabbing the scroller stops all movement 104 | if (_moving) 105 | return; 106 | 107 | // // tunneling catch 108 | // if ((_maxVelocity > 0 && _velocity < 0) || (_maxVelocity < 0 && _velocity > 0)) 109 | // _velocity = 0; 110 | // 111 | // float friction = _maxVelocity * deltaTime; 112 | // 113 | // // apply friction to velocity, cease at epsilon 114 | // if (fabsf(_velocity) > fabsf(_maxVelocity * _velocityEpsilon)) 115 | // _velocity -= friction; 116 | // else 117 | // _velocity = 0; 118 | 119 | // // calculate gravity 120 | // float snapGravity = 0; 121 | // 122 | // if (fabsf(_velocity) < fabsf(_maxVelocity) * velocityThreshold) { 123 | // 124 | // snapGravity = (attractPoint - _position) * gravityStrength; 125 | // 126 | // // gravity gets stronger as velocity gets weaker 127 | // snapGravity *= velocityThreshold - fabsf(_velocity / _maxVelocity); 128 | // } 129 | 130 | // // update position 131 | // this.x += _velocity.x;// + snapGravity.x; 132 | // this.y += _velocity.y;// + snapGravity.y; 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /sample/src/com/freshplanet/ui/TestBlock.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 FreshPlanet 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.freshplanet.ui { 16 | 17 | import flash.display.Sprite; 18 | import flash.events.Event; 19 | import flash.events.MouseEvent; 20 | import flash.text.TextField; 21 | import flash.text.TextFormat; 22 | import flash.text.TextFormatAlign; 23 | 24 | public class TestBlock extends Sprite { 25 | 26 | static private const NAME_FORMAT:TextFormat = new TextFormat("Courier", 27 | 32, 0xffffff, true, null, null, null, null, TextFormatAlign.CENTER); 28 | 29 | private var _name:String = null; 30 | private var _func:Function = null; 31 | 32 | public function TestBlock(name:String, func:Function) { 33 | 34 | super(); 35 | 36 | _name = name; 37 | _func = func; 38 | 39 | this.addEventListener(Event.ADDED_TO_STAGE, _onAddedToStage); 40 | } 41 | 42 | private function _onAddedToStage(event:Event):void { 43 | 44 | this.removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage); 45 | 46 | this.graphics.beginFill(0x000000); 47 | this.graphics.drawRect(0, 0, Main.stageWidth - (Main.indent * 2), 60); 48 | this.graphics.endFill(); 49 | this.x = (Main.stageWidth - this.width) / 2; 50 | 51 | var nameText:TextField = new TextField(); 52 | nameText.defaultTextFormat = NAME_FORMAT; 53 | nameText.textColor = 0xffffff; 54 | nameText.text = _name; 55 | nameText.width = this.width; 56 | nameText.height = this.height; 57 | this.addChild(nameText); 58 | 59 | this.addEventListener(MouseEvent.CLICK, _onClick); 60 | } 61 | 62 | private function _onClick(mouseEvent:MouseEvent):void { 63 | _func(); 64 | } 65 | } 66 | } 67 | --------------------------------------------------------------------------------