diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 116e8fa..1421d39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: cache gradle dependencies - uses: actions/cache@v3 + uses: actions/cache@v2 with: path: | ~/.gradle/caches diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b92c582..b42b515 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: cache gradle dependencies - uses: actions/cache@v3 + uses: actions/cache@v2 with: path: | ~/.gradle/caches diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 844fe05..6ccd79a 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -13,7 +13,7 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: cache gradle dependencies - uses: actions/cache@v3 + uses: actions/cache@v2 with: path: | ~/.gradle/caches diff --git a/LICENSE b/LICENSE index 73b54b7..9c69454 100644 --- a/LICENSE +++ b/LICENSE @@ -1,324 +1,21 @@ -Twilio Software Development Kit License Agreement 2.0 - -Notice to user: THIS IS A TWILIO SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT 2.0 -BETWEEN YOU AND TWILIO FOR ACCESS TO AND USE OF TWILIO'S SOFTWARE DEVELOPMENT -KIT. BY USING THIS SOFTWARE DEVELOPMENT KIT, YOU ACCEPT ALL THE TERMS AND -CONDITIONS OF THIS TWILIO SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT 2.0. - -As a courtesy, below is a quick summary of how this Twilio Software Development -Kit License Agreement 2.0 applies when you download, use, or otherwise access -this Twilio Software Development Kit. The full version can be found by scrolling -down and is the only one that is legally controlling and binding. - -Summary - -When you download, use, or otherwise access this software development kit: - -* Twilio grants you a limited license to use this software development kit only - for the purposes of developing your own applications and software and - distributing those applications and software in connection with your use of - Twilio's products and services as a Twilio customer. - -* You agree not to use this software development kit to create a competing - product or service to this software development kit. - -* You agree that Twilio may make changes or updates to this software development - kit (including discontinuing support for and/or the availability of this - software development kit) at any time for any reason. - -* You agree that you will not use this software development kit in any way that - interferes with, disrupts, damages or otherwise affects anyone's servers, - networks, or services (including Twilio's). - -* You agree that any feedback you provide to Twilio regarding this software - development kit, including any suggestions for improvements, belong to Twilio - without any compensation to you and that Twilio owns all legal rights to that - feedback. - -* Except for this software development kit, any use of Twilio's products and - services is governed by a separate agreement between you and Twilio. - -Full Version - -1. Introduction - - a. This Twilio Software Development Kit License Agreement 2.0 (this - "Agreement") accompanies the Twilio Software Development Kit for the - software and related explanatory materials (including the Software and - Documentation, the "SDK") and includes any upgrades, modified versions, - updates, additions, and copies of the SDK licensed to you by Twilio. Twilio - and you may be referred to herein collectively as the "parties" or - individually as a "party." - - b. "Documentation" means Twilio's user manuals, handbooks, installation - guides, and any explanatory materials relating to or accompanying the SDK - provided by Twilio to you either electronically or in hard copy form. - - c. "Intellectual Property Rights" means any and all rights under patent law, - copyright law, trade secret law, trademark law, and any and all other - proprietary rights. - - d. "Software" means the object and source code, and/or other original works of - authorship in the SDK provided by Twilio to you, including all associated - example code, other tools and any upgrades, modified versions, updates, - additions, and copies provided to you pursuant to this Agreement. - - e. "Twilio" means Twilio Inc., organized under the laws of the State of - Delaware, USA, and operating under the laws of the USA with its principal - place of business at 101 Spear Street, 5th Floor, San Francisco, CA 94105. - -2. Accepting this Agreement - - a. In order to use the SDK, you must first agree to this Agreement. You may - not use the SDK if you do not accept this Agreement. By using the SDK, you - hereby agree to the terms of this Agreement. You may not use the SDK and - may not accept this Agreement if you are a person barred from receiving the - SDK under the laws of the United States or other countries, including the - country in which you are a resident or from which you use the SDK. If you - are agreeing to be bound by this Agreement on behalf of your employer or - other entity, you represent and warrant that you have full legal authority - to bind your employer or such entity to this Agreement. If you do not have - the requisite authority, you may not accept this Agreement or use the SDK - on behalf of your employer or other entity. You must use the SDK in - conjunction with Twilio's products and services ("Twilio Services"), and - your use of the Twilio Services will solely be governed by the Twilio Terms - of Service available at https://www.twilio.com/legal/tos or a separate - written agreement entered into between you and Twilio (each, a "Services - Agreement"). This Agreement will, in no way, modify or affect the terms of - the applicable Services Agreement. - -3. SDK License from Twilio - - a. Subject to the terms and conditions of this Agreement, Twilio grants you a - non-exclusive, non-sublicensable, non-assignable, non-transferable, - worldwide, royalty-free, access to and license to use the SDK solely (i) to - copy, display, perform, modify, and create derivative works from the SDK - only for the purpose of internal development of your software products - (each, an "Application") solely for an Application's use in conjunction - with the Twilio Services; and (ii) distribute the Software as part of an - Application, provided that you have a Services Agreement with Twilio for - the use of such Twilio Services. The license granted in Section 3(a)(ii) - will survive the termination of this Agreement, except to the extent you - are in material breach of any of the obligations hereunder. - - b. You are responsible and liable for all use of the SDK, directly or - indirectly, whether such access or use is permitted by or in violation of - this Agreement. Twilio has no liability to you or any third party arising - or resulting from your use of the SDK. - - c. Use, reproduction, and distribution of software dependencies and components - of the SDK licensed under an open source software license are governed - solely by the terms of that open source software license and not this - Agreement. You understand and acknowledge that such open source software is - not licensed to you pursuant to the provisions of this Agreement and that - this Agreement may not be construed to grant any such right and/or - license. If you do not agree to abide by the applicable terms for such - components of the SDK licensed under an open source software license, then - you should not use the SDK. - - d. You will not remove, obscure, or alter any proprietary rights notices - (including copyright and trademark notices) that may be affixed to or - contained within the SDK. - -4. Use of the SDK by You - - a. You may not use the SDK to develop a competing product or service to the - SDK or for any purposes not expressly permitted by this Agreement - including, but not limited to, using the SDK in any manner or for any - purpose that infringes, misappropriates, or otherwise violates any - Intellectual Property Right or other right of any person, or that violates - any applicable law or regulation (including any laws regarding the export - of data or software to and from the United States or other relevant - countries). - - b. You acknowledge and agree that Twilio has no obligation to provide - updates, upgrades, or any other modifications to the SDK. In addition, you - acknowledge and agree that Twilio has no obligation to support or maintain - the SDK. - - c. You agree that the form and nature of the SDK that Twilio provides may - change without prior notice to you and that future versions of the SDK may - be incompatible with Applications developed on previous versions of the - SDK. You agree that Twilio may stop (permanently or temporarily) providing - the SDK (or any features within the SDK) to you or to users generally at - Twilio's sole discretion, without prior notice to you. - - d. You agree that you will not engage in any activity with the SDK, - including the development or distribution of an Application, that - interferes with, disrupts, damages, or accesses in an unauthorized manner - the servers, networks, or other properties or services of any third party - including, but not limited to, Twilio or any telecommunications provider. - - e. Nothing in this Agreement gives you a right to use any of Twilio's trade - names, trademarks, service marks, logos, domain names, or other - distinctive brand features. - - f. You agree that you are solely responsible for (and that Twilio has no - responsibility to you or to any third party for) any breach of your - obligations under this Agreement, any applicable third party contract, or - any applicable law or regulation, and for the consequences (including any - loss or damage which Twilio or any third party may suffer) of any such - breach. - -5. Intellectual Property Ownership and Feedback - - a. You agree that Twilio or third parties own all legal right, title, and - interest in and to the SDK, including any Intellectual Property Rights - that subsist in the SDK. Twilio reserves all rights not expressly granted - to you in this Agreement. Except for the limited rights and licenses - expressly granted under this Agreement, nothing in this Agreement grants, - by implication, waiver, estoppel, or otherwise, to your or any third - party any Intellectual Property Rights or other right, title, or interest - in or to the SDK. - - b. Twilio agrees that it obtains no right, title or interest from you (or - your licensors) under this Agreement in or to any Applications that you - develop using the SDK, including any Intellectual Property Rights that - subsist in those Applications. - - c. If you or any of your employees or contractors send or transmit any - communications, materials, code, documentation, or other original works of - authorship (including any modifications) to Twilio by any form of - electronic or written communication, including but not limited to mail, - email, telephone, source code control systems, issue tracking systems, or - otherwise, suggesting or recommending changes to the SDK, including - without limitation, new features or functionality relating thereto, or any - comments, questions, suggestions, or the like ("Feedback"), Twilio is free - to use such Feedback irrespective of any other obligation or limitation - between the parties governing such Feedback. You hereby assign to Twilio - on your behalf, and on behalf of your employees, contractors and/or - agents, all right, title, and interest in, and Twilio is free to use, - Feedback without any attribution or compensation to any party, any ideas, - know-how, concepts, techniques, or other Intellectual Property Rights - contained in the Feedback, for any purpose whatsoever. Twilio is not - required to use any Feedback. For clarity, Feedback will not include any - code, documentation, or works of authorship, including the Intellectual - Property Rights embedded therein, which are (a) unrelated to the core - functionality of the Software or (b) conceived and/or developed by you (i) - prior to the date this Agreement is accepted by you, (ii) outside the - scope of this Agreement, or (iii) independently without the use of the - SDK. - -6. Terminating this Agreement - - a. This Agreement, as may be updated from time to time, will commence on the - date it is accepted by you and continue until terminated as set out below. - - b. If you want to terminate this Agreement, you may do so by ceasing your - use of the SDK. - - c. Without prejudice to any other rights, this Agreement shall terminate - automatically without notice from Twilio if: - i. your Services Agreement for use of the Twilio Services terminates; or - ii. you have breached any provision of this Agreement; or - iii. Twilio is required to do so by law or regulation; or - iv. Twilio decides to no longer provide the SDK or certain parts of the - SDK to users in the country in which you are resident or from which - you use the service, or the provision of the SDK or certain SDK - services to you by Twilio is, in Twilio's sole discretion, no longer - commercially viable. - - d. When this Agreement terminates, all of the legal rights, obligations, and - liabilities that you and Twilio have benefited from, been subject to (or - which have accrued over time whilst this Agreement has been in force) or - which are expressed to continue indefinitely, will be unaffected by this - cessation. - -7. DISCLAIMER OF WARRANTIES - - a. YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR - SOLE RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT - WARRANTY OF ANY KIND FROM TWILIO. - - b. YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED - THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE - SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE - OR LOSS OF DATA THAT RESULTS FROM SUCH USE. - - c. TWILIO FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY - KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE - IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A - PARTICULAR PURPOSE AND NON-INFRINGEMENT. - -8. LIMITATION OF LIABILITY - - a. YOU EXPRESSLY UNDERSTAND AND AGREE THAT TWILIO, ITS SUBSIDIARIES AND - AFFILIATES, AND ITS LICENSORS WILL NOT BE LIABLE TO YOU UNDER ANY THEORY - OF LIABILITY FOR ANY DAMAGES WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR EXEMPLARY - DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS OF DATA, WHETHER - OR NOT TWILIO OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE - BEEN AWARE OF THE POSSIBILITY OF ANY SUCH DAMAGES OR LOSSES ARISING. - -9. Indemnification - - a. To the maximum extent permitted by law, you agree to defend, indemnify - and hold harmless Twilio, its affiliates and their respective directors, - officers, employees, and agents from and against any and all claims, - actions, demands, suits, or proceedings, as well as any and all losses, - liabilities, damages, costs and expenses (including reasonable attorneys' - fees) arising out of or accruing from (a) your use of the SDK or any - resulting Application you develop on the SDK; (b) any Application you - develop using the SDK that infringes any copyright, trademark, trade - secret, trade dress, patent, or other intellectual property right of any - person or defames any person or violates their rights of publicity or - privacy; and (c) your non-compliance with the terms of this Agreement. - -10. Changes to this Agreement - - a. Twilio may make changes to this Agreement as it distributes new versions - of the SDK. When these changes are made, Twilio will make a new version - of this Agreement available on the website where the SDK is made - available. - -11. Additional Terms - - a. Except as provided in this Agreement, this Agreement supersedes all prior - and contemporaneous agreements, oral and written, in relation to the SDK. - No oral or written information or advice given by Twilio, its agents or - employees will create a warranty or in any way increase the scope of the - warranties or obligations under this Agreement. Except as permitted in - Section 10 of this Agreement, no modification to this Agreement will be - legally binding unless set forth in writing and signed by you and Twilio. - - b. You agree that Twilio's failure to enforce at any time any provision of - this Agreement or any other of your obligations does not waive Twilio's - right to do so later. And, if Twilio does expressly waive any provision - of this Agreement or any of your other obligations, that does not mean it - is waived for all time in the future. Any waiver must be in writing and - signed by you and Twilio to be legally binding. - - c. If any court of law, having the jurisdiction to decide on this matter, - rules that any provision of this Agreement is invalid, then that - provision will be removed from this Agreement without affecting the rest - of this Agreement. The remaining provisions of this Agreement will - continue to be valid and enforceable. - - d. You acknowledge and agree that each member of the group of companies of - which Twilio is the parent will be third party beneficiaries to this - Agreement and that such other companies will be entitled to directly - enforce, and rely upon, any provision of this Agreement that confers a - benefit on (or rights in favor of) them. Other than this, no other - person or company will be third party beneficiaries to this Agreement. - - e. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU - MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND - REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON - DESTINATIONS, END USERS, AND END USE. - - f. You will not assign or otherwise transfer this Agreement, in whole or in - part, without Twilio's prior written consent. Any attempt by you to - assign, delegate, or transfer this Agreement will be void. Twilio may - assign this Agreement, in whole or in part, without consent. Subject to - this Section 13(f), this Agreement will be binding on both you and - Twilio and both parties' successors and assigns. - - g. This Agreement will be governed by and interpreted according to the laws - of the State of California without regard to conflicts of laws and - principles that would cause laws of another jurisdiction to apply. This - Agreement will not be governed by the United Nations Convention on - Contracts for the International Sale of Goods. Any legal suit, action or - proceeding arising out of or related to this Agreement or the SDK will be - instituted in either the state or federal courts of San Francisco, - California, and the parties each consent to the personal jurisdiction of - these courts. +MIT License + +Copyright (c) 2022 Segment + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/destination-filters-kotlin/build.gradle b/destination-filters-kotlin/build.gradle index 8d83e68..3292069 100644 --- a/destination-filters-kotlin/build.gradle +++ b/destination-filters-kotlin/build.gradle @@ -27,21 +27,17 @@ android { kotlinOptions { jvmTarget = '1.8' } - namespace 'com.segment.analytics.plugins' } dependencies { - implementation 'com.segment.analytics.kotlin:analytics-kotlin-live:1.2.0' - implementation 'com.segment.analytics.kotlin:substrata:1.1.1' - implementation 'com.segment.analytics.kotlin:android:1.20.0' + implementation 'com.segment.analytics.kotlin:analytics-kotlin-live:1.0.0' + implementation 'com.segment.analytics.kotlin:substrata:1.0.0' + implementation 'com.segment.analytics.kotlin:android:1.16.0' implementation 'androidx.core:core-ktx:1.7.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } -apply from: rootProject.file('gradle/mvn-publish.gradle') - -tasks.named("signReleasePublication") { - dependsOn("bundleReleaseAar") -} \ No newline at end of file +apply from: rootProject.file('gradle/artifacts.gradle') +apply from: rootProject.file('gradle/mvn-publish.gradle') \ No newline at end of file diff --git a/destination-filters-kotlin/src/main/java/com/segment/analytics/plugins/DestinationFilters.kt b/destination-filters-kotlin/src/main/java/com/segment/analytics/plugins/DestinationFilters.kt index b94eb4c..96256ef 100644 --- a/destination-filters-kotlin/src/main/java/com/segment/analytics/plugins/DestinationFilters.kt +++ b/destination-filters-kotlin/src/main/java/com/segment/analytics/plugins/DestinationFilters.kt @@ -1,145 +1,90 @@ package com.segment.analytics.plugins import com.segment.analytics.kotlin.core.Analytics -import com.segment.analytics.kotlin.core.BaseEvent import com.segment.analytics.kotlin.core.Settings -import com.segment.analytics.kotlin.core.platform.DestinationPlugin import com.segment.analytics.kotlin.core.platform.Plugin -import com.segment.analytics.kotlin.core.utilities.EncodeDefaultsJson import com.segment.analytics.kotlin.core.utilities.safeJsonArray -import com.segment.analytics.kotlin.core.utilities.toBaseEvent -import com.segment.analytics.substrata.kotlin.JSObject +import com.segment.analytics.liveplugins.kotlin.LivePlugins import com.segment.analytics.substrata.kotlin.JSScope import com.segment.analytics.substrata.kotlin.JsonElementConverter -import kotlinx.serialization.json.JsonElement -import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.contentOrNull -import kotlinx.serialization.json.encodeToJsonElement import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive -import java.lang.ref.WeakReference class DestinationFilters : Plugin { companion object { - public const val version = "1.2.1" + public const val version = "1.0.0" } private val tsubScript = """ var dest_filters=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=5)}([function(e,r,t){e.exports=function(e,r,t,n,o){for(r=r.split?r.split("."):r,n=0;n1?(s.pop(),c=o(t,s.join("."))):c=e,"object"==typeof c){if(i.copy){var f=o(t,i.copy);void 0!==f&&u(e,n,f)}else if(i.move){var l=o(t,i.move);void 0!==l&&u(e,n,l),a.unset(e,i.move)}else i.hasOwnProperty("set")&&u(e,n,i.set);if(i.to_string){var p=o(e,n);if("string"==typeof p||"object"==typeof p&&null!==p)continue;u(e,n,void 0!==p?JSON.stringify(p):"undefined")}}}}function l(e,r){return!(r.sample.percent<=0)&&(r.sample.percent>=1||(r.sample.path?function(e,r){var t=o(e,r.sample.path),u=n(JSON.stringify(t)),a=-64,s=[];p(u.slice(0,8),s);for(var c=0,f=0;f<64&&1!==s[f];f++)c++;if(0!==c){var l=[];p(u.slice(9,16),l),a-=c,s.splice(0,c),l.splice(64-c),s=s.concat(l)}return s[63]=0===s[63]?1:0,i(parseInt(s.join(""),2),a)=1;o/=2)n-o>=0?(n-=o,r.push(1)):r.push(0)}r.default=function(e,r){for(var t=e,n=0,o=r;n>2]|=s.charCodeAt(c)<<8*c--;for(o=s=0;o>4]+n[s]+~~a[o|15&[s,5*s+1,3*s+5,7*s][c]])<<(c=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*c+s++%4])|i>>>-c),r,t])r=0|c[1],t=c[2];for(s=4;s;)u[--s]+=c[s]}for(e="";s<32;)e+=(u[s>>3]>>4*(1^s++)&15).toString(16);return e}},function(e,r,t){"use strict";var n=t(10),o=t(11),i=t(12),u=t(17),a=t(20),s=t(3),c=t(4);e.exports=function(e,r){var t,f,l,p;return 0===e||e!=e||e===n||e===o?e:(e=(f=i(e))[0],r+=f[1],(r+=u(e))<-1074?a(0,e):r>1023?e<0?o:n:(r<=-1023?(r+=52,p=2220446049250313e-31):p=1,t=(l=s(e))[0],t&=2148532223,p*c(t|=r+1023<<20,l[1])))}},function(e,r,t){"use strict";e.exports=Number.POSITIVE_INFINITY},function(e,r,t){"use strict";e.exports=Number.NEGATIVE_INFINITY},function(e,r,t){"use strict";var n=t(13).VALUE,o=t(15),i=t(16);e.exports=function(e){return e!=e||o(e)?[e,0]:0!==e&&i(e)>>20)-1023}},function(e,r,t){"use strict";var n;n=!0===t(1)?1:0,e.exports=n},function(e,r,t){"use strict";var n={uint16:Uint16Array,uint8:Uint8Array};e.exports=n},function(e,r,t){"use strict";var n=t(3),o=t(2),i=t(4);e.exports=function(e,r){var t,u;return t=(e=n(e))[0],t&=2147483647,u=o(r),i(t|=u&=2147483648,e[1])}},function(e,r,t){"use strict";var n,o;t(1)?(n=1,o=0):(n=0,o=1),e.exports={HIGH:n,LOW:o}},function(e,r,t){"use strict";var n,o;!0===t(1)?(n=1,o=0):(n=0,o=1),e.exports={HIGH:n,LOW:o}},function(e,r){e.exports=function(e,r,t){r.split&&(r=r.split("."));for(var n,o,i=0,u=r.length,a=e;i":case">=":return function(e,r,t,n){u(e)&&(e=o(e,n));u(r)&&(r=o(r,n));if("number"!=typeof e||"number"!=typeof r)return!1;switch(t){case"<=":return e<=r;case">=":return e>=r;case"<":return e":return e>r;default:throw new Error("Invalid operator in compareNumbers: "+t)}}(i(e[1],r),i(e[2],r),t,r);case"contains":return function(e,r){if("string"!=typeof e||"string"!=typeof r)return!1;return-1!==e.indexOf(r)}(i(e[1],r),i(e[2],r));case"match":return function(e,r){if("string"!=typeof e||"string"!=typeof r)return!1;return function(e,r){var t,n;e:for(;e.length>0;){var o,i;if(t=a(e),o=t.star,i=t.chunk,e=t.pattern,o&&""===i)return!0;var u=s(i,r),c=u.t,f=u.ok,l=u.err;if(l)return!1;if(!f||!(0===c.length||e.length>0)){if(o)for(var p=0;p0)continue;r=c;continue e}if(l)return!1}return!1}r=c}return 0===r.length}(r,e)}(i(e[1],r),i(e[2],r));case"lowercase":var c=i(e[1],r);return"string"!=typeof c?null:c.toLowerCase();case"typeof":return typeof i(e[1],r);case"length":return function(e){if(null===e)return 0;if(!Array.isArray(e)&&"string"!=typeof e)return NaN;return e.length}(i(e[1],r));default:throw new Error("FQL IR could not evaluate for token: "+t)}}function i(e,r){return Array.isArray(e)?e:"object"==typeof e?e.value:n(r,e)}function u(e){return!!Array.isArray(e)&&(("lowercase"===e[0]||"length"===e[0]||"typeof"===e[0])&&2===e.length||("contains"===e[0]||"match"===e[0])&&3===e.length)}function a(e){for(var r={star:!1,chunk:"",pattern:""};e.length>0&&"*"===e[0];)e=e.slice(1),r.star=!0;var t,n=!1;e:for(t=0;t0;){if(0===r.length)return o;switch(e[0]){case"[":var i=r[0];r=r.slice(1);var u=!0;(e=e.slice(1)).length>0&&"^"===e[0]&&(u=!1,e=e.slice(1));for(var a=!1,s=0;;){if(e.length>0&&"]"===e[0]&&s>0){e=e.slice(1);break}var f,l="";if(f=(t=c(e)).char,e=t.newChunk,t.err)return o;if(l=f,"-"===e[0]&&(l=(n=c(e.slice(1))).char,e=n.newChunk,n.err))return o;f<=i&&i<=l&&(a=!0),s++}if(a!==u)return o;break;case"?":r=r.slice(1),e=e.slice(1);break;case"\\":if(0===(e=e.slice(1)).length)return o.err=!0,o;default:if(e[0]!==r[0])return o;r=r.slice(1),e=e.slice(1)}}return o.t=r,o.ok=!0,o.err=!1,o}function c(e){var r={char:"",newChunk:"",err:!1};return 0===e.length||"-"===e[0]||"]"===e[0]||"\\"===e[0]&&0===(e=e.slice(1)).length?(r.err=!0,r):(r.char=e[0],r.newChunk=e.slice(1),0===r.newChunk.length&&(r.err=!0),r)}r.default=function(e,r){if(!r)throw new Error("No matcher supplied!");switch(r.type){case"all":return!0;case"fql":return function(e,r){if(!e)return!1;try{e=JSON.parse(e)}catch(r){throw new Error('Failed to JSON.parse FQL intermediate representation "'+e+'": '+r)}var t=o(e,r);if("boolean"!=typeof t)return!1;return t}(r.ir,e);default:throw new Error("Matcher of type "+r.type+" unsupported.")}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e){this.rules=[],this.rules=e||[]}return e.prototype.getRulesByDestinationName=function(e){for(var r=[],t=0,n=this.rules;t + if (type != Plugin.UpdateType.Initial) return + val setOfActiveDestinations = mutableSetOf() + settings.middlewareSettings["routingRules"]?.safeJsonArray?.let { rules -> for (it in rules) { val rule = it.jsonObject val destination: String = rule["destinationName"]?.jsonPrimitive?.contentOrNull ?: "" if (destination.isNotBlank()) { - val added = createFilter(destination, rule) - if (added) { - metricsPlugin.setOfActiveDestinations.add(destination) + val added = engine.await { + return@await call( + "createDestinationFilter", + destination, + JsonElementConverter.write(rule, context) + ) + } + if (added == true) { + setOfActiveDestinations.add(destination) } - } - } - } - } - - private fun removeExistingFilters() { - for (dest in analytics.findAll(DestinationPlugin::class)) { - for (filter in dest.findAll(DestinationFilter::class)) { - dest.remove(filter) - } - } - } - - private fun createFilter(destination: String, rule: JsonObject): Boolean { - analytics.find(destination)?.let { dest -> - val filter = DestinationFilter(WeakReference(engine), rule) - dest.add(filter) - return true - } - return false - } -} - -internal class DestinationFilter( - val engineRef: WeakReference, - val rule: JsonObject -): Plugin { - override lateinit var analytics: Analytics - override val type: Plugin.Type = Plugin.Type.Enrichment - - override fun execute(event: BaseEvent): BaseEvent? { - var result: BaseEvent? = event - - engineRef.get()?.let { engine -> - val payload = EncodeDefaultsJson.encodeToJsonElement(event) - result = engine.await { - val modified = call( - "evaluateRules", - JsonElementConverter.write(rule, context), - JsonElementConverter.write(payload, context) - ) - - return@await if (modified is JSObject) { - JsonElementConverter.read(modified).jsonObject.toBaseEvent() - } else { - null } } } - return result + analytics.add(MetricsPlugin(setOfActiveDestinations)) } } \ No newline at end of file diff --git a/destination-filters-kotlin/src/main/java/com/segment/analytics/plugins/MetricsPlugin.kt b/destination-filters-kotlin/src/main/java/com/segment/analytics/plugins/MetricsPlugin.kt index 4b5577e..e434898 100644 --- a/destination-filters-kotlin/src/main/java/com/segment/analytics/plugins/MetricsPlugin.kt +++ b/destination-filters-kotlin/src/main/java/com/segment/analytics/plugins/MetricsPlugin.kt @@ -4,30 +4,33 @@ import com.segment.analytics.kotlin.core.Analytics import com.segment.analytics.kotlin.core.BaseEvent import com.segment.analytics.kotlin.core.platform.Plugin import com.segment.analytics.kotlin.core.utilities.putInContextUnderKey +import kotlinx.serialization.json.JsonArray import kotlinx.serialization.json.add +import kotlinx.serialization.json.buildJsonArray import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.put -import kotlinx.serialization.json.putJsonArray -import java.util.concurrent.CopyOnWriteArraySet -class MetricsPlugin: Plugin { +class MetricsPlugin(setOfActiveDestinations: Set): Plugin { - val setOfActiveDestinations = CopyOnWriteArraySet() + private val activeDestinations: JsonArray + + init { + activeDestinations = buildJsonArray { + for (dest in setOfActiveDestinations) { + add(dest) + } + } + } override val type: Plugin.Type = Plugin.Type.Enrichment override lateinit var analytics: Analytics - override fun execute(event: BaseEvent): BaseEvent? { event.putInContextUnderKey( "plugins", "destination-filters", buildJsonObject { put("version", DestinationFilters.version) - putJsonArray("active") { - for (dest in setOfActiveDestinations) { - add(dest) - } - } + put("active", activeDestinations) } ) return super.execute(event) diff --git a/gradle.properties b/gradle.properties index ceb9c29..0acb55d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,8 +24,8 @@ android.nonTransitiveRClass=true GROUP=com.segment.analytics.kotlin -VERSION_CODE=121 -VERSION_NAME=1.2.1 +VERSION_CODE=101 +VERSION_NAME=1.0.1 POM_NAME=DestinationFilters-Kotlin POM_DESCRIPTION=Enrich and modify events via OTA updates @@ -38,9 +38,9 @@ POM_SCM_URL=http://github.com/segmentio/DestinationFilters-kotlin POM_SCM_CONNECTION=scm:git:git://github.com/segmentio/DestinationFilters-kotlin.git POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/segmentio/DestinationFilters-kotlin.git -POM_LICENCE_NAME=Twilio Software Development Kit License Agreement 2.0 -POM_LICENCE_URL=https://github.com/segment-integrations/DestinationFilters-Kotlin/blob/main/LICENSE +POM_LICENCE_NAME=The MIT License (MIT) +POM_LICENCE_URL=http://opensource.org/licenses/MIT POM_LICENCE_DIST=repo POM_DEVELOPER_ID=segmentio -POM_DEVELOPER_NAME=Segment, Inc. +POM_DEVELOPER_NAME=Segment, Inc. \ No newline at end of file diff --git a/gradle/artifacts.gradle b/gradle/artifacts.gradle new file mode 100644 index 0000000..bbe66a2 --- /dev/null +++ b/gradle/artifacts.gradle @@ -0,0 +1,4 @@ +task sourcesJar(type: Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs +} \ No newline at end of file diff --git a/gradle/mvn-publish.gradle b/gradle/mvn-publish.gradle index 83d4beb..c7a0c2a 100644 --- a/gradle/mvn-publish.gradle +++ b/gradle/mvn-publish.gradle @@ -12,6 +12,7 @@ publishing { version getVersionName() artifact("$projectDir/build/outputs/aar/${project.getName()}-release.aar") + artifact sourcesJar // Self-explanatory metadata for the most part pom { diff --git a/gradle/publish.gradle b/gradle/publish.gradle index f386103..b780e63 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -19,6 +19,7 @@ publishing { version VERSION_NAME artifact("$projectDir/build/outputs/aar/${project.getName()}-release.aar") + artifact sourcesJar // Self-explanatory metadata for the most part pom { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9..e708b1c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cea7a79..2c6e82a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,6 @@ +#Wed Aug 17 10:50:02 PDT 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f3b75f3..4f906e0 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env sh # -# Copyright © 2015-2021 the original authors. +# Copyright 2015 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,103 +15,69 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# SPDX-License-Identifier: Apache-2.0 -# ############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# +## +## Gradle start up script for UN*X +## ############################################################################## # Attempt to set APP_HOME - # Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum +MAX_FD="maximum" warn () { echo "$*" -} >&2 +} die () { echo echo "$*" echo exit 1 -} >&2 +} # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -121,9 +87,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java + JAVACMD="$JAVA_HOME/jre/sh/java" else - JAVACMD=$JAVA_HOME/bin/java + JAVACMD="$JAVA_HOME/bin/java" fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -132,120 +98,88 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi fi # Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi fi -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi # For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg + i=`expr $i + 1` done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac fi +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 9d21a21..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,10 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem -@if "%DEBUG%"=="" @echo off +@if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -27,8 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused +if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -43,13 +40,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute +if "%ERRORLEVEL%" == "0" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. goto fail @@ -59,11 +56,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. goto fail @@ -78,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd +if "%ERRORLEVEL%"=="0" goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/sample/build.gradle b/sample/build.gradle index 21ab9f7..5c878f6 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -35,8 +35,7 @@ android { dependencies { implementation project(":destination-filters-kotlin") implementation 'com.segment.analytics.kotlin:substrata:1.0.0' - implementation 'com.segment.analytics.kotlin:analytics-kotlin-live:1.0.1' - implementation 'com.segment.analytics.kotlin:android:1.16.3' + implementation 'com.segment.analytics.kotlin:android:1.16.0' implementation 'com.segment.analytics.kotlin.destinations:appsflyer:1.5.1' diff --git a/sample/src/main/java/com/segment/analytics/destination/filters/app/MainApplication.kt b/sample/src/main/java/com/segment/analytics/destination/filters/app/MainApplication.kt index f2ce0e6..f8beca5 100644 --- a/sample/src/main/java/com/segment/analytics/destination/filters/app/MainApplication.kt +++ b/sample/src/main/java/com/segment/analytics/destination/filters/app/MainApplication.kt @@ -4,15 +4,8 @@ import android.app.Application import com.segment.analytics.destination.filters.app.filters.WebhookPlugin import com.segment.analytics.kotlin.android.Analytics import com.segment.analytics.kotlin.core.Analytics -import com.segment.analytics.kotlin.core.platform.Plugin -import com.segment.analytics.kotlin.core.utilities.updateJsonObject import com.segment.analytics.kotlin.destinations.appsflyer.AppsFlyerDestination import com.segment.analytics.plugins.DestinationFilters -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonArray -import kotlinx.serialization.json.JsonObject import java.util.concurrent.Executors class MainApplication : Application() { @@ -24,7 +17,7 @@ class MainApplication : Application() { super.onCreate() analytics = Analytics( - "tteOFND0bb5ugJfALOJWpF0wu1tcxYgr", + "93EMLzmXzP6EJ3cJOhdaAgEVNnZjwRqA", applicationContext ) { this.collectDeviceId = true @@ -34,51 +27,10 @@ class MainApplication : Application() { this.flushInterval = 0 } -// analytics.add(WebhookPlugin("https://webhook.site/c6349c6a-bc14-49be-9677-0c8df3e07b58", Executors.newSingleThreadExecutor())) + analytics.add(WebhookPlugin("https://webhook.site/c6349c6a-bc14-49be-9677-0c8df3e07b58", Executors.newSingleThreadExecutor())) analytics.add(AppsFlyerDestination(applicationContext, false)) - val df = DestinationFilters() - analytics.add(df) - - analytics.analyticsScope.launch { - delay(5000L) - analytics.settingsAsync()?.let { settings -> - settings.middlewareSettings = updateJsonObject(settings.middlewareSettings) { - it["routingRules"] = Json.decodeFromString(""" - [{ - "matchers": [ - { - "ir": "", - "type": "all" - } - ], - "scope": "destinations", - "target_type": "workspace::project::destination::config", - "transformers": [ - [ - { - "type": "drop_properties", - "config": { - "drop": { - "context.device": [ - "id", - "advertisingId", - "model", - "manufacturer" - ] - } - } - } - ] - ], - "destinationName": "Segment.io" - }] - """.trimIndent()) - } - df.update(settings, Plugin.UpdateType.Initial) - } - } - + analytics.add(DestinationFilters()) } } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 6f40ca0..e0bc3b9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,6 +8,7 @@ pluginManagement { dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { + mavenLocal() google() mavenCentral() }