Skip to content

Commit

Permalink
API Key is now part of gradle and not inside an XML string file. The …
Browse files Browse the repository at this point in the history
…was halting releases due to string not being found in Spanish XML string files.
  • Loading branch information
ram-on committed Oct 23, 2016
1 parent fc207af commit 80e41a5
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 18 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ android {
minSdkVersion 14
targetSdkVersion 25
versionCode 3
buildConfigField 'String', 'YOUTUBE_API_KEY', '"AIzaSyDAOcAgAAd098p_FLIePaQNKPTpcyhUGBA"';
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.preference.PreferenceManager;
import android.util.Log;

import free.rm.skytube.BuildConfig;
import free.rm.skytube.R;
import free.rm.skytube.businessobjects.YouTubeVideo;
import free.rm.skytube.gui.activities.YouTubePlayerActivity;
Expand Down Expand Up @@ -72,7 +73,7 @@ private static boolean useOfficialYouTubePlayer(Context context) {
private static void launchOfficialYouTubePlayer(String videoId, Context context) {
try {
// try to start the YouTube standalone player
Intent intent = com.google.android.youtube.player.YouTubeStandalonePlayer.createVideoIntent((Activity) context, context.getString(R.string.API_KEY), videoId);
Intent intent = com.google.android.youtube.player.YouTubeStandalonePlayer.createVideoIntent((Activity) context, BuildConfig.YOUTUBE_API_KEY, videoId);
context.startActivity(intent);
} catch (Exception e) {
String errorMsg = context.getString(R.string.launch_offical_player_error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
import java.io.IOException;
import java.util.List;

import free.rm.skytube.R;
import free.rm.skytube.gui.app.SkyTubeApp;
import free.rm.skytube.BuildConfig;

/**
* Check if there has been an activity (e.g. a new video has been published) on the given channel.
Expand All @@ -45,7 +44,7 @@ public void init() throws IOException {
this.activitiesList = YouTubeAPI.create().activities()
.list("snippet")
.setFields("items(snippet/publishedAt)")
.setKey(SkyTubeApp.getStr(R.string.API_KEY))
.setKey(BuildConfig.YOUTUBE_API_KEY)
.setMaxResults(MAX_RESULTS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
import java.util.ArrayList;
import java.util.List;

import free.rm.skytube.R;
import free.rm.skytube.gui.app.SkyTubeApp;
import free.rm.skytube.BuildConfig;

/**
* Queries the YouTube service and gets the comments of a video.
Expand All @@ -49,7 +48,7 @@ public void init(String videoId) throws IOException {
this.commentsList = YouTubeAPI.create().commentThreads()
.list("snippet, replies")
.setFields("items(snippet, replies), nextPageToken")
.setKey(SkyTubeApp.getStr(R.string.API_KEY))
.setKey(BuildConfig.YOUTUBE_API_KEY)
.setVideoId(videoId)
.setTextFormat("plainText")
.setMaxResults(MAX_RESULTS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
import java.io.IOException;
import java.util.List;

import free.rm.skytube.R;
import free.rm.skytube.gui.app.SkyTubeApp;
import free.rm.skytube.BuildConfig;

/**
* Get today's featured YouTube videos.
Expand All @@ -48,7 +47,7 @@ public void init() throws IOException {
videosList.setFields("items(id, snippet/defaultAudioLanguage, snippet/defaultLanguage, snippet/publishedAt, snippet/title, snippet/channelId, snippet/channelTitle," +
"snippet/thumbnails/high, contentDetails/duration, statistics)," +
"nextPageToken");
videosList.setKey(SkyTubeApp.getStr(R.string.API_KEY));
videosList.setKey(BuildConfig.YOUTUBE_API_KEY);
videosList.setChart("mostPopular");
videosList.setRegionCode(getPreferredRegion());
videosList.setMaxResults(MAX_RESULTS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
import java.io.IOException;
import java.util.List;

import free.rm.skytube.R;
import free.rm.skytube.gui.app.SkyTubeApp;
import free.rm.skytube.BuildConfig;

/**
* Get videos corresponding to the user's query (refer to {@link #setQuery(String)}).
Expand All @@ -46,7 +45,7 @@ public class GetYouTubeVideoBySearch extends GetYouTubeVideos {
public void init() throws IOException {
videosList = YouTubeAPI.create().search().list("id");
videosList.setFields("items(id/videoId), nextPageToken");
videosList.setKey(SkyTubeApp.getStr(R.string.API_KEY));
videosList.setKey(BuildConfig.YOUTUBE_API_KEY);
videosList.setType("video");
//videosList.setRegionCode(getPreferredRegion()); // there is a bug in V3 API, so this does not work: https://code.google.com/p/gdata-issues/issues/detail?id=6383 and https://code.google.com/p/gdata-issues/issues/detail?id=6913
videosList.setSafeSearch("none");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.io.Serializable;
import java.util.List;

import free.rm.skytube.BuildConfig;
import free.rm.skytube.R;
import free.rm.skytube.businessobjects.db.SubscriptionsDb;
import free.rm.skytube.gui.app.SkyTubeApp;
Expand Down Expand Up @@ -80,7 +81,7 @@ public void init(String channelId, boolean isUserSubscribed) throws IOException
channelInfo.setFields("items(id, snippet/title, snippet/description, snippet/thumbnails/default," +
"statistics/subscriberCount, brandingSettings/image/bannerTabletHdImageUrl)," +
"nextPageToken");
channelInfo.setKey(SkyTubeApp.getStr(R.string.API_KEY));
channelInfo.setKey(BuildConfig.YOUTUBE_API_KEY);
channelInfo.setId(channelId);

// get this channel's info from the remote YouTube server
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values/strings_api_key.xml

This file was deleted.

0 comments on commit 80e41a5

Please sign in to comment.