Java Code Examples for com.google.firebase.crash.FirebaseCrash#report()

The following examples show how to use com.google.firebase.crash.FirebaseCrash#report() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YoutubeUriChecker.java    From OneTapVideoDownload with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Video checkUrl(String url) {
    if (!url.contains("youtube.com/watch")) {
        return null;
    }

    try {
        Uri uri = Uri.parse(url);
        String videoId = uri.getQueryParameter("v");
        if (videoId == null) {
            return null;
        }
        return new YoutubeVideo("", videoId);
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }

    return null;
}
 
Example 2
Source File: VimeoUriChecker.java    From OneTapVideoDownload with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Video checkUrl(String url) {
    if (!url.contains("player.vimeo.com")) {
        return null;
    }

    try {
        String vimeoConfig = Global.getResponseBody(url);
        JSONObject json = new JSONObject(vimeoConfig);
        String videoUrl = json.getJSONObject("request")
                .getJSONObject("files")
                .getJSONArray("progressive")
                .getJSONObject(0)
                .getString("url");

        if (videoUrl != null && !videoUrl.isEmpty()) {
            return new BrowserVideo(videoUrl);
        }
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }

    return null;
}
 
Example 3
Source File: Global.java    From OneTapVideoDownload with GNU General Public License v3.0 6 votes vote down vote up
public static String getResponseBody(String url) {
    try {
        Request request = new Request.Builder()
                .url(url)
                .build();

        OkHttpClient client = new OkHttpClient();
        Response response = client.newCall(request).execute();
        if (response.body().contentLength() < 3*1000*1000L) {
            return response.body().string();
        } else {
            throw new IllegalArgumentException("Body content size is very large");
        }
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
        return null;
    }
}
 
Example 4
Source File: DownloadViewHolder.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
void setProgress(int progress) {
    mProgressBar.setProgress(progress);
    try {
        mPercentageTextView.setText(String.format(Locale.getDefault(), "%d%%", progress));
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }
}
 
Example 5
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) {
    xprv = xprv.trim();
    try {
        DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params);
        String privhex = dk01.getPrivateKeyAsHex();
        ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex));
        KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent());
        kcg.importKeys(ecKey001);
        wallet = new Wallet(params, kcg);
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv));
        updateWalletFriendlyAddress();
        xprvKey = xprv;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOListQtum(walletFriendlyAddress, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example 6
Source File: GithubRemoteDataSource.java    From gito-github-client with Apache License 2.0 5 votes vote down vote up
@WorkerThread
public void getUserSync() {
    try {
        User user = GitHubAPI.user()
                .setToken(getToken())
                .getUser();

        mLocalDataSource.saveUser(user);

    } catch (IOException e) {
        if (Utils.isNetworkAvailable()) {
            FirebaseCrash.report(e);
        }
    }
}
 
Example 7
Source File: GithubLocalDataSource.java    From gito-github-client with Apache License 2.0 5 votes vote down vote up
public void saveTrendingRepositories(String period, String language,
                                     List<TrendingRepository> repositories) {
    Uri uri = TrendingContract.TrendingEntry.CONTENT_URI;

    ArrayList<ContentProviderOperation> ops = new ArrayList<>();

    ops.add(ContentProviderOperation.newDelete(uri)
            .withSelection(TrendingContract.TrendingEntry.COLUMN_LANGUAGE + " = ? AND " +
                            TrendingContract.TrendingEntry.COLUMN_PERIOD + " = ? ",
                    new String[]{language, period}).build());

    for (TrendingRepository repository : repositories) {

        repository.setLanguage(language);
        repository.setPeriod(period);

        ContentValues contentValues = TrendingContract.TrendingEntry
                .buildContentValues(repository, period, language);
        ops.add(ContentProviderOperation.newInsert(uri)
                .withValues(contentValues).build());
    }
    try {
        mContentResolver.applyBatch(TrendingContract.CONTENT_AUTHORITY, ops);
        mContentResolver.notifyChange(uri, null);
    } catch (RemoteException | OperationApplicationException e) {
        FirebaseCrash.report(e);
    }
}
 
Example 8
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) {
    xprv = xprv.trim();
    try {
        DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params);
        String privhex = dk01.getPrivateKeyAsHex();
        ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex));
        KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent());
        kcg.importKeys(ecKey001);
        wallet = new Wallet(params, kcg);
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv));
        walletFriendlyAddress = wallet.currentReceiveAddress().toString();
        xprvKey = xprv;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOListLtcNew(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example 9
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByWif(String wif, WalletCreationCallback callback) {
    wif = wif.trim();
    try {
        DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, wif);
        ECKey key = dumpedPrivateKey.getKey();
        wallet = new Wallet(params);
        wallet.importKey(key);
        restFromWif = true;
        walletFriendlyAddress = wallet.getImportedKeys().get(0).toAddress(params).toString();
        wifKey = wif;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByWif: " + iae.toString());
        callback.onWalletCreated(wallet);
        return;
    }

    callback.onWalletCreated(wallet);

    RequestorBtc.getUTXOListLtcNew(walletFriendlyAddress, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example 10
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByWif(String wif, WalletCreationCallback callback) {
    wif = wif.trim();
    try {
        DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, wif);
        ECKey key = dumpedPrivateKey.getKey();
        wallet = new Wallet(params);
        wallet.importKey(key);
        restFromWif = true;
        walletFriendlyAddress = wallet.getImportedKeys().get(0).toAddress(params).toString();
        wifKey = wif;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByWif: " + iae.toString());
        callback.onWalletCreated(wallet);
        return;
    }

    callback.onWalletCreated(wallet);

    RequestorBtc.getUTXOListBch(walletFriendlyAddress, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example 11
Source File: Global.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
public static String readFileToString(File file) {
    String result = null;
    try {
        FileInputStream fis = new FileInputStream(file);
        byte[] data = new byte[(int) file.length()];
        fis.read(data);
        fis.close();

        result = new String(data, "UTF-8");
    } catch (IOException e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }
    return result;
}
 
Example 12
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) {
    xprv = xprv.trim();
    try {
        DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params);
        String privhex = dk01.getPrivateKeyAsHex();
        ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex));
        KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent());
        kcg.importKeys(ecKey001);
        wallet = new Wallet(params, kcg);
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv));
        walletFriendlyAddress = wallet.currentReceiveAddress().toString();
        xprvKey = xprv;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example 13
Source File: TrafficFragment.java    From gito-github-client with Apache License 2.0 5 votes vote down vote up
@Override
public void openUrl(String url) {
    try {
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        getActivity().startActivity(browserIntent);
    } catch (ActivityNotFoundException e) {
        FirebaseCrash.report(e);
    }
}
 
Example 14
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) {
    xprv = xprv.trim();
    try {
        DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params);
        String privhex = dk01.getPrivateKeyAsHex();
        ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex));
        KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent());
        kcg.importKeys(ecKey001);
        wallet = new Wallet(params, kcg);
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv));
        walletFriendlyAddress = wallet.currentReceiveAddress().toString();
        xprvKey = xprv;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOListDgbNew(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItemDgb> utxos = (List<UTXOItemDgb>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example 15
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByWif(String wif, WalletCreationCallback callback) {
    wif = wif.trim();
    try {
        DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, wif);
        ECKey key = dumpedPrivateKey.getKey();
        wallet = new Wallet(params);
        wallet.importKey(key);
        restFromWif = true;
        walletFriendlyAddress = wallet.getImportedKeys().get(0).toAddress(params).toString();
        wifKey = wif;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByWif: " + iae.toString());
        callback.onWalletCreated(wallet);
        return;
    }

    callback.onWalletCreated(wallet);

    RequestorBtc.getUTXOListDgbNew(walletFriendlyAddress, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItemDgb> utxos = (List<UTXOItemDgb>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example 16
Source File: Fa.java    From justaline-android with Apache License 2.0 5 votes vote down vote up
/**
 * Send a caught exception to Firebase with an additional logged message
 */
public void exception(Throwable throwable, String logMessage) {
    Log.e(TAG, "Exception: " + throwable + " | " + logMessage, throwable);
    if (BuildConfig.DEBUG) {
        return;
    }

    FirebaseCrash.logcat(Log.WARN, TAG, logMessage);
    FirebaseCrash.report(throwable);
}
 
Example 17
Source File: FirebaseTree.java    From wear-notify-for-reddit with Apache License 2.0 4 votes vote down vote up
@Override public void i(Throwable t, String message, Object... args) {
    FirebaseCrash.report(t);
}
 
Example 18
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
public void restoreFromBlockByWif2(String wif, Runnable callback) {
    wif = wif.trim();
    try {
        DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, wif);
        ECKey key = dumpedPrivateKey.getKey();
        wallet = new Wallet(params);
        wallet.importKey(key);
        restFromWif = true;
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(wif));
        walletFriendlyAddress = wallet.getImportedKeys().get(0).toAddress(params).toString();
        wifKey = wif;
    } catch (WrongNetworkException wne) {
        Log.e("psd", "restoreFromBlockByWif2: " + wne.toString());
        callback.run();
        return;
    } catch (AddressFormatException afe) {
        Log.e("psd", "restoreFromBlockByWif2: " + afe.toString());
        callback.run();
        return;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByWif2: " + iae.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOListDgbNew(walletFriendlyAddress, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItemDgb> utxos = (List<UTXOItemDgb>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example 19
Source File: FirebaseTree.java    From wear-notify-for-reddit with Apache License 2.0 4 votes vote down vote up
@Override public void e(Throwable t, String message, Object... args) {
    FirebaseCrash.report(t);
}
 
Example 20
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
public void restoreFromBlockByWif2(String wif, Runnable callback) {
    wif = wif.trim();
    try {
        DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, wif);
        ECKey key = dumpedPrivateKey.getKey();
        wallet = new Wallet(params);
        wallet.importKey(key);
        restFromWif = true;
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(wif));
        walletFriendlyAddress = wallet.getImportedKeys().get(0).toAddress(params).toString();
        wifKey = wif;
    } catch (WrongNetworkException wne) {
        FirebaseCrash.report(wne);
        Log.e("psd", "restoreFromBlockByWif2: " + wne.toString());
        callback.run();
        return;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByWif2: " + iae.toString());
        callback.run();
        return;
    } catch (NullPointerException npe) {
        FirebaseCrash.report(npe);
        Log.e("psd", "restoreFromBlockByWif2: " + npe.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOList(walletFriendlyAddress, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            UTXOListResponse utxoResponse = (UTXOListResponse) response;
            setUTXO(utxoResponse.getUTXOList());
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}