├── LICENSE ├── README.md ├── android └── openIM │ ├── build.gradle │ ├── consumer-rules.pro │ ├── libs │ └── README.md │ ├── proguard-rules.pro │ └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── openim │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── example │ │ └── openim │ │ ├── BaseImpl.java │ │ └── OpenIMSDK.java │ └── test │ └── java │ └── com │ └── example │ └── openim │ └── ExampleUnitTest.java └── ios └── OpenIMUniPlugin ├── Framework └── README.md ├── OpenIMUniPlugin.podspec └── OpenIMUniPlugin ├── Assets └── .gitkeep └── Classes ├── .gitkeep ├── CallbackProxy.h ├── CallbackProxy.m ├── OpenIMModule.h ├── OpenIMModule.m ├── SendMessageCallbackProxy.h ├── SendMessageCallbackProxy.m ├── UploadFileCallbackProxy.h ├── UploadFileCallbackProxy.m ├── UploadLogsCallbackProxy.h └── UploadLogsCallbackProxy.m /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Uniapp Client SDK for OpenIM 👨‍💻💬 2 | 3 | 使用此 SDK 为您的应用程序添加即时消息功能。通过连接到自己的的 [OpenIM](https://www.openim.io/) 服务器,您只需几行代码即可快速将即时消息功能集成到您的应用程序中。 4 | 5 | Android SDK 底层核心在 [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) 中实现。使用 [gomobile](https://github.com/golang/mobile)后,它可以被编译成一个 AAR 文件为 Android 集成。Android 通过 JSON 与 [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) 交互,并且 SDK 公开了一个重新封装的 API,以便于使用。在数据存储方面,Android 利用了 [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) 内部提供的 SQLite。 6 | 7 | iOS SDK 底层核心在 [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) 中实现。使用 [gomobile](https://github.com/golang/mobile) 后,它可以被编译成一个 XCFramework 用于 iOS 集成。iOS 通过 JSON 与 [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) 交互,并且 SDK 公开了一个重新封装的 API,以便于使用。在数据存储方面,iOS 利用了 [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) 内部提供的 SQLite。 8 | 9 | Uni-app 在 App 侧的原生扩展插件,支持使用 java、object-c 等原生语言编写。使用云插件或本地插件引入 SDK 将即时消息功能集成到您的应用程序中。 10 | 11 | ## 文档 📚 12 | 13 | 请访问 [https://docs.openim.io/](https://docs.openim.io/) 获取详细的文档和指南。 14 | 15 | SDK参考请访问 [https://docs.openim.io/sdks/quickstart/browser](https://docs.openim.io/sdks/quickstart/browser)。 16 | 17 | ## 使用 💻 18 | 19 | - 使用此项目需要对Uniapp原生插件开发有一定的了解,如果您不了解,请查看[Uniapp原生语言插件开发文档](https://nativesupport.dcloud.net.cn/NativePlugin),并下载Android/iOS离线SDK,参考文档将当前仓库下的插件导入到您的离线SDK项目中。 20 | - 需要先拉取[OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core),并按照文档编译生成Android/iOS所需要的aar/Framework,分别引入andorid插件的libs目录下和ios插件的Framework目录下。 21 | 22 | ## 示例 🌟 23 | 24 | 您可以在 [open-im-uniapp-demo](https://github.com/openimsdk/open-im-uniapp-demo) 中找到使用 SDK 的应用程序, 或者[插件市场](https://ext.dcloud.net.cn/plugin?id=6577)获取并使用已经编译好的SDK。 25 | 26 | ## 社区参与 :busts_in_silhouette: 27 | 28 | - 📚 [OpenIM 社区](https://github.com/OpenIMSDK/community) 29 | - 💕 [OpenIM 兴趣小组](https://github.com/Openim-sigs) 30 | - 🚀 [加入我们的Slack社区](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A) 31 | - :eyes: [加入我们的微信社区](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg) 32 | 33 | ## 社区会议 :calendar: 34 | 35 | 我们希望任何人都能参与到我们的社区并贡献代码,我们提供礼物和奖励,我们欢迎您每周四晚上加入我们。 36 | 37 | 我们的会议在 [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A) 🎯, 然后你可以搜索 Open-IM-Server 频道加入。 38 | 39 | 我们把每一次 [双周会](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) 记录在 [GitHub discussions](https://github.com/openimsdk/open-im-server/discussions/categories/meeting), 我们的历史会议记录以及会议回放可以在 [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing)。 40 | 41 | ## 谁在使用OpenIM :eyes: 42 | 43 | 查看我们的 [用户案例](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md)。 不要犹豫,留下 [评论](https://github.com/openimsdk/open-im-server/issues/379) 并分享您的用例。 44 | 45 | ## 授权许可 :page_facing_up: 46 | 47 | This software is licensed under a dual-license model: 48 | 49 | - The GNU Affero General Public License (AGPL), Version 3 or later; **OR** 50 | - Commercial license terms from OpenIMSDK. 51 | 52 | If you wish to use this software under commercial terms, please contact us at: contact@openim.io 53 | 54 | For more information, see: https://www.openim.io/en/licensing 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /android/openIM/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | } 4 | 5 | android { 6 | compileSdk rootProject.ext.androidConfig.compileSdk 7 | 8 | 9 | defaultConfig { 10 | minSdk rootProject.ext.androidConfig.minSdk 11 | targetSdk rootProject.ext.androidConfig.targetSdk 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | consumerProguardFiles "consumer-rules.pro" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | dependencies { 32 | compileOnly fileTree(dir: 'libs', include: ['*.jar', '*.aar']) 33 | 34 | api 'com.google.code.gson:gson:2.9.0' 35 | 36 | compileOnly 'androidx.recyclerview:recyclerview:1.0.0' 37 | compileOnly 'androidx.legacy:legacy-support-v4:1.0.0' 38 | compileOnly 'androidx.appcompat:appcompat:1.0.0' 39 | implementation 'com.alibaba:fastjson:1.1.46.android' 40 | implementation 'com.facebook.fresco:fresco:1.13.0' 41 | } -------------------------------------------------------------------------------- /android/openIM/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openimsdk/open-im-sdk-uniapp/d7a6a205bcf3da30081ab06cdea5328c18cff00a/android/openIM/consumer-rules.pro -------------------------------------------------------------------------------- /android/openIM/libs/README.md: -------------------------------------------------------------------------------- 1 | > 需要先拉取[OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core),并按照文档编译生成Android/iOS所需要的aar/Framework,分别引入andorid插件的libs目录下和ios插件的Framework目录下。 -------------------------------------------------------------------------------- /android/openIM/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /android/openIM/src/androidTest/java/com/example/openim/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.openim; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.example.openim.test", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /android/openIM/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /android/openIM/src/main/java/com/example/openim/BaseImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.openim; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import io.dcloud.feature.uniapp.bridge.UniJSCallback; 5 | import open_im_sdk_callback.Base; 6 | 7 | 8 | public class BaseImpl implements Base { 9 | UniJSCallback callback; 10 | 11 | public BaseImpl(UniJSCallback callback) { 12 | this.callback = callback; 13 | } 14 | 15 | 16 | @Override 17 | public void onError(int i, String s) { 18 | JSONObject data = new JSONObject(); 19 | data.put("data",""); 20 | data.put("errMsg", s); 21 | data.put("errCode",i); 22 | callback.invoke(data); 23 | } 24 | 25 | @Override 26 | public void onSuccess(String s) { 27 | JSONObject data = new JSONObject(); 28 | data.put("data", s); 29 | data.put("errCode",0); 30 | data.put("errMsg",""); 31 | callback.invoke(data); 32 | } 33 | } -------------------------------------------------------------------------------- /android/openIM/src/main/java/com/example/openim/OpenIMSDK.java: -------------------------------------------------------------------------------- 1 | package com.example.openim; 2 | 3 | import android.util.Log; 4 | 5 | import com.alibaba.fastjson.JSONArray; 6 | import com.alibaba.fastjson.JSONObject; 7 | 8 | import io.dcloud.feature.uniapp.annotation.UniJSMethod; 9 | import io.dcloud.feature.uniapp.bridge.UniJSCallback; 10 | import io.dcloud.feature.uniapp.common.UniModule; 11 | 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | 15 | import open_im_sdk.Open_im_sdk; 16 | import open_im_sdk_callback.OnAdvancedMsgListener; 17 | import open_im_sdk_callback.OnBatchMsgListener; 18 | import open_im_sdk_callback.OnConnListener; 19 | import open_im_sdk_callback.OnConversationListener; 20 | import open_im_sdk_callback.OnCustomBusinessListener; 21 | import open_im_sdk_callback.OnFriendshipListener; 22 | import open_im_sdk_callback.OnGroupListener; 23 | import open_im_sdk_callback.OnUserListener; 24 | import open_im_sdk_callback.SendMsgCallBack; 25 | import open_im_sdk_callback.UploadFileCallback; 26 | import open_im_sdk_callback.UploadLogProgress; 27 | 28 | public class OpenIMSDK extends UniModule { 29 | private Boolean initFlag; 30 | public OpenIMSDK() { 31 | initFlag = false; 32 | } 33 | 34 | @UniJSMethod( 35 | uiThread = false 36 | ) 37 | public Boolean initSDK(String operationID, JSONObject options) { 38 | if(this.initFlag) return true; 39 | 40 | options.put("platformID", 2); 41 | 42 | OnConnListener connListener = new OnConnListener() { 43 | public void onConnectFailed(int i, String s) { 44 | Map params = new HashMap(); 45 | params.put("errCode", i); 46 | params.put("errMsg", s); 47 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onConnectFailed", params); 48 | } 49 | 50 | public void onConnectSuccess() { 51 | Map params = new HashMap(); 52 | params.put("errCode", 0); 53 | params.put("errMsg", ""); 54 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onConnectSuccess", params); 55 | } 56 | 57 | public void onConnecting() { 58 | Map params = new HashMap(); 59 | params.put("errCode", 0); 60 | params.put("errMsg", ""); 61 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onConnecting", params); 62 | } 63 | 64 | public void onKickedOffline() { 65 | Map params = new HashMap(); 66 | params.put("errCode", 0); 67 | params.put("errMsg", ""); 68 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onKickedOffline", params); 69 | } 70 | 71 | public void onUserTokenExpired() { 72 | Map params = new HashMap(); 73 | params.put("errCode", 0); 74 | params.put("errMsg", ""); 75 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onUserTokenExpired", params); 76 | } 77 | 78 | @Override 79 | public void onUserTokenInvalid(String s) { 80 | Map params = new HashMap(); 81 | params.put("errCode", 0); 82 | params.put("errMsg", ""); 83 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onUserTokenInvalid", params); 84 | } 85 | }; 86 | Boolean flag = Open_im_sdk.initSDK(connListener, operationID, options.toJSONString()); 87 | if(flag){ 88 | _setUserListener(); 89 | _setAdvancedMsgListener(); 90 | _setBatchMsgListener(); 91 | _setConversationListener(); 92 | _setFriendListener(); 93 | _setGroupListener(); 94 | _setCustomBusinessListener(); 95 | } 96 | this.initFlag = flag; 97 | return flag; 98 | } 99 | 100 | @UniJSMethod( 101 | uiThread = false 102 | ) 103 | public void unInitSDK(String operationID) { 104 | Open_im_sdk.unInitSDK(operationID); 105 | } 106 | 107 | @UniJSMethod( 108 | uiThread = false 109 | ) 110 | public void login(String operationID, JSONObject options, UniJSCallback callback) { 111 | Open_im_sdk.getLoginStatus(operationID); 112 | Open_im_sdk.login(new BaseImpl(callback), operationID, options.getString("userID"), options.getString("token")); 113 | } 114 | 115 | @UniJSMethod( 116 | uiThread = false 117 | ) 118 | public void logout(String operationID, UniJSCallback callback) { 119 | Open_im_sdk.logout(new BaseImpl(callback), operationID); 120 | } 121 | 122 | @UniJSMethod( 123 | uiThread = false 124 | ) 125 | public void setAppBackgroundStatus(String operationID,boolean isBackground, UniJSCallback callback) { 126 | Log.e("setAppBackgroundStatus","setAppBackgroundStatus::::::::::"); 127 | Open_im_sdk.setAppBackgroundStatus(new BaseImpl(callback), operationID,isBackground); 128 | } 129 | 130 | @UniJSMethod( 131 | uiThread = false 132 | ) 133 | public void networkStatusChanged(String operationID, UniJSCallback callback) { 134 | Open_im_sdk.networkStatusChanged(new BaseImpl(callback), operationID); 135 | } 136 | 137 | @UniJSMethod( 138 | uiThread = false 139 | ) 140 | public long getLoginStatus(String operationID) { 141 | return Open_im_sdk.getLoginStatus(operationID); 142 | } 143 | 144 | @UniJSMethod( 145 | uiThread = false 146 | ) 147 | public String getLoginUserID() { 148 | return Open_im_sdk.getLoginUserID(); 149 | } 150 | 151 | // user 152 | @UniJSMethod( 153 | uiThread = false 154 | ) 155 | public void _setUserListener() { 156 | OnUserListener userListener = new OnUserListener() { 157 | @Override 158 | public void onSelfInfoUpdated(String s) { 159 | Map params = new HashMap(); 160 | params.put("data", JSONObject.parseObject(s)); 161 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onSelfInfoUpdated", params); 162 | } 163 | 164 | @Override 165 | public void onUserCommandAdd(String s) { 166 | 167 | } 168 | 169 | @Override 170 | public void onUserCommandDelete(String s) { 171 | 172 | } 173 | 174 | @Override 175 | public void onUserCommandUpdate(String s) { 176 | 177 | } 178 | 179 | @Override 180 | public void onUserStatusChanged(String s) { 181 | Map params = new HashMap(); 182 | params.put("data", JSONObject.parseObject(s)); 183 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onUserStatusChanged", params); 184 | } 185 | }; 186 | Open_im_sdk.setUserListener(userListener); 187 | } 188 | 189 | @UniJSMethod( 190 | uiThread = false 191 | ) 192 | public void getUsersInfo(String operationID, JSONArray userIDList, UniJSCallback callback) { 193 | Open_im_sdk.getUsersInfo(new BaseImpl(callback), operationID, userIDList.toJSONString()); 194 | } 195 | 196 | @UniJSMethod( 197 | uiThread = false 198 | ) 199 | public void setSelfInfo(String operationID, JSONObject userInfo, UniJSCallback callback) { 200 | Open_im_sdk.setSelfInfo(new BaseImpl(callback), operationID, userInfo.toJSONString()); 201 | } 202 | 203 | @UniJSMethod( 204 | uiThread = false 205 | ) 206 | public void getSelfUserInfo(String operationID, UniJSCallback callback) { 207 | Open_im_sdk.getSelfUserInfo(new BaseImpl(callback), operationID); 208 | } 209 | 210 | @UniJSMethod( 211 | uiThread = false 212 | ) 213 | public void getUserStatus(String operationID,JSONArray userIDList, UniJSCallback callback) { 214 | Open_im_sdk.getUserStatus(new BaseImpl(callback), operationID, userIDList.toJSONString()); 215 | } 216 | 217 | @UniJSMethod( 218 | uiThread = false 219 | ) 220 | public void subscribeUsersStatus(String operationID,JSONArray userIDList, UniJSCallback callback) { 221 | Open_im_sdk.subscribeUsersStatus(new BaseImpl(callback), operationID, userIDList.toJSONString()); 222 | } 223 | 224 | @UniJSMethod( 225 | uiThread = false 226 | ) 227 | public void unsubscribeUsersStatus(String operationID,JSONArray userIDList, UniJSCallback callback) { 228 | Open_im_sdk.unsubscribeUsersStatus(new BaseImpl(callback), operationID, userIDList.toJSONString()); 229 | } 230 | 231 | @UniJSMethod( 232 | uiThread = false 233 | ) 234 | public void getSubscribeUsersStatus(String operationID, UniJSCallback callback) { 235 | Open_im_sdk.getSubscribeUsersStatus(new BaseImpl(callback), operationID); 236 | } 237 | 238 | // conversation & message 239 | @UniJSMethod( 240 | uiThread = false 241 | ) 242 | public void _setAdvancedMsgListener() { 243 | OnAdvancedMsgListener advancedMsgListener = new OnAdvancedMsgListener() { 244 | @Override 245 | public void onMsgDeleted(String s) { 246 | Map params = new HashMap(); 247 | params.put("data", JSONObject.parseObject(s)); 248 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onMsgDeleted", params); 249 | } 250 | 251 | @Override 252 | public void onNewRecvMessageRevoked(String s) { 253 | Map params = new HashMap(); 254 | params.put("data", JSONObject.parseObject(s)); 255 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onNewRecvMessageRevoked", params); 256 | } 257 | 258 | public void onRecvC2CReadReceipt(String s) { 259 | Map params = new HashMap(); 260 | params.put("data", JSONArray.parseArray(s)); 261 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onRecvC2CReadReceipt", params); 262 | } 263 | 264 | public void onRecvNewMessage(String s) { 265 | Map params = new HashMap(); 266 | params.put("data", JSONObject.parseObject(s)); 267 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onRecvNewMessage", params); 268 | } 269 | 270 | @Override 271 | public void onRecvOfflineNewMessage(String s) { 272 | Map params = new HashMap(); 273 | params.put("data", JSONObject.parseObject(s)); 274 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onRecvOfflineNewMessage", params); 275 | } 276 | 277 | @Override 278 | public void onRecvOnlineOnlyMessage(String s) { 279 | 280 | } 281 | }; 282 | Open_im_sdk.setAdvancedMsgListener(advancedMsgListener); 283 | } 284 | 285 | @UniJSMethod( 286 | uiThread = false 287 | ) 288 | public void _setBatchMsgListener() { 289 | OnBatchMsgListener batchMsgListener = new OnBatchMsgListener() { 290 | @Override 291 | public void onRecvNewMessages(String s) { 292 | Map params = new HashMap(); 293 | params.put("data", JSONArray.parseArray(s)); 294 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onRecvNewMessages", params); 295 | } 296 | 297 | @Override 298 | public void onRecvOfflineNewMessages(String s) { 299 | Map params = new HashMap(); 300 | params.put("data", JSONArray.parseArray(s)); 301 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onRecvOfflineNewMessages", params); 302 | } 303 | }; 304 | Open_im_sdk.setBatchMsgListener(batchMsgListener); 305 | } 306 | 307 | @UniJSMethod( 308 | uiThread = false 309 | ) 310 | public void _setConversationListener() { 311 | OnConversationListener conversationListener = new OnConversationListener() { 312 | public void onConversationChanged(String s) { 313 | Log.e("onConversationChanged",s); 314 | Map params = new HashMap(); 315 | params.put("data", JSONObject.parseArray(s)); 316 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onConversationChanged", params); 317 | } 318 | 319 | @Override 320 | public void onConversationUserInputStatusChanged(String s) { 321 | Map params = new HashMap(); 322 | params.put("data", JSONObject.parseObject(s)); 323 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onInputStatusChanged", params); 324 | } 325 | 326 | public void onNewConversation(String s) { 327 | Map params = new HashMap(); 328 | params.put("data", JSONObject.parseArray(s)); 329 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onNewConversation", params); 330 | } 331 | 332 | @Override 333 | public void onSyncServerFailed(boolean reinstall) { 334 | Map params = new HashMap(); 335 | params.put("errCode", 0); 336 | params.put("errMsg", ""); 337 | params.put("data", reinstall); 338 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onSyncServerFailed", params); 339 | } 340 | 341 | @Override 342 | public void onSyncServerFinish(boolean reinstall) { 343 | Map params = new HashMap(); 344 | params.put("errCode", 0); 345 | params.put("errMsg", ""); 346 | params.put("data", reinstall); 347 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onSyncServerFinish", params); 348 | } 349 | 350 | @Override 351 | public void onSyncServerProgress(long progress) { 352 | Map params = new HashMap(); 353 | params.put("errCode", 0); 354 | params.put("errMsg", ""); 355 | params.put("data", progress); 356 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onSyncServerProgress", params); 357 | } 358 | 359 | @Override 360 | public void onSyncServerStart(boolean reinstall) { 361 | Map params = new HashMap(); 362 | params.put("errCode", 0); 363 | params.put("errMsg", ""); 364 | params.put("data", reinstall); 365 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onSyncServerStart", params); 366 | } 367 | 368 | public void onTotalUnreadMessageCountChanged(int i) { 369 | Map params = new HashMap(); 370 | params.put("data", i); 371 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onTotalUnreadMessageCountChanged", params); 372 | } 373 | }; 374 | Open_im_sdk.setConversationListener(conversationListener); 375 | } 376 | 377 | 378 | @UniJSMethod( 379 | uiThread = false 380 | ) 381 | public void getAllConversationList(String operationID, UniJSCallback callback) { 382 | Open_im_sdk.getAllConversationList(new BaseImpl(callback), operationID); 383 | } 384 | 385 | @UniJSMethod( 386 | uiThread = false 387 | ) 388 | public void getConversationListSplit(String operationID, JSONObject options, UniJSCallback callback) { 389 | Open_im_sdk.getConversationListSplit(new BaseImpl(callback), operationID, options.getInteger("offset"), options.getInteger("count")); 390 | } 391 | 392 | @UniJSMethod( 393 | uiThread = false 394 | ) 395 | public void getOneConversation(String operationID, JSONObject options, UniJSCallback callback) { 396 | Open_im_sdk.getOneConversation(new BaseImpl(callback), operationID, options.getInteger("sessionType"), options.getString("sourceID")); 397 | } 398 | 399 | @UniJSMethod( 400 | uiThread = false 401 | ) 402 | public void getMultipleConversation(String operationID, JSONArray conversationIDList, UniJSCallback callback) { 403 | Open_im_sdk.getMultipleConversation(new BaseImpl(callback), operationID, conversationIDList.toJSONString()); 404 | } 405 | 406 | @UniJSMethod( 407 | uiThread = false 408 | ) 409 | public void setGlobalRecvMessageOpt(String operationID, Integer opt, UniJSCallback callback) { 410 | JSONObject params = new JSONObject(); 411 | params.put("globalRecvMsgOpt", opt); 412 | Open_im_sdk.setGroupInfo(new BaseImpl(callback), operationID, params.toJSONString()); 413 | } 414 | 415 | @UniJSMethod( 416 | uiThread = false 417 | ) 418 | public void hideConversation(String operationID, String conversationID, UniJSCallback callback) { 419 | Open_im_sdk.hideConversation(new BaseImpl(callback), operationID, conversationID ); 420 | } 421 | 422 | @UniJSMethod( 423 | uiThread = false 424 | ) 425 | public void setConversation(String operationID, JSONObject options, UniJSCallback callback) { 426 | Open_im_sdk.setConversation(new BaseImpl(callback), operationID, options.getString("conversationID"), options.toJSONString()); 427 | } 428 | 429 | @UniJSMethod( 430 | uiThread = false 431 | ) 432 | public void setConversationDraft(String operationID, JSONObject options, UniJSCallback callback) { 433 | Open_im_sdk.setConversationDraft(new BaseImpl(callback), operationID, options.getString("conversationID"), options.getString("draftText")); 434 | } 435 | 436 | @UniJSMethod( 437 | uiThread = false 438 | ) 439 | public void resetConversationGroupAtType(String operationID, String conversationID, UniJSCallback callback) { 440 | JSONObject params = new JSONObject(); 441 | params.put("groupAtType", 0); 442 | Open_im_sdk.setConversation(new BaseImpl(callback), operationID, conversationID, params.toJSONString()); 443 | } 444 | 445 | @UniJSMethod( 446 | uiThread = false 447 | ) 448 | public void pinConversation(String operationID, JSONObject options, UniJSCallback callback) { 449 | JSONObject params = new JSONObject(); 450 | params.put("isPinned", options.getBoolean("isPinned")); 451 | Open_im_sdk.setConversation(new BaseImpl(callback), operationID, options.getString("conversationID"), params.toJSONString()); 452 | } 453 | 454 | @UniJSMethod( 455 | uiThread = false 456 | ) 457 | public void setConversationPrivateChat(String operationID, JSONObject options, UniJSCallback callback) { 458 | JSONObject params = new JSONObject(); 459 | params.put("isPrivateChat", options.getBoolean("isPrivate")); 460 | Open_im_sdk.setConversation(new BaseImpl(callback), operationID, options.getString("conversationID"), params.toJSONString()); 461 | } 462 | 463 | @UniJSMethod( 464 | uiThread = false 465 | ) 466 | public void setConversationBurnDuration(String operationID, JSONObject options, UniJSCallback callback){ 467 | JSONObject params = new JSONObject(); 468 | params.put("burnDuration", options.getInteger("burnDuration")); 469 | Open_im_sdk.setConversation(new BaseImpl(callback), operationID, options.getString("conversationID"), params.toJSONString()); 470 | } 471 | 472 | @UniJSMethod( 473 | uiThread = false 474 | ) 475 | public void setConversationRecvMessageOpt(String operationID, JSONObject options, UniJSCallback callback) { 476 | JSONObject params = new JSONObject(); 477 | params.put("recvMsgOpt", options.getInteger("opt")); 478 | Open_im_sdk.setConversation(new BaseImpl(callback), operationID, options.getString("conversationID"), params.toJSONString()); 479 | } 480 | 481 | @UniJSMethod( 482 | uiThread = false 483 | ) 484 | public void getTotalUnreadMsgCount(String operationID, UniJSCallback callback) { 485 | Open_im_sdk.getTotalUnreadMsgCount(new BaseImpl(callback), operationID); 486 | } 487 | 488 | @UniJSMethod( 489 | uiThread = false 490 | ) 491 | public String getAtAllTag(String OperationID) { 492 | return Open_im_sdk.getAtAllTag(OperationID); 493 | } 494 | 495 | @UniJSMethod( 496 | uiThread = false 497 | ) 498 | public String createAdvancedTextMessage(String OperationID, JSONObject options) { 499 | return Open_im_sdk.createAdvancedTextMessage(OperationID, options.getString("text"),options.getJSONArray("messageEntityList").toJSONString()); 500 | } 501 | 502 | @UniJSMethod( 503 | uiThread = false 504 | ) 505 | public String createTextAtMessage(String OperationID, JSONObject options) { 506 | String messageJson = ""; 507 | Object message = options.get("message"); 508 | if (message instanceof JSONObject) { 509 | messageJson = ((JSONObject)message).toJSONString(); 510 | } 511 | return Open_im_sdk.createTextAtMessage(OperationID, options.getString("text"), options.getJSONArray("atUserIDList").toJSONString(), options.getJSONArray("atUsersInfo").toJSONString(), messageJson); 512 | } 513 | 514 | @UniJSMethod( 515 | uiThread = false 516 | ) 517 | public String createTextMessage(String OperationID, String textMsg) { 518 | return Open_im_sdk.createTextMessage(OperationID, textMsg); 519 | } 520 | 521 | @UniJSMethod( 522 | uiThread = false 523 | ) 524 | public String createLocationMessage(String OperationID, JSONObject options) { 525 | return Open_im_sdk.createLocationMessage(OperationID, options.getString("description"), options.getDoubleValue("longitude"), options.getDoubleValue("latitude")); 526 | } 527 | 528 | @UniJSMethod( 529 | uiThread = false 530 | ) 531 | public String createCustomMessage(String operationID, JSONObject options) { 532 | return Open_im_sdk.createCustomMessage(operationID, options.getString("data"), options.getString("extension"), options.getString("description")); 533 | } 534 | 535 | @UniJSMethod( 536 | uiThread = false 537 | ) 538 | public String createQuoteMessage(String OperationID, JSONObject options) { 539 | return Open_im_sdk.createQuoteMessage(OperationID, options.getString("text"), options.getJSONObject("message").toJSONString()); 540 | } 541 | 542 | @UniJSMethod( 543 | uiThread = false 544 | ) 545 | public String createAdvancedQuoteMessage(String OperationID, JSONObject options) { 546 | return Open_im_sdk.createAdvancedQuoteMessage(OperationID, options.getString("text"), options.getJSONObject("message").toJSONString(),options.getJSONArray("messageEntityList").toJSONString()); 547 | } 548 | 549 | @UniJSMethod( 550 | uiThread = false 551 | ) 552 | public String createCardMessage(String operationID, JSONObject cardElem) { 553 | return Open_im_sdk.createCardMessage(operationID, cardElem.toJSONString()); 554 | } 555 | 556 | 557 | @UniJSMethod( 558 | uiThread = false 559 | ) 560 | public String createImageMessage(String OperationID, String imagePath) { 561 | return Open_im_sdk.createImageMessage(OperationID, imagePath); 562 | } 563 | 564 | @UniJSMethod( 565 | uiThread = false 566 | ) 567 | public String createImageMessageFromFullPath(String OperationID, String imagePath) { 568 | return Open_im_sdk.createImageMessageFromFullPath(OperationID, imagePath); 569 | } 570 | 571 | @UniJSMethod( 572 | uiThread = false 573 | ) 574 | public String createImageMessageByURL(String OperationID, JSONObject options) { 575 | String jsonStr1 = options.getJSONObject("sourcePicture").toJSONString(); 576 | String jsonStr2 = options.getJSONObject("bigPicture").toJSONString(); 577 | String jsonStr3 = options.getJSONObject("snapshotPicture").toJSONString(); 578 | return Open_im_sdk.createImageMessageByURL(OperationID,options.getString("sourcePath"), jsonStr1, jsonStr2, jsonStr3); 579 | } 580 | 581 | @UniJSMethod( 582 | uiThread = false 583 | ) 584 | public String createSoundMessage(String OperationID, JSONObject options) { 585 | return Open_im_sdk.createSoundMessage(OperationID, options.getString("soundPath"), options.getLong("duration")); 586 | } 587 | 588 | @UniJSMethod( 589 | uiThread = false 590 | ) 591 | public String createSoundMessageFromFullPath(String OperationID, JSONObject options) { 592 | return Open_im_sdk.createSoundMessageFromFullPath(OperationID, options.getString("soundPath"), options.getLong("duration")); 593 | } 594 | 595 | @UniJSMethod( 596 | uiThread = false 597 | ) 598 | public String createSoundMessageByURL(String OperationID, JSONObject soundInfo) { 599 | return Open_im_sdk.createSoundMessageByURL(OperationID, soundInfo.toJSONString()); 600 | } 601 | 602 | @UniJSMethod( 603 | uiThread = false 604 | ) 605 | public String createVideoMessage(String OperationID, JSONObject options) { 606 | return Open_im_sdk.createVideoMessage(OperationID, options.getString("videoPath"), options.getString("videoType"), (long)options.getLong("duration"), options.getString("snapshotPath")); 607 | } 608 | 609 | @UniJSMethod( 610 | uiThread = false 611 | ) 612 | public String createVideoMessageFromFullPath(String OperationID, JSONObject options) { 613 | return Open_im_sdk.createVideoMessageFromFullPath(OperationID, options.getString("videoPath"), options.getString("videoType"), (long)options.getLong("duration"), options.getString("snapshotPath")); 614 | } 615 | 616 | @UniJSMethod( 617 | uiThread = false 618 | ) 619 | public String createVideoMessageByURL(String OperationID, JSONObject videoInfo) { 620 | return Open_im_sdk.createVideoMessageByURL(OperationID, videoInfo.toJSONString()); 621 | } 622 | 623 | @UniJSMethod( 624 | uiThread = false 625 | ) 626 | public String createFileMessage(String OperationID, JSONObject options) { 627 | return Open_im_sdk.createFileMessage(OperationID, options.getString("filePath"), options.getString("fileName")); 628 | } 629 | 630 | @UniJSMethod( 631 | uiThread = false 632 | ) 633 | public String createFileMessageFromFullPath(String OperationID, JSONObject options) { 634 | return Open_im_sdk.createFileMessageFromFullPath(OperationID, options.getString("filePath"), options.getString("fileName")); 635 | } 636 | 637 | @UniJSMethod( 638 | uiThread = false 639 | ) 640 | public String createFileMessageByURL(String OperationID, JSONObject fileInfo) { 641 | return Open_im_sdk.createFileMessageByURL(OperationID, fileInfo.toJSONString()); 642 | } 643 | 644 | @UniJSMethod( 645 | uiThread = false 646 | ) 647 | public String createMergerMessage(String operationID, JSONObject options) { 648 | return Open_im_sdk.createMergerMessage(operationID, options.getJSONArray("messageList").toJSONString() , options.getString("title"), options.getJSONArray("summaryList").toJSONString()); 649 | } 650 | 651 | @UniJSMethod( 652 | uiThread = false 653 | ) 654 | public String createFaceMessage(String operationID, JSONObject options) { 655 | return Open_im_sdk.createFaceMessage(operationID, options.getInteger("index"),options.getString("dataStr")); 656 | } 657 | 658 | @UniJSMethod( 659 | uiThread = false 660 | ) 661 | public String createForwardMessage(String operationID, JSONObject message) { 662 | return Open_im_sdk.createForwardMessage(operationID, message.toJSONString()); 663 | } 664 | 665 | @UniJSMethod( 666 | uiThread = false 667 | ) 668 | public String getConversationIDBySessionType(String operationID, JSONObject options) { 669 | return Open_im_sdk.getConversationIDBySessionType(operationID, options.getString("sourceID"), options.getInteger("sessionType")); 670 | } 671 | 672 | @UniJSMethod( 673 | uiThread = false 674 | ) 675 | public void sendMessage(String operationID, JSONObject options, UniJSCallback callback) { 676 | String messageStr = options.getJSONObject("message").toJSONString(); 677 | String offlinePushInfoStr = options.getJSONObject("offlinePushInfo").toJSONString(); 678 | boolean isOnlineOnly = options.getBooleanValue("isOnlineOnly"); 679 | SendMsgCallBack sendMsgCallBack = new SendMsgCallBack() { 680 | public void onError(int i, String s) { 681 | Map params = new HashMap(); 682 | params.put("errCode", i); 683 | params.put("errMsg", s); 684 | params.put("data", options.getJSONObject("message")); 685 | // OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("sendMessageFailed", params); 686 | callback.invoke(params); 687 | } 688 | 689 | public void onProgress(long l) { 690 | Map params = new HashMap(); 691 | JSONObject data = new JSONObject(); 692 | data.put("message", options.getJSONObject("message")); 693 | data.put("progress", l); 694 | params.put("data", data); 695 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("sendMessageProgress", params); 696 | } 697 | 698 | public void onSuccess(String s) { 699 | Map params = new HashMap(); 700 | params.put("errCode", 0); 701 | params.put("errMsg", ""); 702 | params.put("data", JSONObject.parseObject(s)); 703 | callback.invoke(params); 704 | // OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("sendMessageSuccess", params); 705 | } 706 | }; 707 | Open_im_sdk.sendMessage(sendMsgCallBack, operationID,messageStr, options.getString("recvID"), options.getString("groupID"), offlinePushInfoStr,isOnlineOnly); 708 | } 709 | 710 | @UniJSMethod( 711 | uiThread = false 712 | ) 713 | public void sendMessageNotOss(String operationID, JSONObject options, UniJSCallback callback) { 714 | String messageStr = options.getJSONObject("message").toJSONString(); 715 | String offlinePushInfoStr = options.getJSONObject("offlinePushInfo").toJSONString(); 716 | boolean isOnlineOnly = options.getBooleanValue("isOnlineOnly"); 717 | SendMsgCallBack sendMsgNotOssCallBack = new SendMsgCallBack() { 718 | public void onError(int i, String s) { 719 | Map params = new HashMap(); 720 | params.put("errCode", i); 721 | params.put("errMsg", s); 722 | params.put("data", options.getJSONObject("message")); 723 | callback.invoke(params); 724 | // OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("sendMessageFailed", params); 725 | } 726 | 727 | public void onProgress(long l) { 728 | Map params = new HashMap(); 729 | JSONObject data = new JSONObject(); 730 | data.put("message", options.getJSONObject("message")); 731 | data.put("progress", l); 732 | params.put("data", data); 733 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("sendMessageProgress", params); 734 | } 735 | 736 | public void onSuccess(String s) { 737 | Map params = new HashMap(); 738 | params.put("errCode", 0); 739 | params.put("errMsg", ""); 740 | params.put("data", JSONObject.parseObject(s)); 741 | callback.invoke(params); 742 | // OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("sendMessageSuccess", params); 743 | } 744 | }; 745 | Open_im_sdk.sendMessageNotOss(sendMsgNotOssCallBack, operationID, messageStr, options.getString("recvID"), options.getString("groupID"), offlinePushInfoStr, isOnlineOnly); 746 | } 747 | 748 | @UniJSMethod( 749 | uiThread = false 750 | ) 751 | public void findMessageList(String operationID,JSONArray findOptions, UniJSCallback callback) { 752 | Open_im_sdk.findMessageList(new BaseImpl(callback), operationID,findOptions.toJSONString()); 753 | } 754 | 755 | @UniJSMethod( 756 | uiThread = false 757 | ) 758 | public void getAdvancedHistoryMessageList(String operationID,JSONObject findOptions, UniJSCallback callback) { 759 | Open_im_sdk.getAdvancedHistoryMessageList(new BaseImpl(callback), operationID,findOptions.toJSONString()); 760 | } 761 | 762 | @UniJSMethod( 763 | uiThread = false 764 | ) 765 | public void getAdvancedHistoryMessageListReverse(String operationID, JSONObject options, UniJSCallback callback) { 766 | String optionStr = options.toJSONString(); 767 | Open_im_sdk.getAdvancedHistoryMessageListReverse(new BaseImpl(callback), operationID, optionStr); 768 | } 769 | 770 | @UniJSMethod( 771 | uiThread = false 772 | ) 773 | public void revokeMessage(String operationID, JSONObject options, UniJSCallback callback) { 774 | Open_im_sdk.revokeMessage(new BaseImpl(callback), operationID, options.getString("conversationID"), options.getString("clientMsgID")); 775 | } 776 | 777 | @UniJSMethod( 778 | uiThread = false 779 | ) 780 | public void typingStatusUpdate(String operationID, JSONObject options, UniJSCallback callback) { 781 | Open_im_sdk.typingStatusUpdate(new BaseImpl(callback), operationID, options.getString("recvID"), options.getString("msgTip")); 782 | } 783 | 784 | @UniJSMethod( 785 | uiThread = false 786 | ) 787 | public void changeInputStates(String operationID, JSONObject options, UniJSCallback callback) { 788 | Open_im_sdk.changeInputStates(new BaseImpl(callback), operationID, options.getString("conversationID"), options.getBoolean("focus")); 789 | } 790 | 791 | @UniJSMethod( 792 | uiThread = false 793 | ) 794 | public void getInputStates(String operationID, JSONObject options, UniJSCallback callback) { 795 | Open_im_sdk.getInputStates(new BaseImpl(callback), operationID, options.getString("conversationID"), options.getString("userID")); 796 | } 797 | 798 | @UniJSMethod( 799 | uiThread = false 800 | ) 801 | public void markConversationMessageAsRead(String operationID, String conversationID, UniJSCallback callback) { 802 | Open_im_sdk.markConversationMessageAsRead(new BaseImpl(callback), operationID, conversationID); 803 | } 804 | 805 | @UniJSMethod( 806 | uiThread = false 807 | ) 808 | public void markMessagesAsReadByMsgID(String operationID, JSONObject options, UniJSCallback callback) { 809 | Open_im_sdk.markMessagesAsReadByMsgID(new BaseImpl(callback), operationID, options.getString("conversationID"),options.getJSONArray("clientMsgIDList").toJSONString()); 810 | } 811 | 812 | @UniJSMethod( 813 | uiThread = false 814 | ) 815 | public void deleteMessageFromLocalStorage(String operationID, JSONObject options, UniJSCallback callback) { 816 | Open_im_sdk.deleteMessageFromLocalStorage(new BaseImpl(callback), operationID, options.getString("conversationID"), options.getString("clientMsgID")); 817 | } 818 | 819 | @UniJSMethod( 820 | uiThread = false 821 | ) 822 | public void deleteMessage(String operationID, JSONObject options, UniJSCallback callback) { 823 | Open_im_sdk.deleteMessage(new BaseImpl(callback), operationID, options.getString("conversationID"), options.getString("clientMsgID")); 824 | } 825 | 826 | @UniJSMethod( 827 | uiThread = false 828 | ) 829 | public void deleteAllMsgFromLocalAndSvr(String operationID, UniJSCallback callback) { 830 | Open_im_sdk.deleteAllMsgFromLocalAndSvr(new BaseImpl(callback), operationID); 831 | } 832 | 833 | @UniJSMethod( 834 | uiThread = false 835 | ) 836 | public void deleteAllMsgFromLocal(String operationID, UniJSCallback callback) { 837 | Open_im_sdk.deleteAllMsgFromLocal(new BaseImpl(callback), operationID); 838 | } 839 | 840 | @UniJSMethod( 841 | uiThread = false 842 | ) 843 | public void clearConversationAndDeleteAllMsg(String operationID, String conversationID, UniJSCallback callback) { 844 | Open_im_sdk.clearConversationAndDeleteAllMsg(new BaseImpl(callback), operationID, conversationID); 845 | } 846 | 847 | @UniJSMethod( 848 | uiThread = false 849 | ) 850 | public void deleteConversationAndDeleteAllMsg(String operationID, String conversationID, UniJSCallback callback) { 851 | Open_im_sdk.deleteConversationAndDeleteAllMsg(new BaseImpl(callback), operationID, conversationID); 852 | } 853 | 854 | @UniJSMethod( 855 | uiThread = false 856 | ) 857 | public void insertSingleMessageToLocalStorage(String operationID, JSONObject options, UniJSCallback callback) { 858 | Open_im_sdk.insertSingleMessageToLocalStorage(new BaseImpl(callback), operationID, options.getJSONObject("message").toJSONString(), options.getString("recvID"), options.getString("sendID")); 859 | } 860 | 861 | @UniJSMethod( 862 | uiThread = false 863 | ) 864 | public void insertGroupMessageToLocalStorage(String operationID, JSONObject options, UniJSCallback callback) { 865 | Open_im_sdk.insertGroupMessageToLocalStorage(new BaseImpl(callback), operationID, options.getJSONObject("message").toJSONString(), options.getString("groupID"), options.getString("sendID")); 866 | } 867 | 868 | @UniJSMethod( 869 | uiThread = false 870 | ) 871 | public void searchLocalMessages(String operationID, JSONObject searchParam, UniJSCallback callback) { 872 | Open_im_sdk.searchLocalMessages(new BaseImpl(callback), operationID, searchParam.toJSONString()); 873 | } 874 | 875 | @UniJSMethod( 876 | uiThread = false 877 | ) 878 | public void setMessageLocalEx(String operationID, JSONObject options, UniJSCallback callback) { 879 | Open_im_sdk.setMessageLocalEx(new BaseImpl(callback), operationID, options.getString("conversationID"),options.getString("clientMsgID"),options.getString("localEx")); 880 | } 881 | 882 | // friend 883 | @UniJSMethod( 884 | uiThread = false 885 | ) 886 | public void _setFriendListener() { 887 | OnFriendshipListener friendshipListener = new OnFriendshipListener() { 888 | public void onBlackAdded(String s) { 889 | Map params = new HashMap(); 890 | params.put("data", JSONObject.parseObject(s)); 891 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onBlackAdded", params); 892 | } 893 | 894 | public void onBlackDeleted(String s) { 895 | Map params = new HashMap(); 896 | params.put("data", JSONObject.parseObject(s)); 897 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onBlackDeleted", params); 898 | } 899 | 900 | public void onFriendAdded(String s) { 901 | Map params = new HashMap(); 902 | params.put("data", JSONObject.parseObject(s)); 903 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onFriendAdded", params); 904 | } 905 | 906 | public void onFriendApplicationAccepted(String s) { 907 | Map params = new HashMap(); 908 | params.put("data", JSONObject.parseObject(s)); 909 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onFriendApplicationAccepted", params); 910 | } 911 | 912 | public void onFriendApplicationAdded(String s) { 913 | Map params = new HashMap(); 914 | params.put("data", JSONObject.parseObject(s)); 915 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onFriendApplicationAdded", params); 916 | } 917 | 918 | public void onFriendApplicationDeleted(String s) { 919 | Map params = new HashMap(); 920 | params.put("data", JSONObject.parseObject(s)); 921 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onFriendApplicationDeleted", params); 922 | } 923 | 924 | public void onFriendApplicationRejected(String s) { 925 | Map params = new HashMap(); 926 | params.put("data", JSONObject.parseObject(s)); 927 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onFriendApplicationRejected", params); 928 | } 929 | 930 | public void onFriendDeleted(String s) { 931 | Map params = new HashMap(); 932 | params.put("data", JSONObject.parseObject(s)); 933 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onFriendDeleted", params); 934 | } 935 | 936 | public void onFriendInfoChanged(String s) { 937 | Map params = new HashMap(); 938 | params.put("data", JSONObject.parseObject(s)); 939 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onFriendInfoChanged", params); 940 | } 941 | }; 942 | Open_im_sdk.setFriendListener(friendshipListener); 943 | } 944 | 945 | @UniJSMethod( 946 | uiThread = false 947 | ) 948 | public void getSpecifiedFriendsInfo(String operationID, JSONObject options, UniJSCallback callback) { 949 | Open_im_sdk.getSpecifiedFriendsInfo(new BaseImpl(callback), operationID, options.getJSONArray("userIDList").toJSONString(), options.getBooleanValue("filterBlack")); 950 | } 951 | 952 | @UniJSMethod( 953 | uiThread = false 954 | ) 955 | public void getFriendList(String operationID, boolean filterBlack, UniJSCallback callback) { 956 | Open_im_sdk.getFriendList(new BaseImpl(callback), operationID, filterBlack); 957 | } 958 | 959 | @UniJSMethod( 960 | uiThread = false 961 | ) 962 | public void getFriendListPage(String operationID, JSONObject options, UniJSCallback callback) { 963 | Open_im_sdk.getFriendListPage(new BaseImpl(callback), operationID, options.getInteger("offset"), options.getInteger("count"), options.getBooleanValue("filterBlack")); 964 | } 965 | 966 | @UniJSMethod( 967 | uiThread = false 968 | ) 969 | public void searchFriends(String operationID, JSONObject options, UniJSCallback callback) { 970 | Open_im_sdk.searchFriends(new BaseImpl(callback), operationID, options.toJSONString()); 971 | } 972 | 973 | @UniJSMethod( 974 | uiThread = false 975 | ) 976 | public void checkFriend(String operationID, JSONArray userIDList, UniJSCallback callback) { 977 | Open_im_sdk.checkFriend(new BaseImpl(callback), operationID, userIDList.toJSONString()); 978 | } 979 | 980 | @UniJSMethod( 981 | uiThread = false 982 | ) 983 | public void addFriend(String operationID, JSONObject paramsReq, UniJSCallback callback) { 984 | Open_im_sdk.addFriend(new BaseImpl(callback), operationID, paramsReq.toJSONString()); 985 | } 986 | 987 | @UniJSMethod( 988 | uiThread = false 989 | ) 990 | public void updateFriends(String operationID, JSONObject options, UniJSCallback callback) { 991 | Open_im_sdk.updateFriends(new BaseImpl(callback), operationID, options.toJSONString()); 992 | } 993 | 994 | @UniJSMethod( 995 | uiThread = false 996 | ) 997 | public void setFriendRemark(String operationID, JSONObject options, UniJSCallback callback) { 998 | JSONArray toUserIDList = new JSONArray(); 999 | toUserIDList.add(options.getString("toUserID")); 1000 | 1001 | JSONObject params = new JSONObject(); 1002 | params.put("friendUserIDs", toUserIDList); 1003 | params.put("remark", options.getString("remark")); 1004 | 1005 | Open_im_sdk.updateFriends(new BaseImpl(callback), operationID, params.toJSONString()); 1006 | } 1007 | 1008 | @UniJSMethod( 1009 | uiThread = false 1010 | ) 1011 | public void deleteFriend(String operationID, String userID, UniJSCallback callback) { 1012 | Open_im_sdk.deleteFriend(new BaseImpl(callback), operationID, userID); 1013 | } 1014 | 1015 | @UniJSMethod( 1016 | uiThread = false 1017 | ) 1018 | public void getFriendApplicationListAsRecipient(String operationID, UniJSCallback callback) { 1019 | Open_im_sdk.getFriendApplicationListAsRecipient(new BaseImpl(callback), operationID); 1020 | } 1021 | 1022 | @UniJSMethod( 1023 | uiThread = false 1024 | ) 1025 | public void getFriendApplicationListAsApplicant(String operationID, UniJSCallback callback) { 1026 | Open_im_sdk.getFriendApplicationListAsApplicant(new BaseImpl(callback), operationID); 1027 | } 1028 | 1029 | @UniJSMethod( 1030 | uiThread = false 1031 | ) 1032 | public void acceptFriendApplication(String operationID, JSONObject userIDHandleMsg, UniJSCallback callback) { 1033 | Open_im_sdk.acceptFriendApplication(new BaseImpl(callback), operationID, userIDHandleMsg.toJSONString()); 1034 | } 1035 | 1036 | @UniJSMethod( 1037 | uiThread = false 1038 | ) 1039 | public void refuseFriendApplication(String operationID, JSONObject userIDHandleMsg, UniJSCallback callback) { 1040 | Open_im_sdk.refuseFriendApplication(new BaseImpl(callback), operationID, userIDHandleMsg.toJSONString()); 1041 | } 1042 | 1043 | @UniJSMethod( 1044 | uiThread = false 1045 | ) 1046 | public void addBlack(String operationID, JSONObject options, UniJSCallback callback) { 1047 | Open_im_sdk.addBlack(new BaseImpl(callback), operationID, options.getString("toUserID"), options.getString("ex")); 1048 | } 1049 | 1050 | @UniJSMethod( 1051 | uiThread = false 1052 | ) 1053 | public void getBlackList(String operationID, UniJSCallback callback) { 1054 | Open_im_sdk.getBlackList(new BaseImpl(callback), operationID); 1055 | } 1056 | 1057 | @UniJSMethod( 1058 | uiThread = false 1059 | ) 1060 | public void removeBlack(String operationID, String userID, UniJSCallback callback) { 1061 | Open_im_sdk.removeBlack(new BaseImpl(callback), operationID, userID); 1062 | } 1063 | 1064 | // group 1065 | @UniJSMethod( 1066 | uiThread = false 1067 | ) 1068 | public void _setGroupListener() { 1069 | OnGroupListener groupListener = new OnGroupListener() { 1070 | public void onGroupApplicationAccepted(String s) { 1071 | Map params = new HashMap(); 1072 | params.put("data", JSONObject.parseObject(s)); 1073 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupApplicationAccepted", params); 1074 | } 1075 | 1076 | public void onGroupApplicationAdded(String s) { 1077 | Map params = new HashMap(); 1078 | params.put("data", JSONObject.parseObject(s)); 1079 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupApplicationAdded", params); 1080 | } 1081 | 1082 | public void onGroupApplicationDeleted(String s) { 1083 | Map params = new HashMap(); 1084 | params.put("data", JSONObject.parseObject(s)); 1085 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupApplicationDeleted", params); 1086 | } 1087 | 1088 | public void onGroupApplicationRejected(String s) { 1089 | Map params = new HashMap(); 1090 | params.put("data", JSONObject.parseObject(s)); 1091 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupApplicationRejected", params); 1092 | } 1093 | 1094 | @Override 1095 | public void onGroupDismissed(String s) { 1096 | Map params = new HashMap(); 1097 | params.put("data", JSONObject.parseObject(s)); 1098 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupDismissed", params); 1099 | } 1100 | 1101 | public void onGroupInfoChanged(String s) { 1102 | Map params = new HashMap(); 1103 | params.put("data", JSONObject.parseObject(s)); 1104 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupInfoChanged", params); 1105 | } 1106 | 1107 | public void onGroupMemberAdded(String s) { 1108 | Map params = new HashMap(); 1109 | params.put("data", JSONObject.parseObject(s)); 1110 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupMemberAdded", params); 1111 | } 1112 | 1113 | public void onGroupMemberDeleted(String s) { 1114 | Map params = new HashMap(); 1115 | params.put("data", JSONObject.parseObject(s)); 1116 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupMemberDeleted", params); 1117 | } 1118 | 1119 | public void onGroupMemberInfoChanged(String s) { 1120 | Map params = new HashMap(); 1121 | params.put("data", JSONObject.parseObject(s)); 1122 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onGroupMemberInfoChanged", params); 1123 | } 1124 | 1125 | public void onJoinedGroupAdded(String s) { 1126 | Map params = new HashMap(); 1127 | params.put("data", JSONObject.parseObject(s)); 1128 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onJoinedGroupAdded", params); 1129 | } 1130 | 1131 | public void onJoinedGroupDeleted(String s) { 1132 | Map params = new HashMap(); 1133 | params.put("data", JSONObject.parseObject(s)); 1134 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onJoinedGroupDeleted", params); 1135 | } 1136 | }; 1137 | Open_im_sdk.setGroupListener(groupListener); 1138 | } 1139 | 1140 | @UniJSMethod( 1141 | uiThread = false 1142 | ) 1143 | public void createGroup(String operationID, JSONObject baseInfo, UniJSCallback callback) { 1144 | Open_im_sdk.createGroup(new BaseImpl(callback), operationID, baseInfo.toJSONString()); 1145 | } 1146 | 1147 | @UniJSMethod( 1148 | uiThread = false 1149 | ) 1150 | public void joinGroup(String operationID, JSONObject options, UniJSCallback callback) { 1151 | Open_im_sdk.joinGroup(new BaseImpl(callback), operationID, options.getString("groupID"), options.getString("reqMsg"),options.getInteger("joinSource"),options.getString("ex")); 1152 | } 1153 | 1154 | @UniJSMethod( 1155 | uiThread = false 1156 | ) 1157 | public void quitGroup(String operationID, String groupID, UniJSCallback callback) { 1158 | Open_im_sdk.quitGroup(new BaseImpl(callback), operationID, groupID); 1159 | } 1160 | 1161 | @UniJSMethod( 1162 | uiThread = false 1163 | ) 1164 | public void dismissGroup(String operationID, String groupID, UniJSCallback callback) { 1165 | Open_im_sdk.dismissGroup(new BaseImpl(callback), operationID, groupID); 1166 | } 1167 | 1168 | @UniJSMethod( 1169 | uiThread = false 1170 | ) 1171 | public void changeGroupMute(String operationID, JSONObject options, UniJSCallback callback) { 1172 | Open_im_sdk.changeGroupMute(new BaseImpl(callback), operationID, options.getString("groupID"), options.getBoolean("isMute")); 1173 | } 1174 | 1175 | @UniJSMethod( 1176 | uiThread = false 1177 | ) 1178 | public void changeGroupMemberMute(String operationID, JSONObject options, UniJSCallback callback) { 1179 | Open_im_sdk.changeGroupMemberMute(new BaseImpl(callback), operationID, options.getString("groupID"), options.getString("userID"), options.getLong("mutedSeconds")); 1180 | } 1181 | 1182 | @UniJSMethod( 1183 | uiThread = false 1184 | ) 1185 | public void setGroupMemberRoleLevel(String operationID, JSONObject options, UniJSCallback callback) { 1186 | JSONObject params = new JSONObject(); 1187 | params.put("groupID", options.getString("groupID")); 1188 | params.put("userID", options.getString("userID")); 1189 | params.put("roleLevel", options.getInteger("roleLevel")); 1190 | Open_im_sdk.setGroupMemberInfo(new BaseImpl(callback), operationID, params.toJSONString()); 1191 | } 1192 | 1193 | @UniJSMethod( 1194 | uiThread = false 1195 | ) 1196 | public void setGroupMemberInfo(String operationID, JSONObject data, UniJSCallback callback) { 1197 | Open_im_sdk.setGroupMemberInfo(new BaseImpl(callback), operationID, data.toJSONString()); 1198 | } 1199 | 1200 | @UniJSMethod( 1201 | uiThread = false 1202 | ) 1203 | public void getJoinedGroupList(String operationID, UniJSCallback callback) { 1204 | Open_im_sdk.getJoinedGroupList(new BaseImpl(callback), operationID); 1205 | } 1206 | 1207 | @UniJSMethod( 1208 | uiThread = false 1209 | ) 1210 | public void getJoinedGroupListPage(String operationID, JSONObject options, UniJSCallback callback) { 1211 | Open_im_sdk.getJoinedGroupListPage(new BaseImpl(callback), operationID, options.getInteger("offset"), options.getInteger("count")); 1212 | } 1213 | 1214 | @UniJSMethod( 1215 | uiThread = false 1216 | ) 1217 | public void getSpecifiedGroupsInfo(String operationID, JSONArray groupIDList, UniJSCallback callback) { 1218 | Open_im_sdk.getSpecifiedGroupsInfo(new BaseImpl(callback), operationID, groupIDList.toJSONString()); 1219 | } 1220 | 1221 | @UniJSMethod( 1222 | uiThread = false 1223 | ) 1224 | public void searchGroups(String operationID, JSONObject options, UniJSCallback callback) { 1225 | Open_im_sdk.searchGroups(new BaseImpl(callback), operationID, options.toJSONString()); 1226 | } 1227 | 1228 | @UniJSMethod( 1229 | uiThread = false 1230 | ) 1231 | public void setGroupInfo(String operationID, JSONObject jsonGroupInfo, UniJSCallback callback) { 1232 | Open_im_sdk.setGroupInfo(new BaseImpl(callback), operationID, jsonGroupInfo.toJSONString()); 1233 | } 1234 | 1235 | @UniJSMethod( 1236 | uiThread = false 1237 | ) 1238 | public void setGroupVerification(String operationID, JSONObject options, UniJSCallback callback) { 1239 | JSONObject params = new JSONObject(); 1240 | params.put("groupID", options.getString("groupID")); 1241 | params.put("needVerification", options.getInteger("verification")); 1242 | Open_im_sdk.setGroupInfo(new BaseImpl(callback), operationID, params.toJSONString()); 1243 | } 1244 | 1245 | @UniJSMethod( 1246 | uiThread = false 1247 | ) 1248 | public void setGroupLookMemberInfo(String operationID,JSONObject options, UniJSCallback callback) { 1249 | JSONObject params = new JSONObject(); 1250 | params.put("groupID", options.getString("groupID")); 1251 | params.put("lookMemberInfo", options.getInteger("rule")); 1252 | Open_im_sdk.setGroupInfo(new BaseImpl(callback), operationID, params.toJSONString()); 1253 | } 1254 | 1255 | @UniJSMethod( 1256 | uiThread = false 1257 | ) 1258 | public void setGroupApplyMemberFriend(String operationID,JSONObject options, UniJSCallback callback) { 1259 | JSONObject params = new JSONObject(); 1260 | params.put("groupID", options.getString("groupID")); 1261 | params.put("applyMemberFriend", options.getInteger("rule")); 1262 | Open_im_sdk.setGroupInfo(new BaseImpl(callback), operationID, params.toJSONString()); 1263 | } 1264 | 1265 | @UniJSMethod( 1266 | uiThread = false 1267 | ) 1268 | public void getGroupMemberList(String operationID, JSONObject options, UniJSCallback callback) { 1269 | Open_im_sdk.getGroupMemberList(new BaseImpl(callback), operationID, options.getString("groupID"), options.getInteger("filter"), options.getInteger("offset"), options.getInteger("count")); 1270 | } 1271 | 1272 | @UniJSMethod( 1273 | uiThread = false 1274 | ) 1275 | public void getGroupMemberOwnerAndAdmin(String operationID, String groupID, UniJSCallback callback) { 1276 | Open_im_sdk.getGroupMemberOwnerAndAdmin(new BaseImpl(callback), operationID, groupID); 1277 | } 1278 | 1279 | @UniJSMethod( 1280 | uiThread = false 1281 | ) 1282 | public void getGroupMemberListByJoinTimeFilter(String operationID, JSONObject options, UniJSCallback callback) { 1283 | Open_im_sdk.getGroupMemberListByJoinTimeFilter(new BaseImpl(callback), operationID, options.getString("groupID"), options.getInteger("offset"), options.getInteger("count"), options.getInteger("joinTimeBegin"),options.getInteger("joinTimeEnd"),options.getJSONArray("filterUserIDList").toJSONString()); 1284 | } 1285 | 1286 | @UniJSMethod( 1287 | uiThread = false 1288 | ) 1289 | public void getSpecifiedGroupMembersInfo(String operationID, JSONObject options, UniJSCallback callback) { 1290 | Open_im_sdk.getSpecifiedGroupMembersInfo(new BaseImpl(callback), operationID, options.getString("groupID"), options.getJSONArray("userIDList").toJSONString()); 1291 | } 1292 | 1293 | @UniJSMethod( 1294 | uiThread = false 1295 | ) 1296 | public void getUsersInGroup(String operationID, JSONObject options, UniJSCallback callback) { 1297 | Open_im_sdk.getUsersInGroup(new BaseImpl(callback), operationID, options.getString("groupID"), options.getJSONArray("userIDList").toJSONString()); 1298 | } 1299 | 1300 | @UniJSMethod( 1301 | uiThread = false 1302 | ) 1303 | public void kickGroupMember(String operationID, JSONObject options , UniJSCallback callback) { 1304 | Open_im_sdk.kickGroupMember(new BaseImpl(callback), operationID, options.getString("groupID"), options.getString("reason"), options.getJSONArray("userIDList").toJSONString()); 1305 | } 1306 | 1307 | @UniJSMethod( 1308 | uiThread = false 1309 | ) 1310 | public void transferGroupOwner(String operationID, JSONObject options, UniJSCallback callback) { 1311 | Open_im_sdk.transferGroupOwner(new BaseImpl(callback), operationID, options.getString("groupID"), options.getString("newOwnerUserID")); 1312 | } 1313 | 1314 | @UniJSMethod( 1315 | uiThread = false 1316 | ) 1317 | public void inviteUserToGroup(String operationID, JSONObject options, UniJSCallback callback) { 1318 | Open_im_sdk.inviteUserToGroup(new BaseImpl(callback),operationID, options.getString("groupID"), options.getString("reason"), options.getJSONArray("userIDList").toJSONString()); 1319 | } 1320 | 1321 | @UniJSMethod( 1322 | uiThread = false 1323 | ) 1324 | public void getGroupApplicationListAsRecipient(String operationID, UniJSCallback callback) { 1325 | Open_im_sdk.getGroupApplicationListAsRecipient(new BaseImpl(callback), operationID); 1326 | } 1327 | 1328 | @UniJSMethod( 1329 | uiThread = false 1330 | ) 1331 | public void getGroupApplicationListAsApplicant(String operationID, UniJSCallback callback) { 1332 | Open_im_sdk.getGroupApplicationListAsApplicant(new BaseImpl(callback), operationID); 1333 | } 1334 | 1335 | @UniJSMethod( 1336 | uiThread = false 1337 | ) 1338 | public void acceptGroupApplication(String operationID, JSONObject options, UniJSCallback callback) { 1339 | Open_im_sdk.acceptGroupApplication(new BaseImpl(callback), operationID, options.getString("groupID"), options.getString("fromUserID"), options.getString("handleMsg")); 1340 | } 1341 | 1342 | @UniJSMethod( 1343 | uiThread = false 1344 | ) 1345 | public void refuseGroupApplication(String operationID, JSONObject options, UniJSCallback callback) { 1346 | Open_im_sdk.refuseGroupApplication(new BaseImpl(callback), operationID, options.getString("groupID"), options.getString("fromUserID"), options.getString("handleMsg")); 1347 | } 1348 | 1349 | @UniJSMethod( 1350 | uiThread = false 1351 | ) 1352 | public void setGroupMemberNickname(String operationID, JSONObject options, UniJSCallback callback) { 1353 | JSONObject params = new JSONObject(); 1354 | params.put("groupID", options.getString("groupID")); 1355 | params.put("userID", options.getString("userID")); 1356 | params.put("nickname", options.getString("groupMemberNickname")); 1357 | Open_im_sdk.setGroupMemberInfo(new BaseImpl(callback), operationID, params.toJSONString()); 1358 | } 1359 | 1360 | @UniJSMethod( 1361 | uiThread = false 1362 | ) 1363 | public void searchGroupMembers(String operationID,JSONObject searchOptions, UniJSCallback callback) { 1364 | Open_im_sdk.searchGroupMembers(new BaseImpl(callback), operationID,searchOptions.toJSONString()); 1365 | } 1366 | 1367 | @UniJSMethod( 1368 | uiThread = false 1369 | ) 1370 | public void isJoinGroup(String operationID,String groupID, UniJSCallback callback) { 1371 | Open_im_sdk.isJoinGroup(new BaseImpl(callback), operationID,groupID); 1372 | } 1373 | 1374 | @UniJSMethod( 1375 | uiThread = false 1376 | ) 1377 | public void setAppBadge(String operationID, Integer appUnreadCount, UniJSCallback callback) { 1378 | Open_im_sdk.setAppBadge(new BaseImpl(callback), operationID,appUnreadCount); 1379 | } 1380 | 1381 | @UniJSMethod( 1382 | uiThread = false 1383 | ) 1384 | public void uploadLogs(String operationID, JSONObject options, UniJSCallback callback) { 1385 | UploadLogProgress uploadLogProgress = new UploadLogProgress() { 1386 | @Override 1387 | public void onProgress(long current, long size) { 1388 | Map params = new HashMap(); 1389 | JSONObject data = new JSONObject(); 1390 | data.put("current", current); 1391 | data.put("size", size); 1392 | params.put("data", data); 1393 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("uploadLogsProgress", params); 1394 | } 1395 | }; 1396 | Open_im_sdk.uploadLogs(new BaseImpl(callback), operationID, options.getInteger("line"), options.getString("ex"), uploadLogProgress); 1397 | } 1398 | 1399 | @UniJSMethod( 1400 | uiThread = false 1401 | ) 1402 | public void logs(String operationID, JSONObject options, UniJSCallback callback) { 1403 | Open_im_sdk.logs(new BaseImpl(callback), operationID, options.getLong("logLevel"), options.getString("file"), options.getInteger("line"), options.getString("msgs"), options.getString("err"), options.getString("keyAndValue")); 1404 | } 1405 | 1406 | @UniJSMethod( 1407 | uiThread = false 1408 | ) 1409 | public String getSdkVersion() { 1410 | return Open_im_sdk.getSdkVersion(); 1411 | } 1412 | 1413 | @UniJSMethod( 1414 | uiThread = false 1415 | ) 1416 | public void uploadFile(String operationID, JSONObject reqData,UniJSCallback callback) { 1417 | UploadFileCallback uploadFileCallback = new UploadFileCallback() { 1418 | @Override 1419 | public void complete(long l, String s, long l1) { 1420 | 1421 | } 1422 | 1423 | @Override 1424 | public void hashPartComplete(String s, String s1) { 1425 | 1426 | } 1427 | 1428 | @Override 1429 | public void hashPartProgress(long l, long l1, String s) { 1430 | 1431 | } 1432 | 1433 | @Override 1434 | public void open(long l) { 1435 | 1436 | } 1437 | 1438 | @Override 1439 | public void partSize(long l, long l1) { 1440 | 1441 | } 1442 | 1443 | @Override 1444 | public void uploadComplete(long l, long l1, long l2) { 1445 | Map params = new HashMap(); 1446 | JSONObject data = new JSONObject(); 1447 | data.put("fileSize", l); 1448 | data.put("streamSize", l1); 1449 | data.put("storageSize", l2); 1450 | data.put("operationID", operationID); 1451 | params.put("data", data); 1452 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("uploadComplete", params); 1453 | } 1454 | 1455 | @Override 1456 | public void uploadID(String s) { 1457 | 1458 | } 1459 | 1460 | @Override 1461 | public void uploadPartComplete(long l, long l1, String s) { 1462 | 1463 | } 1464 | }; 1465 | Open_im_sdk.uploadFile(new BaseImpl(callback), operationID, reqData.toJSONString(),uploadFileCallback); 1466 | } 1467 | 1468 | @UniJSMethod( 1469 | uiThread = false 1470 | ) 1471 | public void _setCustomBusinessListener() { 1472 | OnCustomBusinessListener onCustomBusinessListener = new OnCustomBusinessListener() { 1473 | @Override 1474 | public void onRecvCustomBusinessMessage(String s) { 1475 | Map params = new HashMap(); 1476 | params.put("data", JSONObject.parseObject(s)); 1477 | OpenIMSDK.this.mUniSDKInstance.fireGlobalEventCallback("onRecvCustomBusinessMessage", params); 1478 | } 1479 | }; 1480 | Open_im_sdk.setCustomBusinessListener(onCustomBusinessListener); 1481 | } 1482 | } -------------------------------------------------------------------------------- /android/openIM/src/test/java/com/example/openim/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.openim; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/Framework/README.md: -------------------------------------------------------------------------------- 1 | > 需要先拉取[OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core),并按照文档编译生成Android/iOS所需要的aar/Framework,分别引入andorid插件的libs目录下和ios插件的Framework目录下。 -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint OpenIMUniPlugin.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'OpenIMUniPlugin' 11 | s.version = '1.0.0' 12 | s.summary = 'A short description of OpenIMUniPlugin.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | TODO: Add long description of the pod here. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/openimsdk/openim-uni-plugin' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'openim' => 'contact@openim.io' } 28 | s.source = { :git => 'https://github.com/openimsdk/openim-uni-plugin.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.platform = :ios 32 | s.ios.deployment_target = '9.0' 33 | s.requires_arc = true 34 | 35 | s.source_files = 'OpenIMUniPlugin/Classes/**/*' 36 | 37 | s.static_framework = true 38 | s.xcconfig = { 39 | 'USER_HEADER_SEARCH_PATHS' => [ 40 | '"$(SRCROOT)/../../SDK/inc/**"' 41 | ] 42 | } 43 | s.user_target_xcconfig = { 44 | 'ENABLE_BITCODE' => 'NO', 45 | 'EMBEDDED_CONTENT_CONTAINS_SWIFT' => 'NO' 46 | } 47 | s.vendored_frameworks = 'Framework/*.framework' 48 | end 49 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openimsdk/open-im-sdk-uniapp/d7a6a205bcf3da30081ab06cdea5328c18cff00a/ios/OpenIMUniPlugin/OpenIMUniPlugin/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openimsdk/open-im-sdk-uniapp/d7a6a205bcf3da30081ab06cdea5328c18cff00a/ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/.gitkeep -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/CallbackProxy.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "DCUniModule.h" 3 | @import OpenIMCore; 4 | 5 | NS_ASSUME_NONNULL_BEGIN 6 | 7 | @interface CallbackProxy : NSObject 8 | 9 | - (id)initWithCallback:(UniModuleKeepAliveCallback)callback; 10 | 11 | @end 12 | 13 | NS_ASSUME_NONNULL_END 14 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/CallbackProxy.m: -------------------------------------------------------------------------------- 1 | #import "CallbackProxy.h" 2 | @import OpenIMCore; 3 | 4 | @interface CallbackProxy() 5 | 6 | @property (nonatomic, copy) UniModuleKeepAliveCallback callback; 7 | 8 | @end 9 | 10 | @implementation CallbackProxy 11 | 12 | - (id)initWithCallback:(UniModuleKeepAliveCallback)callback { 13 | if (self = [super init]) { 14 | self.callback = callback; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg { 20 | if (errMsg == nil) { 21 | errMsg = @""; 22 | } 23 | [self doCallback:@{@"errMsg": errMsg, @"errCode": @(errCode),@"data":@""}]; 24 | } 25 | 26 | - (void)onSuccess:(NSString * _Nullable)data { 27 | if (data == nil) { 28 | data = @""; 29 | } 30 | [self doCallback:@{@"errMsg": @"", @"errCode": @(0),@"data":data}]; 31 | } 32 | 33 | - (void)doCallback:(NSDictionary *)param { 34 | if (self.callback) { 35 | self.callback(param, false); 36 | self.callback = nil; 37 | } 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/OpenIMModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // OpenIMUniPlugin.h 3 | // OpenIMUniPlugin 4 | // 5 | // Created by blooming on 2022/12/13. 6 | // 7 | 8 | #import 9 | #import "DCUniModule.h" 10 | #import "CallbackProxy.h" 11 | @import OpenIMCore; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface OpenIMModule : DCUniModule 16 | 17 | @property (nonatomic, readwrite) BOOL initFlag; 18 | 19 | - (void)pushEvent:(NSString *) eventName msg:(nullable id) msg; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/OpenIMModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // OpenIMModule.m 3 | // OpenIMUniPlugin 4 | // 5 | // Created by Snow on 2021/6/24. 6 | // 7 | 8 | #import "OpenIMModule.h" 9 | #import "SendMessageCallbackProxy.h" 10 | #import "UploadFileCallbackProxy.h" 11 | #import "UploadLogsCallbackProxy.h" 12 | 13 | #define PUSH_EVENT(param) \ 14 | NSString *funcName = [NSString stringWithFormat:@"%s", __func__]; \ 15 | NSString *eventName = [[funcName stringByReplacingOccurrencesOfString:@":" withString:@" "] componentsSeparatedByString:@" "][1]; \ 16 | [self pushEvent:eventName msg:param]; 17 | 18 | #define PUSH_EVENT_NIL() PUSH_EVENT(nil) 19 | 20 | @implementation NSDictionary (Extensions) 21 | 22 | - (NSString *)json { 23 | NSString *json = nil; 24 | 25 | NSError *error = nil; 26 | NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error]; 27 | json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 28 | 29 | return (error ? nil : json); 30 | } 31 | 32 | @end 33 | 34 | 35 | @implementation NSArray (Extensions) 36 | 37 | - (NSString *)json { 38 | NSString *json = nil; 39 | 40 | NSError *error = nil; 41 | NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error]; 42 | json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 43 | 44 | return (error ? nil : json); 45 | } 46 | 47 | @end 48 | 49 | @implementation NSString (Extensions) 50 | 51 | - (NSString *)json { 52 | return [NSString stringWithFormat:@"\"%@\"",self]; 53 | } 54 | 55 | @end 56 | 57 | @implementation OpenIMModule 58 | 59 | - (void)pushEvent:(NSString *) eventName msg:(nullable id) msg { 60 | NSDictionary *param = @{}; 61 | if ([msg isKindOfClass:NSDictionary.class]) { 62 | param = msg; 63 | } else if (msg != nil) { 64 | param = @{@"msg": msg}; 65 | }else{ 66 | param = @{@"msg": eventName}; 67 | } 68 | NSLog(@"pushEvent ---- %@",eventName); 69 | [self.uniInstance fireGlobalEvent:eventName params:param]; 70 | } 71 | 72 | // MARK: - Init & Login 73 | 74 | UNI_EXPORT_METHOD_SYNC(@selector(initSDK:config:)) 75 | 76 | - (BOOL)initSDK:(NSString *)opid config:(NSDictionary *)config { 77 | NSLog(@"initSDK ---- %@", [config json]); 78 | if(self.initFlag) return true; 79 | 80 | NSMutableDictionary *newConfig = [config mutableCopy]; 81 | [newConfig setObject:@1 forKey:@"platformID"]; 82 | NSLog(@"newConfig ---- %@", [newConfig json]); 83 | 84 | BOOL flag = Open_im_sdkInitSDK(self, opid, [newConfig json]); 85 | if (flag) { 86 | Open_im_sdkSetUserListener(self); 87 | Open_im_sdkSetConversationListener(self); 88 | Open_im_sdkSetAdvancedMsgListener(self); 89 | Open_im_sdkSetBatchMsgListener(self); 90 | Open_im_sdkSetFriendListener(self); 91 | Open_im_sdkSetGroupListener(self); 92 | Open_im_sdkSetCustomBusinessListener(self); 93 | } 94 | self.initFlag = flag; 95 | return flag; 96 | } 97 | 98 | UNI_EXPORT_METHOD_SYNC(@selector(unInitSDK)) 99 | 100 | - (void)unInitSDK:(NSString *)opid { 101 | Open_im_sdkUnInitSDK(opid); 102 | } 103 | 104 | UNI_EXPORT_METHOD(@selector(login:options:callback:)) 105 | 106 | - (void)login:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 107 | Open_im_sdkGetLoginStatus(opid); 108 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 109 | Open_im_sdkLogin(proxy,opid,[options valueForKey:@"userID"],[options valueForKey:@"token"]); 110 | } 111 | 112 | UNI_EXPORT_METHOD(@selector(logout:callback:)) 113 | 114 | - (void)logout:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 115 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 116 | Open_im_sdkLogout(proxy,opid); 117 | } 118 | 119 | UNI_EXPORT_METHOD(@selector(setAppBackgroundStatus:isBackground:callback:)) 120 | 121 | - (void)setAppBackgroundStatus:(NSString *)opid isBackground:(BOOL)isBackground callback:(UniModuleKeepAliveCallback)callback { 122 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 123 | Open_im_sdkSetAppBackgroundStatus(proxy,opid,isBackground); 124 | } 125 | 126 | UNI_EXPORT_METHOD(@selector(networkStatusChanged:callback:)) 127 | 128 | - (void)networkStatusChanged:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 129 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 130 | Open_im_sdkNetworkStatusChanged(proxy,opid); 131 | } 132 | 133 | UNI_EXPORT_METHOD_SYNC(@selector(getLoginStatus)) 134 | 135 | - (long)getLoginStatus { 136 | return Open_im_sdkGetLoginStatus(@"opid"); 137 | } 138 | 139 | UNI_EXPORT_METHOD_SYNC(@selector(getLoginUserID)) 140 | 141 | - (NSString *)getLoginUserID { 142 | return Open_im_sdkGetLoginUserID(); 143 | } 144 | 145 | 146 | // MARK: - User 147 | 148 | UNI_EXPORT_METHOD(@selector(getUsersInfo:userIDList:callback:)) 149 | 150 | - (void)getUsersInfo:(NSString *)opid userIDList:(NSArray *)userIDList callback:(UniModuleKeepAliveCallback)callback { 151 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 152 | Open_im_sdkGetUsersInfo(proxy,opid,[userIDList json]); 153 | } 154 | 155 | UNI_EXPORT_METHOD(@selector(setSelfInfo:userInfo:callback:)) 156 | 157 | - (void)setSelfInfo:(NSString *)opid userInfo:(NSDictionary*)userInfo callback:(UniModuleKeepAliveCallback)callback { 158 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 159 | Open_im_sdkSetSelfInfo(proxy,opid,[userInfo json]); 160 | } 161 | 162 | UNI_EXPORT_METHOD(@selector(getSelfUserInfo:callback:)) 163 | 164 | - (void)getSelfUserInfo:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 165 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 166 | Open_im_sdkGetSelfUserInfo(proxy,opid); 167 | } 168 | 169 | UNI_EXPORT_METHOD(@selector(getUserStatus:userIDList:callback:)) 170 | 171 | - (void)getUserStatus:(NSString *)opid userIDList:(NSArray *)userIDList callback:(UniModuleKeepAliveCallback)callback { 172 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 173 | Open_im_sdkGetUserStatus(proxy,opid,[userIDList json]); 174 | } 175 | 176 | UNI_EXPORT_METHOD(@selector(subscribeUsersStatus:userIDList:callback:)) 177 | 178 | - (void)subscribeUsersStatus:(NSString *)opid userIDList:(NSArray *)userIDList callback:(UniModuleKeepAliveCallback)callback { 179 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 180 | Open_im_sdkSubscribeUsersStatus(proxy,opid,[userIDList json]); 181 | } 182 | 183 | UNI_EXPORT_METHOD(@selector(unsubscribeUsersStatus:userIDList:callback:)) 184 | 185 | - (void)unsubscribeUsersStatus:(NSString *)opid userIDList:(NSArray *)userIDList callback:(UniModuleKeepAliveCallback)callback { 186 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 187 | Open_im_sdkUnsubscribeUsersStatus(proxy,opid,[userIDList json]); 188 | } 189 | 190 | UNI_EXPORT_METHOD(@selector(getSubscribeUsersStatus:callback:)) 191 | 192 | - (void)getSubscribeUsersStatus:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 193 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 194 | Open_im_sdkGetSubscribeUsersStatus(proxy,opid); 195 | } 196 | 197 | // MARK: - Conversation & Message 198 | 199 | UNI_EXPORT_METHOD(@selector(getAllConversationList:callback:)) 200 | 201 | - (void)getAllConversationList:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 202 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 203 | Open_im_sdkGetAllConversationList(proxy,opid); 204 | } 205 | 206 | UNI_EXPORT_METHOD(@selector(getConversationListSplit:options:callback:)) 207 | 208 | - (void)getConversationListSplit:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 209 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 210 | Open_im_sdkGetConversationListSplit(proxy,opid,[[options valueForKey:@"offset"] longValue], [[options valueForKey:@"count"] longValue]); 211 | } 212 | 213 | 214 | UNI_EXPORT_METHOD(@selector(getOneConversation:options:callback:)) 215 | 216 | - (void)getOneConversation:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 217 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 218 | Open_im_sdkGetOneConversation(proxy,opid, [[options valueForKey:@"sessionType"] intValue], [options valueForKey:@"sourceID"]); 219 | } 220 | 221 | UNI_EXPORT_METHOD(@selector(getMultipleConversation:conversationIDList:callback:)) 222 | 223 | - (void)getMultipleConversation:(NSString *)opid conversationIDList:(NSArray *)conversationIDList callback:(UniModuleKeepAliveCallback)callback { 224 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 225 | Open_im_sdkGetMultipleConversation(proxy, opid, [conversationIDList json]); 226 | } 227 | 228 | 229 | UNI_EXPORT_METHOD(@selector(setGlobalRecvMessageOpt:opt:callback:)) 230 | 231 | - (void)setGlobalRecvMessageOpt:(NSString *)opid opt:(long)opt callback:(UniModuleKeepAliveCallback)callback { 232 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 233 | NSDictionary *param = @{ 234 | @"globalRecvMsgOpt":@(opt), 235 | }; 236 | Open_im_sdkSetSelfInfo(proxy,opid,[param json]); 237 | } 238 | 239 | UNI_EXPORT_METHOD(@selector(hideConversation:conversationID:callback:)) 240 | 241 | - (void)hideConversation:(NSString *)opid conversationID:(NSString *)conversationID callback:(UniModuleKeepAliveCallback)callback { 242 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 243 | Open_im_sdkHideConversation(proxy,opid,conversationID); 244 | } 245 | 246 | //UNI_EXPORT_METHOD(@selector(getConversationRecvMessageOpt:conversationIDList:callback:)) 247 | // 248 | //- (void)getConversationRecvMessageOpt:(NSString *)opid conversationIDList:(NSArray *)conversationIDList callback:(UniModuleKeepAliveCallback)callback { 249 | // CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 250 | // Open_im_sdkGetConversationRecvMessageOpt(proxy, opid, [conversationIDList json]); 251 | //} 252 | 253 | // UNI_EXPORT_METHOD(@selector(deleteAllConversationFromLocal:callback:)) 254 | 255 | // - (void)deleteAllConversationFromLocal:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 256 | // CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 257 | // Open_im_sdkDeleteAllConversationFromLocal(proxy, opid); 258 | // } 259 | 260 | UNI_EXPORT_METHOD(@selector(setConversation:options:callback:)) 261 | 262 | - (void)setConversation:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 263 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 264 | Open_im_sdkSetConversation(proxy,opid, [options valueForKey:@"conversationID"],[options json]); 265 | } 266 | 267 | UNI_EXPORT_METHOD(@selector(setConversationDraft:options:callback:)) 268 | 269 | - (void)setConversationDraft:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 270 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 271 | Open_im_sdkSetConversationDraft(proxy,opid, [options valueForKey:@"conversationID"],[options valueForKey:@"draftText"]); 272 | } 273 | 274 | UNI_EXPORT_METHOD(@selector(resetConversationGroupAtType:conversationID:callback:)) 275 | 276 | - (void)resetConversationGroupAtType:(NSString *)opid conversationID:(NSString *)conversationID callback:(UniModuleKeepAliveCallback)callback { 277 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 278 | NSDictionary *param = @{ 279 | @"groupAtType":@(0), 280 | }; 281 | Open_im_sdkSetConversation(proxy,opid,conversationID,[param json]); 282 | } 283 | 284 | UNI_EXPORT_METHOD(@selector(pinConversation:options:callback:)) 285 | 286 | - (void)pinConversation:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 287 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 288 | NSDictionary *param = @{ 289 | @"isPinned":options[@"isPinned"], 290 | }; 291 | Open_im_sdkSetConversation(proxy,opid, [options valueForKey:@"conversationID"], [param json]); 292 | } 293 | 294 | UNI_EXPORT_METHOD(@selector(setConversationPrivateChat:options:callback:)) 295 | 296 | - (void)setConversationPrivateChat:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 297 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 298 | NSDictionary *param = @{ 299 | @"isPrivateChat":options[@"isPrivate"], 300 | }; 301 | Open_im_sdkSetConversation(proxy,opid, [options valueForKey:@"conversationID"], [param json]); 302 | } 303 | 304 | 305 | UNI_EXPORT_METHOD(@selector(setConversationBurnDuration:options:callback:)) 306 | 307 | - (void)setConversationBurnDuration:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 308 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 309 | NSDictionary *param = @{ 310 | @"burnDuration":options[@"burnDuration"], 311 | }; 312 | Open_im_sdkSetConversation(proxy,opid,[options valueForKey:@"conversationID"], [param json]); 313 | } 314 | 315 | UNI_EXPORT_METHOD(@selector(setConversationRecvMessageOpt:options:callback:)) 316 | 317 | - (void)setConversationRecvMessageOpt:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 318 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 319 | NSDictionary *param = @{ 320 | @"recvMsgOpt":options[@"opt"], 321 | }; 322 | Open_im_sdkSetConversation(proxy, opid, [options valueForKey:@"conversationID"], [param json]); 323 | } 324 | 325 | UNI_EXPORT_METHOD(@selector(getTotalUnreadMsgCount:callback:)) 326 | 327 | - (void)getTotalUnreadMsgCount:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 328 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 329 | Open_im_sdkGetTotalUnreadMsgCount(proxy,opid); 330 | } 331 | 332 | UNI_EXPORT_METHOD(@selector(getAtAllTag:callback:)) 333 | 334 | - (NSString *)getAtAllTag:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 335 | return Open_im_sdkGetAtAllTag(opid); 336 | } 337 | 338 | UNI_EXPORT_METHOD(@selector(createAdvancedTextMessage:options:callback:)) 339 | 340 | - (NSString *)createAdvancedTextMessage:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 341 | NSArray* messageEntityList = [options valueForKey:@"messageEntityList"]; 342 | return Open_im_sdkCreateAdvancedTextMessage(opid,[options valueForKey:@"text"],[messageEntityList json]); 343 | } 344 | 345 | UNI_EXPORT_METHOD_SYNC(@selector(createTextAtMessage:options:)) 346 | 347 | - (NSString *)createTextAtMessage:(NSString *)opid options:(NSDictionary *)options { 348 | NSArray* atUserIDList = [options valueForKey:@"atUserIDList"]; 349 | NSArray* atUsersInfo = [options valueForKey:@"atUsersInfo"]; 350 | NSDictionary* message = [options valueForKey:@"message"]; 351 | NSString *messageJson = @""; 352 | if ([[options allKeys] containsObject:@"message"]) { 353 | if ([message isKindOfClass:[NSDictionary class]]) { 354 | messageJson = [message json]; 355 | } 356 | } 357 | return Open_im_sdkCreateTextAtMessage(opid,[options valueForKey: @"text"], [atUserIDList json],[atUsersInfo json],messageJson); 358 | } 359 | 360 | UNI_EXPORT_METHOD_SYNC(@selector(createTextMessage:textMsg:)) 361 | 362 | - (NSString *)createTextMessage:(NSString *)opid textMsg:(NSString *)textMsg { 363 | return Open_im_sdkCreateTextMessage(opid,textMsg); 364 | } 365 | 366 | UNI_EXPORT_METHOD_SYNC(@selector(createLocationMessage:options:)) 367 | 368 | - (NSString *)createLocationMessage:(NSString *)opid options:(NSDictionary *)options { 369 | return Open_im_sdkCreateLocationMessage(opid,[options valueForKey: @"description"], [[options valueForKey: @"longitude"] doubleValue], [[options valueForKey: @"latitude"] doubleValue]); 370 | } 371 | 372 | UNI_EXPORT_METHOD_SYNC(@selector(createCustomMessage:options:)) 373 | 374 | - (NSString *)createCustomMessage:(NSString *)opid options:(NSDictionary*)options { 375 | return Open_im_sdkCreateCustomMessage(opid,[options valueForKey:@"data"], [options valueForKey:@"extension"], [options valueForKey:@"description"]); 376 | } 377 | 378 | UNI_EXPORT_METHOD_SYNC(@selector(createQuoteMessage:options:)) 379 | 380 | - (NSString *)createQuoteMessage:(NSString *)opid options:(NSDictionary *)options { 381 | NSDictionary* message = [options valueForKey:@"message"]; 382 | return Open_im_sdkCreateQuoteMessage(opid,[options valueForKey:@"text"], [message json]); 383 | } 384 | 385 | UNI_EXPORT_METHOD_SYNC(@selector(createAdvancedQuoteMessage:options:)) 386 | 387 | - (NSString *)createAdvancedQuoteMessage:(NSString *)opid options:(NSDictionary *)options { 388 | NSDictionary* message = [options valueForKey:@"message"]; 389 | NSArray* messageEntityList = [options valueForKey:@"messageEntityList"]; 390 | return Open_im_sdkCreateAdvancedQuoteMessage(opid,[options valueForKey:@"text"], [message json],[messageEntityList json]); 391 | } 392 | 393 | UNI_EXPORT_METHOD_SYNC(@selector(createCardMessage:cardDesc:)) 394 | 395 | - (NSString *)createCardMessage:(NSString *)opid cardDesc:(NSDictionary *)cardDesc { 396 | return Open_im_sdkCreateCardMessage(opid,[cardDesc json]); 397 | } 398 | 399 | UNI_EXPORT_METHOD_SYNC(@selector(createImageMessage:imagePath:)) 400 | 401 | - (NSString *)createImageMessage:(NSString *)opid imagePath:(NSString *)imagePath { 402 | return Open_im_sdkCreateImageMessage(opid,imagePath); 403 | } 404 | 405 | UNI_EXPORT_METHOD_SYNC(@selector(createImageMessageFromFullPath:imagePath:)) 406 | 407 | - (NSString *)createImageMessageFromFullPath:(NSString *)opid imagePath:(NSString *)imagePath { 408 | return Open_im_sdkCreateImageMessageFromFullPath(opid,imagePath); 409 | } 410 | 411 | 412 | UNI_EXPORT_METHOD_SYNC(@selector(createImageMessageByURL:options:)) 413 | 414 | - (NSString *)createImageMessageByURL:(NSString *)opid options:(NSDictionary *)options { 415 | NSDictionary* sourcePicture = [options valueForKey:@"sourcePicture"]; 416 | NSDictionary* bigPicture = [options valueForKey:@"bigPicture"]; 417 | NSDictionary* snapshotPicture = [options valueForKey:@"snapshotPicture"]; 418 | return Open_im_sdkCreateImageMessageByURL(opid, [options valueForKey:@"sourcePath"], [sourcePicture json], [bigPicture json], [snapshotPicture json]); 419 | } 420 | 421 | UNI_EXPORT_METHOD_SYNC(@selector(createSoundMessage:options:)) 422 | 423 | - (NSString *)createSoundMessage:(NSString *)opid options:(NSDictionary *)options { 424 | return Open_im_sdkCreateSoundMessage(opid,[options valueForKey:@"soundPath"], [[options valueForKey:@"duration"] intValue]); 425 | } 426 | 427 | UNI_EXPORT_METHOD_SYNC(@selector(createSoundMessageFromFullPath:options:)) 428 | 429 | - (NSString *)createSoundMessageFromFullPath:(NSString *)opid options:(NSDictionary *)options { 430 | return Open_im_sdkCreateSoundMessageFromFullPath(opid,[options valueForKey:@"soundPath"], [[options valueForKey:@"duration"] intValue]); 431 | } 432 | 433 | UNI_EXPORT_METHOD_SYNC(@selector(createSoundMessageByURL:soundInfo:)) 434 | 435 | - (NSString *)createSoundMessageByURL:(NSString *)opid soundInfo:(NSDictionary *)soundInfo { 436 | return Open_im_sdkCreateSoundMessageByURL(opid,[soundInfo json]); 437 | } 438 | 439 | UNI_EXPORT_METHOD_SYNC(@selector(createVideoMessage:options:)) 440 | 441 | - (NSString *)createVideoMessage:(NSString *)opid options:(NSDictionary *)options { 442 | 443 | return Open_im_sdkCreateVideoMessage(opid,[options valueForKey:@"videoPath"], [options valueForKey:@"videoType"], [[options valueForKey:@"duration"] integerValue], [options valueForKey:@"snapshotPath"]); 444 | } 445 | 446 | UNI_EXPORT_METHOD_SYNC(@selector(createVideoMessageFromFullPath:options:)) 447 | 448 | - (NSString *)createVideoMessageFromFullPath:(NSString *)opid options:(NSDictionary *)options { 449 | return Open_im_sdkCreateVideoMessageFromFullPath(opid,[options valueForKey:@"videoPath"], [options valueForKey:@"videoType"], [[options valueForKey:@"duration"] integerValue], [options valueForKey:@"snapshotPath"]); 450 | } 451 | 452 | UNI_EXPORT_METHOD_SYNC(@selector(createVideoMessageByURL:videoInfo:)) 453 | 454 | - (NSString *)createVideoMessageByURL:(NSString *)opid videoInfo:(NSDictionary *)videoInfo { 455 | return Open_im_sdkCreateVideoMessageByURL(opid,[videoInfo json]); 456 | } 457 | 458 | UNI_EXPORT_METHOD_SYNC(@selector(createFileMessage:options:)) 459 | 460 | - (NSString *)createFileMessage:(NSString *)opid options:(NSDictionary *)options { 461 | return Open_im_sdkCreateFileMessage(opid,[options valueForKey:@"filePath"], [options valueForKey:@"fileName"]); 462 | } 463 | 464 | UNI_EXPORT_METHOD_SYNC(@selector(createFileMessageFromFullPath:options:)) 465 | 466 | - (NSString *)createFileMessageFromFullPath:(NSString *)opid options:(NSDictionary *)options { 467 | return Open_im_sdkCreateFileMessageFromFullPath(opid,[options valueForKey:@"filePath"], [options valueForKey:@"fileName"]); 468 | } 469 | 470 | UNI_EXPORT_METHOD_SYNC(@selector(createFileMessageByURL:fileInfo:)) 471 | 472 | - (NSString *)createFileMessageByURL:(NSString *)opid fileInfo:(NSDictionary *)fileInfo { 473 | return Open_im_sdkCreateFileMessageByURL(opid,[fileInfo json]); 474 | } 475 | 476 | UNI_EXPORT_METHOD_SYNC(@selector(createMergerMessage:options:)) 477 | 478 | - (NSString *)createMergerMessage:(NSString *)opid options:(NSDictionary *)options { 479 | NSArray* messageList = [options valueForKey:@"messageList"]; 480 | NSArray* summaryList = [options valueForKey:@"summaryList"]; 481 | return Open_im_sdkCreateMergerMessage(opid,[messageList json], [options valueForKey:@"title"], [summaryList json]); 482 | } 483 | 484 | UNI_EXPORT_METHOD_SYNC(@selector(createFaceMessage:options:)) 485 | 486 | - (NSString *)createFaceMessage:(NSString *)opid options:(NSDictionary *)options { 487 | return Open_im_sdkCreateFaceMessage(opid,[[options valueForKey:@"index"] longValue], [options valueForKey:@"dataStr"]); 488 | } 489 | 490 | UNI_EXPORT_METHOD_SYNC(@selector(createForwardMessage:message:)) 491 | 492 | - (NSString *)createForwardMessage:(NSString *)opid message:(NSDictionary *)message { 493 | return Open_im_sdkCreateForwardMessage(opid,[message json]); 494 | } 495 | 496 | 497 | UNI_EXPORT_METHOD_SYNC(@selector(getConversationIDBySessionType:options:)) 498 | 499 | - (NSString *)getConversationIDBySessionType:(NSString *)opid options:(NSDictionary *)options { 500 | return Open_im_sdkGetConversationIDBySessionType(opid,[options valueForKey:@"sourceID"],[[options valueForKey:@"sessionType"] longValue]); 501 | } 502 | 503 | UNI_EXPORT_METHOD(@selector(sendMessage:options:callback:)) 504 | 505 | - (void)sendMessage:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 506 | NSDictionary* message = [options valueForKey:@"message"]; 507 | NSDictionary* offlinePushInfo = [options valueForKey:@"offlinePushInfo"]; 508 | NSNumber* isOnlineOnlyNumber = [options valueForKey:@"isOnlineOnly"]; 509 | BOOL isOnlineOnly = [isOnlineOnlyNumber boolValue]; 510 | SendMessageCallbackProxy *proxy = [[SendMessageCallbackProxy alloc] initWithMessage:message module:self callback:callback]; 511 | Open_im_sdkSendMessage(proxy,opid, [message json], [options valueForKey:@"recvID"], [options valueForKey:@"groupID"], [offlinePushInfo json],isOnlineOnly); 512 | } 513 | 514 | UNI_EXPORT_METHOD(@selector(sendMessageNotOss:options:callback:)) 515 | 516 | - (void)sendMessageNotOss:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 517 | NSDictionary* message = [options valueForKey:@"message"]; 518 | NSDictionary* offlinePushInfo = [options valueForKey:@"offlinePushInfo"]; 519 | NSNumber* isOnlineOnlyNumber = [options valueForKey:@"isOnlineOnly"]; 520 | BOOL isOnlineOnly = [isOnlineOnlyNumber boolValue]; 521 | 522 | SendMessageCallbackProxy *proxy = [[SendMessageCallbackProxy alloc] initWithMessage:message module:self callback:callback]; 523 | Open_im_sdkSendMessageNotOss(proxy,opid, [message json], [options valueForKey:@"recvID"], [options valueForKey:@"groupID"], [offlinePushInfo json], isOnlineOnly); 524 | } 525 | 526 | UNI_EXPORT_METHOD(@selector(findMessageList:findOptions:callback:)) 527 | 528 | - (void)findMessageList:(NSString *)opid findOptions:(NSArray *)findOptions callback:(UniModuleKeepAliveCallback)callback { 529 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 530 | Open_im_sdkFindMessageList(proxy, opid,[findOptions json]); 531 | } 532 | 533 | UNI_EXPORT_METHOD(@selector(getAdvancedHistoryMessageList:messageOptions:callback:)) 534 | 535 | - (void)getAdvancedHistoryMessageList:(NSString *)opid messageOptions:(NSDictionary *)messageOptions callback:(UniModuleKeepAliveCallback)callback { 536 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 537 | Open_im_sdkGetAdvancedHistoryMessageList(proxy,opid, [messageOptions json]); 538 | } 539 | 540 | UNI_EXPORT_METHOD(@selector(getAdvancedHistoryMessageListReverse:messageOptions:callback:)) 541 | 542 | - (void)getAdvancedHistoryMessageListReverse:(NSString *)opid messageOptions:(NSDictionary *)messageOptions callback:(UniModuleKeepAliveCallback)callback { 543 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 544 | Open_im_sdkGetAdvancedHistoryMessageListReverse(proxy,opid, [messageOptions json]); 545 | } 546 | 547 | UNI_EXPORT_METHOD(@selector(revokeMessage:options:callback:)) 548 | 549 | - (void)revokeMessage:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 550 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 551 | Open_im_sdkRevokeMessage(proxy,opid, [options valueForKey:@"conversationID"], [options valueForKey:@"clientMsgID"]); 552 | } 553 | 554 | UNI_EXPORT_METHOD(@selector(typingStatusUpdate:options:callback:)) 555 | 556 | - (void)typingStatusUpdate:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 557 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 558 | Open_im_sdkTypingStatusUpdate(proxy,opid,[options valueForKey:@"recvID"], [options valueForKey:@"msgTip"]); 559 | } 560 | 561 | UNI_EXPORT_METHOD(@selector(changeInputStates:options:callback:)) 562 | 563 | - (void)changeInputStates:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 564 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 565 | Open_im_sdkChangeInputStates(proxy,opid,[options valueForKey:@"conversationID"], [[options valueForKey:@"focus"] boolValue]); 566 | } 567 | 568 | UNI_EXPORT_METHOD(@selector(getInputStates:options:callback:)) 569 | 570 | - (void)getInputStates:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 571 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 572 | Open_im_sdkGetInputStates(proxy,opid,[options valueForKey:@"conversationID"], [options valueForKey:@"userID"]); 573 | } 574 | 575 | UNI_EXPORT_METHOD(@selector(markConversationMessageAsRead:conversationID:callback:)) 576 | 577 | - (void)markConversationMessageAsRead:(NSString *)opid conversationID:(NSString *)conversationID callback:(UniModuleKeepAliveCallback)callback { 578 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 579 | Open_im_sdkMarkConversationMessageAsRead(proxy,opid,conversationID); 580 | } 581 | 582 | UNI_EXPORT_METHOD(@selector(markMessagesAsReadByMsgID:options:callback:)) 583 | 584 | - (void)markMessagesAsReadByMsgID:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 585 | NSArray* clientMsgIDList = [options valueForKey:@"clientMsgIDList"]; 586 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 587 | Open_im_sdkMarkMessagesAsReadByMsgID(proxy,opid, [options valueForKey:@"conversationID"], [clientMsgIDList json]); 588 | } 589 | 590 | UNI_EXPORT_METHOD(@selector(deleteMessageFromLocalStorage:coptions:callback:)) 591 | 592 | - (void)deleteMessageFromLocalStorage:(NSString *)opid coptions:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 593 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 594 | Open_im_sdkDeleteMessageFromLocalStorage(proxy,opid, [options valueForKey:@"conversationID"],[options valueForKey:@"clientMsgID"]); 595 | } 596 | 597 | UNI_EXPORT_METHOD(@selector(deleteMessage:options:callback:)) 598 | 599 | - (void)deleteMessage:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 600 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 601 | Open_im_sdkDeleteMessage(proxy,opid, [options valueForKey:@"conversationID"],[options valueForKey:@"clientMsgID"]); 602 | } 603 | 604 | // UNI_EXPORT_METHOD(@selector(deleteConversationFromLocal:conversationID:callback:)) 605 | 606 | // - (void)deleteConversationFromLocal:(NSString *)opid conversationID:(NSString *)conversationID callback:(UniModuleKeepAliveCallback)callback { 607 | // CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 608 | // Open_im_sdkDeleteConversationFromLocal(proxy, opid,conversationID); 609 | // } 610 | 611 | UNI_EXPORT_METHOD(@selector(deleteAllMsgFromLocalAndSvr:callback:)) 612 | 613 | - (void)deleteAllMsgFromLocalAndSvr:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 614 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 615 | Open_im_sdkDeleteAllMsgFromLocalAndSvr(proxy,opid); 616 | } 617 | 618 | UNI_EXPORT_METHOD(@selector(deleteAllMsgFromLocal:callback:)) 619 | 620 | - (void)deleteAllMsgFromLocal:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 621 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 622 | Open_im_sdkDeleteAllMsgFromLocal(proxy,opid); 623 | } 624 | 625 | UNI_EXPORT_METHOD(@selector(clearConversationAndDeleteAllMsg:conversationID:callback:)) 626 | 627 | - (void)clearConversationAndDeleteAllMsg:(NSString *)opid conversationID:(NSString *)conversationID callback:(UniModuleKeepAliveCallback)callback { 628 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 629 | Open_im_sdkClearConversationAndDeleteAllMsg(proxy,opid,conversationID); 630 | } 631 | 632 | UNI_EXPORT_METHOD(@selector(deleteConversationAndDeleteAllMsg:conversationID:callback:)) 633 | 634 | - (void)deleteConversationAndDeleteAllMsg:(NSString *)opid conversationID:(NSString *)conversationID callback:(UniModuleKeepAliveCallback)callback { 635 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 636 | Open_im_sdkDeleteConversationAndDeleteAllMsg(proxy,opid,conversationID); 637 | } 638 | 639 | UNI_EXPORT_METHOD(@selector(insertSingleMessageToLocalStorage:options:callback:)) 640 | 641 | - (void)insertSingleMessageToLocalStorage:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 642 | NSDictionary *message = [options valueForKey:@"message"]; 643 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 644 | Open_im_sdkInsertSingleMessageToLocalStorage(proxy,opid, [message json], [options valueForKey:@"recvID"], [options valueForKey:@"sendID"]); 645 | } 646 | 647 | UNI_EXPORT_METHOD(@selector(insertGroupMessageToLocalStorage:options:callback:)) 648 | 649 | - (void)insertGroupMessageToLocalStorage:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 650 | NSDictionary *message = [options valueForKey:@"message"]; 651 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 652 | Open_im_sdkInsertGroupMessageToLocalStorage(proxy,opid, [message json], [options valueForKey:@"recvID"], [options valueForKey:@"sendID"]); 653 | } 654 | 655 | UNI_EXPORT_METHOD(@selector(searchLocalMessages:searchParam:callback:)) 656 | 657 | - (void)searchLocalMessages:(NSString *)opid searchParam:(NSDictionary *)searchParam callback:(UniModuleKeepAliveCallback)callback { 658 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 659 | Open_im_sdkSearchLocalMessages(proxy, opid, [searchParam json]); 660 | } 661 | 662 | UNI_EXPORT_METHOD(@selector(setMessageLocalEx:options:callback:)) 663 | 664 | - (void)setMessageLocalEx:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 665 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 666 | Open_im_sdkSetMessageLocalEx(proxy,opid,[options valueForKey:@"conversationID"],[options valueForKey:@"clientMsgID"],[options valueForKey:@"localEx"]); 667 | } 668 | 669 | // MARK: - Friend 670 | 671 | UNI_EXPORT_METHOD(@selector(getSpecifiedFriendsInfo:options:callback:)) 672 | 673 | - (void)getSpecifiedFriendsInfo:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 674 | NSArray *userIDList = [options valueForKey:@"userIDList"]; 675 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 676 | Open_im_sdkGetSpecifiedFriendsInfo(proxy, opid,[userIDList json],[[options valueForKey:@"filterBlack"] boolValue]); 677 | } 678 | 679 | UNI_EXPORT_METHOD(@selector(getFriendList:filterBlack:callback:)) 680 | 681 | - (void)getFriendList:(NSString *)opid filterBlack:(BOOL)filterBlack callback:(UniModuleKeepAliveCallback)callback { 682 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 683 | Open_im_sdkGetFriendList(proxy,opid,filterBlack); 684 | } 685 | 686 | UNI_EXPORT_METHOD(@selector(getFriendListPage:options:callback:)) 687 | 688 | - (void)getFriendListPage:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 689 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 690 | Open_im_sdkGetFriendListPage(proxy,opid,[[options valueForKey:@"offset"] intValue],[[options valueForKey:@"count"] intValue],[[options valueForKey:@"filterBlack"] boolValue]); 691 | } 692 | 693 | UNI_EXPORT_METHOD(@selector(searchFriends:options:callback:)) 694 | 695 | - (void)searchFriends:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 696 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 697 | Open_im_sdkSearchFriends(proxy,opid, [options json]); 698 | } 699 | 700 | UNI_EXPORT_METHOD(@selector(checkFriend:userIdList:callback:)) 701 | 702 | - (void)checkFriend:(NSString *)opid userIdList:(NSArray *)userIdList callback:(UniModuleKeepAliveCallback)callback { 703 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 704 | Open_im_sdkCheckFriend(proxy,opid, [userIdList json]); 705 | } 706 | 707 | 708 | UNI_EXPORT_METHOD(@selector(addFriend:userIDReqMsg:callback:)) 709 | 710 | - (void)addFriend:(NSString *)opid userIDReqMsg:(NSDictionary *)userIDReqMsg callback:(UniModuleKeepAliveCallback)callback { 711 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 712 | Open_im_sdkAddFriend(proxy,opid, [userIDReqMsg json]); 713 | } 714 | 715 | UNI_EXPORT_METHOD(@selector(updateFriends:options:callback:)) 716 | 717 | - (void)updateFriends:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 718 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 719 | Open_im_sdkUpdateFriends(proxy, opid, [options json]); 720 | } 721 | 722 | UNI_EXPORT_METHOD(@selector(setFriendRemark:options:callback:)) 723 | 724 | - (void)setFriendRemark:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 725 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 726 | NSArray *friendUserIDs = @[options[@"toUserID"]]; 727 | NSDictionary *param = @{ 728 | @"friendUserIDs":friendUserIDs, 729 | @"remark":options[@"remark"], 730 | }; 731 | Open_im_sdkUpdateFriends(proxy, opid,[param json]); 732 | } 733 | 734 | UNI_EXPORT_METHOD(@selector(deleteFriend:friendUserID:callback:)) 735 | 736 | - (void)deleteFriend:(NSString *)opid friendUserID:(NSString *)friendUserID callback:(UniModuleKeepAliveCallback)callback { 737 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 738 | Open_im_sdkDeleteFriend(proxy, opid, friendUserID ); 739 | } 740 | 741 | UNI_EXPORT_METHOD(@selector(getFriendApplicationListAsRecipient:callback:)) 742 | 743 | - (void)getFriendApplicationListAsRecipient:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 744 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 745 | Open_im_sdkGetFriendApplicationListAsRecipient(proxy,opid); 746 | } 747 | 748 | UNI_EXPORT_METHOD(@selector(getFriendApplicationListAsApplicant:callback:)) 749 | 750 | - (void)getFriendApplicationListAsApplicant:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 751 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 752 | Open_im_sdkGetFriendApplicationListAsApplicant(proxy,opid); 753 | } 754 | 755 | UNI_EXPORT_METHOD(@selector(acceptFriendApplication:userIDHandleMsg:callback:)) 756 | 757 | - (void)acceptFriendApplication:(NSString *)opid userIDHandleMsg:(NSDictionary *)userIDHandleMsg callback:(UniModuleKeepAliveCallback)callback { 758 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 759 | Open_im_sdkAcceptFriendApplication(proxy,opid, [userIDHandleMsg json]); 760 | } 761 | 762 | UNI_EXPORT_METHOD(@selector(refuseFriendApplication:userIDHandleMsg:callback:)) 763 | 764 | - (void)refuseFriendApplication:(NSString *)opid userIDHandleMsg:(NSDictionary *)userIDHandleMsg callback:(UniModuleKeepAliveCallback)callback { 765 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 766 | Open_im_sdkRefuseFriendApplication(proxy,opid, [userIDHandleMsg json]); 767 | } 768 | 769 | 770 | UNI_EXPORT_METHOD(@selector(addBlack:options:callback:)) 771 | 772 | - (void)addBlack:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 773 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 774 | NSString *ex = [options valueForKey:@"ex"]; 775 | if (ex == nil){ 776 | ex = @""; 777 | } 778 | Open_im_sdkAddBlack(proxy, opid, [options valueForKey:@"toUserID"], ex); 779 | } 780 | 781 | UNI_EXPORT_METHOD(@selector(getBlackList:callback:)) 782 | 783 | - (void)getBlackList:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 784 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 785 | Open_im_sdkGetBlackList(proxy,opid); 786 | } 787 | 788 | UNI_EXPORT_METHOD(@selector(removeBlack:removeUserID:callback:)) 789 | 790 | - (void)removeBlack:(NSString *)opid removeUserID:(NSString *)removeUserID callback:(UniModuleKeepAliveCallback)callback { 791 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 792 | Open_im_sdkRemoveBlack(proxy, opid, removeUserID ); 793 | } 794 | 795 | 796 | // MARK: - Group 797 | 798 | UNI_EXPORT_METHOD(@selector(createGroup:groupBaseInfo:callback:)) 799 | 800 | - (void)createGroup:(NSString *)opid groupBaseInfo:(NSDictionary *)groupBaseInfo callback:(UniModuleKeepAliveCallback)callback { 801 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 802 | Open_im_sdkCreateGroup(proxy,opid,[groupBaseInfo json]); 803 | } 804 | 805 | UNI_EXPORT_METHOD(@selector(joinGroup:options:callback:)) 806 | 807 | - (void)joinGroup:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 808 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 809 | NSString *ex = [options valueForKey:@"ex"]; 810 | if (ex == nil){ 811 | ex = @""; 812 | } 813 | Open_im_sdkJoinGroup(proxy,opid,[options valueForKey:@"groupID"], [options valueForKey:@"reqMsg"],[[options valueForKey:@"joinSource"] intValue], ex); 814 | } 815 | 816 | UNI_EXPORT_METHOD(@selector(quitGroup:groupID:callback:)) 817 | 818 | - (void)quitGroup:(NSString *)opid groupID:(NSString *)groupID callback:(UniModuleKeepAliveCallback)callback { 819 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 820 | Open_im_sdkQuitGroup(proxy,opid, groupID ); 821 | } 822 | 823 | UNI_EXPORT_METHOD(@selector(dismissGroup:groupID:callback:)) 824 | 825 | - (void)dismissGroup:(NSString *)opid groupID:(NSString *)groupID callback:(UniModuleKeepAliveCallback)callback { 826 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 827 | Open_im_sdkDismissGroup(proxy,opid,groupID); 828 | } 829 | 830 | UNI_EXPORT_METHOD(@selector(changeGroupMute:options:callback:)) 831 | 832 | - (void)changeGroupMute:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 833 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 834 | Open_im_sdkChangeGroupMute(proxy,opid,[options valueForKey:@"groupID"],[[options valueForKey:@"isMute"] boolValue]); 835 | } 836 | 837 | UNI_EXPORT_METHOD(@selector(changeGroupMemberMute:options:callback:)) 838 | 839 | - (void)changeGroupMemberMute:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 840 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 841 | Open_im_sdkChangeGroupMemberMute(proxy,opid,[options valueForKey:@"groupID"],[options valueForKey:@"userID"],[[options valueForKey:@"mutedSeconds"] longValue]); 842 | } 843 | 844 | UNI_EXPORT_METHOD(@selector(setGroupMemberRoleLevel:options:callback:)) 845 | 846 | - (void)setGroupMemberRoleLevel:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 847 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 848 | Open_im_sdkSetGroupMemberInfo(proxy,opid, [options json]); 849 | } 850 | 851 | UNI_EXPORT_METHOD(@selector(setGroupMemberInfo:memeberInfo:callback:)) 852 | 853 | - (void)setGroupMemberInfo:(NSString *)opid memeberInfo:(NSDictionary *)memeberInfo callback:(UniModuleKeepAliveCallback)callback { 854 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 855 | Open_im_sdkSetGroupMemberInfo(proxy,opid, [memeberInfo json]); 856 | } 857 | 858 | UNI_EXPORT_METHOD(@selector(getJoinedGroupList:callback:)) 859 | 860 | - (void)getJoinedGroupList:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 861 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 862 | Open_im_sdkGetJoinedGroupList(proxy,opid); 863 | } 864 | 865 | UNI_EXPORT_METHOD(@selector(getJoinedGroupListPage:options:callback:)) 866 | 867 | - (void)getJoinedGroupListPage:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 868 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 869 | Open_im_sdkGetJoinedGroupListPage(proxy,opid,[[options valueForKey:@"offset"] intValue],[[options valueForKey:@"count"] intValue]); 870 | } 871 | 872 | UNI_EXPORT_METHOD(@selector(getSpecifiedGroupsInfo:groupIDList:callback:)) 873 | 874 | - (void)getSpecifiedGroupsInfo:(NSString *)opid groupIDList:(NSArray *)groupIDList callback:(UniModuleKeepAliveCallback)callback { 875 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 876 | Open_im_sdkGetSpecifiedGroupsInfo(proxy,opid,[groupIDList json]); 877 | } 878 | 879 | UNI_EXPORT_METHOD(@selector(searchGroups:options:callback:)) 880 | 881 | - (void)searchGroups:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 882 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 883 | Open_im_sdkSearchGroups(proxy,opid, [options json]); 884 | } 885 | 886 | UNI_EXPORT_METHOD(@selector(setGroupInfo:groupInfo:callback:)) 887 | 888 | - (void)setGroupInfo:(NSString *)opid groupInfo:(NSDictionary *)groupInfo callback:(UniModuleKeepAliveCallback)callback { 889 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 890 | Open_im_sdkSetGroupInfo(proxy,opid,[groupInfo json]); 891 | } 892 | 893 | UNI_EXPORT_METHOD(@selector(setGroupVerification:options:callback:)) 894 | 895 | - (void)setGroupVerification:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 896 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 897 | NSDictionary *param = @{ 898 | @"groupID":options[@"groupID"], 899 | @"needVerification":options[@"verification"], 900 | }; 901 | Open_im_sdkSetGroupInfo(proxy,opid, [param json]); 902 | } 903 | 904 | UNI_EXPORT_METHOD(@selector(setGroupLookMemberInfo:options:callback:)) 905 | 906 | - (void)setGroupLookMemberInfo:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 907 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 908 | NSDictionary *param = @{ 909 | @"groupID":options[@"groupID"], 910 | @"lookMemberInfo":options[@"rule"], 911 | }; 912 | Open_im_sdkSetGroupInfo(proxy,opid,[param json]); 913 | } 914 | 915 | UNI_EXPORT_METHOD(@selector(setGroupApplyMemberFriend:options:callback:)) 916 | 917 | - (void)setGroupApplyMemberFriend:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 918 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 919 | NSDictionary *param = @{ 920 | @"groupID":options[@"groupID"], 921 | @"applyMemberFriend":options[@"rule"], 922 | }; 923 | Open_im_sdkSetGroupInfo(proxy,opid,[param json]); 924 | } 925 | 926 | UNI_EXPORT_METHOD(@selector(getGroupMemberList:options:callback:)) 927 | 928 | - (void)getGroupMemberList:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 929 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 930 | Open_im_sdkGetGroupMemberList(proxy,opid,[options valueForKey:@"groupID"], [[options valueForKey:@"filter"] intValue], [[options valueForKey:@"offset"] intValue], [[options valueForKey:@"count"] intValue]); 931 | } 932 | 933 | UNI_EXPORT_METHOD(@selector(getGroupMemberOwnerAndAdmin:groupID:callback:)) 934 | 935 | - (void)getGroupMemberOwnerAndAdmin:(NSString *)opid groupID:(NSString *)groupID callback:(UniModuleKeepAliveCallback)callback { 936 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 937 | Open_im_sdkGetGroupMemberOwnerAndAdmin(proxy,opid,groupID); 938 | } 939 | 940 | UNI_EXPORT_METHOD(@selector(getGroupMemberListByJoinTimeFilter:options:callback:)) 941 | 942 | - (void)getGroupMemberListByJoinTimeFilter:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 943 | NSArray* filterUserIDList = [options valueForKey:@"filterUserIDList"]; 944 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 945 | Open_im_sdkGetGroupMemberListByJoinTimeFilter(proxy,opid,[options valueForKey:@"groupID"],[[options valueForKey:@"offset"] intValue],[[options valueForKey:@"count"] intValue],[[options valueForKey:@"joinTimeBegin"] intValue],[[options valueForKey:@"joinTimeEnd"] intValue],[filterUserIDList json]); 946 | } 947 | 948 | UNI_EXPORT_METHOD(@selector(getSpecifiedGroupMembersInfo:options:callback:)) 949 | 950 | - (void)getSpecifiedGroupMembersInfo:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 951 | NSArray *userIDList = [options valueForKey:@"userIDList"]; 952 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 953 | Open_im_sdkGetSpecifiedGroupMembersInfo(proxy,opid, [options valueForKey:@"groupID"],[userIDList json]); 954 | } 955 | 956 | UNI_EXPORT_METHOD(@selector(getUsersInGroup:options:callback:)) 957 | 958 | - (void)getUsersInGroup:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 959 | NSArray *userIDList = [options valueForKey:@"userIDList"]; 960 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 961 | Open_im_sdkGetUsersInGroup(proxy,opid, [options valueForKey:@"groupID"],[userIDList json]); 962 | } 963 | 964 | UNI_EXPORT_METHOD(@selector(kickGroupMember:options:callback:)) 965 | 966 | - (void)kickGroupMember:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 967 | NSArray *userIDList = [options valueForKey:@"userIDList"]; 968 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 969 | Open_im_sdkKickGroupMember(proxy ,opid, [options valueForKey:@"groupID"], [options valueForKey:@"reason"],[userIDList json]); 970 | } 971 | 972 | UNI_EXPORT_METHOD(@selector(transferGroupOwner:options:callback:)) 973 | 974 | - (void)transferGroupOwner:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 975 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 976 | Open_im_sdkTransferGroupOwner(proxy,opid, [options valueForKey:@"groupID"], [options valueForKey:@"newOwnerUserID"]); 977 | } 978 | 979 | UNI_EXPORT_METHOD(@selector(inviteUserToGroup:options:callback:)) 980 | 981 | - (void)inviteUserToGroup:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 982 | NSArray *userIDList = [options valueForKey:@"userIDList"]; 983 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 984 | Open_im_sdkInviteUserToGroup(proxy, opid, [options valueForKey:@"groupID"], [options valueForKey:@"reason"], [userIDList json]); 985 | } 986 | 987 | UNI_EXPORT_METHOD(@selector(getGroupApplicationListAsRecipient:callback:)) 988 | 989 | - (void)getGroupApplicationListAsRecipient:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 990 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 991 | Open_im_sdkGetGroupApplicationListAsRecipient(proxy,opid); 992 | } 993 | 994 | UNI_EXPORT_METHOD(@selector(getGroupApplicationListAsApplicant:callback:)) 995 | 996 | - (void)getGroupApplicationListAsApplicant:(NSString *)opid callback:(UniModuleKeepAliveCallback)callback { 997 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 998 | Open_im_sdkGetGroupApplicationListAsApplicant(proxy,opid); 999 | } 1000 | 1001 | UNI_EXPORT_METHOD(@selector(acceptGroupApplication:options:callback:)) 1002 | 1003 | - (void)acceptGroupApplication:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 1004 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1005 | Open_im_sdkAcceptGroupApplication(proxy,opid, [options valueForKey:@"groupID"], [options valueForKey:@"fromUserID"],[options valueForKey:@"handleMsg"]); 1006 | } 1007 | 1008 | UNI_EXPORT_METHOD(@selector(refuseGroupApplication:options:callback:)) 1009 | 1010 | - (void)refuseGroupApplication:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 1011 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1012 | Open_im_sdkRefuseGroupApplication(proxy,opid, [options valueForKey:@"groupID"], [options valueForKey:@"fromUserID"],[options valueForKey:@"handleMsg"]); 1013 | } 1014 | 1015 | UNI_EXPORT_METHOD(@selector(setGroupMemberNickname:options:callback:)) 1016 | 1017 | - (void)setGroupMemberNickname:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 1018 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1019 | NSDictionary *param = @{ 1020 | @"groupID":options[@"groupID"], 1021 | @"userID":options[@"userID"], 1022 | @"nickname":options[@"groupMemberNickname"], 1023 | }; 1024 | Open_im_sdkSetGroupMemberInfo(proxy,opid,[param json]); 1025 | } 1026 | 1027 | UNI_EXPORT_METHOD(@selector(searchGroupMembers:searchOptions:callback:)) 1028 | 1029 | - (void)searchGroupMembers:(NSString *)opid searchOptions:(NSDictionary *)searchOptions callback:(UniModuleKeepAliveCallback)callback { 1030 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1031 | Open_im_sdkSearchGroupMembers(proxy,opid,[searchOptions json]); 1032 | } 1033 | 1034 | UNI_EXPORT_METHOD(@selector(isJoinGroup:groupID:callback:)) 1035 | 1036 | - (void)isJoinGroup:(NSString *)opid groupID:(NSString *)groupID callback:(UniModuleKeepAliveCallback)callback { 1037 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1038 | Open_im_sdkIsJoinGroup(proxy,opid,groupID); 1039 | } 1040 | 1041 | 1042 | // MARK: - Third 1043 | UNI_EXPORT_METHOD(@selector(setAppBadge:appUnreadCount:callback:)) 1044 | 1045 | - (void)setAppBadge:(NSString *)opid appUnreadCount:(int32_t)appUnreadCount callback:(UniModuleKeepAliveCallback)callback { 1046 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1047 | Open_im_sdkSetAppBadge(proxy,opid,appUnreadCount); 1048 | } 1049 | 1050 | UNI_EXPORT_METHOD(@selector(uploadLogs:options:callback:)) 1051 | 1052 | - (void)uploadLogs:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 1053 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1054 | UploadLogsCallbackProxy *uploadProxy = [[UploadLogsCallbackProxy alloc] initWithOpid:opid module:self]; 1055 | Open_im_sdkUploadLogs(proxy,opid,[options valueForKey:@"line"],[options valueForKey:@"ex"],uploadProxy); 1056 | } 1057 | 1058 | UNI_EXPORT_METHOD(@selector(logs:options:callback:)) 1059 | 1060 | - (void)logs:(NSString *)opid options:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback { 1061 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1062 | Open_im_sdkLogs(proxy,opid,[[options valueForKey:@"logLevel"] longValue],[options valueForKey:@"file"],[[options valueForKey:@"line"] longValue],[options valueForKey:@"msgs"],[options valueForKey:@"err"],[options valueForKey:@"keyAndValue"]); 1063 | } 1064 | 1065 | UNI_EXPORT_METHOD(@selector(getSdkVersion)) 1066 | 1067 | - (NSString *)getSdkVersion{ 1068 | return Open_im_sdkGetSdkVersion(); 1069 | } 1070 | 1071 | UNI_EXPORT_METHOD(@selector(uploadFile:reqData:callback:)) 1072 | 1073 | - (void)uploadFile:(NSString *)opid reqData:(NSDictionary *)reqData callback:(UniModuleKeepAliveCallback)callback { 1074 | CallbackProxy *proxy = [[CallbackProxy alloc] initWithCallback:callback]; 1075 | UploadFileCallbackProxy *uploadProxy = [[UploadFileCallbackProxy alloc] initWithOpid:opid module:self]; 1076 | Open_im_sdkUploadFile(proxy,opid, [reqData json],uploadProxy); 1077 | } 1078 | 1079 | // MARK: - utils 1080 | - (NSDictionary *)parseJsonStr2Dict:(NSString *)jsonStr { 1081 | NSData *jsonData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding]; 1082 | NSError *error = nil; 1083 | id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; 1084 | if (error) { 1085 | NSLog(@"Error while parsing JSON: %@", error.localizedDescription); 1086 | return nil; 1087 | } 1088 | NSDictionary *data = (NSDictionary *)jsonObject; 1089 | return data; 1090 | } 1091 | 1092 | - (NSArray *)parseJsonStr2Array:(NSString *)jsonStr { 1093 | NSData *jsonData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding]; 1094 | NSError *error = nil; 1095 | id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; 1096 | if (error) { 1097 | NSLog(@"Error while parsing JSON: %@", error.localizedDescription); 1098 | return nil; 1099 | } 1100 | NSArray *data = (NSArray *)jsonObject; 1101 | return data; 1102 | } 1103 | 1104 | // MARK: - Open_im_sdk_callbackOnConnListener 1105 | - (void)onConnectFailed:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg{ 1106 | NSDictionary *param = @{ 1107 | @"err":errMsg, 1108 | @"errCode": @(errCode) 1109 | }; 1110 | [self.uniInstance fireGlobalEvent:@"onConnectFailed" params:param]; 1111 | } 1112 | 1113 | - (void)onConnectSuccess { 1114 | NSDictionary *param = @{ 1115 | @"err":@"", 1116 | @"errCode": @(0) 1117 | }; 1118 | [self.uniInstance fireGlobalEvent:@"onConnectSuccess" params:param]; 1119 | } 1120 | 1121 | - (void)onConnecting { 1122 | NSDictionary *param = @{ 1123 | @"err":@"", 1124 | @"errCode": @(0) 1125 | }; 1126 | [self.uniInstance fireGlobalEvent:@"onConnecting" params:param]; 1127 | } 1128 | 1129 | - (void)onKickedOffline { 1130 | NSDictionary *param = @{ 1131 | @"err":@"", 1132 | @"errCode": @(0) 1133 | }; 1134 | [self.uniInstance fireGlobalEvent:@"onKickedOffline" params:param]; 1135 | } 1136 | 1137 | 1138 | - (void)onUserTokenExpired { 1139 | NSDictionary *param = @{ 1140 | @"err":@"", 1141 | @"errCode": @(0) 1142 | }; 1143 | [self.uniInstance fireGlobalEvent:@"onUserTokenExpired" params:param]; 1144 | } 1145 | 1146 | - (void)onUserTokenInvalid:(NSString* _Nullable)errMsg { 1147 | NSDictionary *param = @{ 1148 | @"err":errMsg, 1149 | @"errCode": @(0) 1150 | }; 1151 | [self.uniInstance fireGlobalEvent:@"onUserTokenInvalid" params:param]; 1152 | } 1153 | 1154 | 1155 | // MARK: - Open_im_sdk_callbackOnUserListener 1156 | 1157 | - (void)onSelfInfoUpdated:(NSString* _Nullable)userInfo { 1158 | NSDictionary *data = [self parseJsonStr2Dict:userInfo]; 1159 | NSDictionary *param = @{ 1160 | @"data":data, 1161 | }; 1162 | [self.uniInstance fireGlobalEvent:@"onSelfInfoUpdated" params:param]; 1163 | } 1164 | 1165 | - (void)onUserStatusChanged:(NSString* _Nullable)statusMap { 1166 | NSDictionary *data = [self parseJsonStr2Dict:statusMap]; 1167 | NSDictionary *param = @{ 1168 | @"data":data, 1169 | }; 1170 | [self.uniInstance fireGlobalEvent:@"onUserStatusChanged" params:param]; 1171 | } 1172 | 1173 | 1174 | // MARK: - Open_im_sdk_callbackOnBatchMsgListener 1175 | 1176 | - (void)onRecvNewMessages:(NSString * _Nullable)messageList { 1177 | NSArray *messageListArray = [self parseJsonStr2Array:messageList]; 1178 | NSDictionary *param = @{ 1179 | @"data":messageListArray, 1180 | }; 1181 | PUSH_EVENT(param) 1182 | } 1183 | 1184 | - (void)onRecvOfflineNewMessages:(NSString* _Nullable)messageList { 1185 | NSArray *messageListArray = [self parseJsonStr2Array:messageList]; 1186 | NSDictionary *param = @{ 1187 | @"data":messageListArray, 1188 | }; 1189 | PUSH_EVENT(param) 1190 | } 1191 | 1192 | // MARK: - Open_im_sdk_callbackOnAdvancedMsgListener 1193 | 1194 | - (void)onMsgDeleted:(NSString* _Nullable)message { 1195 | NSDictionary *messageDict = [self parseJsonStr2Dict:message]; 1196 | NSDictionary *param = @{ 1197 | @"data":messageDict, 1198 | }; 1199 | PUSH_EVENT(param) 1200 | } 1201 | 1202 | - (void)onNewRecvMessageRevoked:(NSString *)messageRevoked { 1203 | NSDictionary *messageRevokedDict = [self parseJsonStr2Dict:messageRevoked]; 1204 | NSDictionary *param = @{ 1205 | @"data":messageRevokedDict, 1206 | }; 1207 | PUSH_EVENT(param) 1208 | } 1209 | 1210 | - (void)onRecvC2CReadReceipt:(NSString* _Nullable)msgReceiptList { 1211 | NSArray *msgReceiptListArray = [self parseJsonStr2Array:msgReceiptList]; 1212 | NSDictionary *param = @{ 1213 | @"data":msgReceiptListArray, 1214 | }; 1215 | PUSH_EVENT(param) 1216 | } 1217 | 1218 | - (void)onRecvGroupReadReceipt:(NSString* _Nullable)groupMsgReceiptList { 1219 | NSArray *msgReceiptListArray = [self parseJsonStr2Dict:groupMsgReceiptList]; 1220 | NSDictionary *param = @{ 1221 | @"data":msgReceiptListArray, 1222 | }; 1223 | PUSH_EVENT(param) 1224 | } 1225 | 1226 | - (void)onRecvMessageExtensionsAdded:(NSString * _Nullable)msgID reactionExtensionList:(NSString * _Nullable)reactionExtensionList { 1227 | 1228 | } 1229 | 1230 | 1231 | - (void)onRecvMessageExtensionsChanged:(NSString * _Nullable)msgID reactionExtensionList:(NSString * _Nullable)reactionExtensionList { 1232 | 1233 | } 1234 | 1235 | 1236 | - (void)onRecvMessageExtensionsDeleted:(NSString * _Nullable)msgID reactionExtensionKeyList:(NSString * _Nullable)reactionExtensionKeyList { 1237 | 1238 | } 1239 | 1240 | - (void)onRecvNewMessage:(NSString* _Nullable)message { 1241 | NSDictionary *messageDict = [self parseJsonStr2Dict:message]; 1242 | NSDictionary *param = @{ 1243 | @"data":messageDict, 1244 | }; 1245 | PUSH_EVENT(param) 1246 | } 1247 | 1248 | - (void)onRecvOfflineNewMessage:(NSString* _Nullable)message { 1249 | NSDictionary *messageDict = [self parseJsonStr2Dict:message]; 1250 | NSDictionary *param = @{ 1251 | @"data":messageDict, 1252 | }; 1253 | PUSH_EVENT(param) 1254 | } 1255 | 1256 | - (void)onRecvOnlineOnlyMessage:(NSString* _Nullable)message { 1257 | NSDictionary *messageDict = [self parseJsonStr2Dict:message]; 1258 | NSDictionary *param = @{ 1259 | @"data":messageDict, 1260 | }; 1261 | PUSH_EVENT(param) 1262 | } 1263 | 1264 | // MARK: - Open_im_sdk_callbackOnConversationListener 1265 | 1266 | - (void)onConversationChanged:(NSString* _Nullable)conversationList { 1267 | NSArray *conversationListArray = [self parseJsonStr2Array:conversationList]; 1268 | NSDictionary *param = @{ 1269 | @"data":conversationListArray, 1270 | }; 1271 | PUSH_EVENT(param) 1272 | } 1273 | 1274 | - (void)onConversationUserInputStatusChanged:(NSString* _Nullable)change { 1275 | NSDictionary *data = [self parseJsonStr2Dict:change]; 1276 | NSDictionary *param = @{ 1277 | @"errMsg":@"", 1278 | @"errCode": @(0), 1279 | @"data":data, 1280 | }; 1281 | [self.uniInstance fireGlobalEvent:@"onInputStatusChanged" params:param]; 1282 | } 1283 | 1284 | - (void)onNewConversation:(NSString* _Nullable)conversationList { 1285 | NSArray *conversationListArray = [self parseJsonStr2Array:conversationList]; 1286 | NSDictionary *param = @{ 1287 | @"data":conversationListArray, 1288 | }; 1289 | PUSH_EVENT(param) 1290 | } 1291 | 1292 | - (void)onSyncServerFailed:(BOOL)reinstalled { 1293 | NSDictionary *param = @{ 1294 | @"errMsg":@"", 1295 | @"errCode": @(0), 1296 | @"reinstall": @(reinstalled) 1297 | }; 1298 | [self.uniInstance fireGlobalEvent:@"onSyncServerFailed" params:param]; 1299 | } 1300 | 1301 | - (void)onSyncServerFinish:(BOOL)reinstalled { 1302 | NSDictionary *param = @{ 1303 | @"errMsg":@"", 1304 | @"errCode": @(0), 1305 | @"reinstall": @(reinstalled) 1306 | }; 1307 | [self.uniInstance fireGlobalEvent:@"onSyncServerFinish" params:param]; 1308 | } 1309 | 1310 | - (void)onSyncServerStart:(BOOL)reinstalled { 1311 | NSDictionary *param = @{ 1312 | @"errMsg":@"", 1313 | @"errCode": @(0), 1314 | @"reinstall": @(reinstalled) 1315 | }; 1316 | [self.uniInstance fireGlobalEvent:@"onSyncServerStart" params:param]; 1317 | } 1318 | 1319 | - (void)onSyncServerProgress:(long)progress { 1320 | NSDictionary *param = @{ 1321 | @"errMsg":@"", 1322 | @"errCode": @(0), 1323 | @"progress": @(progress) 1324 | }; 1325 | [self.uniInstance fireGlobalEvent:@"onSyncServerProgress" params:param]; 1326 | } 1327 | 1328 | - (void)onTotalUnreadMessageCountChanged:(int32_t)totalUnreadCount { 1329 | NSDictionary *param = @{ 1330 | @"data":@(totalUnreadCount), 1331 | }; 1332 | PUSH_EVENT(param) 1333 | } 1334 | 1335 | 1336 | // MARK: - Open_im_sdk_callbackOnFriendshipListener 1337 | 1338 | 1339 | - (void)onBlackAdded:(NSString* _Nullable)blackInfo{ 1340 | NSDictionary *blackInfoDict = [self parseJsonStr2Dict:blackInfo]; 1341 | NSDictionary *param = @{ 1342 | @"data":blackInfoDict, 1343 | }; 1344 | PUSH_EVENT(param) 1345 | } 1346 | - (void)onBlackDeleted:(NSString* _Nullable)blackInfo{ 1347 | NSDictionary *blackInfoDict = [self parseJsonStr2Dict:blackInfo]; 1348 | NSDictionary *param = @{ 1349 | @"data":blackInfoDict, 1350 | }; 1351 | PUSH_EVENT(param) 1352 | } 1353 | - (void)onFriendAdded:(NSString* _Nullable)friendInfo{ 1354 | NSDictionary *friendInfoDict = [self parseJsonStr2Dict:friendInfo]; 1355 | NSDictionary *param = @{ 1356 | @"data":friendInfoDict, 1357 | }; 1358 | PUSH_EVENT(param) 1359 | } 1360 | - (void)onFriendApplicationAccepted:(NSString* _Nullable)friendApplication{ 1361 | NSDictionary *friendApplicationDict = [self parseJsonStr2Dict:friendApplication]; 1362 | NSDictionary *param = @{ 1363 | @"data":friendApplicationDict, 1364 | }; 1365 | PUSH_EVENT(param) 1366 | } 1367 | - (void)onFriendApplicationAdded:(NSString* _Nullable)friendApplication{ 1368 | NSDictionary *friendApplicationDict = [self parseJsonStr2Dict:friendApplication]; 1369 | NSDictionary *param = @{ 1370 | @"data":friendApplicationDict, 1371 | }; 1372 | PUSH_EVENT(param) 1373 | } 1374 | - (void)onFriendApplicationDeleted:(NSString* _Nullable)friendApplication{ 1375 | NSDictionary *friendApplicationDict = [self parseJsonStr2Dict:friendApplication]; 1376 | NSDictionary *param = @{ 1377 | @"data":friendApplicationDict, 1378 | }; 1379 | PUSH_EVENT(param) 1380 | } 1381 | - (void)onFriendApplicationRejected:(NSString* _Nullable)friendApplication{ 1382 | NSDictionary *friendApplicationDict = [self parseJsonStr2Dict:friendApplication]; 1383 | NSDictionary *param = @{ 1384 | @"data":friendApplicationDict, 1385 | }; 1386 | PUSH_EVENT(param) 1387 | } 1388 | - (void)onFriendDeleted:(NSString* _Nullable)friendInfo{ 1389 | NSDictionary *friendInfoDict = [self parseJsonStr2Dict:friendInfo]; 1390 | NSDictionary *param = @{ 1391 | @"data":friendInfoDict, 1392 | }; 1393 | PUSH_EVENT(param) 1394 | } 1395 | - (void)onFriendInfoChanged:(NSString* _Nullable)friendInfo{ 1396 | NSDictionary *friendInfoDict = [self parseJsonStr2Dict:friendInfo]; 1397 | NSDictionary *param = @{ 1398 | @"data":friendInfoDict, 1399 | }; 1400 | PUSH_EVENT(param) 1401 | } 1402 | 1403 | 1404 | // MARK: - Open_im_sdk_callbackOnGroupListener 1405 | 1406 | - (void)onGroupApplicationAccepted:(NSString* _Nullable)groupApplication{ 1407 | NSDictionary *groupApplicationDict = [self parseJsonStr2Dict:groupApplication]; 1408 | NSDictionary *param = @{ 1409 | @"data":groupApplicationDict, 1410 | }; 1411 | PUSH_EVENT(param) 1412 | } 1413 | 1414 | - (void)onGroupApplicationAdded:(NSString* _Nullable)groupApplication{ 1415 | NSDictionary *groupApplicationDict = [self parseJsonStr2Dict:groupApplication]; 1416 | NSDictionary *param = @{ 1417 | @"data":groupApplicationDict, 1418 | }; 1419 | PUSH_EVENT(param) 1420 | } 1421 | 1422 | - (void)onGroupApplicationDeleted:(NSString* _Nullable)groupApplication{ 1423 | NSDictionary *groupApplicationDict = [self parseJsonStr2Dict:groupApplication]; 1424 | NSDictionary *param = @{ 1425 | @"data":groupApplicationDict, 1426 | }; 1427 | PUSH_EVENT(param) 1428 | } 1429 | 1430 | - (void)onGroupApplicationRejected:(NSString* _Nullable)groupApplication{ 1431 | NSDictionary *groupApplicationDict = [self parseJsonStr2Dict:groupApplication]; 1432 | NSDictionary *param = @{ 1433 | @"data":groupApplicationDict, 1434 | }; 1435 | PUSH_EVENT(param) 1436 | } 1437 | 1438 | - (void)onGroupInfoChanged:(NSString* _Nullable)groupInfo{ 1439 | NSDictionary *groupInfoDict = [self parseJsonStr2Dict:groupInfo]; 1440 | NSDictionary *param = @{ 1441 | @"data":groupInfoDict, 1442 | }; 1443 | PUSH_EVENT(param) 1444 | } 1445 | 1446 | - (void)onGroupMemberAdded:(NSString* _Nullable)groupMemberInfo{ 1447 | NSDictionary *groupMemberInfoDict = [self parseJsonStr2Dict:groupMemberInfo]; 1448 | NSDictionary *param = @{ 1449 | @"data":groupMemberInfoDict, 1450 | }; 1451 | PUSH_EVENT(param) 1452 | } 1453 | 1454 | - (void)onGroupMemberDeleted:(NSString* _Nullable)groupMemberInfo{ 1455 | NSDictionary *groupMemberInfoDict = [self parseJsonStr2Dict:groupMemberInfo]; 1456 | NSDictionary *param = @{ 1457 | @"data":groupMemberInfoDict, 1458 | }; 1459 | PUSH_EVENT(param) 1460 | } 1461 | 1462 | - (void)onGroupMemberInfoChanged:(NSString* _Nullable)groupMemberInfo{ 1463 | NSDictionary *groupMemberInfoDict = [self parseJsonStr2Dict:groupMemberInfo]; 1464 | NSDictionary *param = @{ 1465 | @"data":groupMemberInfoDict, 1466 | }; 1467 | PUSH_EVENT(param) 1468 | } 1469 | 1470 | - (void)onJoinedGroupAdded:(NSString* _Nullable)groupInfo{ 1471 | NSDictionary *groupInfoDict = [self parseJsonStr2Dict:groupInfo]; 1472 | NSDictionary *param = @{ 1473 | @"data":groupInfoDict, 1474 | }; 1475 | PUSH_EVENT(param) 1476 | } 1477 | 1478 | - (void)onJoinedGroupDeleted:(NSString* _Nullable)groupInfo{ 1479 | NSDictionary *groupInfoDict = [self parseJsonStr2Dict:groupInfo]; 1480 | NSDictionary *param = @{ 1481 | @"data":groupInfoDict, 1482 | }; 1483 | PUSH_EVENT(param) 1484 | } 1485 | 1486 | - (void)onGroupDismissed:(NSString* _Nullable)groupInfo{ 1487 | NSDictionary *groupInfoDict = [self parseJsonStr2Dict:groupInfo]; 1488 | NSDictionary *param = @{ 1489 | @"data":groupInfoDict, 1490 | }; 1491 | PUSH_EVENT(param) 1492 | } 1493 | 1494 | // MARK: Open_im_sdk_callbackOnCustomBusinessListener 1495 | 1496 | - (void)onRecvCustomBusinessMessage:(NSString* _Nullable)businessMessage{ 1497 | NSDictionary *businessMessageDict = [self parseJsonStr2Dict:businessMessage]; 1498 | NSDictionary *param = @{ 1499 | @"data":businessMessageDict, 1500 | }; 1501 | PUSH_EVENT(param) 1502 | } 1503 | 1504 | @end 1505 | 1506 | 1507 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/SendMessageCallbackProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // SendMessageCallbackProxy.h 3 | // OpenIMUniPlugin 4 | // 5 | // Created by Snow on 2021/6/24. 6 | // 7 | 8 | #import 9 | #import "DCUniModule.h" 10 | #import "OpenIMModule.h" 11 | @import OpenIMCore; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface SendMessageCallbackProxy : NSObject 16 | 17 | - (id)initWithMessage:(NSDictionary *)message module:(OpenIMModule *)module callback:(UniModuleKeepAliveCallback)callback; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/SendMessageCallbackProxy.m: -------------------------------------------------------------------------------- 1 | // 2 | // SendMessageCallbackProxy.m 3 | // OpenIMUniPlugin 4 | // 5 | // Created by Snow on 2021/6/24. 6 | // 7 | 8 | #import "SendMessageCallbackProxy.h" 9 | 10 | @interface SendMessageCallbackProxy() 11 | 12 | @property (nonatomic, copy) NSDictionary *message; 13 | @property (nonatomic, weak) OpenIMModule* module; 14 | @property (nonatomic, copy) UniModuleKeepAliveCallback callback; 15 | 16 | @end 17 | 18 | @implementation SendMessageCallbackProxy 19 | 20 | - (id)initWithMessage:(NSDictionary *)message module:(OpenIMModule *)module callback:(UniModuleKeepAliveCallback)callback { 21 | if (self = [super init]) { 22 | self.message = message; 23 | self.module = module; 24 | self.callback = callback; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg { 30 | if (!self.module) { 31 | return; 32 | } 33 | [self doCallback:@{@"errMsg": errMsg, @"errCode": @(errCode),@"data":self.message}]; 34 | } 35 | 36 | - (void)onSuccess:(NSString * _Nullable)data { 37 | if (!self.module) { 38 | return; 39 | } 40 | NSData *jsonData = [data dataUsingEncoding:NSUTF8StringEncoding]; 41 | NSError *error = nil; 42 | id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; 43 | NSDictionary *message = (NSDictionary *)jsonObject; 44 | [self doCallback:@{@"errMsg": @"", @"errCode": @(0),@"data":message}]; 45 | } 46 | 47 | - (void)onProgress:(long)progress { 48 | if (!self.module) { 49 | return; 50 | } 51 | [self.module pushEvent:@"sendMessageProgress" 52 | msg:@{ 53 | @"data": @{@"message":self.message,@"progress":@(progress)} 54 | }]; 55 | } 56 | 57 | - (void)doCallback:(NSDictionary *)param { 58 | if (self.callback) { 59 | self.callback(param, false); 60 | self.callback = nil; 61 | } 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/UploadFileCallbackProxy.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "DCUniModule.h" 3 | #import "OpenIMModule.h" 4 | @import OpenIMCore; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | @interface UploadFileCallbackProxy : NSObject 9 | 10 | - (id)initWithOpid:(NSString *)opid module:(OpenIMModule *)module; 11 | 12 | @end 13 | 14 | NS_ASSUME_NONNULL_END 15 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/UploadFileCallbackProxy.m: -------------------------------------------------------------------------------- 1 | // 2 | // UploadFileCallbackProxy.m 3 | // OpenIMUniPlugin 4 | // 5 | // Created by OpenIM on 2022/6/14. 6 | // 7 | 8 | #import "UploadFileCallbackProxy.h" 9 | 10 | @interface UploadFileCallbackProxy() 11 | 12 | @property (nonatomic, copy) NSString *opid; 13 | @property (nonatomic, weak) OpenIMModule* module; 14 | 15 | @end 16 | 17 | @implementation UploadFileCallbackProxy 18 | 19 | - (id)initWithOpid:(NSString *)opid module:(OpenIMModule *)module { 20 | if (self = [super init]) { 21 | self.opid = opid; 22 | self.module = module; 23 | } 24 | return self; 25 | } 26 | 27 | 28 | - (void)complete:(int64_t)size url:(NSString * _Nullable)url typ:(long)typ { 29 | 30 | } 31 | 32 | - (void)hashPartComplete:(NSString * _Nullable)partsHash fileHash:(NSString * _Nullable)fileHash { 33 | 34 | } 35 | 36 | - (void)hashPartProgress:(long)index size:(int64_t)size partHash:(NSString * _Nullable)partHash { 37 | 38 | } 39 | 40 | - (void)open:(int64_t)size { 41 | 42 | } 43 | 44 | - (void)partSize:(int64_t)partSize num:(long)num { 45 | 46 | } 47 | 48 | - (void)uploadComplete:(int64_t)fileSize streamSize:(int64_t)streamSize storageSize:(int64_t)storageSize { 49 | [self.module pushEvent:@"uploadComplete" msg:@{ 50 | @"data": @{ 51 | @"fileSize":@(fileSize), 52 | @"streamSize":@(streamSize), 53 | @"storageSize":@(storageSize), 54 | @"operationID":self.opid, 55 | 56 | } 57 | }]; 58 | } 59 | 60 | - (void)uploadID:(NSString * _Nullable)uploadID { 61 | 62 | } 63 | 64 | - (void)uploadPartComplete:(long)index partSize:(int64_t)partSize partHash:(NSString * _Nullable)partHash { 65 | 66 | } 67 | 68 | @end 69 | 70 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/UploadLogsCallbackProxy.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "DCUniModule.h" 3 | #import "OpenIMModule.h" 4 | @import OpenIMCore; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | @interface UploadLogsCallbackProxy : NSObject 9 | 10 | - (id)initWithOpid:(NSString *)opid module:(OpenIMModule *)module; 11 | 12 | @end 13 | 14 | NS_ASSUME_NONNULL_END 15 | -------------------------------------------------------------------------------- /ios/OpenIMUniPlugin/OpenIMUniPlugin/Classes/UploadLogsCallbackProxy.m: -------------------------------------------------------------------------------- 1 | #import "UploadLogsCallbackProxy.h" 2 | 3 | @interface UploadLogsCallbackProxy() 4 | 5 | @property (nonatomic, copy) NSString *opid; 6 | @property (nonatomic, weak) OpenIMModule* module; 7 | 8 | @end 9 | 10 | @implementation UploadLogsCallbackProxy 11 | 12 | - (id)initWithOpid:(NSString *)opid module:(OpenIMModule *)module { 13 | if (self = [super init]) { 14 | self.opid = opid; 15 | self.module = module; 16 | } 17 | return self; 18 | } 19 | 20 | - (void)onProgress:(int64_t)current size:(int64_t)size { 21 | [self.module pushEvent:@"uploadComplete" msg:@{ 22 | @"data": @{ 23 | @"current":@(current), 24 | @"size":@(size), 25 | @"operationID":self.opid, 26 | 27 | } 28 | }]; 29 | } 30 | 31 | @end 32 | --------------------------------------------------------------------------------