Ammaza Platform
Technical Documentation

List of supported features
Ammazza! Treasure
Ammazza! WebPlugin
Integrate in Website (Any technology)
N/A
Integrate in Android + iOS (Mobile app)
N/A
Work on iPad
N/A
Real time virtual try-on (Earrings, Necklaces, Sets)
Real time virtual try-on (Rings)
NO
Real time virtual try-on (Watches, Bracelts)
NO
Real time virtual try-on (Nosepins)
NO
Real time virtual try-on (MangTikka)
NO
Image Sharing
Add to Wishlist
NO
Data Analytics Report
Product Detail Page
N/A
Jewellery Shine Simulation
Zoom In - Zoom Out (Image+Jewellery)
NO
Customizations

WebAR Integration

1] Put the “TryOn” Button in the website.

2] On click of the TryOn Button our scripts will get appended to your web-page for calling the API's and loading the iframe.

3] API URL will be

https://tryon.ammazza.me/?product_id=YOUR_PRODUCT_ID&client_id=XXXXXXXXXX

We will use your product id to map the products and client_id is unique id created by us which will be given to you when we implement in your production server.

If you do not add product_id in URL then the https://tryon.ammazza.me/?client_id=XXXXXXXXXX URL will load all the jewelries of yours in right sidebar. Otherwise single product will be there for the TryOn.

4] So if user clicks on the TryOn, it takes the product_id and given client_id and calls the above URL and loads in the iFrame.

5] There are many ways to show the iFrames. Suggested way is to show it with Modal Popup which needs to be created by your tech-team.

<script>
var script = document.createElement('script');
const defaultClientId = "XXXXXXXXXX";
script.src = "https://tryon.ammazza.me/cdn/ammazza-ui.js";
document.body.append(script);
</script>

XXXXXXXXXX - *Write your respective Client ID wherever it is mentioned.*



sub How to add dynamic TRY NOW button in your website:

In Database:

* Add one field in database: "IsTryonAvailable". If you have Tryon of that product then set value TRUE. Otherwise add by default FALSE to remaining all products.

In Front End:

* Get product id on product details page where you have to put TRY NOW button.

* Assuming that you get product id at "product_id" variable. Once you get "product_id" then follow this pseudo code:

   if(IsTryonAvailable for given product_id == TRUE)

  {

   // Add tryon button with that product id

  <button onclick="blossomAmmazzaTryon('product_id')">  Try Now  </button>

  }

* So you can manage TRY NOW button dynamically from your database.

1. Extract module in you project directory and run

-- flutter build aar


(

If flutter is not installed

visit below link for flutter sdk setup.
Download flutter sdk and setup dlutter path.

https://flutter.dev/docs/get-started/install/windows
https://flutter.dev/docs/get-started/install/macos
https://flutter.dev/docs/get-started/install/linux

- Extract flutter SDK zip which is downloaded from that link.

- Add path of flutter to environment variables.

- Update your path

If you wish to run Flutter commands in the regular Windows console, take these steps to add Flutter to the PATH environment variable:
From the Start search bar, enter ‘env’ and select Edit environment variables for your account.
Under User variables check if there is an entry called Path:
If the entry exists, append the full path to flutter\bin using ; as a separator from existing values.
If the entry doesn’t exist, create a new user variable named Path with the full path to flutter\bin as its value.

- In case of No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.

Add a new environment variable
ANDROID_HOME -> path of android SDK (Ex: C:\Users\Administrator\AppData\Local\Android\Sdk)
Add new paths in
Path -> ;%ANDROID_HOME%\tools;%ANDROID_HOME%\tools\bin;%ANDROID_HOME%\platform-tools

)

=============================================
2. settings.gradel

setBinding(new Binding([gradle:this]))

evaluate(new File(
    settingsDir.parentFile,
    'MyApplication2/live_tryon/.android/include_flutter.groovy'
))
include ':live_tryon'

MyApplication2 == Main project root directory.

=============================================
3. build.gradel under app

change defaultConfig -> minSdkVersion to minimum 17

dependencies {

-------
implementation project(':flutter')

}

==========================================

4. Android manifest

-> Under manifest tag
    <uses-permission android:name="android.permission.CAMERA" />     <uses-permission android:name="android.permission.RECORD_AUDIO" />     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />     <uses-permission android:name="android.permission.VIDEO_CAPTURE" />     <uses-permission android:name="android.permission.AUDIO_CAPTURE" />

-> Register activity just above closing application tag

<activity
        android:name="io.flutter.embedding.android.FlutterActivity"
        android:theme="_____________YOUR_THEME_FROM_STYLES____________________"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize"
/>

=============================================
5.

import io.flutter.embedding.android.FlutterActivity;

---- Call on action to open live try on
startActivity(
        FlutterActivity
        .withNewEngine()
        .initialRoute("liveTryOn/--------------clientId-------------" +
            "/------------product Id ---------------------")
        .build(this)
);

1. Extract module in you project directory and run

-- flutter build aar


(

If flutter is not installed

visit below link for flutter sdk setup.
Download flutter sdk and setup dlutter path.

https://flutter.dev/docs/get-started/install/windows
https://flutter.dev/docs/get-started/install/macos
https://flutter.dev/docs/get-started/install/linux

- Extract flutter SDK zip which is downloaded from that link.

- Add path of flutter to environment variables.

- Update your path

If you wish to run Flutter commands in the regular Windows console, take these steps to add Flutter to the PATH environment variable:
From the Start search bar, enter ‘env’ and select Edit environment variables for your account.
Under User variables check if there is an entry called Path:
If the entry exists, append the full path to flutter\bin using ; as a separator from existing values.
If the entry doesn’t exist, create a new user variable named Path with the full path to flutter\bin as its value.

- In case of No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.

Add a new environment variable
ANDROID_HOME -> path of android SDK (Ex: C:\Users\Administrator\AppData\Local\Android\Sdk)
Add new paths in
Path -> ;%ANDROID_HOME%\tools;%ANDROID_HOME%\tools\bin;%ANDROID_HOME%\platform-tools

)

=============================================
2. settings.gradel

setBinding(new Binding([gradle:this]))

evaluate(new File(
    settingsDir.parentFile,
    'MyApplication2/live_tryon/.android/include_flutter.groovy'
))
include ':live_tryon'

MyApplication2 == Main project root directory.

=============================================
3. build.gradel under app

change defaultConfig -> minSdkVersion to minimum 17

dependencies {

-------
implementation project(':flutter')

}

==========================================

4. Android manifest

-> Under manifest tag
    <uses-permission android:name="android.permission.CAMERA" />     <uses-permission android:name="android.permission.RECORD_AUDIO" />     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />     <uses-permission android:name="android.permission.VIDEO_CAPTURE" />     <uses-permission android:name="android.permission.AUDIO_CAPTURE" />

-> Register activity just above closing application tag

<activity
        android:name="io.flutter.embedding.android.FlutterActivity"
        android:theme="_____________YOUR_THEME_FROM_STYLES____________________"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize"
/>

=============================================
5.

import io.flutter.embedding.android.FlutterActivity;

---- Call on action to open live try on
startActivity(
        FlutterActivity
        .withNewEngine()
        .initialRoute("liveTryOn/--------------clientId-------------" +
            "/------------product Id ---------------------")
        .build(this)
);

iOS SDK Integration

1. Integrate module in app

(Now no need to install flutter or pod file updates)

--- Extract zip in project directory
--- Framwork search path add live_tryon directory path to search paths.
--- Add all framworks from live_tryon directory to Build Settings > Build Phases > Link Binary With Libraries.
--- Add all framworks from live_tryon except FLutter plugin registrant frmawork to Build Settings > Build Phases > Embed Frameworks(embed and sign).

2. Appdelegate.swift

    1. Add import header

        import UIKit
        import Flutter
        import FlutterPluginRegistrant

    2. Change app delegate interface to FlutterAppDelegate

    3. define in AppDelegate

    lazy var flutterEngine = FlutterEngine(name: "my flutter engine")
    Replace application function with below code.
    override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)
-> Bool {         // Runs the default Dart entrypoint with a default Flutter route.
        flutterEngine.run();
        // Used to connect plugins (only if you have plugins with iOS platform code).
        GeneratedPluginRegistrant.register(with: self.flutterEngine);
        return super.application(application, didFinishLaunchingWithOptions: launchOptions);
    }


3. View controller

    1. Add import header

        import Flutter

    2. Call on action to open tryon model.

    let channel: String = "com.ammazza.tryon/live"
    let jsonObject: NSMutableDictionary = NSMutableDictionary()
    jsonObject.setValue("5fa15cfe1bc09c3755c36772", forKey: "clientId")
    jsonObject.setValue("5fa15cfe1bc09c3755c36772", forKey: "productId")
        var convertedString: String? = nil

        do {
            let billData = try JSONSerialization.data(withJSONObject: jsonObject, options: JSONSerialization.WritingOptions.prettyPrinted)
        convertedString = String(data: billData, encoding: String.Encoding.utf8)
    } catch let myJSONError {

        }
        let flutterEngine = ((UIApplication.shared.delegate as? AppDelegate)?.flutterEngine)!;
        let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil);
        let resultDataChannel = FlutterMethodChannel(name: channel, binaryMessenger: flutterViewController.binaryMessenger)

    resultDataChannel.setMethodCallHandler({
            [weak self] (call: FlutterMethodCall, result: FlutterResult) -> Void in
            switch call.method {
            case "closeApp":
            self?.dismiss(animated: true);
            default:
            result(FlutterMethodNotImplemented);
            }
    })
    flutterViewController.modalPresentationStyle = .fullScreen
    flutterViewController.modalTransitionStyle = .crossDissolve
    self.present(flutterViewController, animated: true, completion: nil)
    resultDataChannel.invokeMethod("getCalculatedResult", arguments: convertedString)