<div dir="ltr">Location of the project, is currently here:<div><a href="https://github.com/matzew/ag-client-push-sdk">https://github.com/matzew/ag-client-push-sdk</a><br></div><div><br></div><div style>API:</div><div style>
<a href="https://github.com/matzew/ag-client-push-sdk/blob/master/push-sdk/AGDeviceRegistration.h">https://github.com/matzew/ag-client-push-sdk/blob/master/push-sdk/AGDeviceRegistration.h</a> </div><div style><br></div><div style>
TEST (incl. OHHTTPStubs for mocking AFNetworking):</div><div style><a href="https://github.com/matzew/ag-client-push-sdk/blob/master/push-sdkTests/AGDeviceRegistrationSpec.m">https://github.com/matzew/ag-client-push-sdk/blob/master/push-sdkTests/AGDeviceRegistrationSpec.m</a><br>
</div><div style><br></div><div style><br></div><div style>-Matthias</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 6, 2013 at 11:58 AM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p style="line-height:20px;margin-right:0px;font-size:13.63636302947998px;margin-left:0px;margin-bottom:15px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:0px!important">
Hi,</p>
<p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">the client side spec describes the required functionality to register devices with the Unified Push Server.</p>

<p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">The client SKD should be simple to use. For the iOS, I thought about a register that takes three blocks:</p>

<ul style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px;padding:0px 0px 0px 30px"><li>ClientDeviceInformation object/protocol (similar to our configuration objects)</li>

<li>success callback</li><li>failure callback</li></ul><div style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;padding:0px;border:0px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="color:rgb(153,153,136);font-style:italic">// AppDelegate code/delegate function, for a push enabled application:</span>
<span style="font-weight:bold">-</span> <span>(</span><span style="color:rgb(68,85,136);font-weight:bold">void</span><span>)</span><span style="color:rgb(153,0,0);font-weight:bold">application:</span><span>(</span><span style="color:rgb(51,51,51)">UIApplication</span> <span style="font-weight:bold">*</span><span>)</span><span style="color:teal">application</span> 
   <span style="color:rgb(153,153,136);font-style:italic">// deviceToken provided by APNs</span>
   <span>didRegisterForRemoteNotificationsWithDeviceToken:</span><span>(</span><span style="color:rgb(51,51,51)">NSData</span> <span style="font-weight:bold">*</span><span>)</span><span style="color:teal">deviceToken</span> <span>{</span> 

  <span style="color:rgb(153,153,136);font-style:italic">// the AG AGDeviceRegistration helper/class:</span>
  <span>[</span><span style="color:rgb(51,51,51)">registration</span> <span style="color:rgb(51,51,51)">registerWithClientInfo</span><span style="font-weight:bold">:^</span><span>(</span><span style="color:rgb(68,85,136);font-weight:bold">id</span><span style="font-weight:bold">&lt;</span><span style="color:rgb(51,51,51)">AGClientDeviceInformation</span><span style="font-weight:bold">&gt;</span> <span style="color:rgb(51,51,51)">clientInfo</span><span>)</span> <span>{</span>
    <span style="color:rgb(153,153,136);font-style:italic">// apply the desired info:</span>
    <span style="color:rgb(51,51,51)">clientInfo</span><span>.</span><span style="color:rgb(51,51,51)">token</span> <span style="font-weight:bold">=</span> <span style="color:rgb(51,51,51)">deviceToken</span><span>;</span>
    <span style="color:rgb(51,51,51)">clientInfo</span><span>.</span><span style="color:rgb(51,51,51)">alias</span> <span style="font-weight:bold">=</span> <span style="color:rgb(221,17,68)">@&quot;<a href="mailto:mister@xyz.com" target="_blank">mister@xyz.com</a>&quot;</span><span>;</span>
    <span style="color:rgb(51,51,51)">clientInfo</span><span>.</span><span style="color:rgb(51,51,51)">mobileVariantID</span> <span style="font-weight:bold">=</span> <span style="color:rgb(221,17,68)">@&quot;123456432134564321345432&quot;</span><span>;</span>
    <span style="color:rgb(153,153,136);font-style:italic">// ... as needed more of the data;</span>
  <span>}</span> <span style="color:rgb(51,51,51)">success</span><span style="font-weight:bold">:^</span><span>(</span><span style="color:rgb(68,85,136);font-weight:bold">id</span> <span style="color:rgb(51,51,51)">responseObject</span><span>)</span> <span>{</span>
     <span style="color:rgb(153,153,136);font-style:italic">// invoked, on 200 HTTP response code from the Unified Push Server</span>
  <span>}</span> <span style="color:rgb(51,51,51)">failure</span><span style="font-weight:bold">:^</span><span>(</span><span style="color:rgb(51,51,51)">NSError</span> <span style="font-weight:bold">*</span><span style="color:rgb(51,51,51)">error</span><span>)</span> <span>{</span>
    <span style="color:rgb(153,153,136);font-style:italic">// invoked:</span>
      <span style="color:rgb(153,153,136);font-style:italic">// missing required data (e.g. no token submitted)</span>
      <span style="color:rgb(153,153,136);font-style:italic">// on 4xx/5zz HTTP response codes from the Unified Push Server</span>
<span>}];</span>
<span>}</span>
</pre></div><p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">The above <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">registerWithClientInfo:successfailure</code> method uses <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">AFNetworking</code> to submit the received<code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">deviceToken</code> to the <em>AeroGear Unified Push Server</em>. The desired information data is provided on the first callback.</p>

<p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">The concept of a &quot;block&quot; for setting up data/objects has been useful on <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">AGPipeConfig</code>, so reusing the concept here as well.</p>

<p style="line-height:20px;margin-right:0px;font-size:13.63636302947998px;margin-left:0px;margin-bottom:0px!important;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:15px"><strong>Note:</strong> Class/method names may change over time...</p>

<p style="line-height:20px;margin-right:0px;font-size:13.63636302947998px;margin-left:0px;margin-bottom:0px!important;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:15px">Thoughts ?</p><span class="HOEnZb"><font color="#888888"><p style="line-height:20px;margin-right:0px;font-size:13.63636302947998px;margin-left:0px;margin-bottom:0px!important;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:15px">

<br></p><div><br></div><div>-Matthias</div><div><br></div><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>

sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div>