Code Monkey home page Code Monkey logo

sunshine-conversations-cordova's Introduction

Maintenance

This repository is no longer being maintained. If you actively use this and want to become a maintainer let us know at [email protected].

smooch-cordova

Cordova (PhoneGap) bindings for Smooch.

Basic Setup

Install Smooch

For iOS: http://docs.smooch.io/#manual-method

For Android: Gradle does the work for you!

Install Cordova plugin

cordova plugin add smooch-cordova

You should now see smooch-cordova.js and the SmoochCordova source files in your project directory.

Init Smooch with appId

iOS

In your javascript:

Smooch.init({
  	"appId" : "your-smooch-app-id",
  	"conversationAccentColor" : "#FFFFFF" // optional, default is #00B0FF
});

IMPORTANT: This call must be made AFTER the deviceready event of Cordova.

See http://docs.smooch.io/api/ios/Classes/SKTSettings.html for other init settings.

Android

In io.smooch.cordova.SmoochApplication.java, change <your_app_id> to your app id. This file is located inside the src folder of the android project.

Locate the file called AndroidManifest.xml in the root of your Android project. Inside the <application> tag, add android:name="io.smooch.cordova.SmoochApplication"

That's it! See http://docs.smooch.io/api/android/ for other init settings.

To enable push notifications, follow the docs here.

Show Smooch

Now, you're ready to show the Smooch chat window.

Smooch.show();

Awesome Setup

Add user info

Smooch.setUser({
	"firstName" : "Erlich",
	"lastName" : "Bachman",
	"email" : "[email protected]",
	"signedUpAt" : 1397606400000 // unix timestamp in milliseconds
});

Add custom user properties

Smooch.setUserProperties({
	"tv_show" : "Silicon Valley",
	"episodes" : "Server Space, The Lady, Bad Money",
	"net_worth" : 1000000
});

Login

With JWT:

Smooch.login("userId", "jwt");

Without:

Smooch.login("userId");

Common errors

If you stumble upon this error when building for android:

Error: /yourapp/platforms/android/gradlew: Command failed with exit code 1 Error output:
/yourapp/platforms/android/build/intermediates/res/merged/debug/values-v26/values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

/yourapp/platforms/android/build/intermediates/res/merged/debug/values-v26/values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

FAILURE: Build failed with an exception.

Make sure to set the target to android-26 in platforms/android/project-properties

sunshine-conversations-cordova's People

Contributors

dannytranlx avatar dominicj avatar edchan7 avatar edchan77 avatar go-fred avatar gozman avatar janpio avatar jpjoyal avatar jugarrit avatar ubald avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sunshine-conversations-cordova's Issues

Android build error

(I know this is similar to another issue but I think the two are unrelated).

When I install the plugin following the instructions and try to build for Android I get an exception, I have no idea what the problem is but I have a slight hunch that it may be conflicting with: https://github.com/arnesson/cordova-plugin-firebase

(Sidenote: when I uninstall the plugin, it locks platforms\android\app\src\main\java\io\smooch\cordova so I have to restart to actually delete the plugin)

Here's the error, if you need anything else please let me know, I'd like to be able to add smooch to this app.

https://pastebin.com/9j0ZW7rJ

Thanks,
Peter :)

Color and Font Change

Hi team,

Thanks for the awesome cordova plugin. I just wanted to know how can i change the tab color and font of the text to match my cordova app interface?

Chat Window Modification

Hi,
Is it actually possible to modify the chat window in Supportkit-Cordova? Like can I change the style of the header bar or hide the Done button?

Thank you!

No image option for android

Hi team,

I tried using your plugin for android and ios. I noticed that there is not image upload option for the chat in the android version . Is there any way to add it ?

Is there an issue with Ionic, specifically Ionic Creator tool

Am using http://creator.ionic.io to create a hybrid iOS/Android app.

Have added cordova-plugin-smooch as a plugin in Code Settings.

Have added ionic-native.min.js.

Have added smoochio.js with following code...

Smooch.init({
"appToken": "MY-TOKEN",
"soundNotificationEnabled": "true",
"imageUploadEnabled": "true",
});
The smooch.io button appears in the app but I think it's not 'native' because when user tries to type in message field, the iOS keyboard goes on top of the message input field so user can't see what they are typing. Also, in the smooch.io message window header, the 'X' or close icon doesn't show up...

Not sure what I'm missing to activate the 'native' plugin so it functions correctly on the phone. Thanks for any help.

How to setup userId and login

Hi, I'm trying to add the userId so that my users can continue the conversation on different devices, but I don't see this feature on Smooch Cordova, is there a way to add it? Thanks in advance!

Error during build

Hi team

You a got a great product. Excited to implement it.

I followed all the steps mentioned in the readme file but getting the following error during the build process.

:compileDebugJavaWithJavacC:\Users\XYZ\Desktop\App\XYZ\platfo
rms\android\src\com\XYZ\android\MainApplication.java:5: error: package
io.smooch.core does not exist
import io.smooch.core.Smooch;
^
C:\Users\XYZ\Desktop\App\XYZ\platforms\android\src\io\smooch
cordova\SmoochCordova.java:3: error: package io.smooch.core does not exist
import io.smooch.core.*;
^
C:\Users\XYZ\Desktop\App\XYZ\platforms\android\src\io\smooch
cordova\SmoochCordova.java:4: error: package io.smooch.ui does not exist
import io.smooch.ui.ConversationActivity;

It will be great if you could provide a quick response.

Regards

Vaibhav

fatal error: 'Smooch/Smooch.h' file not found

Hi Smooch,

When I build my project I get this error:

.../platforms/ios/app-name/Plugins/cordova-plugin-smooch/SmoochCordova.m:10:9: fatal error: 'Smooch/Smooch.h' file not found
#import <Smooch/Smooch.h>

I have installed the plugin with:
cordova plugin add smooch-cordova

Is there anything more to be done, before the build process should be able to run?

Jesper.

Androidmanifest duplicate entry

we are using phonegap-push plugin in our app.

when we installed smooch we started getting duplicate entry in androidmanifest.xml file

Please let us know if this plugin is compatible with phonegap push plugin

Cordova Android Example

Hi

Can you guys upload a demo project for intergration with cordova android. As instructions are not very clear. It would be very helpful as cordova developers usually dont have native experience. I am confused with the application part step where init function needs to called.

Regards

Vaibhav

android take picture problem

Hi
Sorry for my English.
I have a simple cordova app with smooch plugin and whitelist, when I want generate apk, I get this error:

Error:Execution failed for task ':processDebugResources'.
Error: more than one library with package name 'com.google.android.gms'

So I change my smooch gradle:

repositories {
jcenter()
}

buildscript {
repositories {
jcenter()
}

dependencies {
//classpath 'com.google.gms:google-services:1.3.0-beta1'
}
}

dependencies {
//compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'io.smooch:core:latest.release'
compile 'io.smooch:ui:latest.release'
}

Know I can generate apk, but when I want take picture from camera I get "unfortunately" and log is:


java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contains(java.lang.CharSequence)' on a null object reference
at io.smooch.ui.fragment.ConversationFragment.dispatchTakePhotoIntent(Unknown Source)
at io.smooch.ui.fragment.ConversationFragment.access$2300(Unknown Source)
at io.smooch.ui.fragment.ConversationFragment$6.onClick(Unknown Source)
at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:1082)
at android.widget.AdapterView.performItemClick(AdapterView.java:305)
at android.widget.AbsListView.performItemClick(AbsListView.java:1146)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3057)
at android.widget.AbsListView$3.run(AbsListView.java:3864)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5389)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

Another options not worked fine like "Choose from Library", but "Use Last Photo Taken" worked fine.

Please let me what can I do?

Regards

Plugin conflicting with another push enabled plugin

Build is failing with following error:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/actions/ItemListIntents;

        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)



 FAILED



FAILURE: Build failed with an exception.


* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.

> 
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/karan/jdk1.8.0_91/bin/java'' finished with non-zero exit value 2

Please suggest me some work around for this situation.

Thanks

Error while building for android

I'm experiencing the following problem during compilation for android:

"FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugCompile'.
Could not find any version that matches io.smooch:core:latest.release."

The same thing happens with the ui part of library. I also tried to change 'latest.release' to diffirent versions, still no success.
Can you please help me?

Cordova Errors

$ meteor add cordova:[email protected]
Added Cordova plugin [email protected].
โžœ vynomvp git:(master) โœ— meteor build ~/clients/builds/vynomvp --server=https://app.vno.mx
=> Errors executing Cordova commands:

While building Cordova app for platform Android:
Error: /Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/cordova/build: Command failed
with exit code 8 Error output:

/Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/src/io/smooch/cordova/SmoochCordova.java:3:
error: package io.smooch.core does not exist
import io.smooch.core.*;
^

/Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/src/io/smooch/cordova/SmoochCordova.java:4:
error: package io.smooch.ui does not exist
import io.smooch.ui.ConversationActivity;
^

/Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/src/io/smooch/cordova/SmoochCordova.java:45:
error: cannot find symbol
ConversationActivity.show(this.cordova.getActivity());
^
symbol: variable ConversationActivity
location: class SmoochCordova

/Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/src/io/smooch/cordova/SmoochCordova.java:52:
error: cannot find symbol
final User user = User.getCurrentUser();
^
symbol: class User
location: class SmoochCordova

/Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/src/io/smooch/cordova/SmoochCordova.java:52:
error: cannot find symbol
final User user = User.getCurrentUser();
^
symbol: variable User
location: class SmoochCordova

/Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/src/io/smooch/cordova/SmoochCordova.java:77:
error: cannot find symbol
User.getCurrentUser().addProperties(customProps);
^
symbol: variable User
location: class SmoochCordova

/Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/src/io/smooch/cordova/SmoochCordova.java:88:
error: cannot find symbol
Smooch.track(eventName);
^
symbol: variable Smooch
location: class SmoochCordova
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileArmv7ReleaseJava'.

    Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    /Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:126
    throw e;
    ^
    Error code 1 for command: /Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/gradlew with
    args:
    cdvBuildRelease,-b,/Users/jcochran/clients/vynomvp/.meteor/local/cordova-build/platforms/android/build.gradle,-Dorg.gradle.daemon=true
    at ChildProcess.whenDone
    (/Users/jcochran/.meteor/packages/meteor-tool/.1.1.10.c6ilhh++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Socket. (child_process.js:979:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

@cosio55

Problem with Ionic2

The following build commands failed:
CompileC build/auth0-ionic2.dev.build/Debug-iphonesimulator/auth0-ionic2.dev.build/Objects-normal/i386/SmoochCordova.o auth0-ionic2.dev/Plugins/cordova-plugin-smooch/SmoochCordova.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/bloodmoonshard/IonicProjects/luxembourgdigital-ionic2/platforms/ios/cordova/build-debug.xcconfig,-project,auth0-ionic2.dev.xcodeproj,-target,auth0-ionic2.dev,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,build,CONFIGURATION_BUILD_DIR=/Users/bloodmoonshard/IonicProjects/luxembourgdigital-ionic2/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/bloodmoonshard/IonicProjects/luxembourgdigital-ionic2/platforms/ios/build/sharedpch

Can't build application after init this

Using web installation

If I use web installation method with cordova index.html file, it works properly. Doesn't this repo become obsolete then ?

Failed to install with Cordova 9.x

I just tried to install the plugin on a fresh cordova project and it failed.

Here is the steps.

cordova create test-project com.example.test "Test App"
cd test-project
cordova platform add ios
cordova platform add android
cordova plugin add smooch-cordova

Here is the error output.

Installing "cordova-plugin-smooch" for android
Subproject Path: CordovaLib
Subproject Path: app
Failed to install 'cordova-plugin-smooch': CordovaError: Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at module.exports (/Users/pascal/Vagrant/_cordova/gpsh/plugins/cordova-plugin-smooch/scripts/afterInstall.js:5:20)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
    at process._tickCallback (internal/process/next_tick.js:68:7)
Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

Thank you!

Should mention to manually load www/smooch-cordova.js

Hi,

During the first time trying to use this plugin I had to find out by myself that the plugin isn't being added to cordova_plugins.js and I need to manually load www/smooch-cordova.js in my index.html.

You might want to mention it in the README file or add to the plugin.xml the line that actually loads the js automatically (I think its called in the plugin.xml)

Thanks for this plugin though :)

Error in SupportKitCordova.m

Hi, there is an error on the file SupportKitCordva.m on line 61, there is a ']' missing, the code should be like:

- (void)setUser:(CDVInvokedUrlCommand *)command {
    NSDictionary *user = [command argumentAtIndex:0];

    SKTUser *currentUser = [SKTUser currentUser];
    [currentUser setValuesForKeysWithDictionary:user];

    id timestamp = [user valueForKey:@"signedUpAt"];
    if (timestamp && [timestamp isKindOfClass:[NSNumber class]]) {
        NSTimeInterval seconds = [timestamp doubleValue] / 1000; // covert from milliseconds to seconds
        [currentUser setSignedUpAt:[NSDate dateWithTimeIntervalSince1970:seconds]];
    }
}

Is this a first class intergation method for smooch?

Looking at the issues and open PR I am not 100% sure smooch-cordova is in the focus of you guys. As we are just evaluating you and you market colleagues (competitors...) to add to a set of Ionic/Cordova apps this is quite important for me to know.

What's the plan for the future of smooch-cordova?

(Basically I am checking if anybody is reading the issues at all in a timely manner :p)

Unable to fetch plugin from "phonegap plugin add"

Hi,

I am trying to setup plugin in my phonegap project. When I execute phonegap plugin add cordova-plugin-smooch

$ phonegap plugin add cordova-plugin-smooch
Fetching plugin "cordova-plugin-smooch" via npm

Error: Failed to fetch plugin cordova-plugin-smooch via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: Registry returned 404 for GET on https://registry.npmjs.org/cordova-plugin-smooch

Is there any step which I am missing?

Thanks,
Karan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.