mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Pebble: Implement getAccountToken for paid watchfaces/apps
This commit is contained in:
committed by
Arjan Schrijver
parent
3528ab725c
commit
5a6bdace66
@@ -222,7 +222,7 @@ function gbPebble() {
|
||||
}
|
||||
|
||||
this.getAccountToken = function() {
|
||||
return '';
|
||||
return GBjs.getAccountToken();
|
||||
}
|
||||
|
||||
this.getWatchToken = function() {
|
||||
|
||||
+9
@@ -40,6 +40,7 @@ import java.util.UUID;
|
||||
import androidx.annotation.NonNull;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.CheckSums;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.PebbleUtils;
|
||||
@@ -211,6 +212,14 @@ public class JSInterface {
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String getAccountToken() {
|
||||
//specification says: A unique account token that is associated with the Pebble account of the current user.
|
||||
//we don't have an account, so we use the device's mac address instead
|
||||
//this allows purchasing / using purchased watchfaces using kiezelpay
|
||||
return GB.hexdump(CheckSums.md5(this.device.getAddress().getBytes()));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String getWatchToken() {
|
||||
//specification says: A string that is guaranteed to be identical for each Pebble device for the same app across different mobile devices. The token is unique to your app and cannot be used to track Pebble devices across applications. see https://developer.pebble.com/docs/js/Pebble/
|
||||
|
||||
Reference in New Issue
Block a user