Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14792 manas 1
/**
2
 * Copyright 2010-present Facebook.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *    http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
package com.facebook;
18
 
19
import android.content.Context;
20
import android.os.Bundle;
21
import com.facebook.internal.Logger;
22
 
23
import java.math.BigDecimal;
24
import java.util.Currency;
25
 
26
/**
27
 * This class is deprecated. Please use {@link AppEventsLogger} instead.
28
 */
29
@Deprecated
30
public class InsightsLogger {
31
    private static final String EVENT_PARAMETER_PIXEL_ID         = "fb_offsite_pixel_id";
32
    private static final String EVENT_PARAMETER_PIXEL_VALUE      = "fb_offsite_pixel_value";
33
 
34
    private static final String EVENT_NAME_LOG_CONVERSION_PIXEL  = "fb_log_offsite_pixel";
35
 
36
    private AppEventsLogger appEventsLogger;
37
 
38
    private InsightsLogger(Context context, String applicationId, Session session) {
39
        appEventsLogger = AppEventsLogger.newLogger(context, applicationId, session);
40
    }
41
 
42
    /**
43
     * Deprecated. Please use {@link AppEventsLogger} instead.
44
     */
45
    public static InsightsLogger newLogger(Context context, String clientToken) {
46
        return new InsightsLogger(context, null, null);
47
    }
48
 
49
    /**
50
     * Deprecated. Please use {@link AppEventsLogger} instead.
51
     */
52
    public static InsightsLogger newLogger(Context context, String clientToken, String applicationId) {
53
        return new InsightsLogger(context, applicationId, null);
54
    }
55
 
56
    /**
57
     * Deprecated. Please use {@link AppEventsLogger} instead.
58
     */
59
    public static InsightsLogger newLogger(Context context, String clientToken, String applicationId, Session session) {
60
        return new InsightsLogger(context, applicationId, session);
61
    }
62
 
63
    /**
64
     * Deprecated. Please use {@link AppEventsLogger} instead.
65
     */
66
    public void logPurchase(BigDecimal purchaseAmount, Currency currency) {
67
        logPurchase(purchaseAmount, currency, null);
68
    }
69
 
70
    /**
71
     * Deprecated. Please use {@link AppEventsLogger} instead.
72
     */
73
    public void logPurchase(BigDecimal purchaseAmount, Currency currency, Bundle parameters) {
74
        appEventsLogger.logPurchase(purchaseAmount, currency, parameters);
75
    }
76
 
77
    /**
78
     * Deprecated. Please use {@link AppEventsLogger} instead.
79
     */
80
    public void logConversionPixel(String pixelId, double valueOfPixel) {
81
 
82
        if (pixelId == null) {
83
            Logger.log(LoggingBehavior.DEVELOPER_ERRORS, "Insights", "pixelID cannot be null");
84
            return;
85
        }
86
 
87
        Bundle parameters = new Bundle();
88
        parameters.putString(EVENT_PARAMETER_PIXEL_ID, pixelId);
89
        parameters.putDouble(EVENT_PARAMETER_PIXEL_VALUE, valueOfPixel);
90
 
91
        appEventsLogger.logEvent(EVENT_NAME_LOG_CONVERSION_PIXEL, valueOfPixel, parameters);
92
        AppEventsLogger.eagerFlush();
93
    }
94
}