Skip to content

Commit 65d0f99

Browse files
committed
Some IrssiNotifier Plus licensing fixes.
1 parent 9478a02 commit 65d0f99

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

Android/mobile/src/main/java/fi/iki/murgo/irssinotifier/InitialSettingsActivity.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ protected void onCreate(Bundle savedInstanceState) {
6767
tv.setText(getString(R.string.welcome_thanks_for_support) + " " + tv.getText());
6868
}
6969

70-
if (LicenseHelper.bothEditionsInstalled(this)) {
71-
MessageBox.Show(this, null, getString(R.string.both_versions_installed), null);
72-
}
73-
7470
whatNext(0);
7571
}
7672

@@ -163,7 +159,16 @@ private void checkLicense() {
163159
public void doStuff(LicenseCheckingTask.LicenseCheckingMessage result) {
164160
switch (result.licenseCheckingStatus) {
165161
case Allow:
166-
continueStateMachine();
162+
if (LicenseHelper.bothEditionsInstalled(InitialSettingsActivity.this)) {
163+
MessageBox.Show(InitialSettingsActivity.this, null, getString(R.string.both_versions_installed), new Callback<Void>() {
164+
@Override
165+
public void doStuff(Void param) {
166+
continueStateMachine();
167+
}
168+
});
169+
} else {
170+
continueStateMachine();
171+
}
167172
break;
168173
case Disallow:
169174
preferences.setLicenseCount(0);

Android/mobile/src/main/java/fi/iki/murgo/irssinotifier/LicenseCheckingTask.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,19 @@ protected LicenseCheckingMessage doInBackground(Void... params) {
8787
private LicenseCheckingMessage checkLicense(int nonce) {
8888
Intent intent = new Intent("com.android.vending.licensing.ILicensingService");
8989
intent.setPackage("com.android.vending");
90-
boolean bindResult = activity.bindService(intent,
91-
new ServiceConnection() {
92-
@Override
93-
public void onServiceConnected(ComponentName name, IBinder s) {
94-
service = ILicensingService.Stub.asInterface(s);
95-
}
96-
97-
@Override
98-
public void onServiceDisconnected(ComponentName name) {
99-
Log.w(TAG, "Service unexpectedly disconnected.");
100-
service = null;
101-
}
102-
},
103-
Context.BIND_AUTO_CREATE);
90+
ServiceConnection serviceConnection = new ServiceConnection() {
91+
@Override
92+
public void onServiceConnected(ComponentName name, IBinder s) {
93+
service = ILicensingService.Stub.asInterface(s);
94+
}
95+
96+
@Override
97+
public void onServiceDisconnected(ComponentName name) {
98+
Log.w(TAG, "Service unexpectedly disconnected.");
99+
service = null;
100+
}
101+
};
102+
boolean bindResult = activity.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
104103

105104
if (!bindResult) {
106105
Log.e(TAG, "Could not bind to service.");
@@ -155,6 +154,8 @@ public void verifyLicense(int responseCode, String signedData, String signature)
155154
return new LicenseCheckingMessage("Could not check license from licensing service in time");
156155
}
157156

157+
activity.unbindService(serviceConnection);
158+
158159
/* Response codes:
159160
private static final int LICENSED = 0x0;
160161
private static final int NOT_LICENSED = 0x1;

0 commit comments

Comments
 (0)