Skip to content

Commit

Permalink
Merge branch 'master' of github.com:codeka/wwmmo
Browse files Browse the repository at this point in the history
  • Loading branch information
codeka committed Apr 18, 2017
2 parents 2380f6b + 3016927 commit 5291056
Show file tree
Hide file tree
Showing 22 changed files with 466 additions and 1,076 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package au.com.codeka.warworlds.client.net;

import android.os.Build;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
Expand All @@ -19,6 +21,7 @@
import au.com.codeka.warworlds.common.debug.PacketDebug;
import au.com.codeka.warworlds.common.net.PacketDecoder;
import au.com.codeka.warworlds.common.net.PacketEncoder;
import au.com.codeka.warworlds.common.proto.DeviceInfo;
import au.com.codeka.warworlds.common.proto.HelloPacket;
import au.com.codeka.warworlds.common.proto.LoginRequest;
import au.com.codeka.warworlds.common.proto.LoginResponse;
Expand Down Expand Up @@ -86,6 +89,7 @@ private void login(@Nonnull String cookie) {
.method(HttpRequest.Method.POST)
.body(new LoginRequest.Builder()
.cookie(cookie)
.device_info(populateDeviceInfo())
.build().encode())
.build();
if (request.getResponseCode() != 200) {
Expand Down Expand Up @@ -231,4 +235,14 @@ private void updateState(
currState = new ServerStateEvent(ServerUrl.getUrl(), state, loginStatus);
App.i.getEventBus().publish(currState);
}

private static DeviceInfo populateDeviceInfo() {
return new DeviceInfo.Builder()
.device_build(Build.DEVICE)
.device_id(Build.ID)
.device_manufacturer(Build.MANUFACTURER)
.device_model(Build.MODEL)
.device_version(Build.VERSION.RELEASE)
.build();
}
}
24 changes: 24 additions & 0 deletions common/src/main/proto/account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ message Account {
message LoginRequest {
// Your login cookie. Required.
optional string cookie = 1;

// The DeviceInfo of the device you're logging in from.
optional DeviceInfo device_info = 2;
}

// This is sent from the /login endpoing in response to a LoginRequest.
Expand Down Expand Up @@ -107,3 +110,24 @@ message LoginResponse {
// whatever the In-App Purchase API has to say.
optional bool force_remove_ads = 6;
}

// Contains details about a device, such as it's ID, model etc. Also contains details about the
// device's GCM registration (so we can send it GCM messages).
message DeviceInfo {
// The identifier of the device. You can have multiple accounts on one device, this
// will then refer to the device itself.
optional string device_id = 1;

// The value of android.os.Build.MODEL for this device
optional string device_model = 2;

// The value of android.os.Build.MANUFACTURER for this device
optional string device_manufacturer = 3;

// The value of android.os.Build.DISPLAY for this device
optional string device_build = 4;

// The value of android.os.Build.VERSION.RELEASE for this device (note that this can
// change if you upgrade the OS without re-registering your device!)
optional string device_version = 5;
}
19 changes: 19 additions & 0 deletions common/src/main/proto/stats.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package au.com.codeka.warworlds.common.proto;

import "common.proto";
import "account.proto";

message LoginEvent {
optional int64 timestamp = 1;
optional int32 day = 2;
optional int64 empire_id = 3;
optional string email_addr = 4;
optional DeviceInfo device_info = 5;
}

message DailyStat {
optional int32 day = 1;
optional int32 oneda = 2;
optional int32 sevenda = 3;
optional int32 signups = 4;
}
41 changes: 0 additions & 41 deletions common/src/main/proto/user.proto

This file was deleted.

32 changes: 0 additions & 32 deletions server/src/main/data/admin/static/js/hashparams.js

This file was deleted.

Loading

0 comments on commit 5291056

Please sign in to comment.